fix:定时任务增加管控注记
This commit is contained in:
@@ -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() {
|
||||
log.info("======================================开始同步基础数据========================================");
|
||||
iDataSyncService.orgDataSync(); //时间短
|
||||
iDataSyncService.dataSync(); //时间长
|
||||
log.info("======================================结束同步基础数据========================================");
|
||||
if(isNotScheduled){
|
||||
log.info("======================================开始同步基础数据========================================");
|
||||
iDataSyncService.orgDataSync(); //时间短
|
||||
iDataSyncService.dataSync(); //时间长
|
||||
log.info("======================================结束同步基础数据========================================");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user