xiejun
2023-08-22 99e7bd4734c18ab06f4984a2aa6e5db435cb1ede
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/Scheduling/DockingClassSyncScheduling.java
@@ -1,10 +1,8 @@
package com.vci.ubcs.code.Scheduling;
import com.vci.ubcs.code.service.CodeDuckingSyncServiceI;
import com.vci.starter.web.enumpck.BooleanEnum;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.vci.ubcs.code.service.ICodeDuckingSyncService;
import com.vci.ubcs.starter.web.enumpck.BooleanEnum;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
@@ -20,38 +18,39 @@
 * 从dockingtask中取出来数据,推送出去的操作
 */
@Component
@Slf4j
public class DockingClassSyncScheduling {
    private Logger logger = LoggerFactory.getLogger(getClass());
   @Resource
   private ICodeDuckingSyncService codeDuckingSyncServiceI;
    @Resource
    private CodeDuckingSyncServiceI codeDuckingSyncServiceI;
   @Value("${clsfSyncPush.isStart:false}")
   public boolean CLSF_SYNC_PUSH_ISSTARE;
    @Value("${clsfSyncPush.isStart:false}")
    public boolean CLSF_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 = "${clsfSyncPush.cronTime:0 0/10 * * * ?}")
    public void scheduled() {
        if(CLSF_SYNC_PUSH_ISSTARE && BooleanEnum.TRUE.getValue().equalsIgnoreCase(FINISH_INIT)) {
            codeDuckingSyncServiceI.DockingClassSyncScheduing();
            SimpleDateFormat formatter= new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.");
            String time = formatter.format(new Date());
            String outinfo = "============在 "+time+" 执行了分类集成推送";
            logger.info(outinfo);
        }
    }
   //默认每分钟执行方法
   @Scheduled(cron = "${clsfSyncPush.cronTime:0 0/10 * * * ?}")
   public void scheduled() {
      log.info("执行分类集成推送 start:");
      if(CLSF_SYNC_PUSH_ISSTARE && BooleanEnum.TRUE.getValue().equalsIgnoreCase(FINISH_INIT)) {
         codeDuckingSyncServiceI.DockingClassSyncScheduing();
         SimpleDateFormat formatter= new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.");
         String time = formatter.format(new Date());
         String outinfo = "============在 "+time+" 执行了分类集成推送";
         log.info(outinfo);
      }
      log.info("执行分类集成推送 end: "+ "开关是否开启:" +CLSF_SYNC_PUSH_ISSTARE);
   }
}