| | |
| | | package com.vci.ubcs.code.Scheduling; |
| | | |
| | | import com.alibaba.nacos.shaded.com.google.protobuf.ServiceException; |
| | | import com.vci.ubcs.code.service.ICodeDuckingSyncService; |
| | | import com.vci.ubcs.code.service.UniversalInterfaceI; |
| | | import com.vci.ubcs.starter.web.enumpck.BooleanEnum; |
| | | import io.swagger.annotations.Scope; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | 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 javax.servlet.http.HttpServletRequest; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | |
| | |
| | | @Value("${erp.item.isStart:false}") |
| | | public boolean ERP_ITEM_ISSTARE; |
| | | |
| | | @Value("${erp.item.btmName:XHDH}") |
| | | public String ERP_ITEM_BTMNAME; |
| | | /** |
| | | * 是否初始化完成了 |
| | | */ |
| | | public static volatile String FINISH_INIT = "false"; |
| | | |
| | | /** |
| | | * 在初始化完成后执行 |
| | | */ |
| | |
| | | } |
| | | |
| | | //默认每十分钟执行方法 |
| | | @Scheduled(cron = "${dataSyncPush.cronTime:0 0/10 * * * ?}") |
| | | public void scheduled() { |
| | | @Scheduled(cron = "${erp.item.cronTime:0 0/10 * * * ?}") |
| | | public void scheduled() throws ServiceException { |
| | | log.info("执行从ERP项目代号/型号代号数据 start:"); |
| | | log.info("执行主数据集成数据推送 end: "+ "开关是否开启:" +ERP_ITEM_ISSTARE); |
| | | if(ERP_ITEM_ISSTARE && BooleanEnum.TRUE.getValue().equalsIgnoreCase(FINISH_INIT)) { |
| | | SimpleDateFormat formatter= new SimpleDateFormat("yyyy-MM-dd HH:mm:ss."); |
| | | SimpleDateFormat formatter= new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | String time = formatter.format(new Date()); |
| | | codeDuckingSyncServiceI.saveItemDataSyncScheduing(ERP_ITEM_BTMNAME); |
| | | codeDuckingSyncServiceI.saveItemDataSyncScheduing(""); |
| | | String outInfo = "============ 执行了从ERP项目代号/型号代号数据 end;"; |
| | | log.info(outInfo+time); |
| | | } |