fix:定时任务增加管控注记
This commit is contained in:
@@ -16,6 +16,7 @@ import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
@@ -48,6 +49,13 @@ public class ProcessTimer {
|
||||
@Autowired
|
||||
private WorkFlowController workFlowController;
|
||||
|
||||
/**
|
||||
* 根据配置文件设置是否开启定时器
|
||||
*/
|
||||
|
||||
@Value("${isNotScheduled}")
|
||||
private boolean isNotScheduled; //是否开启定时器
|
||||
|
||||
/***
|
||||
* @Description: 自动催办,任务截至时间前3天开始每天催办
|
||||
* @Author: yangxuenan
|
||||
@@ -59,6 +67,8 @@ public class ProcessTimer {
|
||||
// @Scheduled(cron = "*/5 * * * * ?")//每5秒执行一次
|
||||
// @Scheduled(cron = "0/20 * * * * ?")
|
||||
public void urging() {
|
||||
if(isNotScheduled){
|
||||
log.info("=================================自动催办定时任务启动=====================================");
|
||||
List<BusProcessName> busProcessNames = workFlowFeignClient.queryBusProcessNameForEnd(null);
|
||||
if (null != busProcessNames && 0 < busProcessNames.size()) {
|
||||
for (BusProcessName busProcessName : busProcessNames) {
|
||||
@@ -98,6 +108,8 @@ public class ProcessTimer {
|
||||
mailUtil.sendMsgFeign(array, title, msg);
|
||||
}
|
||||
}
|
||||
log.info("=================================自动催办定时任务结束=====================================");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -169,6 +181,8 @@ public class ProcessTimer {
|
||||
@Scheduled(cron = "0 0 10 * * ? ")//每天十点执行
|
||||
// @Scheduled(cron = "*/20 * * * * ? ")//每天十点执行
|
||||
public void everyDayTenOlockScan() {
|
||||
if(isNotScheduled){
|
||||
log.info("=================================政策课题组会后流程定时任务启动=====================================");
|
||||
List<BusProcessNew> busProcessNews=new ArrayList<>();
|
||||
busProcessNews=workFlowFeignClient.everyDayTenOlock();
|
||||
if (!busProcessNews.isEmpty()){
|
||||
@@ -184,12 +198,16 @@ public class ProcessTimer {
|
||||
log.info("政策课题组会后流程已发起");
|
||||
}
|
||||
}
|
||||
log.info("=================================政策课题组会后流程定时任务启动=====================================");
|
||||
}
|
||||
}
|
||||
|
||||
@Scheduled(cron = "0 0 10 * * ? ")//每天十点执行
|
||||
// @Scheduled(cron = "0 0 0/1 * * ? ")//每天十点执行
|
||||
// @Scheduled(cron = "*/40 * * * * ? ")//20s
|
||||
public void everyDayTenOlockScanSAM() {
|
||||
if(isNotScheduled){
|
||||
log.info("=================================标准化活动参会流程定时任务启动=====================================");
|
||||
List<BusProcessNew> busProcessNews=new ArrayList<>();
|
||||
busProcessNews=workFlowFeignClient.everyDayTenOlockSAM();
|
||||
if (!busProcessNews.isEmpty()){
|
||||
@@ -213,13 +231,8 @@ public class ProcessTimer {
|
||||
|
||||
}
|
||||
}
|
||||
log.info("=================================标准化活动参会流程定时任务启动=====================================");
|
||||
}
|
||||
|
||||
|
||||
public static void main(String[]args){
|
||||
ProcessTimer processTimer = new ProcessTimer();
|
||||
processTimer.everyDayTenOlockScan();
|
||||
processTimer.everyDayTenOlockScanSAM();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.adc.da.slrs.DataSync.service.IDataSyncService;
|
||||
import com.sun.org.apache.bcel.internal.generic.NEW;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
@@ -22,15 +23,22 @@ public class ScheduledSync {
|
||||
@Autowired
|
||||
private IDataSyncService iDataSyncService;
|
||||
|
||||
/**
|
||||
* 根据配置文件设置是否开启定时器
|
||||
*/
|
||||
|
||||
@Value("${isNotScheduled}")
|
||||
private boolean isNotScheduled; //是否开启定时器
|
||||
|
||||
//每天凌晨两点执行
|
||||
@Scheduled(cron="0 0 2 * * ?")
|
||||
|
||||
@Async
|
||||
public void syncSchedulingTasks() {
|
||||
if(isNotScheduled){
|
||||
log.info("======================================开始同步基础数据========================================");
|
||||
iDataSyncService.orgDataSync(); //时间短
|
||||
iDataSyncService.dataSync(); //时间长
|
||||
log.info("======================================结束同步基础数据========================================");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user