feat: There is no way the, 企标复审计划月初逻辑 改为 下整月

This commit is contained in:
super_liu
2022-02-23 09:05:59 +08:00
parent 183ba86528
commit 85e90b378d
@@ -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<SarBussionessStand> standList = sarBussionessStandDao.queryByBussStateSync(stand);
if(!standList.isEmpty()){
List<SarBussionessStandState> filterList = new ArrayList<>();
@@ -85,7 +91,7 @@ public class StateSync {
List<SarBussionessStandState> updList = new ArrayList<>();
QueryWrapper wrapper = new QueryWrapper();
wrapper.isNull("REVIEW_RESULTS");
wrapper.between("REVIEW_TIME",nowFirst,nowFinByQuery);
wrapper.between("REVIEW_TIME",nextFirst,nextFinByQuery);
List<SarBussionessStandState> 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());