springboot跑批
阿新 • • 發佈:2018-11-28
/**
*
*/
package com.huij.platform.config;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import com.huij.platform.mapper.ex.Channel_userMapperEx;
import com.huij.platform.union.service.UnionCommonService;
/**
* 定時任務,每天跑批,實現資料倉庫中M1Vintage報表的更新操作
*
* @author Administrator
*
*/
@Configuration
@EnableScheduling // 啟用定時任務
public class TaskConfig {
private final Logger logger = LoggerFactory.getLogger(TaskConfig.class); @Autowired private UnionCommonService unionCommonService; @Autowired private Channel_userMapperEx channel_userMapperEx; /** * * @Description 資料庫心跳連結 */ @Scheduled(cron = "0 0/1 * * * ?") public void dbHeartbeat() { channel_userMapperEx.dbHeartbeat(); } /** * * @Description 每1分鐘跑一次測試,防止程式死掉 */ @Scheduled(cron = "${code_schedule}") public void codeScheduler() { logger.info("開始跑批獲取碼錶資料"); // 獲取碼錶資訊 unionCommonService.getCodeTables(); }
}