| | |
| | | package com.vci.ubcs.code.Scheduling; |
| | | package com.vci.ubcs.code.Scheduling; |
| | | |
| | | import com.vci.ubcs.code.service.CodeDuckingSyncServiceI; |
| | | import com.vci.starter.web.enumpck.BooleanEnum; |
| | | import com.vci.ubcs.code.service.ICodeDuckingSyncService; |
| | | import com.vci.ubcs.starter.web.enumpck.BooleanEnum; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | |
| | | * 从dockingtask中取出来数据,推送出去的操作 |
| | | */ |
| | | @Component |
| | | @Slf4j |
| | | public class DockingDataSyncScheduling { |
| | | |
| | | private Logger logger = LoggerFactory.getLogger(getClass()); |
| | | // private Logger logger = LoggerFactory.getLogger(getClass()); |
| | | |
| | | @Resource |
| | | private CodeDuckingSyncServiceI codeDuckingSyncServiceI; |
| | | @Resource |
| | | private ICodeDuckingSyncService codeDuckingSyncServiceI; |
| | | |
| | | @Value("${dataSyncPush.isStart:false}") |
| | | public boolean DATA_SYNC_PUSH_ISSTARE; |
| | | @Value("${dataSyncPush.isStart:false}") |
| | | public boolean DATA_SYNC_PUSH_ISSTARE; |
| | | |
| | | /** |
| | | * 是否初始化完成了 |
| | | */ |
| | | public static volatile String FINISH_INIT = "false"; |
| | | /** |
| | | * 是否初始化完成了 |
| | | */ |
| | | public static volatile String FINISH_INIT = "false"; |
| | | |
| | | /** |
| | | * 在初始化完成后执行 |
| | | */ |
| | | @PostConstruct() |
| | | public void onInit(){ |
| | | FINISH_INIT = "true"; |
| | | } |
| | | /** |
| | | * 在初始化完成后执行 |
| | | */ |
| | | @PostConstruct() |
| | | public void onInit(){ |
| | | FINISH_INIT = "true"; |
| | | } |
| | | |
| | | //默认每分钟执行方法 |
| | | @Scheduled(cron = "${dataSyncPush.cronTime:0 0/10 * * * ?}") |
| | | public void scheduled() { |
| | | if(DATA_SYNC_PUSH_ISSTARE && BooleanEnum.TRUE.getValue().equalsIgnoreCase(FINISH_INIT)) { |
| | | codeDuckingSyncServiceI.DockingDataSyncScheduing(); |
| | | SimpleDateFormat formatter= new SimpleDateFormat("yyyy-MM-dd HH:mm:ss."); |
| | | String time = formatter.format(new Date()); |
| | | String outinfo = "============在 "+time+" 执行了主数据集成数据推送"; |
| | | logger.info(outinfo); |
| | | } |
| | | } |
| | | /** |
| | | * 默认每分钟执行方法 |
| | | */ |
| | | @Scheduled(cron = "${dataSyncPush.cronTime:0 0/10 * * * ?}") |
| | | public void scheduled() { |
| | | log.info("执行主数据集成数据推送 start:"); |
| | | if(DATA_SYNC_PUSH_ISSTARE && BooleanEnum.TRUE.getValue().equalsIgnoreCase(FINISH_INIT)) { |
| | | codeDuckingSyncServiceI.DockingDataSyncScheduing(); |
| | | SimpleDateFormat formatter= new SimpleDateFormat("yyyy-MM-dd HH:mm:ss."); |
| | | String time = formatter.format(new Date()); |
| | | String outinfo = "============ 执行了主数据集成数据推送"; |
| | | log.info(outinfo); |
| | | } |
| | | log.info("执行主数据集成数据推送 end: "+ "开关是否开启:" +DATA_SYNC_PUSH_ISSTARE); |
| | | } |
| | | |
| | | } |