From 85e90b378df0691e890a8d8fc14a807ebcea1325 Mon Sep 17 00:00:00 2001 From: super_liu <396572590@qq.com> Date: Wed, 23 Feb 2022 09:05:59 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20There=20is=20no=20way=20the,=20?= =?UTF-8?q?=E4=BC=81=E6=A0=87=E5=A4=8D=E5=AE=A1=E8=AE=A1=E5=88=92=E6=9C=88?= =?UTF-8?q?=E5=88=9D=E9=80=BB=E8=BE=91=20=E6=94=B9=E4=B8=BA=20=E4=B8=8B?= =?UTF-8?q?=E6=95=B4=E6=9C=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sync/StateSync.java | 35 ++++++++++--------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/adc-da-slrs/src/main/java/com/adc/da/slrs/sarBussionessStandState/sync/StateSync.java b/adc-da-slrs/src/main/java/com/adc/da/slrs/sarBussionessStandState/sync/StateSync.java index e7d718c9..e5da96a4 100644 --- a/adc-da-slrs/src/main/java/com/adc/da/slrs/sarBussionessStandState/sync/StateSync.java +++ b/adc-da-slrs/src/main/java/com/adc/da/slrs/sarBussionessStandState/sync/StateSync.java @@ -46,7 +46,7 @@ public class StateSync { // 月初 -// @Scheduled(cron="0 0 1 1 * ?") + @Scheduled(cron="0 0 1 1 * ?") // @Scheduled(cron="*/5 * * * * ?") @Async public void StandScheduledJobMonthBegin(){ @@ -54,15 +54,21 @@ public class StateSync { try{ Thread.sleep(2000); logger.info("月初:"+Thread.currentThread().getName() + " cron=0 0 1 1 * ? --- " + new Date()+"---START-01"); - String nowFirst = DateUtil.firstOneDay(DateUtil.printDate(new Date())); - String nowFin = DateUtil.finOneDay(DateUtil.printDate(new Date())); - String nowFinByQuery = DateUtil.addDay(DateUtil.finOneDay(DateUtil.printDate(new Date())),1); - System.out.println("当前月第一日:"+nowFirst); - System.out.println("当前月最后一日:"+nowFin); +// String nowFirst = DateUtil.firstOneDay(DateUtil.printDate(new Date())); +// String nowFin = DateUtil.finOneDay(DateUtil.printDate(new Date())); +// String nowFinByQuery = DateUtil.addDay(DateUtil.finOneDay(DateUtil.printDate(new Date())),1); +// System.out.println("当前月第一日:"+nowFirst); +// System.out.println("当前月最后一日:"+nowFin); + // 改为下月整月 + String nextFirst = DateUtil.printDate(DateUtil.nextMonthFirstDate()); + String nextFin = DateUtil.finOneDay(DateUtil.printDate(DateUtil.nextMonthFirstDate())); + String nextFinByQuery = DateUtil.addDay(DateUtil.finOneDay(DateUtil.printDate(DateUtil.nextMonthFirstDate())),1); + System.out.println("下个月第一日:"+ nextFirst); + System.out.println("下个月最后一日:"+nextFin); SarBussionessStand stand = new SarBussionessStand(); - stand.setIssueTimeStart(nowFirst); - stand.setIssueTimeEnd(nowFin); + stand.setIssueTimeStart(nextFirst); + stand.setIssueTimeEnd(nextFin); List standList = sarBussionessStandDao.queryByBussStateSync(stand); if(!standList.isEmpty()){ List filterList = new ArrayList<>(); @@ -85,7 +91,7 @@ public class StateSync { List updList = new ArrayList<>(); QueryWrapper wrapper = new QueryWrapper(); wrapper.isNull("REVIEW_RESULTS"); - wrapper.between("REVIEW_TIME",nowFirst,nowFinByQuery); + wrapper.between("REVIEW_TIME",nextFirst,nextFinByQuery); List stateList = bussionessStandStateService.list(wrapper); if(!stateList.isEmpty()){ // 差集 (list1 - list2) 新增复审表 @@ -143,8 +149,6 @@ public class StateSync { } } - // 月初 - @Scheduled(cron="0 0 1 1 * ?") // 月末 // @Scheduled(cron="0 0 1 28-31 * ?") // @Scheduled(cron="*/5 * * * * ?") @@ -156,8 +160,7 @@ public class StateSync { // 判断当前日期是否为月末 Date date = new Date(); if(isLastDayOfMonth(date)){ - logger.info("月初:"+Thread.currentThread().getName() + " cron=0 0 1 1 * ? --- " + new Date()+"---START-01"); -// logger.info("月末:"+Thread.currentThread().getName() + " cron=0 0 1 28-31 * ? --- " + new Date()+"---START-01"); + logger.info("月末:"+Thread.currentThread().getName() + " cron=0 0 1 28-31 * ? --- " + new Date()+"---START-01"); String nextFirst = DateUtil.printDate(DateUtil.nextMonthFirstDate()); String nextFin = DateUtil.finOneDay(DateUtil.printDate(DateUtil.nextMonthFirstDate())); String nextFinByQuery = DateUtil.addDay(DateUtil.finOneDay(DateUtil.printDate(DateUtil.nextMonthFirstDate())),1); @@ -236,11 +239,9 @@ public class StateSync { bussionessStandStateService.updateBatchById(updList); } } - logger.info("月初:"+Thread.currentThread().getName() + " cron=0 0 1 1 * ? --- " + new Date()+"---End-01"); -// logger.info("月末:"+Thread.currentThread().getName() + " cron=0 0 1 28-31 * ? --- " + new Date()+"---End-01"); + logger.info("月末:"+Thread.currentThread().getName() + " cron=0 0 1 28-31 * ? --- " + new Date()+"---End-01"); }else { - logger.info("月初:"+Thread.currentThread().getName() + " cron=0 0 1 1 * ? --- " + new Date()+"---End-01"); -// logger.info("月末:"+Thread.currentThread().getName() + " cron=0 0 1 28-31 * ? --- " + new Date()+"当前日期不是最后一日---End-01"); + logger.info("月末:"+Thread.currentThread().getName() + " cron=0 0 1 28-31 * ? --- " + new Date()+"当前日期不是最后一日---End-01"); } }catch(Exception e){ logger.info(e.getMessage());