刘小明
2024-09-03 b5a3c0f6823d17d4acd97545cee3556a07f09865
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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);
    }
}