feat: There is no way the,福田标准自动变更逻辑 30%

This commit is contained in:
super_liu
2022-05-12 10:33:39 +08:00
parent d041bb4611
commit b7341b55f3
4 changed files with 49 additions and 19 deletions
@@ -24,9 +24,11 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import java.sql.Clob;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
@@ -77,6 +79,7 @@ public class UpdateStateBussSync {
// 每天0点1分执行 企标标准文本状态 即将实施和现行有效状态自动变更逻辑
// @Scheduled(cron="0 0 1 1 * ?")
@Scheduled(cron="*/60 * * * * ?")
// @Scheduled(cron = "0 1 0 * * ?")
@Async
public void BussScheduled(){
@@ -88,12 +91,12 @@ public class UpdateStateBussSync {
// 发布、即将实施
List<String> list = new ArrayList<>();
// 发布
list.add("hc99551723c");
list.add("6jnqba2mby");
// 即将实施
list.add("hb0iy9z23c");
list.add("rpvoxsvr60");
QueryWrapper wrapper = new QueryWrapper();
wrapper.eq("A.VALID_FLAG","0");
wrapper.in("A.TEXT_STATUS",list);
wrapper.in("A.TEXT_STATUS_BUSS",list);
List<SarBussionessStand> getStateScheduledList = sarBussionessStandDao.getStateScheduledList(wrapper);
if(!getStateScheduledList.isEmpty()){
// N个实施日期中大于当前日期
@@ -103,9 +106,8 @@ public class UpdateStateBussSync {
List<String> dateIsAfterList = dateList.stream().filter(s -> {
if(Util.isValidDate(s)){
LocalDateTime now = LocalDateTime.now();
DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd");
LocalDateTime parse = LocalDateTime.parse(s, dtf);
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
LocalDateTime parse = LocalDate.parse(s, dateTimeFormatter).atStartOfDay();
// 实施日期是否大于当前日期
return parse.isAfter(now);
}
@@ -125,9 +127,8 @@ public class UpdateStateBussSync {
List<String> dateIsBeforeList = dateList.stream().filter(s -> {
if(Util.isValidDate(s)){
LocalDateTime now = LocalDateTime.now();
DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd");
LocalDateTime parse = LocalDateTime.parse(s, dtf);
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
LocalDateTime parse = LocalDate.parse(s, dateTimeFormatter).atStartOfDay();
// 实施日期是否小于当前时间
return parse.isBefore(now);
}
@@ -139,14 +140,14 @@ public class UpdateStateBussSync {
return false;
}).collect(Collectors.toList());
// N个实施日期中大于当前日期 执行逻辑
// N个实施日期中大于当前日期 执行逻辑 更为即将实施
if(!getStateScheduledListToIsAfter.isEmpty()){
execStandDate(getStateScheduledListToIsAfter,"hb0iy9z23c");
execStandDate(getStateScheduledListToIsAfter,"rpvoxsvr60");
}
// N个实施日期中小于当前时间 执行逻辑
// N个实施日期中小于当前时间 执行逻辑 更为现行有效
if(!getStateScheduledListToIsBefore.isEmpty()){
execStandDate(getStateScheduledListToIsAfter,"vsaga7nwub");
execStandDate(getStateScheduledListToIsBefore,"9z741h2m3j");
}
}
@@ -179,13 +180,26 @@ public class UpdateStateBussSync {
@Async
public void execStandDate(List<SarBussionessStand> infoList, String textStatusStand) throws Exception {
List<SarBussionessStand> list = new ArrayList<>();
for (SarBussionessStand info : infoList) {
info.setTextStatusBuss(textStatusStand);
bussAttrInfoShowSearchDetails(info);
if (info.getAttrInfoMap() != null) {
info.setSarStandAttrEOStr(JSONObject.toJSONString(info.getAttrInfoMap()));
}
createStandMQService.sendBussStandMQ(info,"update"); }
createStandMQService.sendBussStandMQ(info,"update");
// 只批量更新文本字段
SarBussionessStand newInfo = new SarBussionessStand();
newInfo.setTextStatusBuss(textStatusStand);
newInfo.setId(info.getId());
newInfo.setModifyTime(new Date());
list.add(newInfo);
}
if(!list.isEmpty()){
iSarBussionessStandService.updateBatchById(list);
}
}
@@ -80,7 +80,7 @@ public class UpdateStateStandSync {
// 每天0点1分执行 国内标准文本状态 即将实施和现行有效状态自动变更逻辑
// @Scheduled(cron="0 0 1 1 * ?")
// @Scheduled(cron="0 42 17 * * ?")
// @Scheduled(cron="0 37 9 * * ?")
// @Scheduled(cron = "0 1 0 * * ?")
@Async
public void StandScheduled(){
@@ -89,7 +89,7 @@ public class UpdateStateStandSync {
Thread.sleep(2000);
logger.info("每天0点1分执行 国内标准文本状态 即将实施和现行有效状态自动变更逻辑:"+Thread.currentThread().getName() + " cron=0 1 0 * * ? --- " + new Date()+"---START-01");
// 发布、即将实施
// 发布、即将实施 只查询国内标准
List<String> list = new ArrayList<>();
// 发布
list.add("hc99551723c");
@@ -97,6 +97,7 @@ public class UpdateStateStandSync {
list.add("hb0iy9z23c");
QueryWrapper wrapper = new QueryWrapper();
wrapper.eq("A.VALID_FLAG","0");
wrapper.eq("STAND_TYPE","INLAND");
wrapper.in("A.TEXT_STATUS",list);
List<SarStandardsInfo> getStateScheduledList = sarStandardsInfoDao.getStateScheduledList(wrapper);
if(!getStateScheduledList.isEmpty()){
@@ -141,14 +142,14 @@ public class UpdateStateStandSync {
return false;
}).collect(Collectors.toList());
// N个实施日期中大于当前日期 执行逻辑
// N个实施日期中大于当前日期 执行逻辑 更为即将实施
if(!getStateScheduledListToIsAfter.isEmpty()){
logger.info("=============N个实施日期中大于当前日期 执行============");
// 文本状态更为即将实施
execStandDate(getStateScheduledListToIsAfter,"hb0iy9z23c");
}
// N个实施日期中小于当前时间 执行逻辑
// N个实施日期中小于当前时间 执行逻辑 更为现行有效
if(!getStateScheduledListToIsBefore.isEmpty()){
logger.info("=============N个实施日期中小于当前时间 执行============");
// 文本状态更为现行有效
@@ -175,6 +176,17 @@ public class UpdateStateStandSync {
Thread.sleep(2000);
logger.info("每天0点1分执行 国内标准文本状态被代替逻辑 标准自动变更废止:"+Thread.currentThread().getName() + " cron=0 1 0 * * ? --- " + new Date()+"---START-01");
// 发布、即将实施 只查询国内标准
List<String> list = new ArrayList<>();
// 发布
list.add("hc99551723c");
// 即将实施
list.add("hb0iy9z23c");
QueryWrapper wrapper = new QueryWrapper();
wrapper.eq("A.VALID_FLAG","0");
wrapper.eq("STAND_TYPE","INLAND");
wrapper.in("A.TEXT_STATUS",list);
List<SarStandardsInfo> getStateScheduledList = sarStandardsInfoDao.getStateScheduledList(wrapper);
logger.info("每天0点1分执行 国内标准文本状态被代替逻辑 标准自动变更废止:"+Thread.currentThread().getName() + " cron=0 1 0 * * ? --- " + new Date()+"---End-01");
}catch(Exception e){
@@ -26,7 +26,7 @@ import java.util.List;
@Repository
public interface SarBussionessStandDao extends BaseMapper<SarBussionessStand> {
String updateStateScheduledSql = "SELECT A.*,B.BDTQBBHBUSS FROM sar_bussioness_stand A LEFT JOIN sar_buss_stand_attr_info B ON B.STAND_ID = A.ID";
String updateStateScheduledSql = "SELECT A.*,B.BDTQBBHBUSS FROM sar_bussioness_stand A LEFT JOIN sar_buss_stand_attr_info B ON B.STAND_ID = A.ID ${ew.customSqlSegment}";
/**
* 自动更新文本状态通用查询
+4
View File
@@ -1,2 +1,6 @@
4.13------------------
INSERT INTO `foton_slrs_test2`.`sar_menu`(`ID`, `SOR_DIVIDE`, `MENU_NAME`, `PARENT_ID`, `PARENT_IDS`, `LEVEL`, `DISPLAY_SEQ`, `HREF`, `VALID_FLAG`, `CREATION_TIME`, `MODIFY_TIME`, `REMARKS`) VALUES ('asdzcfgk', NULL, '政策法规库', NULL, NULL, 1, NULL, NULL, NULL, NULL, NULL, NULL);
5.12------------------- 新增企标文本状态 发布、即将实施
INSERT INTO `foton_slrs`.`ts_dictype` (`ID`, `DIC_ID`, `DIC_TYPE_NAME`, `DIC_TYPE_CODE`, `DESCRIBES`, `SHOW_INDEX`, `PARENT_ID`, `TREE_PID`, `OTHERS`, `CREATION_USER`, `VALID_FLAG`, `CREATION_TIME`, `MODIFY_TIME`) VALUES ('yxje11vu7hngvakm6xor', 'qybmpmpvykzpwy511xai', '发布', '6jnqba2mby', '', '7', NULL, NULL, NULL, 'chenchunmei', '0', '2022-05-12 01:45:21', '2022-05-12 01:45:21');
INSERT INTO `foton_slrs`.`ts_dictype` (`ID`, `DIC_ID`, `DIC_TYPE_NAME`, `DIC_TYPE_CODE`, `DESCRIBES`, `SHOW_INDEX`, `PARENT_ID`, `TREE_PID`, `OTHERS`, `CREATION_USER`, `VALID_FLAG`, `CREATION_TIME`, `MODIFY_TIME`) VALUES ('n4wyayhkmbhc58wi21rs', 'qybmpmpvykzpwy511xai', '即将实施', 'rpvoxsvr60', '', '8', NULL, NULL, NULL, 'chenchunmei', '0', '2022-05-12 01:45:56', '2022-05-12 01:45:56');