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());
|
}
|
}
|
}
|