| package com.dy.pmsStation.config; | 
|   | 
| import com.dy.common.schedulerTask.SchedulerTaskSupport; | 
| import com.dy.pmsGlobal.daoSta.StaDeviceProductionLogPastMapper; | 
| import com.dy.pmsStation.task.LogMoveTask; | 
| import lombok.extern.slf4j.Slf4j; | 
| import org.springframework.beans.factory.annotation.Autowired; | 
| import org.springframework.boot.CommandLineRunner; | 
| import org.springframework.stereotype.Component; | 
|   | 
| @Slf4j | 
| @Component | 
| public class AppStartupRunner implements CommandLineRunner { | 
|   | 
|   | 
|     private StaDeviceProductionLogPastMapper pastMapper; | 
|     @Autowired | 
|     public void setPastMapper(StaDeviceProductionLogPastMapper pastMapper) { | 
|         this.pastMapper = pastMapper; | 
|     } | 
|   | 
|     @Override | 
|     public void run(String... args) throws Exception { | 
|         //服务启动时检查上次任务是否已执行 | 
|         Long count = pastMapper.countLastDayLogs(); | 
|         log.info("未移动记录数量:"+count); | 
|         if(count >0){ | 
|             new LogMoveTask().execute(null); | 
|         } | 
|         SchedulerTaskSupport.addDailyJob("logMoveTask", "station", LogMoveTask.class, | 
|                 null, 0, 5); | 
|     } | 
| } |