diff --git a/syn-data-task/src/main/java/com/ningdatech/syndataapi/SynDataTaskApp.java b/syn-data-task/src/main/java/com/ningdatech/syndataapi/SynDataTaskApp.java index 39d9615..cad2a6f 100644 --- a/syn-data-task/src/main/java/com/ningdatech/syndataapi/SynDataTaskApp.java +++ b/syn-data-task/src/main/java/com/ningdatech/syndataapi/SynDataTaskApp.java @@ -16,7 +16,7 @@ import org.springframework.transaction.annotation.EnableTransactionManagement; * @author CMM * @since 2023/08/22 18:14 */ -@SpringBootApplication(exclude = {SecurityAutoConfiguration.class }) +@SpringBootApplication @EnableAsync @MapperScan(SynDataTaskApp.MAPPER_PACKAGES) @EnableScheduling diff --git a/syn-data-task/src/main/java/com/ningdatech/syndataapi/scheduler/task/SynDataTask.java b/syn-data-task/src/main/java/com/ningdatech/syndataapi/scheduler/task/SynDataTask.java index 669211c..6b0773e 100644 --- a/syn-data-task/src/main/java/com/ningdatech/syndataapi/scheduler/task/SynDataTask.java +++ b/syn-data-task/src/main/java/com/ningdatech/syndataapi/scheduler/task/SynDataTask.java @@ -193,56 +193,32 @@ public class SynDataTask { * 定时同步前置机数据 每天3点开始执行一次 * */ - @Scheduled(cron = "0 55 19 * * ?") + @Scheduled(cron = "0 15 10 * * ?") public void doTask() throws UnknownHostException { if (flag && HOST.equals(InetAddress.getLocalHost().getHostName())) { log.info("数据同步任务开始"); - // 先删除表中的所有数据,再插入数据,测试数据只有一条,这里只插入一条 - List baseInfos = projectBaseInfoService.list(); - if (CollUtil.isNotEmpty(baseInfos)) { - projectBaseInfoService.removeBatchByIds(baseInfos); - } + // 前置机每天晚上10点自动清空,测试数据只有一条,这里只插入一条 // 项目基本信息 ProjectBaseInfo projectBaseInfo = JSON.parseObject(PROJECT_BASE_INFO_TEST_DATA, ProjectBaseInfo.class); projectBaseInfoService.save(projectBaseInfo); - List applies = projectApplyService.list(); - if (CollUtil.isNotEmpty(applies)){ - projectApplyService.removeBatchByIds(applies); - } // 项目申报信息 ProjectApply projectApply = JSON.parseObject(PROJECT_APPLY_TEST_DATA, ProjectApply.class); projectApplyService.save(projectApply); - List approves = projectApproveService.list(); - if (CollUtil.isNotEmpty(approves)){ - projectApproveService.removeBatchByIds(approves); - } // 项目立项评审信息 ProjectApprove projectApprove = JSON.parseObject(PROJECT_APPROVE_TEST_DATA, ProjectApprove.class); projectApproveService.save(projectApprove); - List procures = projectProcureService.list(); - if (CollUtil.isNotEmpty(procures)){ - projectProcureService.removeBatchByIds(procures); - } // 项目采购信息 ProjectProcure projectProcure = JSON.parseObject(PROJECT_PROCURE_TEST_DATA, ProjectProcure.class); projectProcureService.save(projectProcure); - List cimplements = projectCimplementService.list(); - if (CollUtil.isNotEmpty(cimplements)){ - projectCimplementService.removeBatchByIds(cimplements); - } // 建设项目实施信息 ProjectCimplement projectCimplement = JSON.parseObject(PROJECT_CIMPLEMENT_TEST_DATA, ProjectCimplement.class); projectCimplementService.save(projectCimplement); - List mimplements = projectMimplementService.list(); - if (CollUtil.isNotEmpty(mimplements)){ - projectCimplementService.removeBatchByIds(cimplements); - } // 运维项目实施信息 ProjectMimplement projectMimplement = JSON.parseObject(PROJECT_MIMPLEMENT_TEST_DATA, ProjectMimplement.class); projectMimplementService.save(projectMimplement);