From 095c96be6541ee0fb8ec3e2c266e85bcaad1ea3e Mon Sep 17 00:00:00 2001 From: CMM <2198256324@qq.com> Date: Thu, 24 Aug 2023 10:15:45 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=90=8C=E6=AD=A5=E5=AE=9A?= =?UTF-8?q?=E6=97=B6=E4=BB=BB=E5=8A=A1=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/ningdatech/syndataapi/SynDataTaskApp.java | 2 +- .../syndataapi/scheduler/task/SynDataTask.java | 28 ++-------------------- 2 files changed, 3 insertions(+), 27 deletions(-) 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);