wang1
2023-07-13 af73b1917e58e37daaa3e63f5303da1056cedfa3
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/Scheduling/DockingClassSyncScheduling.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,54 @@
package com.vci.ubcs.code.Scheduling;
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;
import javax.annotation.PostConstruct;
import javax.annotation.Resource;
import java.text.SimpleDateFormat;
import java.util.Date;
/**
 * é›†æˆä»»åŠ¡å®šæ—¶å™¨
 * æ’å…¥dockingtask中
 * ä»Ždockingtask中取出来数据,推送出去的操作
 */
@Component
@Slf4j
public class DockingClassSyncScheduling {
   @Resource
   private ICodeDuckingSyncService codeDuckingSyncServiceI;
   @Value("${clsfSyncPush.isStart:false}")
   public boolean CLSF_SYNC_PUSH_ISSTARE;
   /**
    * æ˜¯å¦åˆå§‹åŒ–完成了
    */
   public static volatile String FINISH_INIT = "false";
   /**
    * åœ¨åˆå§‹åŒ–完成后执行
    */
   @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+" æ‰§è¡Œäº†åˆ†ç±»é›†æˆæŽ¨é€";
         log.info(outinfo);
      }
   }
}