自动化立体仓库 - WMS系统
1
zhang
2 天以前 40254eb1fc7ad9bef6e820c0ffc0cc5a63e9e53e
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
34
35
36
37
38
39
40
41
42
43
44
45
package com.zy.asrs.task;
 
import com.zy.asrs.task.core.ReturnT;
import com.zy.asrs.task.handler.OverYearLogHandler;
import com.zy.system.entity.Config;
import com.zy.system.service.ConfigService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
 
/**
 * Created by vincent on 2020/7/7
 */
@Component
public class OverYearLogScheduler {
 
    private static final Logger log = LoggerFactory.getLogger(OverYearLogScheduler.class);
 
    public static Integer days = 60;
 
    @Autowired
    private OverYearLogHandler overYearLogHandler;
 
    @Autowired
    private ConfigService configService;
 
    @Scheduled(cron = "0/3 * * * * ? ")
    private void execute() {
        ReturnT<String> returnT = overYearLogHandler.start();
        if (!returnT.isSuccess()) {
            log.error(returnT.getMsg());
        }
    }
 
 
    @Scheduled(cron = "0/2 * * * * ? ")
    private void execute2() {
        Config config = configService.selectConfigByCode("AlarmDays");
        if (config != null && config.getValue() != null && config.getStatus() == 1) {
            days = Integer.parseInt(config.getValue());
        }
    }
}