Merge remote-tracking branch 'origin/develop_master' into develop_master
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
package com.adc.da.mq;
|
||||
|
||||
import com.adc.da.slrs.sarStandardsInfo.entity.DSarStandardDTO;
|
||||
import org.springframework.amqp.core.AmqpTemplate;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@Component
|
||||
public class CreateStandardMQService {
|
||||
@Autowired
|
||||
private AmqpTemplate rabbitTemplate;
|
||||
|
||||
/**
|
||||
* @Author yuezhihang
|
||||
* @Description 创建消息队列
|
||||
* Date 2018/8/24 13:59
|
||||
* @Param [convert, convertType]
|
||||
* @return int
|
||||
**/
|
||||
public void sendMQ(List<DSarStandardDTO> changeJJSS, List<DSarStandardDTO> changeXXYX ){
|
||||
Map<String,Object> map=new HashMap<>();
|
||||
map.put("changeJJSS",changeJJSS);
|
||||
map.put("changeXXYX",changeXXYX);
|
||||
// map.put("map",hashMap);
|
||||
//发送消息队列
|
||||
this.rabbitTemplate.convertAndSend("standard-exchange_updateText_RELEASE", "standard-key_updateText_RELEASE", map);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -4,6 +4,7 @@ import com.adc.da.slrs.sarLawsAttrInfo.service.ISarLawsAttrInfoService;
|
||||
import com.adc.da.slrs.sarLawsStandInfo.entity.SarLawsStandInfo;
|
||||
import com.adc.da.slrs.sarLawsStandInfo.service.ISarLawsStandInfoService;
|
||||
import com.adc.da.slrs.sarStandAttrInfo.service.ISarStandAttrInfoService;
|
||||
import com.adc.da.slrs.sarStandardsInfo.entity.DSarStandardDTO;
|
||||
import com.adc.da.slrs.sarStandardsInfo.entity.SarStandardsInfo;
|
||||
import com.adc.da.slrs.sarStandardsInfo.service.ISarStandardsInfoService;
|
||||
import com.adc.da.sys.service.IDicTypeEOService;
|
||||
@@ -201,6 +202,77 @@ public class SendQdUpdateMQService {
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
@RabbitListener(bindings = @QueueBinding(
|
||||
value = @Queue(value = "createMQ_Standard_updateText_RELEASE", durable = "true"),
|
||||
exchange = @Exchange(value = "standard-exchange_updateText_RELEASE", ignoreDeclarationExceptions = "true"),
|
||||
key = "standard-key_updateText_RELEASE"))
|
||||
public void createStandardMQ(Map<String, Object> bussMap, Message message, Channel channel) throws Exception {
|
||||
|
||||
//数据字典数据组装
|
||||
//数据字典数据组装
|
||||
Map<String, Object> dicTypeEO = dicTypeEOService.getDicTypeListCode();
|
||||
Map<String, String> map = new HashMap<>();
|
||||
List<Map<String, String>> arr = (List<Map<String, String>>) dicTypeEO.get("WBZTCLASS");
|
||||
arr.forEach(stringStringMap -> {
|
||||
map.put(stringStringMap.get("label"), stringStringMap.get("value"));
|
||||
});
|
||||
|
||||
|
||||
List<DSarStandardDTO> changeJJSS= (List<DSarStandardDTO>) bussMap.get("changeJJSS");
|
||||
List<DSarStandardDTO> changeXXYX= (List<DSarStandardDTO>) bussMap.get("changeXXYX");
|
||||
|
||||
|
||||
|
||||
//写修改逻辑
|
||||
Thread.sleep(5000);
|
||||
for (DSarStandardDTO jjss : changeJJSS) {
|
||||
QueryWrapper<SarStandardsInfo> wrapper = new QueryWrapper<>();
|
||||
wrapper.eq("ID", jjss.getId());
|
||||
List<SarStandardsInfo> infos = sarStandardsInfoService.list(wrapper);
|
||||
if (null != infos && infos.size() > 0) {
|
||||
SarStandardsInfo sarStandardsInfo = new SarStandardsInfo();
|
||||
sarStandardsInfo.setId(jjss.getId());
|
||||
sarStandardsInfo.setModifyTime(new Date());
|
||||
sarStandardsInfo.setTextStatus(map.get("即将实施"));
|
||||
Map<String, Object> bussAttrInfoMap = iSarStandAttrInfoService.getBussAttrInfo(jjss.getId());
|
||||
if (bussAttrInfoMap != null) {
|
||||
sarStandardsInfo.setSarStandAttrEOStr(JSONObject.toJSONString(bussAttrInfoMap));
|
||||
}
|
||||
try {
|
||||
|
||||
sarStandardsInfoService.updateSarStandardsInfo(sarStandardsInfo);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (DSarStandardDTO jjss : changeXXYX) {
|
||||
QueryWrapper<SarStandardsInfo> wrapper = new QueryWrapper<>();
|
||||
wrapper.eq("ID", jjss.getId());
|
||||
List<SarStandardsInfo> infos = sarStandardsInfoService.list(wrapper);
|
||||
if (null != infos && infos.size() > 0) {
|
||||
SarStandardsInfo sarStandardsInfo = new SarStandardsInfo();
|
||||
sarStandardsInfo.setId(jjss.getId());
|
||||
sarStandardsInfo.setModifyTime(new Date());
|
||||
sarStandardsInfo.setTextStatus(map.get("现行有效"));
|
||||
Map<String, Object> bussAttrInfoMap = iSarStandAttrInfoService.getBussAttrInfo(jjss.getId());
|
||||
if (bussAttrInfoMap != null) {
|
||||
sarStandardsInfo.setSarStandAttrEOStr(JSONObject.toJSONString(bussAttrInfoMap));
|
||||
}
|
||||
try {
|
||||
sarStandardsInfoService.updateSarStandardsInfo(sarStandardsInfo);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
package com.adc.da.scheduled;
|
||||
|
||||
import com.adc.da.mq.CreateStandardMQService;
|
||||
import com.adc.da.scheduled.dao.SarStandardInfoDao;
|
||||
import com.adc.da.scheduled.dao.SarStandardItemDao;
|
||||
import com.adc.da.scheduled.dao.SarStandardWarningDao;
|
||||
import com.adc.da.scheduled.entity.TermDTO;
|
||||
|
||||
import com.adc.da.slrs.ActivityDatas.entity.DataList;
|
||||
import com.adc.da.slrs.processModel.utils.TrainFormDate;
|
||||
import com.adc.da.slrs.sarStandAttrInfo.dao.SarStandAttrInfoDao;
|
||||
import com.adc.da.slrs.sarStandAttrInfo.entity.SarStandAttrInfo;
|
||||
|
||||
@@ -13,8 +15,10 @@ import com.adc.da.slrs.sarStandWarning.entity.EarlyWarningEO;
|
||||
import com.adc.da.slrs.sarStandWarning.entity.WarningDate;
|
||||
import com.adc.da.slrs.sarStandWarning.service.IWarningDateService;
|
||||
import com.adc.da.slrs.sarStandardsInfo.dao.SarStandardsInfoDao;
|
||||
import com.adc.da.slrs.sarStandardsInfo.entity.DSarStandardDTO;
|
||||
import com.adc.da.slrs.sarStandardsInfo.entity.SarStandardsInfo;
|
||||
import com.adc.da.slrs.sarUpdLog.service.ISarUpdLogService;
|
||||
import com.adc.da.sys.service.IDicTypeEOService;
|
||||
import com.adc.da.util.UUIDUtils;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -35,6 +39,8 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDate;
|
||||
import java.util.*;
|
||||
import java.util.regex.Matcher;
|
||||
@@ -73,7 +79,13 @@ public class ScheduledJob {
|
||||
@Autowired
|
||||
private IWarningDateService iWarningDateService;// 预警日期
|
||||
|
||||
// @PostConstruct //程序启动时执行一次
|
||||
@Autowired
|
||||
CreateStandardMQService createStandardMQService;
|
||||
|
||||
@Autowired
|
||||
private IDicTypeEOService dicTypeEOService;
|
||||
|
||||
// @PostConstruct //程序启动时执行一次
|
||||
// @Scheduled(cron = "0 0 0 * * ?") //每天的凌晨0点执行
|
||||
// @Scheduled(cron="*/5 * * * * ?")
|
||||
// @Scheduled(fixedDelay = 120000)
|
||||
@@ -121,7 +133,7 @@ public class ScheduledJob {
|
||||
logger.info("========================================================================================================");
|
||||
//删除不在预警范围的标准
|
||||
int remove = sarStandardWarningDao.autoCancelWarning();
|
||||
logger.info("取消"+remove+"条预警");
|
||||
logger.info("取消" + remove + "条预警");
|
||||
|
||||
//预警期限(当前日期至3个月后)
|
||||
TermDTO term = new TermDTO();
|
||||
@@ -129,7 +141,7 @@ public class ScheduledJob {
|
||||
List<WarningDate> warningDateList = sarStandardWarningDao.getWarningDate(term);
|
||||
|
||||
ArrayList<WarningDate> data = new ArrayList<>();
|
||||
warningDateList.forEach(item->{
|
||||
warningDateList.forEach(item -> {
|
||||
|
||||
for (String s : item.getSSRQ().split(",")) {
|
||||
|
||||
@@ -157,16 +169,16 @@ public class ScheduledJob {
|
||||
//联接标准的日期子表 和分解单表 查询符合预警期限的标准和分解项
|
||||
List<EarlyWarningEO> warningList = sarStandardWarningDao.getWarningId(term);
|
||||
|
||||
warningList.forEach(item->{
|
||||
warningList.forEach(item -> {
|
||||
item.setId(UUIDUtils.randomUUID20());
|
||||
});
|
||||
//持久化至预警表 忽略标准id和标志位都一样的数据
|
||||
if (warningList.size()!=0){
|
||||
if (warningList.size() != 0) {
|
||||
//此表的STAND_ID和MARK字段以及ITEMS_ID字段需个建立唯一性约束
|
||||
int count = sarStandardWarningDao.ignoreInsert(warningList);
|
||||
logger.info("==================================预警结束======================================");
|
||||
logger.info("==================================预警结束======================================");
|
||||
logger.info("已预警"+ count+"条标准或条款!!");
|
||||
logger.info("已预警" + count + "条标准或条款!!");
|
||||
logger.info("==================================预警结束======================================");
|
||||
logger.info("==================================预警结束======================================");
|
||||
|
||||
@@ -174,10 +186,6 @@ public class ScheduledJob {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@Autowired
|
||||
private ISarUpdLogService sarUpdLogEOService;
|
||||
|
||||
@@ -205,11 +213,11 @@ public class ScheduledJob {
|
||||
*实施日期是当前系统时间的标准文本状态变为'现行有效'
|
||||
*/
|
||||
QueryWrapper<SarStandAttrInfo> columnsAndCondition = new QueryWrapper<>();
|
||||
columnsAndCondition.select("STAND_ID").like("SSRQ",LocalDate.now());
|
||||
List<Map<String, Object>> effectiveList=sarStandAttrInfoDao.selectMaps(columnsAndCondition);
|
||||
columnsAndCondition.select("STAND_ID").like("SSRQ", LocalDate.now());
|
||||
List<Map<String, Object>> effectiveList = sarStandAttrInfoDao.selectMaps(columnsAndCondition);
|
||||
// List<ScheduledDTO> effectiveList = sarStandardInfoDao.selectWithinTerm(data, "SSRQ");
|
||||
|
||||
effectiveList.forEach(item->{
|
||||
effectiveList.forEach(item -> {
|
||||
try {
|
||||
SarStandardsInfo sarStandardsInfo = new SarStandardsInfo();
|
||||
sarStandardsInfo.setId(item.get("STAND_ID").toString());
|
||||
@@ -218,8 +226,8 @@ public class ScheduledJob {
|
||||
sarStandardsInfoDao.updateById(sarStandardsInfo);
|
||||
// sarStandardInfoDao.updateStandardInfo(item.getStandId(),"vsaga7nwub");
|
||||
|
||||
}catch (Exception e){
|
||||
System.out.println("标准id为=="+item.get("STAND_ID").toString()+"==文本状态更新失败");
|
||||
} catch (Exception e) {
|
||||
System.out.println("标准id为==" + item.get("STAND_ID").toString() + "==文本状态更新失败");
|
||||
}
|
||||
});
|
||||
|
||||
@@ -230,8 +238,8 @@ public class ScheduledJob {
|
||||
QueryWrapper<SarStandAttrInfo> columnForDTBJH = new QueryWrapper<>();
|
||||
|
||||
columnForDTBJH.select("DTBJH")
|
||||
.eq("VALID_FLAG","0")
|
||||
.ne("DTBJH","");
|
||||
.eq("VALID_FLAG", "0")
|
||||
.ne("DTBJH", "");
|
||||
//查询代替标准字段得到一个 被代替了的标准的id的键值对列表
|
||||
List<Map<String, Object>> replaceStandIdMaps = sarStandAttrInfoDao.selectMaps(columnForDTBJH);
|
||||
HashMap<String, Integer> replaceIdCountMap = new HashMap<>();
|
||||
@@ -242,15 +250,15 @@ public class ScheduledJob {
|
||||
* 国内外表准号格式不统一
|
||||
*/
|
||||
// Pattern pattern = Pattern.compile("^\\S*\\s\\S*[\\u2014\\u002d\\s]\\d{4}$");
|
||||
replaceStandIdMaps.forEach(item->{
|
||||
if (item!=null){
|
||||
//此标准代替的标准的标准号的数组
|
||||
String DTBJHStr = item.get("DTBJH").toString();
|
||||
replaceStandIdMaps.forEach(item -> {
|
||||
if (item != null) {
|
||||
//此标准代替的标准的标准号的数组
|
||||
String DTBJHStr = item.get("DTBJH").toString();
|
||||
|
||||
//数据格式: (GB 123-2000,GB 4233434-2021,GB 423423423-2021)
|
||||
if (!DTBJHStr.equals("")) {
|
||||
String[] DTBJHArray = DTBJHStr.split(",");
|
||||
for (String DTBJH : DTBJHArray) {
|
||||
//数据格式: (GB 123-2000,GB 4233434-2021,GB 423423423-2021)
|
||||
if (!DTBJHStr.equals("")) {
|
||||
String[] DTBJHArray = DTBJHStr.split(",");
|
||||
for (String DTBJH : DTBJHArray) {
|
||||
|
||||
// if (!pattern.matcher(DTBJH).matches()){
|
||||
// continue;
|
||||
@@ -268,45 +276,43 @@ public class ScheduledJob {
|
||||
// .eq("STAND_YEAR", year);
|
||||
|
||||
|
||||
List<String> standId = sarStandardsInfoDao.selectIdFormDTBZH(DTBJH);
|
||||
if (standId.size() > 0) {
|
||||
boolean b = replaceIdCountMap.containsKey(standId.get(0));
|
||||
//如果代替标准id已存在则映射为2不存在则添加并映射为1
|
||||
if (b) {
|
||||
replaceIdCountMap.replace(standId.get(0), 2);
|
||||
} else {
|
||||
replaceIdCountMap.put(standId.get(0), 1);
|
||||
}
|
||||
List<String> standId = sarStandardsInfoDao.selectIdFormDTBZH(DTBJH);
|
||||
if (standId.size() > 0) {
|
||||
boolean b = replaceIdCountMap.containsKey(standId.get(0));
|
||||
//如果代替标准id已存在则映射为2不存在则添加并映射为1
|
||||
if (b) {
|
||||
replaceIdCountMap.replace(standId.get(0), 2);
|
||||
} else {
|
||||
replaceIdCountMap.put(standId.get(0), 1);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
//一个被代替标准号时,文本状态更新为废止状态,两个及以上时更新为被代替状态
|
||||
for (String key : replaceIdCountMap.keySet()) {
|
||||
SarStandardsInfo sarStandardsInfo = new SarStandardsInfo();
|
||||
String reasonMsg="";
|
||||
switch (replaceIdCountMap.get(key)){
|
||||
case 1 :
|
||||
String reasonMsg = "";
|
||||
switch (replaceIdCountMap.get(key)) {
|
||||
case 1:
|
||||
//废止状态
|
||||
sarStandardsInfo.setTextStatus("chblaarg77");
|
||||
sarStandardsInfo.setId(key);
|
||||
reasonMsg="该标准被一个标准代替";
|
||||
reasonMsg = "该标准被一个标准代替";
|
||||
break;
|
||||
case 2 :
|
||||
case 2:
|
||||
//被代替状态
|
||||
sarStandardsInfo.setTextStatus("qke0ckro2p");
|
||||
sarStandardsInfo.setId(key);
|
||||
reasonMsg="该标准被一个以上标准代替";
|
||||
reasonMsg = "该标准被一个以上标准代替";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -321,11 +327,11 @@ public class ScheduledJob {
|
||||
sarStandardsInfo.setStandNumber(beforeSarStandardsInfoEO.getStandNumber());
|
||||
sarStandardsInfo.setStandYear(beforeSarStandardsInfoEO.getStandYear());
|
||||
sarStandardsInfo.setStandName(beforeSarStandardsInfoEO.getStandName());
|
||||
saveUpdateLog(sarStandardsInfo,beforeSarStandardsInfoEO,reasonMsg);
|
||||
saveUpdateLog(sarStandardsInfo, beforeSarStandardsInfoEO, reasonMsg);
|
||||
//更新日志
|
||||
sarStandardsInfoDao.updateById(sarStandardsInfo);
|
||||
}catch (Exception e){
|
||||
System.out.println("代替标准状态更新:id为"+key+"文本状态更新失败");
|
||||
} catch (Exception e) {
|
||||
System.out.println("代替标准状态更新:id为" + key + "文本状态更新失败");
|
||||
}
|
||||
}
|
||||
logger.info("==================================更新文本状态结束======================================");
|
||||
@@ -334,22 +340,134 @@ public class ScheduledJob {
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void saveUpdateLog(SarStandardsInfo sarStandardsInfoEO, SarStandardsInfo beforeSarStandardsInfo,String reasonMsg) throws Exception {
|
||||
public void saveUpdateLog(SarStandardsInfo sarStandardsInfoEO, SarStandardsInfo beforeSarStandardsInfo, String reasonMsg) throws Exception {
|
||||
Map<String, Object> newMap = new HashMap<>();
|
||||
Map<String, Object> oldMap = new HashMap<>();
|
||||
String attrStr = sarStandardsInfoEO.getSarStandAttrEOStr();
|
||||
if (StringUtils.isNotBlank(attrStr)) {
|
||||
newMap = JSONObject.fromObject(attrStr);
|
||||
}
|
||||
newMap.put("textStatus",sarStandardsInfoEO.getTextStatus());
|
||||
oldMap.put("textStatus",beforeSarStandardsInfo.getTextStatus());
|
||||
newMap.put("textStatus", sarStandardsInfoEO.getTextStatus());
|
||||
oldMap.put("textStatus", beforeSarStandardsInfo.getTextStatus());
|
||||
// 增加关联事件
|
||||
String number = sarStandardsInfoEO.getStandSort() + " " + sarStandardsInfoEO.getStandNumber();
|
||||
if (StringUtils.isNotBlank(sarStandardsInfoEO.getStandYear())) {
|
||||
number += "-" + sarStandardsInfoEO.getStandYear();
|
||||
}
|
||||
String content ="==定时任务执行修改==:" + number + " 《" + sarStandardsInfoEO.getStandName() + "》"+reasonMsg;
|
||||
String content = "==定时任务执行修改==:" + number + " 《" + sarStandardsInfoEO.getStandName() + "》" + reasonMsg;
|
||||
sarUpdLogEOService.createUpdateLog(sarStandardsInfoEO.getStandType() + "_STAND", sarStandardsInfoEO.getId(), oldMap, newMap, content);
|
||||
}
|
||||
|
||||
|
||||
// @Scheduled(cron = "0 0 0 * * ?") //每天的凌晨0点执行
|
||||
// @Scheduled(cron = "*/30 * * * * ?")
|
||||
@Async
|
||||
public void TextStatusUpdateStandard() {
|
||||
Logger logger = LoggerFactory.getLogger(ScheduledJob.class);
|
||||
logger.info("=======================================开始更新文本状态======================================");
|
||||
//第一步 查询满足条件的数据 第一步只能查询 需要的标准id和日期
|
||||
//查询出两组数据
|
||||
Map<String, String> map = new HashMap<>();
|
||||
List<String> types = new ArrayList<>();
|
||||
types.add("WBZTCLASS");
|
||||
Map<String, Object> dicTypeEO = dicTypeEOService.getDicTypeListCodeByType(types);
|
||||
List<Map<String, String>> arr = (List<Map<String, String>>) dicTypeEO.get("WBZTCLASS");
|
||||
arr.forEach(stringStringMap -> {
|
||||
stringStringMap.keySet().forEach(s -> {
|
||||
map.put(stringStringMap.get("label"), stringStringMap.get("value"));
|
||||
});
|
||||
});
|
||||
//只针对国内标准 INLAND
|
||||
|
||||
// 查询国标 实施日期 晚于现在
|
||||
// 标准状态属于发布
|
||||
// 标准状态改为即将实施
|
||||
List<DSarStandardDTO> changeJJSS = new ArrayList<>();
|
||||
List<String> strings = new ArrayList<>();
|
||||
strings.add(map.get("发布"));
|
||||
List<DSarStandardDTO> sarStandardsInfos = sarStandardsInfoDao.dealWithDS("INLAND", strings);
|
||||
//判定时间
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||
if (null != sarStandardsInfos && sarStandardsInfos.size() > 0) {
|
||||
for (DSarStandardDTO s : sarStandardsInfos) {
|
||||
if (null != s.getSSRQ()) {
|
||||
if (s.getSSRQ().contains(",")) {
|
||||
//多个日期拆分 一个满足就都满足
|
||||
if (findFirstTime(s.getSSRQ()).compareTo(new Date()) >= 0 && !changeJJSS.contains(s)) {
|
||||
changeJJSS.add(s);
|
||||
}
|
||||
} else {
|
||||
Date date = null;
|
||||
try {
|
||||
date = dateFormat.parse(TrainFormDate.dealWithTimeZoneyyyy(s.getSSRQ(), "yyyy-MM-dd"));
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
logger.info("时间为:" + date);
|
||||
//与现在时间进行比较
|
||||
if (date.compareTo(new Date()) >= 0 && !changeJJSS.contains(s)) {
|
||||
changeJJSS.add(s);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 标桩状态 属于即将实施 或 发布
|
||||
// 实施日期 在今天之前
|
||||
// 标准状态 改为现行有效
|
||||
List<DSarStandardDTO> changeXXYX = new ArrayList<>();
|
||||
List<String> strings2 = new ArrayList<>();
|
||||
strings2.add(map.get("即将实施"));
|
||||
strings2.add(map.get("发布"));
|
||||
List<DSarStandardDTO> sarStandardsInfos1 = sarStandardsInfoDao.dealWithDS("INLAND", strings2);
|
||||
if (null != sarStandardsInfos1 && sarStandardsInfos1.size() > 0) {
|
||||
for (DSarStandardDTO s : sarStandardsInfos1) {
|
||||
if (null != s.getSSRQ()) {
|
||||
if (s.getSSRQ().contains(",")) {
|
||||
//多个日期拆分 一个满足就都满足
|
||||
if (findFirstTime(s.getSSRQ()).compareTo(new Date()) < 0 && !changeXXYX.contains(s)) {
|
||||
changeXXYX.add(s);
|
||||
}
|
||||
} else {
|
||||
Date date = null;
|
||||
try {
|
||||
date = dateFormat.parse(TrainFormDate.dealWithTimeZoneyyyy(s.getSSRQ(), "yyyy-MM-dd"));
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
logger.info("时间为:" + date);
|
||||
//与现在时间进行比较
|
||||
if (date.compareTo(new Date()) < 0 && !changeXXYX.contains(s)) {
|
||||
changeXXYX.add(s);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
logger.info("改为即将实施的有" + changeJJSS.size() + "条");
|
||||
logger.info("改为现行有效的有" + changeXXYX.size() + "条");
|
||||
logger.info("=============================");
|
||||
createStandardMQService.sendMQ(changeJJSS,changeXXYX);
|
||||
}
|
||||
}
|
||||
|
||||
private Date findFirstTime(String ssrq) {
|
||||
String[] as = ssrq.split(",");
|
||||
List<Date> dates = new ArrayList<>();
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||
for (String s : as) {
|
||||
Date date = null;
|
||||
try {
|
||||
date = dateFormat.parse(TrainFormDate.dealWithTimeZoneyyyy(s, "yyyy-MM-dd"));
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
dates.add(date);
|
||||
}
|
||||
dates.sort(Comparator.comparing(date -> date));
|
||||
return dates.get(0);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,301 @@
|
||||
package com.adc.da.scheduledState.server;
|
||||
|
||||
import com.adc.da.mq.CreateStandMQService;
|
||||
import com.adc.da.person.service.IPersonCollectEOService;
|
||||
import com.adc.da.scheduledState.utils.Util;
|
||||
import com.adc.da.slrs.sarBussStandAttrInfo.dao.SarBussStandAttrInfoDao;
|
||||
import com.adc.da.slrs.sarBussStandAttrInfo.service.ISarBussStandAttrInfoService;
|
||||
import com.adc.da.slrs.sarBussionessStand.dao.SarBussionessStandDao;
|
||||
import com.adc.da.slrs.sarBussionessStand.entity.SarBussionessStand;
|
||||
import com.adc.da.slrs.sarBussionessStand.service.ISarBussionessStandService;
|
||||
import com.adc.da.slrs.sarStandItems.dao.SarStandItemsDao;
|
||||
import com.adc.da.slrs.sarStandardsInfo.entity.SarStandardsInfo;
|
||||
import com.adc.da.sys.dao.DicTypeEODao;
|
||||
import com.adc.da.utils.util.FieldConvertUtil;
|
||||
import com.adc.da.utils.util.InitStandAttrUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.json.JSONTokener;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
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.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Description: TODO
|
||||
* @author: super_liu
|
||||
* @date: 2022年01月25日 3:34
|
||||
*/
|
||||
@EnableScheduling
|
||||
@Component
|
||||
@Slf4j
|
||||
public class UpdateStateBussSync {
|
||||
Logger logger = LoggerFactory.getLogger(UpdateStateBussSync.class);
|
||||
|
||||
@Autowired
|
||||
private DicTypeEODao dicTypeEODao;
|
||||
|
||||
@Autowired
|
||||
private SarStandItemsDao standItemsDao;
|
||||
|
||||
@Autowired
|
||||
private CreateStandMQService createStandMQService;
|
||||
|
||||
@Autowired
|
||||
private IPersonCollectEOService personCollectEOService;
|
||||
|
||||
@Autowired
|
||||
private SarBussionessStandDao sarBussionessStandDao;
|
||||
|
||||
@Autowired
|
||||
private ISarBussionessStandService iSarBussionessStandService;
|
||||
|
||||
@Autowired
|
||||
private ISarBussStandAttrInfoService sarBussStandAttrInfoService;
|
||||
|
||||
@Autowired
|
||||
private SarBussStandAttrInfoDao sarBussStandAttrInfoEODao;
|
||||
|
||||
/**
|
||||
* 根据配置文件设置是否开启定时器
|
||||
*/
|
||||
|
||||
@Value("${isNotScheduled}")
|
||||
private boolean isNotScheduled; //是否开启定时器
|
||||
|
||||
|
||||
// 每天0点1分执行 企标标准文本状态 即将实施和现行有效状态自动变更逻辑
|
||||
// @Scheduled(cron="0 0 1 1 * ?")
|
||||
// @Scheduled(cron="*/60 * * * * ?")
|
||||
// @Scheduled(cron = "0 1 0 * * ?")
|
||||
@Async
|
||||
public void BussScheduled(){
|
||||
if(isNotScheduled){
|
||||
try{
|
||||
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("6jnqba2mby");
|
||||
// 即将实施
|
||||
list.add("rpvoxsvr60");
|
||||
QueryWrapper wrapper = new QueryWrapper();
|
||||
wrapper.eq("A.VALID_FLAG","0");
|
||||
wrapper.in("A.TEXT_STATUS_BUSS",list);
|
||||
List<SarBussionessStand> getStateScheduledList = sarBussionessStandDao.getStateScheduledList(wrapper);
|
||||
if(!getStateScheduledList.isEmpty()){
|
||||
// N个实施日期中大于当前日期
|
||||
List<SarBussionessStand> getStateScheduledListToIsAfter = getStateScheduledList.stream().filter(info -> {
|
||||
if(StringUtils.isNotBlank(info.getPutTime())){
|
||||
List<String> dateList = Arrays.stream(info.getPutTime().split(",")).map(String::trim).collect(Collectors.toList());
|
||||
List<String> dateIsAfterList = dateList.stream().filter(s -> {
|
||||
if(Util.isValidDate(s)){
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||
LocalDateTime parse = LocalDate.parse(s, dateTimeFormatter).atStartOfDay();
|
||||
// 实施日期是否大于当前日期
|
||||
return parse.isAfter(now);
|
||||
}
|
||||
return false;
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
return !dateIsAfterList.isEmpty();
|
||||
}
|
||||
return false;
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
|
||||
// N个实施日期中小于当前时间
|
||||
List<SarBussionessStand> getStateScheduledListToIsBefore = getStateScheduledList.stream().filter(info -> {
|
||||
if(StringUtils.isNotBlank(info.getPutTime())){
|
||||
List<String> dateList = Arrays.stream(info.getPutTime().split(",")).map(String::trim).collect(Collectors.toList());
|
||||
List<String> dateIsBeforeList = dateList.stream().filter(s -> {
|
||||
if(Util.isValidDate(s)){
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||
LocalDateTime parse = LocalDate.parse(s, dateTimeFormatter).atStartOfDay();
|
||||
// 实施日期是否小于当前时间
|
||||
return parse.isBefore(now);
|
||||
}
|
||||
return false;
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
return !dateIsBeforeList.isEmpty();
|
||||
}
|
||||
return false;
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
// N个实施日期中大于当前日期 执行逻辑 更为即将实施
|
||||
if(!getStateScheduledListToIsAfter.isEmpty()){
|
||||
execStandDate(getStateScheduledListToIsAfter,"rpvoxsvr60");
|
||||
}
|
||||
|
||||
// N个实施日期中小于当前时间 执行逻辑 更为现行有效
|
||||
if(!getStateScheduledListToIsBefore.isEmpty()){
|
||||
execStandDate(getStateScheduledListToIsBefore,"9z741h2m3j");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
logger.info("每天0点1分执行 企标标准文本状态 即将实施和现行有效状态自动变更逻辑:"+Thread.currentThread().getName() + " cron=0 1 0 * * ? --- " + new Date()+"---End-01");
|
||||
}catch(Exception e){
|
||||
logger.info(e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 每天0点1分执行 企标标准文本状态被代替逻辑 自动变更作废状态
|
||||
// @Scheduled(cron="0 0 1 1 * ?")
|
||||
// @Scheduled(cron="*/60 * * * * ?")
|
||||
// @Scheduled(cron = "0 1 0 * * ?")
|
||||
@Async
|
||||
public void BussScheduledToAbolish(){
|
||||
if(isNotScheduled){
|
||||
try{
|
||||
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("9z741h2m3j");
|
||||
// 即将实施
|
||||
list.add("rpvoxsvr60");
|
||||
QueryWrapper wrapper = new QueryWrapper();
|
||||
wrapper.eq("A.VALID_FLAG","0");
|
||||
wrapper.in("A.TEXT_STATUS_BUSS",list);
|
||||
List<SarBussionessStand> getStateScheduledList = sarBussionessStandDao.getStateScheduledList(wrapper);
|
||||
if(!getStateScheduledList.isEmpty()){
|
||||
|
||||
// 需要更新为作废状态的集合
|
||||
List<SarBussionessStand> invalidList = getStateScheduledList.stream().filter(info -> {
|
||||
if(StringUtils.isNotBlank(info.getBDTQBBHBUSS())){
|
||||
List<String> bdtList = Arrays.stream(info.getBDTQBBHBUSS().split(",")).map(String::trim).collect(Collectors.toList());
|
||||
// 现行有效、作废
|
||||
List<String> bdtStateList = new ArrayList<>();
|
||||
// 现行有效
|
||||
bdtStateList.add("9z741h2m3j");
|
||||
// 作废
|
||||
bdtStateList.add("3lqnlgmgcn");
|
||||
QueryWrapper wrapperBdt = new QueryWrapper();
|
||||
wrapperBdt.eq("VALID_FLAG","0");
|
||||
wrapperBdt.in("STAND_CODE",bdtList);
|
||||
wrapperBdt.in("TEXT_STATUS_BUSS",bdtStateList);
|
||||
List<SarBussionessStand> queryBDTBussList = sarBussionessStandDao.selectList(wrapperBdt);
|
||||
// 所有的被代替标准号中的有效标准中有一个标准标准状态是现行有效、作废
|
||||
return !queryBDTBussList.isEmpty();
|
||||
}
|
||||
return false;
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
|
||||
// 作废状态的集合 执行逻辑 更为作废
|
||||
if(!invalidList.isEmpty()){
|
||||
execStandDate(invalidList,"3lqnlgmgcn");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
logger.info("每天0点1分执行 企标标准文本状态被代替逻辑 自动变更作废状态:"+Thread.currentThread().getName() + " cron=0 1 0 * * ? --- " + new Date()+"---End-01");
|
||||
}catch(Exception e){
|
||||
logger.info(e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@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");
|
||||
|
||||
// 只批量更新文本字段
|
||||
SarBussionessStand newInfo = new SarBussionessStand();
|
||||
newInfo.setTextStatusBuss(textStatusStand);
|
||||
newInfo.setId(info.getId());
|
||||
newInfo.setModifyTime(new Date());
|
||||
list.add(newInfo);
|
||||
}
|
||||
|
||||
if(!list.isEmpty()){
|
||||
iSarBussionessStandService.updateBatchById(list);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取属性字段
|
||||
* @param row
|
||||
*/
|
||||
|
||||
public void bussAttrInfoShowSearchDetails(SarBussionessStand row) throws Exception {
|
||||
if (row != null) {
|
||||
bussAttrInfoSearchDetails(row);
|
||||
Map<String, Object> getAttrMap = row.getAttrInfoCaseMap();
|
||||
if (getAttrMap != null && getAttrMap.size() > 0) {
|
||||
for (Map.Entry<String, Object> entry : getAttrMap.entrySet()) {
|
||||
String name = entry.getKey().toUpperCase();
|
||||
String value = "";
|
||||
List<String> valArr = new ArrayList<>();
|
||||
if (entry.getValue() != null && InitStandAttrUtil.selectionFieldListBuss != null && InitStandAttrUtil.selectionFieldListBuss.size() > 0 && InitStandAttrUtil.selectionFieldListBuss.contains(name)) {
|
||||
if(org.apache.commons.lang.StringUtils.isNotBlank(entry.getValue().toString())){
|
||||
Object json= new JSONTokener(entry.getValue().toString()).nextValue();
|
||||
if(json instanceof org.json.JSONArray){
|
||||
valArr = com.alibaba.fastjson.JSONObject.parseArray(entry.getValue().toString(),String.class);
|
||||
}else {
|
||||
value = entry.getValue().toString();
|
||||
valArr = Arrays.asList(value.split(","));
|
||||
}
|
||||
if(!valArr.isEmpty()){
|
||||
value = dicTypeEODao.getDicNamesByCodes(valArr,"");
|
||||
}
|
||||
}
|
||||
entry.setValue(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void bussAttrInfoSearchDetails(SarBussionessStand row) throws Exception {
|
||||
String fieldInfo = InitStandAttrUtil.queryFieldBuss;
|
||||
String collectId = personCollectEOService.queryCollectByUserAndId(row.getId());
|
||||
row.setCollectId(collectId);
|
||||
// 查询属性表数据
|
||||
if (org.apache.commons.lang.StringUtils.isNotBlank(fieldInfo)) {
|
||||
Map<String, Object> getAttrMap = sarBussStandAttrInfoEODao.selectStandFieldAndData(fieldInfo, row.getId());
|
||||
if (InitStandAttrUtil.clobFieldList != null && !InitStandAttrUtil.clobFieldList.isEmpty()) {
|
||||
// 遍历修改所有clob类型的值
|
||||
for (String clobField : InitStandAttrUtil.clobFieldList) {
|
||||
Clob clobValue = (Clob) getAttrMap.get(clobField);
|
||||
String fieldValue = FieldConvertUtil.ClobToString(clobValue);
|
||||
getAttrMap.put(clobField, fieldValue);
|
||||
}
|
||||
}
|
||||
|
||||
row.setAttrInfoMap(getAttrMap);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,405 @@
|
||||
package com.adc.da.scheduledState.server;
|
||||
|
||||
import com.adc.da.mq.CreateStandMQService;
|
||||
import com.adc.da.person.service.IPersonCollectEOService;
|
||||
import com.adc.da.scheduledState.utils.Util;
|
||||
import com.adc.da.slrs.sarStandAttrInfo.dao.SarStandAttrInfoDao;
|
||||
import com.adc.da.slrs.sarStandAttrInfo.service.ISarStandAttrInfoService;
|
||||
import com.adc.da.slrs.sarStandItems.dao.SarStandItemsDao;
|
||||
import com.adc.da.slrs.sarStandItems.entity.FindSarItemsPageReqDTO;
|
||||
import com.adc.da.slrs.sarStandItems.entity.SarStandItems;
|
||||
import com.adc.da.slrs.sarStandardsInfo.dao.SarStandardsInfoDao;
|
||||
import com.adc.da.slrs.sarStandardsInfo.entity.SarStandardsInfo;
|
||||
import com.adc.da.slrs.sarStandardsInfo.service.ISarStandardsInfoService;
|
||||
import com.adc.da.sys.dao.DicTypeEODao;
|
||||
import com.adc.da.utils.util.FieldConvertUtil;
|
||||
import com.adc.da.utils.util.InitStandAttrUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.json.JSONTokener;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
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.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Description: TODO
|
||||
* @author: super_liu
|
||||
* @date: 2022年01月25日 3:34
|
||||
*/
|
||||
@EnableScheduling
|
||||
@Component
|
||||
@Slf4j
|
||||
public class UpdateStateStandSync {
|
||||
Logger logger = LoggerFactory.getLogger(UpdateStateStandSync.class);
|
||||
|
||||
@Autowired
|
||||
private DicTypeEODao dicTypeEODao;
|
||||
|
||||
@Autowired
|
||||
private SarStandItemsDao standItemsDao;
|
||||
|
||||
@Autowired
|
||||
private CreateStandMQService createStandMQService;
|
||||
|
||||
@Autowired
|
||||
private IPersonCollectEOService personCollectEOService;
|
||||
|
||||
@Autowired
|
||||
private SarStandAttrInfoDao sarStandAttrInfoEODao;
|
||||
|
||||
@Autowired
|
||||
private SarStandardsInfoDao sarStandardsInfoDao;
|
||||
|
||||
@Autowired
|
||||
private ISarStandardsInfoService iSarStandardsInfoService;
|
||||
|
||||
@Autowired
|
||||
private ISarStandAttrInfoService sarStandAttrInfoEOService;
|
||||
|
||||
/**
|
||||
* 根据配置文件设置是否开启定时器
|
||||
*/
|
||||
|
||||
@Value("${isNotScheduled}")
|
||||
private boolean isNotScheduled; //是否开启定时器
|
||||
|
||||
|
||||
// 每天0点1分执行 国内标准文本状态 即将实施和现行有效状态自动变更逻辑
|
||||
// @Scheduled(cron="0 0 1 1 * ?")
|
||||
// @Scheduled(cron="0 37 9 * * ?")
|
||||
// @Scheduled(cron = "0 1 0 * * ?")
|
||||
@Async
|
||||
public void StandScheduled(){
|
||||
if(isNotScheduled){
|
||||
try{
|
||||
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);
|
||||
if(!getStateScheduledList.isEmpty()){
|
||||
// N个实施日期中大于当前日期
|
||||
List<SarStandardsInfo> getStateScheduledListToIsAfter = getStateScheduledList.stream().filter(info -> {
|
||||
if(StringUtils.isNotBlank(info.getSSRQ())){
|
||||
List<String> dateList = Arrays.stream(info.getSSRQ().split(",")).map(String::trim).collect(Collectors.toList());
|
||||
List<String> dateIsAfterList = dateList.stream().filter(s -> {
|
||||
if(Util.isValidDate(s)){
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||
LocalDateTime parse = LocalDate.parse(s, dateTimeFormatter).atStartOfDay();
|
||||
// 实施日期是否大于当前日期
|
||||
return parse.isAfter(now);
|
||||
}
|
||||
return false;
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
return !dateIsAfterList.isEmpty();
|
||||
}
|
||||
return false;
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
|
||||
// N个实施日期中小于当前时间
|
||||
List<SarStandardsInfo> getStateScheduledListToIsBefore = getStateScheduledList.stream().filter(info -> {
|
||||
if(StringUtils.isNotBlank(info.getSSRQ())){
|
||||
List<String> dateList = Arrays.stream(info.getSSRQ().split(",")).map(String::trim).collect(Collectors.toList());
|
||||
List<String> dateIsBeforeList = dateList.stream().filter(s -> {
|
||||
if(Util.isValidDate(s)){
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||
LocalDateTime parse = LocalDate.parse(s, dateTimeFormatter).atStartOfDay();
|
||||
// 实施日期是否小于当前时间
|
||||
return parse.isBefore(now);
|
||||
}
|
||||
return false;
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
return !dateIsBeforeList.isEmpty();
|
||||
}
|
||||
return false;
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
// N个实施日期中大于当前日期 执行逻辑 更为即将实施
|
||||
if(!getStateScheduledListToIsAfter.isEmpty()){
|
||||
logger.info("=============N个实施日期中大于当前日期 执行============");
|
||||
// 文本状态更为即将实施
|
||||
execStandDate(getStateScheduledListToIsAfter,"hb0iy9z23c");
|
||||
}
|
||||
|
||||
// N个实施日期中小于当前时间 执行逻辑 更为现行有效
|
||||
if(!getStateScheduledListToIsBefore.isEmpty()){
|
||||
logger.info("=============N个实施日期中小于当前时间 执行============");
|
||||
// 文本状态更为现行有效
|
||||
execStandDate(getStateScheduledListToIsBefore,"vsaga7nwub");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
logger.info("每天0点1分执行 国内标准文本状态 即将实施和现行有效状态自动变更逻辑:"+Thread.currentThread().getName() + " cron=0 1 0 * * ? --- " + new Date()+"---End-01");
|
||||
}catch(Exception e){
|
||||
logger.info(e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 每天0点1分执行 国内标准文本状态被代替逻辑 标准自动变更废止
|
||||
// @Scheduled(cron="0 0 1 1 * ?")
|
||||
// @Scheduled(cron="*/60 * * * * ?")
|
||||
// @Scheduled(cron = "0 1 0 * * ?")
|
||||
@Async
|
||||
public void StandScheduledToAbolish(){
|
||||
if(isNotScheduled){
|
||||
try{
|
||||
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("vsaga7nwub");
|
||||
// 即将实施
|
||||
list.add("hb0iy9z23c");
|
||||
// 被代替
|
||||
list.add("qke0ckro2p");
|
||||
QueryWrapper wrapper = new QueryWrapper();
|
||||
wrapper.eq("A.VALID_FLAG","0");
|
||||
wrapper.eq("STAND_TYPE","INLAND");
|
||||
wrapper.in("A.TEXT_STATUS",list);
|
||||
List<SarStandardsInfo> getStateStandScheduledList = sarStandardsInfoDao.getStateScheduledList(wrapper);
|
||||
|
||||
if(!getStateStandScheduledList.isEmpty()){
|
||||
|
||||
List<SarStandardsInfo> invalidStandToGBList = new ArrayList<>();
|
||||
List<SarStandardsInfo> bdtStandToGBList = new ArrayList<>();
|
||||
|
||||
// 当前标准的标准类别是否是GB类 GB集合逻辑
|
||||
getStateStandScheduledList.forEach(info -> {
|
||||
if(StringUtils.isNotBlank(info.getBDTBZH())){
|
||||
List<String> bdtList = Arrays.stream(info.getBDTBZH().split(",")).map(
|
||||
s -> s.replace(" ","").trim()).collect(Collectors.toList());
|
||||
// 查询等于GB的国内标准
|
||||
QueryWrapper wrapperGB = new QueryWrapper();
|
||||
wrapperGB.eq("SAR_STANDARDS_INFO.VALID_FLAG","0");
|
||||
wrapperGB.eq("SAR_STANDARDS_INFO.STAND_SORT","GB");
|
||||
wrapperGB.in("trim(replace(concat(SAR_STANDARDS_INFO.STAND_SORT,' ',SAR_STANDARDS_INFO.STAND_NUMBER,'-'," +
|
||||
"SAR_STANDARDS_INFO.STAND_YEAR),' ',''))",bdtList);
|
||||
List<SarStandardsInfo> queryGBList = sarStandardsInfoDao.selectList(wrapperGB);
|
||||
|
||||
if(!queryGBList.isEmpty()){
|
||||
int queryGbCount = queryGBList.size();
|
||||
|
||||
//被代替标准号中所有有效标准的状态都是现行有效状态
|
||||
List<SarStandardsInfo> yxList = queryGBList.stream().filter(info1 ->
|
||||
"vsaga7nwub".equals(info1.getTextStatus())).collect(Collectors.toList());
|
||||
|
||||
//被代替标准号中所有有效标准的状态都是被代替状态
|
||||
List<SarStandardsInfo> bdtStateList = queryGBList.stream().filter(info1 ->
|
||||
"qke0ckro2p".equals(info1.getTextStatus())).collect(Collectors.toList());
|
||||
|
||||
//被代替标准号中所有有效标准的状态都是废止状态
|
||||
List<SarStandardsInfo> fzList = queryGBList.stream().filter(info1 ->
|
||||
"chblaarg77".equals(info1.getTextStatus())).collect(Collectors.toList());
|
||||
|
||||
// 满足其上存入更新废止逻辑 如果只有一个被代替标准 优先更新废止状态
|
||||
if(yxList.size() == queryGbCount || bdtStateList.size() == queryGbCount || fzList.size() == queryGbCount){
|
||||
invalidStandToGBList.add(info);
|
||||
}else {
|
||||
// 被代替标准号中的有效标准的标准状态中有一个是发布、即将实施、现行有效、被代替状态的
|
||||
List<SarStandardsInfo> singleList = queryGBList.stream().filter(info1 -> {
|
||||
if("hc99551723c".equals(info1.getTextStatus()) || "hb0iy9z23c".equals(info1.getTextStatus())
|
||||
|| "vsaga7nwub".equals(info1.getTextStatus()) || "qke0ckro2p".equals(info1.getTextStatus())){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
// 满足其上存入更新被代替逻辑
|
||||
if(!singleList.isEmpty()){
|
||||
bdtStandToGBList.add(info);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// 当前标准的标准类别是否是GB类 NOT GB集合逻辑
|
||||
List<SarStandardsInfo> bdtStandToNotGBList = getStateStandScheduledList.stream().filter(info -> {
|
||||
if(StringUtils.isNotBlank(info.getBDTBZH())){
|
||||
List<String> bdtList = Arrays.stream(info.getBDTBZH().split(",")).map(
|
||||
s -> s.replace(" ","").trim()).collect(Collectors.toList());
|
||||
|
||||
//发布、即将实施、现行有效、被代替
|
||||
List<String> bdtStateList = new ArrayList<>();
|
||||
// 发布
|
||||
bdtStateList.add("hc99551723c");
|
||||
// 作废
|
||||
bdtStateList.add("hb0iy9z23c");
|
||||
// 即将实施
|
||||
bdtStateList.add("vsaga7nwub");
|
||||
// 被代替
|
||||
bdtStateList.add("qke0ckro2p");
|
||||
|
||||
// 查询不等于GB的国内标准 且 有效的被代替标准
|
||||
QueryWrapper wrapperNotGB = new QueryWrapper();
|
||||
wrapperNotGB.eq("VALID_FLAG","0");
|
||||
wrapperNotGB.ne("STAND_SORT","GB");
|
||||
wrapperNotGB.in("TEXT_STATUS",wrapperNotGB);
|
||||
wrapperNotGB.in("trim(replace(concat(SAR_STANDARDS_INFO.STAND_SORT,' ',SAR_STANDARDS_INFO.STAND_NUMBER,'-'," +
|
||||
"SAR_STANDARDS_INFO.STAND_YEAR),' ',''))",bdtList);
|
||||
List<SarStandardsInfo> queryNotGBList = sarStandardsInfoDao.selectList(wrapperNotGB);
|
||||
|
||||
// 被代替标准号中的有效标准的标准状态中有一个是发布、即将实施、现行有效、被代替状态的
|
||||
// 满足其上过滤更新被代替数据
|
||||
return !queryNotGBList.isEmpty();
|
||||
}
|
||||
return false;
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
if(!invalidStandToGBList.isEmpty()){
|
||||
logger.info("=============被代替标准号中所有有效标准的状态都是现行有效、被代替、废止状态 执行============");
|
||||
// 文本状态更为废止状态
|
||||
execStandDate(invalidStandToGBList,"chblaarg77");
|
||||
}
|
||||
|
||||
if(!bdtStandToGBList.isEmpty()){
|
||||
logger.info("=============GB=======被代替标准号中的有效标准的标准状态中有一个是发布、即将实施、现行有效、被代替状态的 执行============");
|
||||
// 文本状态更为被代替
|
||||
execStandDate(bdtStandToGBList,"qke0ckro2p");
|
||||
}
|
||||
|
||||
if(!bdtStandToNotGBList.isEmpty()){
|
||||
logger.info("=============NOT GB ===被代替标准号中的有效标准的标准状态中有一个是发布、即将实施、现行有效、被代替状态的 执行============");
|
||||
// 文本状态更为被代替
|
||||
execStandDate(bdtStandToNotGBList,"qke0ckro2p");
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
logger.info("每天0点1分执行 国内标准文本状态被代替逻辑 标准自动变更废止:"+Thread.currentThread().getName() + " cron=0 1 0 * * ? --- " + new Date()+"---End-01");
|
||||
}catch(Exception e){
|
||||
logger.info(e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Async
|
||||
public void execStandDate(List<SarStandardsInfo> infoList, String textStatusStand) throws Exception {
|
||||
List<SarStandardsInfo> list = new ArrayList<>();
|
||||
for (SarStandardsInfo info : infoList) {
|
||||
info.setTextStatus(textStatusStand);
|
||||
standFunc(info);
|
||||
createStandMQService.sendStandMQ(info,"update");
|
||||
|
||||
// 只批量更新文本字段
|
||||
SarStandardsInfo newInfo = new SarStandardsInfo();
|
||||
newInfo.setTextStatus(textStatusStand);
|
||||
newInfo.setId(info.getId());
|
||||
newInfo.setModifyTime(new Date());
|
||||
list.add(newInfo);
|
||||
}
|
||||
|
||||
if(!list.isEmpty()){
|
||||
iSarStandardsInfoService.updateBatchById(list);
|
||||
}
|
||||
}
|
||||
|
||||
private void standFunc(SarStandardsInfo sarStandardsInfoEO) throws Exception {
|
||||
attrInfoSearchDetails(sarStandardsInfoEO);
|
||||
FindSarItemsPageReqDTO pageInfo = new FindSarItemsPageReqDTO();
|
||||
pageInfo.setStandId(sarStandardsInfoEO.getId());
|
||||
pageInfo.setFileType("FBGBJBD");
|
||||
|
||||
/**
|
||||
* SarItemVO换为sarItemVOS
|
||||
* List<SarItemVO> sarItemVOS = standItemsDao.querySarItemAndInterpretation(pageInfo);
|
||||
* .collect(Collectors.toMap(SarItemVO::getItemsNum, SarItemVO::getItemsName));
|
||||
*/
|
||||
|
||||
List<SarStandItems> sarItemVOS = standItemsDao.querySarItemAndInterpretation(pageInfo);
|
||||
if (!sarItemVOS.isEmpty()) {
|
||||
Map<String, String> collectMap = sarItemVOS.stream().filter((e) -> e.getItemsNum() != null && e.getItemsName() != null)
|
||||
.collect(Collectors.toMap(SarStandItems::getItemsNum, SarStandItems::getTermsConditions));
|
||||
sarStandardsInfoEO.setMapItems(collectMap);
|
||||
}
|
||||
if (sarStandardsInfoEO.getAttrInfoMap() != null) {
|
||||
sarStandardsInfoEO.setSarStandAttrEOStr(JSONObject.toJSONString(sarStandardsInfoEO.getAttrInfoMap()));
|
||||
}
|
||||
}
|
||||
|
||||
public void attrInfoSearchDetails(SarStandardsInfo row) throws Exception {
|
||||
if (row != null) {
|
||||
String fieldInfo = InitStandAttrUtil.queryField;
|
||||
String collectId = personCollectEOService.queryCollectByUserAndId(row.getId());
|
||||
row.setCollectId(collectId);
|
||||
// 查询属性表数据
|
||||
if (StringUtils.isNotBlank(fieldInfo)) {
|
||||
Map<String, Object> getAttrMap = sarStandAttrInfoEODao.selectStandFieldAndData(fieldInfo, row.getId());
|
||||
if (InitStandAttrUtil.clobFieldList != null && !InitStandAttrUtil.clobFieldList.isEmpty()) {
|
||||
// 遍历修改所有clob类型的值
|
||||
for (String clobField : InitStandAttrUtil.clobFieldList) {
|
||||
Clob clobValue = (Clob) getAttrMap.get(clobField);
|
||||
String fieldValue = FieldConvertUtil.ClobToString(clobValue);
|
||||
getAttrMap.put(clobField, fieldValue);
|
||||
}
|
||||
}
|
||||
|
||||
row.setAttrInfoMap(getAttrMap);
|
||||
}
|
||||
|
||||
Map<String, Object> getAttrMap = row.getAttrInfoMap();
|
||||
if (getAttrMap != null && getAttrMap.size() > 0) {
|
||||
for (Map.Entry<String, Object> entry : getAttrMap.entrySet()) {
|
||||
String name = entry.getKey();
|
||||
String value = "";
|
||||
List<String> valArr = new ArrayList<>();
|
||||
if (entry.getValue() != null && InitStandAttrUtil.selectionFieldList != null && InitStandAttrUtil.selectionFieldList.size() > 0 && InitStandAttrUtil.selectionFieldList.contains(name)) {
|
||||
if (StringUtils.isNotBlank(entry.getValue().toString())) {
|
||||
Object json = new JSONTokener(entry.getValue().toString()).nextValue();
|
||||
if (json instanceof org.json.JSONArray) {
|
||||
valArr = com.alibaba.fastjson.JSONObject.parseArray(entry.getValue().toString(), String.class);
|
||||
} else {
|
||||
value = entry.getValue().toString();
|
||||
valArr = Arrays.asList(value.split(","));
|
||||
}
|
||||
if (!valArr.isEmpty()) {
|
||||
value = dicTypeEODao.getDicNamesByCodes(valArr, "");
|
||||
}
|
||||
}
|
||||
entry.setValue(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.adc.da.scheduledState.utils;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @Description: TODO
|
||||
* @author: super_liu
|
||||
* @date: 2022年05月11日 15:36
|
||||
*/
|
||||
public class Util {
|
||||
/**
|
||||
* 判断字符串是否为合法的日期格式
|
||||
* @param dateStr 待判断的字符串
|
||||
* @return
|
||||
*/
|
||||
public static boolean isValidDate(String dateStr){
|
||||
//判断结果 默认为true
|
||||
boolean judgeresult=true;
|
||||
//1、首先使用SimpleDateFormat初步进行判断,过滤掉注入 yyyy-01-32 或yyyy-00-0x等格式
|
||||
//此处可根据实际需求进行调整,如需判断yyyy/MM/dd格式将参数改掉即可
|
||||
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
|
||||
try{
|
||||
//增加强判断条件,否则 诸如2022-02-29也可判断出去
|
||||
format.setLenient(false);
|
||||
Date date =format.parse(dateStr);
|
||||
}catch(Exception e){
|
||||
judgeresult=false;
|
||||
}
|
||||
//由于上述方法只能验证正常的日期格式,像诸如 0001-01-01、11-01-01,10001-01-01等无法校验,此处再添加校验年费是否合法
|
||||
String yearStr=dateStr.split("-")[0];
|
||||
if(yearStr.startsWith("0")||yearStr.length()!=4){
|
||||
judgeresult=false;
|
||||
}
|
||||
return judgeresult;
|
||||
}
|
||||
}
|
||||
@@ -12,6 +12,8 @@ import com.adc.da.util.http.Result;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.elasticsearch.index.query.BoolQueryBuilder;
|
||||
import org.elasticsearch.index.query.QueryBuilders;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -29,6 +31,17 @@ public class ResetSearchCenterController extends BaseController<Map<String, Obje
|
||||
|
||||
@Autowired
|
||||
private ResetSearchCenterService resetSearchCenterService;
|
||||
|
||||
@ApiOperation(value = "|Search|文本条件搜索更新标准数据索引")
|
||||
@PostMapping(value="/resetALLSearchCenterToSearch")
|
||||
public ResponseMessage resetALLSearchCenterToSearch(@RequestBody SearchCenter searchCenter) throws Exception{
|
||||
ResponseMessage x = verifySearchCenter(searchCenter);
|
||||
if (x != null){
|
||||
return x;
|
||||
}
|
||||
return resetSearchCenterService.resetALLSearchCenterToSearch(searchCenter);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "|SearchCenter|重新创建ALL标准数据索引")
|
||||
@PostMapping(value="/resetALLSearchCenter")
|
||||
public ResponseMessage resetALLSearchCenter(@RequestBody SearchCenter searchCenter) throws Exception{
|
||||
|
||||
@@ -15,6 +15,9 @@ import java.util.List;
|
||||
@Data
|
||||
public class SearchCenter {
|
||||
|
||||
@ApiModelProperty(value = "根据搜索条件")
|
||||
private String search;
|
||||
|
||||
// @ApiModelProperty(value = "分页查询总数 可不填 自动带入总数")
|
||||
// private Integer countStand;
|
||||
|
||||
|
||||
@@ -105,11 +105,66 @@ public class ResetSearchCenterService {
|
||||
client = this.transportClient;
|
||||
}
|
||||
|
||||
@Async
|
||||
public ResponseMessage resetALLSearchCenterToSearch(SearchCenter searchCenter) throws Exception{
|
||||
Boolean getFulltextserchIndex = elasticsearchService.isIndexExist("fulltextserch");
|
||||
SearchCenter standSearch = new SearchCenter();
|
||||
standSearch.setExecType(searchCenter.getExecType());
|
||||
if(StringUtils.isNotBlank(searchCenter.getSearch())){
|
||||
standSearch.setSearch(searchCenter.getSearch());
|
||||
}
|
||||
if(searchCenter.getIdList() != null && !searchCenter.getIdList().isEmpty()){
|
||||
standSearch.setIdList(searchCenter.getIdList());
|
||||
}
|
||||
SarStandardsInfoEOPage page = new SarStandardsInfoEOPage();
|
||||
ResponseMessage stand = resetStandSearchCenterToSearch(page,standSearch);
|
||||
List<String> r = new ArrayList<>();
|
||||
if(stand.isOk() && StringUtils.isNotBlank(stand.getData().toString())){
|
||||
r.add(stand.getData().toString());
|
||||
}
|
||||
|
||||
SearchCenter lawsSearch = new SearchCenter();
|
||||
lawsSearch.setExecType(searchCenter.getExecType());
|
||||
if(StringUtils.isNotBlank(searchCenter.getSearch())){
|
||||
lawsSearch.setSearch(searchCenter.getSearch());
|
||||
}
|
||||
if(searchCenter.getIdList() != null && !searchCenter.getIdList().isEmpty()){
|
||||
lawsSearch.setIdList(searchCenter.getIdList());
|
||||
}
|
||||
SarLawsStandInfoPage lawsPage = new SarLawsStandInfoPage();
|
||||
ResponseMessage laws = resetLawsSearchCenterToSearch(lawsPage,lawsSearch);
|
||||
if(laws.isOk() && StringUtils.isNotBlank(laws.getData().toString())){
|
||||
r.add(laws.getData().toString());
|
||||
}
|
||||
|
||||
SearchCenter bussSearch = new SearchCenter();
|
||||
bussSearch.setExecType(searchCenter.getExecType());
|
||||
if(searchCenter.getIdList() != null && !searchCenter.getIdList().isEmpty()){
|
||||
bussSearch.setIdList(searchCenter.getIdList());
|
||||
}
|
||||
if(StringUtils.isNotBlank(searchCenter.getSearch())){
|
||||
bussSearch.setSearch(searchCenter.getSearch());
|
||||
}
|
||||
SarBussionessStandEOPage bussPage = new SarBussionessStandEOPage();
|
||||
ResponseMessage buss = resetBussStandSearchCenterToSearch(bussPage,bussSearch);
|
||||
if(buss.isOk() && StringUtils.isNotBlank(buss.getData().toString())){
|
||||
r.add(buss.getData().toString());
|
||||
}
|
||||
|
||||
String res = String.join(", ", r);
|
||||
logger.info(res);
|
||||
|
||||
return Result.success(res);
|
||||
}
|
||||
|
||||
@Async
|
||||
public ResponseMessage resetALLSearchCenter(SearchCenter searchCenter) throws Exception{
|
||||
Boolean getFulltextserchIndex = elasticsearchService.isIndexExist("fulltextserch");
|
||||
SearchCenter standSearch = new SearchCenter();
|
||||
standSearch.setExecType(searchCenter.getExecType());
|
||||
if(StringUtils.isNotBlank(searchCenter.getSearch())){
|
||||
standSearch.setSearch(searchCenter.getSearch());
|
||||
}
|
||||
if(searchCenter.getIdList() != null && !searchCenter.getIdList().isEmpty()){
|
||||
standSearch.setIdList(searchCenter.getIdList());
|
||||
}
|
||||
@@ -122,6 +177,9 @@ public class ResetSearchCenterService {
|
||||
|
||||
SearchCenter lawsSearch = new SearchCenter();
|
||||
lawsSearch.setExecType(searchCenter.getExecType());
|
||||
if(StringUtils.isNotBlank(searchCenter.getSearch())){
|
||||
lawsSearch.setSearch(searchCenter.getSearch());
|
||||
}
|
||||
if(searchCenter.getIdList() != null && !searchCenter.getIdList().isEmpty()){
|
||||
lawsSearch.setIdList(searchCenter.getIdList());
|
||||
}
|
||||
@@ -136,6 +194,9 @@ public class ResetSearchCenterService {
|
||||
if(searchCenter.getIdList() != null && !searchCenter.getIdList().isEmpty()){
|
||||
bussSearch.setIdList(searchCenter.getIdList());
|
||||
}
|
||||
if(StringUtils.isNotBlank(searchCenter.getSearch())){
|
||||
bussSearch.setSearch(searchCenter.getSearch());
|
||||
}
|
||||
SarBussionessStandEOPage bussPage = new SarBussionessStandEOPage();
|
||||
ResponseMessage buss = resetBussStandSearchCenter(bussPage,bussSearch);
|
||||
if(buss.isOk() && StringUtils.isNotBlank(buss.getData().toString())){
|
||||
@@ -185,6 +246,78 @@ public class ResetSearchCenterService {
|
||||
return Result.success(res);
|
||||
}
|
||||
|
||||
//重建国内外标准
|
||||
@Async
|
||||
public ResponseMessage resetStandSearchCenterToSearch(SarStandardsInfoEOPage page,SearchCenter searchCenter) throws Exception{
|
||||
|
||||
int countUpdateSuccess = 0;
|
||||
int countAddSuccess = 0;
|
||||
|
||||
Boolean getStandIndex = elasticsearchService.isIndexExist("fulltextserch");
|
||||
|
||||
if(!getStandIndex){
|
||||
logger.info("ES 不存在索引:fulltextserch");
|
||||
return Result.error("ES 不存在索引:fulltextserch");
|
||||
}
|
||||
|
||||
String search = getSearch(searchCenter);
|
||||
|
||||
List<Map<String, Object>> searchListData = elasticsearchService.searchAll("fulltextserch",search);
|
||||
|
||||
List<String> esIdList = searchListData.stream().map(stringObjectMap -> stringObjectMap.get("id").toString()).collect(Collectors.toList());
|
||||
|
||||
page.setValidFlag("0");
|
||||
if(searchCenter.getIdList() != null && !searchCenter.getIdList().isEmpty()){
|
||||
String[] result = searchCenter.getIdList().toArray(new String[0]);
|
||||
page.setIdlist(result);
|
||||
}
|
||||
QueryWrapper qw = new QueryWrapper();
|
||||
qw.eq("VALID_FLAG","0");
|
||||
int count = iSarStandardsInfoService.count(qw);
|
||||
if(count > 0){
|
||||
page.setPageSize(count);
|
||||
page.setMenuId("nomenu");
|
||||
page.setStandType("ALL");
|
||||
List<SarStandardsInfo> rowsStand = iSarStandardsInfoService.getSarStandardsInfoPage(page);
|
||||
List<SarStandardsInfo> insList = new ArrayList<>();
|
||||
List<SarStandardsInfo> updList = new ArrayList<>();
|
||||
List<String> delList = new ArrayList<>();
|
||||
List<String> standIdList = rowsStand.stream().map(SarStandardsInfo::getId).collect(Collectors.toList());
|
||||
if(!esIdList.isEmpty()){
|
||||
|
||||
// 交集 更新
|
||||
List<SarStandardsInfo> intersection = rowsStand.stream()
|
||||
.filter(item -> new ArrayList<>(esIdList)
|
||||
.contains(item.getId()))
|
||||
.collect(Collectors.toList());
|
||||
if(searchCenter.getIdList() != null && !searchCenter.getIdList().isEmpty() && !intersection.isEmpty()){
|
||||
List<SarStandardsInfo> collect = intersection.stream()
|
||||
.filter(item -> searchCenter.getIdList().contains(item.getId())).collect(Collectors.toList());
|
||||
updList.addAll(collect);
|
||||
}else{
|
||||
updList.addAll(intersection);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
if(!updList.isEmpty() && ("ALL".equals(searchCenter.getExecType().toUpperCase()) || "UPD".equals(searchCenter.getExecType().toUpperCase()))){
|
||||
for(SarStandardsInfo sarStandardsInfoEO : updList){
|
||||
countUpdateSuccess++;
|
||||
standFunc(sarStandardsInfoEO);
|
||||
createStandMQService.sendStandMQ(sarStandardsInfoEO,"update");
|
||||
}
|
||||
}
|
||||
|
||||
logger.info("重置国内外标准:新增-"+ countAddSuccess + "条 更新-"+countUpdateSuccess+"条(国内外标准共:"+0+"条)删除-共"+delList.size()+"条数据");
|
||||
return Result.success("重置国内外标准:新增-"+ countAddSuccess + "条 更新-"+countUpdateSuccess+"条(国内外标准共:"+0+"条)删除-共"+delList.size()+"条数据");
|
||||
}else {
|
||||
logger.info("未查询到标准数据");
|
||||
return Result.error("未查询到标准数据");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//重建国内外标准
|
||||
@Async
|
||||
public ResponseMessage resetStandSearchCenter(SarStandardsInfoEOPage page,SearchCenter searchCenter) throws Exception{
|
||||
@@ -199,7 +332,9 @@ public class ResetSearchCenterService {
|
||||
return Result.error("ES 不存在索引:stand");
|
||||
}
|
||||
|
||||
List<Map<String, Object>> searchListData = elasticsearchService.searchAll("stand");
|
||||
String search = getSearch(searchCenter);
|
||||
|
||||
List<Map<String, Object>> searchListData = elasticsearchService.searchAll("stand",search);
|
||||
|
||||
List<String> esIdList = searchListData.stream().map(stringObjectMap -> stringObjectMap.get("id").toString()).collect(Collectors.toList());
|
||||
|
||||
@@ -296,6 +431,14 @@ public class ResetSearchCenterService {
|
||||
|
||||
}
|
||||
|
||||
private String getSearch(SearchCenter searchCenter) {
|
||||
String search = "";
|
||||
if(StringUtils.isNotBlank(searchCenter.getSearch())) {
|
||||
search = searchCenter.getSearch();
|
||||
}
|
||||
return search;
|
||||
}
|
||||
|
||||
private void standFunc(SarStandardsInfo sarStandardsInfoEO) throws Exception {
|
||||
attrInfoSearchDetails(sarStandardsInfoEO);
|
||||
FindSarItemsPageReqDTO pageInfo = new FindSarItemsPageReqDTO();
|
||||
@@ -365,6 +508,93 @@ public class ResetSearchCenterService {
|
||||
}
|
||||
}
|
||||
|
||||
@Async
|
||||
public ResponseMessage resetLawsSearchCenterToSearch(SarLawsStandInfoPage sarLawsInfoEOPage,SearchCenter searchCenter) throws Exception{
|
||||
Boolean getLawsIndex = elasticsearchService.isIndexExist("fulltextserch");
|
||||
|
||||
if(!getLawsIndex){
|
||||
logger.info("ES 不存在索引:fulltextserch");
|
||||
return Result.error("ES 不存在索引:fulltextserch");
|
||||
}
|
||||
|
||||
String search = getSearch(searchCenter);
|
||||
|
||||
List<Map<String, Object>> searchListData = elasticsearchService.searchAll("fulltextserch",search);
|
||||
|
||||
List<String> esIdList = searchListData.stream().map(stringObjectMap -> stringObjectMap.get("id").toString()).collect(Collectors.toList());
|
||||
|
||||
sarLawsInfoEOPage.setLawsType("FOREIGN");
|
||||
|
||||
// page idlist 赋值
|
||||
idListFunc(sarLawsInfoEOPage, searchCenter);
|
||||
|
||||
int countUpdateSuccess = 0;
|
||||
int countAddSuccess = 0;
|
||||
QueryWrapper qw2 = new QueryWrapper();
|
||||
qw2.eq("VALID_FLAG","0");
|
||||
int count2 = iSarLawsStandInfoService.count(qw2);
|
||||
if(count2 > 0){
|
||||
sarLawsInfoEOPage.setPageSize(count2);
|
||||
List<SarLawsStandInfo> rowsStand = iSarLawsStandInfoService.getSarStandardsInfoPage(sarLawsInfoEOPage);
|
||||
List<SarLawsStandInfo> insList = new ArrayList<>();
|
||||
List<SarLawsStandInfo> updList = new ArrayList<>();
|
||||
List<String> delList = new ArrayList<>();
|
||||
List<String> standIdList = rowsStand.stream().map(SarLawsStandInfo::getId).collect(Collectors.toList());
|
||||
|
||||
if(!esIdList.isEmpty()){
|
||||
|
||||
// 交集 更新
|
||||
List<SarLawsStandInfo> intersection = rowsStand.stream()
|
||||
.filter(item -> new ArrayList<>(esIdList)
|
||||
.contains(item.getId()))
|
||||
.collect(Collectors.toList());
|
||||
if(searchCenter.getIdList() != null && !searchCenter.getIdList().isEmpty() && !intersection.isEmpty()){
|
||||
List<SarLawsStandInfo> collect = intersection.stream()
|
||||
.filter(item -> searchCenter.getIdList().contains(item.getId())).collect(Collectors.toList());
|
||||
updList.addAll(collect);
|
||||
}else{
|
||||
updList.addAll(intersection);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
if(!updList.isEmpty() && ("ALL".equals(searchCenter.getExecType().toUpperCase()) || "UPD".equals(searchCenter.getExecType().toUpperCase()))){
|
||||
for(SarLawsStandInfo sarLawsInfoEO : updList){
|
||||
countUpdateSuccess++;
|
||||
lawsAttrInfoShowSearchDetails(sarLawsInfoEO);
|
||||
FindSarItemsPageReqDTO pageInfo = new FindSarItemsPageReqDTO();
|
||||
pageInfo.setStandId(sarLawsInfoEO.getId());
|
||||
pageInfo.setFileType("FBGBJBD");
|
||||
|
||||
/**
|
||||
* SarItemVO换为sarItemVOS
|
||||
* List<SarItemVO> sarItemVOS = standItemsDao.querySarItemAndInterpretation(pageInfo);
|
||||
* .collect(Collectors.toMap(SarItemVO::getItemsNum, SarItemVO::getItemsName));
|
||||
*/
|
||||
|
||||
List<SarLawsItems> sarItemVOS = sarLawsItemsDao.querySarItemAndInterpretation(pageInfo);
|
||||
if(!sarItemVOS.isEmpty()){
|
||||
Map<String,String> collectMap = sarItemVOS.stream().filter((e) -> e.getItemsNum() != null && e.getItemsName() != null)
|
||||
.collect(Collectors.toMap(SarLawsItems::getItemsNum, SarLawsItems::getTermsConditions));
|
||||
sarLawsInfoEO.setMapItems(collectMap);
|
||||
}
|
||||
if (sarLawsInfoEO.getAttrInfoMap() != null) {
|
||||
sarLawsInfoEO.setSarStandAttrEOStr(JSONObject.toJSONString(sarLawsInfoEO.getAttrInfoMap()));
|
||||
}
|
||||
createStandMQService.sendLawsMQ(sarLawsInfoEO,"update");
|
||||
}
|
||||
}
|
||||
|
||||
logger.info("重置国内外政策:新增-"+ countAddSuccess + "条 更新-"+countUpdateSuccess+"条(国内外政策共:"+rowsStand.size()+"条)数据");
|
||||
return Result.success("");
|
||||
}else {
|
||||
logger.info("未查询到国内外政策数据");
|
||||
return Result.error("未查询到国内外政策数据");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Async
|
||||
public ResponseMessage resetLawsSearchCenter(SarLawsStandInfoPage sarLawsInfoEOPage,SearchCenter searchCenter) throws Exception{
|
||||
Boolean getLawsIndex = elasticsearchService.isIndexExist("laws");
|
||||
@@ -374,7 +604,9 @@ public class ResetSearchCenterService {
|
||||
return Result.error("ES 不存在索引:laws");
|
||||
}
|
||||
|
||||
List<Map<String, Object>> searchListData = elasticsearchService.searchAll("laws");
|
||||
String search = getSearch(searchCenter);
|
||||
|
||||
List<Map<String, Object>> searchListData = elasticsearchService.searchAll("laws",search);
|
||||
|
||||
List<String> esIdList = searchListData.stream().map(stringObjectMap -> stringObjectMap.get("id").toString()).collect(Collectors.toList());
|
||||
|
||||
@@ -442,6 +674,25 @@ public class ResetSearchCenterService {
|
||||
for(SarLawsStandInfo sarLawsInfoEO : updList){
|
||||
countUpdateSuccess++;
|
||||
lawsAttrInfoShowSearchDetails(sarLawsInfoEO);
|
||||
FindSarItemsPageReqDTO pageInfo = new FindSarItemsPageReqDTO();
|
||||
pageInfo.setStandId(sarLawsInfoEO.getId());
|
||||
pageInfo.setFileType("FBGBJBD");
|
||||
|
||||
/**
|
||||
* SarItemVO换为sarItemVOS
|
||||
* List<SarItemVO> sarItemVOS = standItemsDao.querySarItemAndInterpretation(pageInfo);
|
||||
* .collect(Collectors.toMap(SarItemVO::getItemsNum, SarItemVO::getItemsName));
|
||||
*/
|
||||
|
||||
List<SarLawsItems> sarItemVOS = sarLawsItemsDao.querySarItemAndInterpretation(pageInfo);
|
||||
if(!sarItemVOS.isEmpty()){
|
||||
Map<String,String> collectMap = sarItemVOS.stream().filter((e) -> e.getItemsNum() != null && e.getItemsName() != null)
|
||||
.collect(Collectors.toMap(SarLawsItems::getItemsNum, SarLawsItems::getTermsConditions));
|
||||
sarLawsInfoEO.setMapItems(collectMap);
|
||||
}
|
||||
if (sarLawsInfoEO.getAttrInfoMap() != null) {
|
||||
sarLawsInfoEO.setSarStandAttrEOStr(JSONObject.toJSONString(sarLawsInfoEO.getAttrInfoMap()));
|
||||
}
|
||||
createStandMQService.sendLawsMQ(sarLawsInfoEO,"update");
|
||||
}
|
||||
}
|
||||
@@ -571,6 +822,84 @@ public class ResetSearchCenterService {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 文本搜索
|
||||
*/
|
||||
|
||||
@Async
|
||||
public ResponseMessage resetBussStandSearchCenterToSearch(SarBussionessStandEOPage sarBussionessStandEOPage,SearchCenter searchCenter) throws Exception{
|
||||
Boolean getbussstandIndex = elasticsearchService.isIndexExist("fulltextserch");
|
||||
|
||||
if(!getbussstandIndex){
|
||||
logger.info("ES 不存在索引:fulltextserch");
|
||||
return Result.error("ES 不存在索引:fulltextserch");
|
||||
}
|
||||
|
||||
String search = getSearch(searchCenter);
|
||||
|
||||
List<Map<String, Object>> searchListData = elasticsearchService.searchAll("fulltextserch",search);
|
||||
|
||||
List<String> esIdList = searchListData.stream().map(stringObjectMap -> stringObjectMap.get("id").toString()).collect(Collectors.toList());
|
||||
|
||||
sarBussionessStandEOPage.setValidFlag("0");
|
||||
sarBussionessStandEOPage.setOrderBy("SAR_BUSSIONESS_STAND.issue_time is null,SAR_BUSSIONESS_STAND.issue_time desc,SAR_BUSSIONESS_STAND.id");
|
||||
sarBussionessStandEOPage.setMenuRoleList(null);
|
||||
if(searchCenter.getIdList() != null && !searchCenter.getIdList().isEmpty()){
|
||||
String[] result = searchCenter.getIdList().toArray(new String[0]);
|
||||
sarBussionessStandEOPage.setIdlist(result);
|
||||
}
|
||||
|
||||
int countUpdateSuccess = 0;
|
||||
int countAddSuccess = 0;
|
||||
sarBussionessStandEOPage.setMenuId("0");
|
||||
|
||||
QueryWrapper qw3 = new QueryWrapper();
|
||||
qw3.eq("VALID_FLAG","0");
|
||||
int count3 = iSarBussionessStandService.count(qw3);
|
||||
|
||||
if(count3 > 0){
|
||||
sarBussionessStandEOPage.setPageSize(count3);
|
||||
|
||||
List<SarBussionessStand> rowsStand = iSarBussionessStandService.getSarBussionStandPage(sarBussionessStandEOPage);
|
||||
List<SarBussionessStand> insList = new ArrayList<>();
|
||||
List<SarBussionessStand> updList = new ArrayList<>();
|
||||
List<String> delList = new ArrayList<>();
|
||||
List<String> standIdList = rowsStand.stream().map(SarBussionessStand::getId).collect(Collectors.toList());
|
||||
if(!esIdList.isEmpty()){
|
||||
|
||||
// 交集 更新
|
||||
List<SarBussionessStand> intersection = rowsStand.stream()
|
||||
.filter(item -> new ArrayList<>(esIdList)
|
||||
.contains(item.getId()))
|
||||
.collect(Collectors.toList());
|
||||
if(searchCenter.getIdList() != null && !searchCenter.getIdList().isEmpty() && !intersection.isEmpty()){
|
||||
List<SarBussionessStand> collect = intersection.stream()
|
||||
.filter(item -> searchCenter.getIdList().contains(item.getId())).collect(Collectors.toList());
|
||||
updList.addAll(collect);
|
||||
}else{
|
||||
updList.addAll(intersection);
|
||||
}
|
||||
}
|
||||
|
||||
if(!updList.isEmpty() && ("ALL".equals(searchCenter.getExecType().toUpperCase()) || "UPD".equals(searchCenter.getExecType().toUpperCase()))){
|
||||
for(SarBussionessStand sarBussionessStandEO : updList){
|
||||
countUpdateSuccess++;
|
||||
bussAttrInfoShowSearchDetails(sarBussionessStandEO);
|
||||
if (sarBussionessStandEO.getAttrInfoMap() != null) {
|
||||
sarBussionessStandEO.setSarStandAttrEOStr(JSONObject.toJSONString(sarBussionessStandEO.getAttrInfoMap()));
|
||||
}
|
||||
createStandMQService.sendBussStandMQ(sarBussionessStandEO,"update");
|
||||
}
|
||||
}
|
||||
logger.info("重置企标:新增-"+ countAddSuccess + "条 更新-"+countUpdateSuccess+"条(企标共:"+rowsStand.size()+"条)数据");
|
||||
return Result.success("");
|
||||
}else {
|
||||
logger.info("未查询到企标数据");
|
||||
return Result.error("未查询到企标数据");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Async
|
||||
public ResponseMessage resetBussStandSearchCenter(SarBussionessStandEOPage sarBussionessStandEOPage,SearchCenter searchCenter) throws Exception{
|
||||
Boolean getbussstandIndex = elasticsearchService.isIndexExist("bussstand");
|
||||
@@ -580,7 +909,9 @@ public class ResetSearchCenterService {
|
||||
return Result.error("ES 不存在索引:bussstand");
|
||||
}
|
||||
|
||||
List<Map<String, Object>> searchListData = elasticsearchService.searchAll("bussstand");
|
||||
String search = getSearch(searchCenter);
|
||||
|
||||
List<Map<String, Object>> searchListData = elasticsearchService.searchAll("bussstand",search);
|
||||
|
||||
List<String> esIdList = searchListData.stream().map(stringObjectMap -> stringObjectMap.get("id").toString()).collect(Collectors.toList());
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ public class restSearchSync {
|
||||
private boolean isNotScheduled; //是否开启定时器
|
||||
|
||||
|
||||
// 每天0点1分执行 重置ES 自动更新、新增、删除
|
||||
// 每天0点1分执行 重置ES 自动更新、新增
|
||||
// @Scheduled(cron="0 0 1 1 * ?")
|
||||
@Scheduled(cron = "0 1 0 * * ?")
|
||||
@Async
|
||||
@@ -54,14 +54,14 @@ public class restSearchSync {
|
||||
if(isNotScheduled){
|
||||
try{
|
||||
Thread.sleep(2000);
|
||||
logger.info("每天0点1分执行 重置ES 自动更新、新增、删除:"+Thread.currentThread().getName() + " cron=0 1 0 * * ? --- " + new Date()+"---START-01");
|
||||
logger.info("每天0点1分执行 重置ES 自动更新、新增:"+Thread.currentThread().getName() + " cron=0 1 0 * * ? --- " + new Date()+"---START-01");
|
||||
|
||||
SearchCenter searchCenter = new SearchCenter();
|
||||
// ALL 执行全部
|
||||
searchCenter.setExecType("ALL");
|
||||
resetSearchCenterService.syncResetALLSearchCenter(searchCenter);
|
||||
|
||||
logger.info("每天0点1分执行 重置ES 自动更新、新增、删除:"+Thread.currentThread().getName() + " cron=0 1 0 * * ? --- " + new Date()+"---End-01");
|
||||
logger.info("每天0点1分执行 重置ES 自动更新、新增:"+Thread.currentThread().getName() + " cron=0 1 0 * * ? --- " + new Date()+"---End-01");
|
||||
}catch(Exception e){
|
||||
logger.info(e.getMessage());
|
||||
}
|
||||
|
||||
+6
@@ -66,6 +66,12 @@ public class EsRevisePlanController extends BaseController<EsRevisePlan> {
|
||||
return Result.success(iEsRevisePlanService.modPlan(esRevisePlan));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "编辑企标计划-企标技术更新计划状态")
|
||||
@PostMapping("modPlanByState")
|
||||
public ResponseMessage<Object> modPlanByState(EsRevisePlan esRevisePlan){
|
||||
return Result.success(iEsRevisePlanService.modPlanByState(esRevisePlan));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "编辑企标计划")
|
||||
@PostMapping("/modPlanByWk")
|
||||
public ResponseMessage<Object> modPlanByWk(@RequestBody EsRevisePlan esRevisePlan){
|
||||
|
||||
+1
@@ -19,6 +19,7 @@ public interface IEsRevisePlanService extends IService<EsRevisePlan> {
|
||||
EsRevisePlan getOnePlan(String id);//查询详情
|
||||
|
||||
String modPlan(EsRevisePlan esRevisePlan);//编辑
|
||||
String modPlanByState(EsRevisePlan esRevisePlan);//编辑
|
||||
String addPlan(EsRevisePlan esRevisePlan);//插入
|
||||
int delPlan(String id);//删除
|
||||
int delPlans(String ids);//批量删除
|
||||
|
||||
+6
@@ -75,6 +75,12 @@ public class EsRevisePlanServiceImpl extends ServiceImpl<EsRevisePlanDao, EsRevi
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String modPlanByState(EsRevisePlan esRevisePlan) {
|
||||
esRevisePlanDao.updateById(esRevisePlan);
|
||||
return "操作成功";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String addPlan(EsRevisePlan esRevisePlan) {
|
||||
esRevisePlan.setId(UUIDUtils.randomUUID(32));
|
||||
|
||||
+63
@@ -0,0 +1,63 @@
|
||||
package com.adc.da.slrs.regulationsTDM.controller;
|
||||
|
||||
|
||||
import com.adc.da.base.web.BaseController;
|
||||
import com.adc.da.http.Result;
|
||||
import com.adc.da.slrs.regulationsTDM.entity.StandResult;
|
||||
import com.adc.da.slrs.regulationsTDM.entity.SearchStandContext;
|
||||
import com.adc.da.slrs.regulationsTDM.entity.StandData;
|
||||
import com.adc.da.slrs.regulationsTDM.entity.StandMessageCodeEnum;
|
||||
import com.adc.da.slrs.regulationsTDM.service.IStandDataTDMService;
|
||||
import com.adc.da.util.utils.StringUtils;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 标准信息表 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author super_liu
|
||||
* @since 2021-07-13
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "福田标准法规--TDM查询标准")
|
||||
@RequestMapping("/api/regulationsTDM")
|
||||
public class StandDataTDMController extends BaseController<StandData> {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(StandDataTDMController.class);
|
||||
|
||||
@Autowired
|
||||
private IStandDataTDMService iStandDataTDMService;
|
||||
/**
|
||||
* 标准查询列表接口
|
||||
*
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "|regulationsTDM|标准查询列表接口")
|
||||
@PostMapping("/standData")
|
||||
public String searchStandData(@RequestBody SearchStandContext searchStandContext){
|
||||
if(searchStandContext.getPage() == 0
|
||||
|| StringUtils.isEmpty(searchStandContext.getType())){
|
||||
return StandResult.toJson(Result.error(StandMessageCodeEnum.ERROR_PARAM.getCode(),
|
||||
"page/type 为必填项 且page不可为0"));
|
||||
}
|
||||
List<StandData> rows = iStandDataTDMService.searchStandData(searchStandContext);
|
||||
return StandResult.toJson(Result.success(getPageInfo(searchStandContext.getPager(), rows)));
|
||||
}
|
||||
|
||||
private String verifyObj(String str){
|
||||
return (str == null || str.equals("")) ? "" : str;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.adc.da.slrs.regulationsTDM.dao;
|
||||
|
||||
import com.adc.da.slrs.regulationsTDM.entity.SearchStandContext;
|
||||
import com.adc.da.slrs.regulationsTDM.entity.StandData;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 标准信息表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author super_liu
|
||||
*/
|
||||
@Repository
|
||||
public interface StandDataTDMDao extends BaseMapper<StandData> {
|
||||
|
||||
List<StandData> searchStandData(SearchStandContext searchStandContext);
|
||||
List<StandData> searchBussData(SearchStandContext searchStandContext);
|
||||
|
||||
List<StandData> searchStandDataThree(SearchStandContext searchStandContext);
|
||||
|
||||
}
|
||||
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
package com.adc.da.slrs.regulationsTDM.entity;
|
||||
|
||||
import com.adc.da.base.page.BasePage;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @Description: TODO
|
||||
* @author: super_liu
|
||||
* @date: 2022年04月25日 12:05
|
||||
*/
|
||||
@Data
|
||||
public class SearchStandContext extends BasePage {
|
||||
|
||||
// 标准查询条件
|
||||
@ApiModelProperty(value = "页数")
|
||||
private Integer page;
|
||||
|
||||
@ApiModelProperty(value = "区分类别(GB:国内外标准 QB:企业标准)")
|
||||
private String type;
|
||||
|
||||
}
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
package com.adc.da.slrs.regulationsTDM.entity;
|
||||
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.apache.poi.ss.formula.functions.T;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: TODO
|
||||
* @author: super_liu
|
||||
* @date: 2022年04月25日 12:05
|
||||
*/
|
||||
@Data
|
||||
public class SearchStandResult<T> {
|
||||
|
||||
@ApiModelProperty(value = "返回状态 200 正常,-1 系统错误, -10 参数错误")
|
||||
@JSONField(ordinal=1)
|
||||
private String respCode;
|
||||
|
||||
@ApiModelProperty(value = "true:成功 false:失败")
|
||||
@JSONField(ordinal=2)
|
||||
private Boolean ok;
|
||||
|
||||
@ApiModelProperty(value = "正常返回空字符串,系统错误时返回系统异常信息及对应描述")
|
||||
@JSONField(ordinal=3)
|
||||
private String message;
|
||||
|
||||
private T data;
|
||||
|
||||
|
||||
public SearchStandResult(String respCode, String message, boolean ok, T data) {
|
||||
this.respCode = respCode;
|
||||
this.message = message;
|
||||
this.ok = ok;
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public SearchStandResult(String respCode, String message, boolean ok) {
|
||||
this.respCode = respCode;
|
||||
this.message = message;
|
||||
this.ok = ok;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package com.adc.da.slrs.regulationsTDM.entity;
|
||||
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Description: TODO
|
||||
* @author: super_liu
|
||||
* @date: 2022年04月25日 12:05
|
||||
*/
|
||||
@Data
|
||||
public class StandData {
|
||||
|
||||
@ApiModelProperty(value = "标准ID")
|
||||
@JSONField(ordinal=1)
|
||||
private String id;
|
||||
|
||||
@ApiModelProperty(value = "标准类型")
|
||||
@JSONField(ordinal=2)
|
||||
private String standType;
|
||||
|
||||
@ApiModelProperty(value = "标准分类")
|
||||
@JSONField(ordinal=3)
|
||||
private String standSort;
|
||||
|
||||
@ApiModelProperty(value = "标准号")
|
||||
@JSONField(ordinal=4)
|
||||
private String standNumber;
|
||||
|
||||
@ApiModelProperty(value = "年代号")
|
||||
@JSONField(ordinal=5)
|
||||
private String standYear;
|
||||
|
||||
@ApiModelProperty(value = "标准名称")
|
||||
@JSONField(ordinal=6)
|
||||
private String standName;
|
||||
|
||||
@ApiModelProperty(value = "标准英文名称")
|
||||
@JSONField(ordinal=7)
|
||||
private String standEnName;
|
||||
|
||||
@ApiModelProperty(value = "标准分类+空格+标准号+空格+标准名称")
|
||||
@JSONField(ordinal=8)
|
||||
private String documentName;
|
||||
|
||||
@ApiModelProperty(value = "当前标准跳转到本系统内的链接地址")
|
||||
@JSONField(ordinal=9)
|
||||
private String documentUrl;
|
||||
|
||||
@ApiModelProperty(value = "代替标准号")
|
||||
@JSONField(ordinal=10)
|
||||
private String dtbzh;
|
||||
}
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
package com.adc.da.slrs.regulationsTDM.entity;
|
||||
|
||||
/**
|
||||
* @Description: TODO
|
||||
* @author: super_liu
|
||||
* @date: 2022年04月25日 14:58
|
||||
*/
|
||||
public enum StandMessageCodeEnum {
|
||||
SUCCESS("200"),
|
||||
ERROR_SYS("-1"),
|
||||
ERROR_PARAM("-10"),
|
||||
SOURCE("SRMS");
|
||||
|
||||
private String code;
|
||||
|
||||
private StandMessageCodeEnum(String code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getCode() {
|
||||
return this.code;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.adc.da.slrs.regulationsTDM.entity;
|
||||
|
||||
import com.adc.da.http.ResponseMessage;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: TODO
|
||||
* @author: super_liu
|
||||
* @date: 2022年04月25日 14:56
|
||||
*/
|
||||
public class StandResult {
|
||||
|
||||
public static <T>SearchStandResult<T> success(String code,String message,T t) {
|
||||
return new SearchStandResult(code, message, true, t);
|
||||
}
|
||||
|
||||
public static <T>SearchStandResult<T> error(String code,String message) {
|
||||
return new SearchStandResult(code, message, true);
|
||||
}
|
||||
|
||||
public static String toJson(ResponseMessage searchStandResult){
|
||||
GsonBuilder gsonBuilder = getGsonBuilder();
|
||||
Gson json = gsonBuilder.create();
|
||||
return json.toJson(searchStandResult);
|
||||
}
|
||||
|
||||
private static GsonBuilder getGsonBuilder() {
|
||||
return new GsonBuilder().disableHtmlEscaping().serializeNulls().enableComplexMapKeySerialization().serializeSpecialFloatingPointValues().setLenient();
|
||||
}
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
package com.adc.da.slrs.regulationsTDM.service;
|
||||
|
||||
import com.adc.da.http.ResponseMessage;
|
||||
import com.adc.da.slrs.regulationsTDM.entity.SearchStandContext;
|
||||
import com.adc.da.slrs.regulationsTDM.entity.StandData;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 标准信息表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author super_liu
|
||||
*/
|
||||
public interface IStandDataTDMService extends IService<StandData> {
|
||||
|
||||
List<StandData> searchStandData(SearchStandContext searchStandContext);
|
||||
}
|
||||
|
||||
+84
@@ -0,0 +1,84 @@
|
||||
package com.adc.da.slrs.regulationsTDM.service.impl;
|
||||
|
||||
import com.adc.da.slrs.regulationsTDM.entity.*;
|
||||
import com.adc.da.slrs.regulationsTDM.dao.StandDataTDMDao;
|
||||
import com.adc.da.slrs.regulationsTDM.service.IStandDataTDMService;
|
||||
import com.adc.da.slrs.sarBussionessStand.dao.SarBussionessStandDao;
|
||||
import com.adc.da.slrs.sarStandardsInfo.dao.SarStandardsInfoDao;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import sun.misc.BASE64Encoder;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 标准信息表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author super_liu
|
||||
* @date: 2022年04月25日 14:56
|
||||
*/
|
||||
@Service
|
||||
public class StandDataTDMServiceImpl extends ServiceImpl<StandDataTDMDao, StandData> implements IStandDataTDMService {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(StandDataTDMServiceImpl.class);
|
||||
|
||||
private String webUrl = "https://srms.foton.com.cn/#/loginStandDetails";
|
||||
|
||||
@Autowired
|
||||
private SarStandardsInfoDao sarStandardInfoDao;
|
||||
|
||||
@Autowired
|
||||
private SarBussionessStandDao sarBussionessStandDao;
|
||||
|
||||
@Override
|
||||
public List<StandData> searchStandData(SearchStandContext searchStandContext){
|
||||
List<StandData> standDataQuery = new ArrayList<>();
|
||||
searchStandContext.setPageSize(100);
|
||||
QueryWrapper queryCount = new QueryWrapper();
|
||||
queryCount.eq("VALID_FLAG","0");
|
||||
if("GB".equals(searchStandContext.getType().toUpperCase())){
|
||||
int count = sarStandardInfoDao.selectCount(queryCount);
|
||||
searchStandContext.getPager().setRowCount(count);
|
||||
standDataQuery = this.baseMapper.searchStandData(searchStandContext);
|
||||
}else if("QB".equals(searchStandContext.getType().toUpperCase())){
|
||||
int count = sarBussionessStandDao.selectCount(queryCount);
|
||||
searchStandContext.getPager().setRowCount(count);
|
||||
standDataQuery = this.baseMapper.searchBussData(searchStandContext);
|
||||
}
|
||||
if(!standDataQuery.isEmpty()){
|
||||
// 重组数据集合 只需documentName 及 documentUrl
|
||||
standDataQuery.stream().peek(standData -> {
|
||||
standData.setDocumentName(verifyObj(standData.getStandSort(),standData.getStandNumber(),standData.getStandName()));
|
||||
standData.setDocumentUrl(webUrl+"?dataId="+standData.getId()+"&datatype="+standData.getStandType());
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
return standDataQuery;
|
||||
}
|
||||
|
||||
private String verifyObj(String str1,String str2,String str3){
|
||||
String res1 = (str1 == null || str1.equals("")) ? "" : (str1+" ");
|
||||
String res2 = (str2 == null || str2.equals("")) ? "" : (str2+" ");
|
||||
String res3 = (str3 == null || str3.equals("")) ? "" : str3;
|
||||
return res1 + res2 + res3;
|
||||
}
|
||||
private String encode(String str){
|
||||
String encodeStr = new BASE64Encoder().encodeBuffer(str.getBytes()).replaceAll("[\r\n]", "");
|
||||
return encodeStr;
|
||||
}
|
||||
|
||||
private String errFilter(String str){
|
||||
if (str.contains("Cause")){
|
||||
str = str.split("Cause")[0].replaceAll("\\r\\n###","");
|
||||
}
|
||||
return str;
|
||||
}
|
||||
}
|
||||
+13
@@ -4,9 +4,12 @@ import com.adc.da.slrs.sarBussionessStand.entity.SarBussionessStand;
|
||||
import com.adc.da.slrs.sarBussionessStand.entity.SarBussionessStandExport;
|
||||
import com.adc.da.slrs.sarStandardsInfo.entity.RecommendVO;
|
||||
import com.adc.da.slrs.sarStandardsInfo.entity.SarBussionessStandEOPage;
|
||||
import com.adc.da.slrs.sarStandardsInfo.entity.SarStandardsInfo;
|
||||
import com.adc.da.sys.entity.UserEO;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.Date;
|
||||
@@ -23,6 +26,16 @@ 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 ${ew.customSqlSegment}";
|
||||
|
||||
/**
|
||||
* 自动更新文本状态通用查询
|
||||
* @param queryWrapper
|
||||
* @return
|
||||
*/
|
||||
@Select(updateStateScheduledSql)
|
||||
List<SarBussionessStand> getStateScheduledList(@Param("ew") QueryWrapper queryWrapper);
|
||||
|
||||
List<SarBussionessStand> queryByBussStateSync(SarBussionessStand sarBussionessStand);
|
||||
|
||||
SarBussionessStand getStandInfoByReviseStatus(String reviseStatus);
|
||||
|
||||
+6
@@ -86,6 +86,12 @@ public class SarBussionessStandState extends BaseEntity {
|
||||
@TableField("PARAM2")
|
||||
private String param2;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String putTime;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String FSRQBUSS;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String QCDW;
|
||||
|
||||
|
||||
+1
-1
@@ -216,7 +216,7 @@ public class SarLawsDetailedListController extends BaseController<SarLawsDetaile
|
||||
@PostMapping("/importData")
|
||||
public ResponseMessage importData( @RequestParam(value = "file", required = false) MultipartFile file){
|
||||
StringBuilder stringBuilder=new StringBuilder();
|
||||
List<ExportEmptyModel> res=sarLawsDetailedListService.importData(file,stringBuilder);
|
||||
List<ExportEmptyModelDto> res=sarLawsDetailedListService.importData(file,stringBuilder);
|
||||
if (stringBuilder.toString().length()>0){
|
||||
return Result.error("-1","",stringBuilder.toString());
|
||||
}else {
|
||||
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
package com.adc.da.slrs.sarLawsDetailedList.entity;
|
||||
|
||||
import cn.afterturn.easypoi.excel.annotation.Excel;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Author: qk
|
||||
* @Date: 2022/5/10 0010 14:56
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Data
|
||||
public class ExportEmptyModelDto {
|
||||
@Excel(name = "标准编号(必填)",orderNum = "0" ,width = 20.0)
|
||||
private String standNumber;
|
||||
|
||||
@Excel(name = "适用认证(必填,可多选)",orderNum = "1" ,width = 40.0)
|
||||
private String syrz;
|
||||
|
||||
@Excel(name = "标准实施日期",orderNum = "2" ,width = 20.0)
|
||||
// @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
|
||||
// @DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
private String ssrq;
|
||||
|
||||
@Excel(name = "新车型实施日期",orderNum = "3" ,width = 20.0)
|
||||
// @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
|
||||
// @DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
private String xcxssrqgj;
|
||||
|
||||
@Excel(name = "在产车实施日期",orderNum = "4" ,width = 20.0)
|
||||
// @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
|
||||
// @DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
private String zccssrqgj;
|
||||
|
||||
private String id;
|
||||
|
||||
private String compareFlag;
|
||||
|
||||
private String syrzCode;
|
||||
//国内海外为1 企标为2 政策为3
|
||||
private String standName;
|
||||
private String standEnName;
|
||||
private String sycx;
|
||||
private String nylx;
|
||||
private String zrbm;
|
||||
private String sycpx;
|
||||
}
|
||||
+1
-1
@@ -32,7 +32,7 @@ public interface ISarLawsDetailedListService extends IService<SarLawsDetailedLis
|
||||
void standardToLaws(String countryArea,TimeDto timeDto);
|
||||
|
||||
|
||||
List<ExportEmptyModel> importData(MultipartFile file , StringBuilder stringBuilder);
|
||||
List<ExportEmptyModelDto> importData(MultipartFile file , StringBuilder stringBuilder);
|
||||
|
||||
|
||||
}
|
||||
|
||||
+57
-19
@@ -49,6 +49,8 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.lang.reflect.Array;
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -649,11 +651,26 @@ public class SarLawsDetailedListServiceImpl extends ServiceImpl<SarLawsDetailedL
|
||||
|
||||
List<TimeDto> timeDto = new ArrayList<>();
|
||||
if (detailedUpDto.getInforlist().contains(",")) {
|
||||
String[] id = detailedUpDto.getInforlist().split(",");
|
||||
String[] putTime = detailedUpDto.getInforlist1().split(";");
|
||||
String[] zcc = detailedUpDto.getInforlist2().split(";");
|
||||
String[] xcx = detailedUpDto.getInforlist3().split(";");
|
||||
String[] syrz = detailedUpDto.getInforlist4().split(";");
|
||||
String[] id = new String[]{};
|
||||
String[] putTime = new String[]{};
|
||||
String[] zcc = new String[]{};
|
||||
String[] xcx = new String[]{};
|
||||
String[] syrz = new String[]{};
|
||||
if(StringUtils.isNotEmpty(detailedUpDto.getInforlist())){
|
||||
id = detailedUpDto.getInforlist().split(",");
|
||||
}
|
||||
if(StringUtils.isNotEmpty(detailedUpDto.getInforlist1())){
|
||||
putTime = detailedUpDto.getInforlist1().split(";");
|
||||
}
|
||||
if(StringUtils.isNotEmpty(detailedUpDto.getInforlist2())){
|
||||
zcc = detailedUpDto.getInforlist2().split(";");
|
||||
}
|
||||
if(StringUtils.isNotEmpty(detailedUpDto.getInforlist3())){
|
||||
xcx = detailedUpDto.getInforlist3().split(";");
|
||||
}
|
||||
if(StringUtils.isNotEmpty(detailedUpDto.getInforlist4())){
|
||||
syrz=detailedUpDto.getInforlist4().split(";");
|
||||
}
|
||||
for (int a = 0; a < id.length; a++) {
|
||||
TimeDto dto = new TimeDto();
|
||||
dto.setStandId(id[a]);
|
||||
@@ -825,8 +842,8 @@ public class SarLawsDetailedListServiceImpl extends ServiceImpl<SarLawsDetailedL
|
||||
|
||||
|
||||
@Override
|
||||
public List<ExportEmptyModel> importData(MultipartFile file, StringBuilder stringBuilder) {
|
||||
List<ExportEmptyModel> res = ExcelImportUtilByWk.readExcelpublic(ExportEmptyModel.class, file, stringBuilder);
|
||||
public List<ExportEmptyModelDto> importData(MultipartFile file, StringBuilder stringBuilder) {
|
||||
List<ExportEmptyModelDto> res = ExcelImportUtilByWk.readExcelpublic(ExportEmptyModelDto.class, file, stringBuilder);
|
||||
//数据字典数据组装
|
||||
Map<String, Object> dicTypeEO = dicTypeEOService.getDicTypeListCode();
|
||||
Map<String, String> dict = new HashMap<>();
|
||||
@@ -840,7 +857,7 @@ public class SarLawsDetailedListServiceImpl extends ServiceImpl<SarLawsDetailedL
|
||||
//先校验是否存在一堆空数据
|
||||
if (null != res && "".equals(stringBuilder.toString())) {
|
||||
int i = 1;
|
||||
for (ExportEmptyModel e : res) {
|
||||
for (ExportEmptyModelDto e : res) {
|
||||
if (null == e.getStandNumber() || e.getStandNumber().isEmpty()) {
|
||||
stringBuilder.append("第" + i + "行标准编号不能为空;");
|
||||
}
|
||||
@@ -852,6 +869,27 @@ public class SarLawsDetailedListServiceImpl extends ServiceImpl<SarLawsDetailedL
|
||||
}
|
||||
//数据校验 先做重复交验+再做是否存在校验
|
||||
if (null != res && "".equals(stringBuilder.toString())) {
|
||||
for (ExportEmptyModelDto re:res) {
|
||||
if(!(re.getSsrq().contains(",")||re.getSsrq().contains(","))) {
|
||||
Date date = org.apache.poi.ss.usermodel.DateUtil
|
||||
.getJavaDate(Double.valueOf(re.getSsrq()));
|
||||
DateFormat format = new SimpleDateFormat("yyyy-MM-dd");
|
||||
re.setSsrq(format.format(date));
|
||||
}
|
||||
if(!(re.getXcxssrqgj().contains(",")||re.getXcxssrqgj().contains(","))) {
|
||||
Date date = org.apache.poi.ss.usermodel.DateUtil
|
||||
.getJavaDate(Double.valueOf(re.getXcxssrqgj()));
|
||||
DateFormat format = new SimpleDateFormat("yyyy-MM-dd");
|
||||
re.setXcxssrqgj(format.format(date));
|
||||
}
|
||||
if(!(re.getZccssrqgj().contains(",")||re.getZccssrqgj().contains(","))) {
|
||||
Date date = org.apache.poi.ss.usermodel.DateUtil
|
||||
.getJavaDate(Double.valueOf(re.getZccssrqgj()));
|
||||
DateFormat format = new SimpleDateFormat("yyyy-MM-dd");
|
||||
re.setZccssrqgj(format.format(date));
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < res.size(); i++) {
|
||||
for (int j = 0; j < res.size(); j++) {
|
||||
String a = res.get(i).getStandNumber().replaceAll(" ", "").replaceAll(" ", "");
|
||||
@@ -865,7 +903,7 @@ public class SarLawsDetailedListServiceImpl extends ServiceImpl<SarLawsDetailedL
|
||||
//如果没有重复 那么错误提示标识应该为空 现在开始验证标准是否存在
|
||||
if ("".equals(stringBuilder.toString())) {
|
||||
int i = 1;
|
||||
for (ExportEmptyModel exportEmptyModel : res) {
|
||||
for (ExportEmptyModelDto exportEmptyModel : res) {
|
||||
SearchStandContext searchStandContext = new SearchStandContext();
|
||||
searchStandContext.setStandCode(exportEmptyModel.getStandNumber());
|
||||
List<StandData> standData = standDateDao.searchStandDataThree(searchStandContext);
|
||||
@@ -920,15 +958,15 @@ public class SarLawsDetailedListServiceImpl extends ServiceImpl<SarLawsDetailedL
|
||||
}
|
||||
}
|
||||
|
||||
public List<ExportEmptyModel> dealWithData(List<ExportEmptyModel> res) {
|
||||
List<ExportEmptyModel> result = new ArrayList<>();
|
||||
public List<ExportEmptyModelDto> dealWithData(List<ExportEmptyModelDto> res) {
|
||||
List<ExportEmptyModelDto> result = new ArrayList<>();
|
||||
//判定是不是存在于国内海外标准中
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
Map<String, ExportEmptyModel> map = new HashMap<>();
|
||||
res.forEach(exportEmptyModel -> {
|
||||
if (null != exportEmptyModel.getId() && !exportEmptyModel.getId().isEmpty()) {
|
||||
stringBuilder.append(exportEmptyModel.getId() + ",");
|
||||
map.put(exportEmptyModel.getId(), exportEmptyModel);
|
||||
Map<String, ExportEmptyModelDto> map = new HashMap<>();
|
||||
res.forEach(ExportEmptyModel -> {
|
||||
if (null != ExportEmptyModel.getId() && !ExportEmptyModel.getId().isEmpty()) {
|
||||
stringBuilder.append(ExportEmptyModel.getId() + ",");
|
||||
map.put(ExportEmptyModel.getId(), ExportEmptyModel);
|
||||
}
|
||||
});
|
||||
String[] ids = stringBuilder.toString().substring(0, stringBuilder.toString().length() - 1).split(",");
|
||||
@@ -948,7 +986,7 @@ public class SarLawsDetailedListServiceImpl extends ServiceImpl<SarLawsDetailedL
|
||||
}
|
||||
if (null != infos && infos.size() > 0) {
|
||||
infos.forEach(sarStandardsInfo -> {
|
||||
ExportEmptyModel model = map.get(sarStandardsInfo.getId());
|
||||
ExportEmptyModelDto model = map.get(sarStandardsInfo.getId());
|
||||
model.setStandName(sarStandardsInfo.getStandName());
|
||||
model.setStandEnName(sarStandardsInfo.getStandEnName());
|
||||
model.setNylx(null!=sarStandardsInfo.getAttrInfoCaseMap().get("nylx") ?sarStandardsInfo.getAttrInfoCaseMap().get("nylx").toString():"");
|
||||
@@ -975,7 +1013,7 @@ public class SarLawsDetailedListServiceImpl extends ServiceImpl<SarLawsDetailedL
|
||||
}
|
||||
if (null != sarBussionessStands && sarBussionessStands.size() > 0) {
|
||||
sarBussionessStands.forEach(sarStandardsInfo -> {
|
||||
ExportEmptyModel model = map.get(sarStandardsInfo.getId());
|
||||
ExportEmptyModelDto model = map.get(sarStandardsInfo.getId());
|
||||
model.setStandName(sarStandardsInfo.getStandName());
|
||||
model.setStandEnName(sarStandardsInfo.getStandEnName());
|
||||
model.setNylx(null!=sarStandardsInfo.getAttrInfoCaseMap().get("nylx") ?sarStandardsInfo.getAttrInfoCaseMap().get("nylx").toString():"");
|
||||
@@ -1001,7 +1039,7 @@ public class SarLawsDetailedListServiceImpl extends ServiceImpl<SarLawsDetailedL
|
||||
}
|
||||
if (null != sarLawsStandInfos && sarLawsStandInfos.size() > 0) {
|
||||
sarLawsStandInfos.forEach(sarStandardsInfo -> {
|
||||
ExportEmptyModel model = map.get(sarStandardsInfo.getId());
|
||||
ExportEmptyModelDto model = map.get(sarStandardsInfo.getId());
|
||||
model.setStandName(sarStandardsInfo.getLawsName());
|
||||
model.setStandEnName(sarStandardsInfo.getLawsEnName());
|
||||
model.setNylx(null!=sarStandardsInfo.getAttrInfoCaseMap().get("nylxlaws") ?sarStandardsInfo.getAttrInfoCaseMap().get("nylxlaws").toString():"");
|
||||
|
||||
+16
@@ -736,6 +736,22 @@ public class SarLawsStandInfoServiceImpl extends ServiceImpl<SarLawsStandInfoDao
|
||||
saveUpdateLog(sarLawsStandInfo,beforeStandEO);
|
||||
if (elasflag) {
|
||||
attrInfoShowSearchDetails(sarLawsStandInfo,"upd");
|
||||
FindSarItemsPageReqDTO pageInfo = new FindSarItemsPageReqDTO();
|
||||
pageInfo.setStandId(sarLawsStandInfo.getId());
|
||||
pageInfo.setFileType("FBGBJBD");
|
||||
|
||||
/**
|
||||
* SarItemVO换为sarItemVOS
|
||||
* List<SarItemVO> sarItemVOS = standItemsDao.querySarItemAndInterpretation(pageInfo);
|
||||
* .collect(Collectors.toMap(SarItemVO::getItemsNum, SarItemVO::getItemsName));
|
||||
*/
|
||||
|
||||
List<SarLawsItems> sarItemVOS = sarLawsItemsDao.querySarItemAndInterpretation(pageInfo);
|
||||
if(!sarItemVOS.isEmpty()){
|
||||
Map<String,String> collectMap = sarItemVOS.stream().filter((e) -> e.getItemsNum() != null && e.getItemsName() != null)
|
||||
.collect(Collectors.toMap(SarLawsItems::getItemsNum, SarLawsItems::getTermsConditions));
|
||||
sarLawsStandInfo.setMapItems(collectMap);
|
||||
}
|
||||
createStandMQService.sendLawsMQ(sarLawsStandInfo, "update");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
package com.adc.da.slrs.sarQaInfo.entity;
|
||||
|
||||
import com.adc.da.base.page.BasePage;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 标准法规问答信息表
|
||||
* </p>
|
||||
*
|
||||
* @author yzh
|
||||
* @since 2022-05-06
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Accessors(chain = true)
|
||||
@ApiModel(value="SarQaInfo对象", description="标准法规问答信息表")
|
||||
public class SarQaInfoPage extends BasePage {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty(value = "主键")
|
||||
@TableId("ID")
|
||||
private String id;
|
||||
|
||||
@ApiModelProperty(value = "资源类型-标准、法规、企标")
|
||||
@TableField("RES_TYPE")
|
||||
private String resType;
|
||||
|
||||
@ApiModelProperty(value = "资源ID")
|
||||
@TableField("RES_ID")
|
||||
private String resId;
|
||||
|
||||
@TableField("QUE_USER")
|
||||
private String queUser;
|
||||
|
||||
@TableField("ANSWER_USER")
|
||||
private String answerUser;
|
||||
|
||||
@TableField("RE_ANSWER_USER")
|
||||
private String reAnswerUser;
|
||||
|
||||
@ApiModelProperty(value = "提问时间")
|
||||
@TableField("QUE_TIME")
|
||||
private LocalDateTime queTime;
|
||||
|
||||
@ApiModelProperty(value = "是否解答")
|
||||
@TableField("ANSWER_FLAG")
|
||||
private BigDecimal answerFlag;
|
||||
|
||||
@ApiModelProperty(value = "是否有效")
|
||||
@TableField("VALID_FLAG")
|
||||
private BigDecimal validFlag;
|
||||
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
@TableField("CREATED_TIME")
|
||||
private LocalDateTime createdTime;
|
||||
|
||||
@TableField("CREATED_USER")
|
||||
private String createdUser;
|
||||
|
||||
@ApiModelProperty(value = "修改时间")
|
||||
@TableField("MODIFY_TIME")
|
||||
private LocalDateTime modifyTime;
|
||||
|
||||
@TableField("MODIFY_USER")
|
||||
private String modifyUser;
|
||||
|
||||
|
||||
}
|
||||
+9
-7
@@ -220,13 +220,15 @@ public class SarStandardComplianceAssessResultController {
|
||||
for (SarStandardComplianceProductAssess s:sarStandardCompliance) {
|
||||
if (null!=s.getStandardItem()) {
|
||||
String[] as=(s.getStandardItem()+".").split("\\.");
|
||||
if (orderKey.contains(Integer.valueOf(as[0].trim().toString()))) {
|
||||
stringMap.get(Integer.valueOf(as[0].trim().toString())).add(s);
|
||||
} else {
|
||||
orderKey.add(Integer.valueOf(as[0].trim().toString()));
|
||||
List<SarStandardComplianceProductAssess> assesses2 = new ArrayList<>();
|
||||
assesses2.add(s);
|
||||
stringMap.put(Integer.valueOf(as[0].trim().toString()), assesses2);
|
||||
if(StringUtils.isNumeric(as[0].trim())){
|
||||
if (orderKey.contains(Integer.valueOf(as[0].trim().toString()))) {
|
||||
stringMap.get(Integer.valueOf(as[0].trim().toString())).add(s);
|
||||
} else {
|
||||
orderKey.add(Integer.valueOf(as[0].trim().toString()));
|
||||
List<SarStandardComplianceProductAssess> assesses2 = new ArrayList<>();
|
||||
assesses2.add(s);
|
||||
stringMap.put(Integer.valueOf(as[0].trim().toString()), assesses2);
|
||||
}
|
||||
}
|
||||
}else {
|
||||
if (null!=stringMap.get(0)) {
|
||||
|
||||
+1
-1
@@ -829,7 +829,7 @@ public class SarStandardsInfoController extends BaseController<SarStandardsInfo>
|
||||
return "1";
|
||||
}
|
||||
|
||||
|
||||
//处理 代替被代替数据 关系
|
||||
@ApiOperation(value = "国内海外数据处理接口")
|
||||
@GetMapping("/replaceBdtbzhforDtbzh")
|
||||
public String replaceBdtbzhforDtbzh(SarStandardsInfo sarStandardsInfo) {
|
||||
|
||||
+15
@@ -1,10 +1,13 @@
|
||||
package com.adc.da.slrs.sarStandardsInfo.dao;
|
||||
|
||||
import com.adc.da.slrs.sarStandardsInfo.entity.DSarStandardDTO;
|
||||
import com.adc.da.slrs.sarStandardsInfo.entity.RecommendVO;
|
||||
import com.adc.da.slrs.sarStandardsInfo.entity.SarStandardsInfo;
|
||||
import com.adc.da.slrs.sarStandardsInfo.entity.SarStandardsInfoEOPage;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
@@ -21,6 +24,16 @@ import java.util.List;
|
||||
@Repository
|
||||
public interface SarStandardsInfoDao extends BaseMapper<SarStandardsInfo> {
|
||||
|
||||
String updateStateScheduledSql = "SELECT A.*,B.SSRQ,B.BDTBZH FROM sar_standards_info A LEFT JOIN sar_stand_attr_info B ON B.STAND_ID = A.ID ${ew.customSqlSegment}";
|
||||
|
||||
/**
|
||||
* 自动更新文本状态通用查询
|
||||
* @param queryWrapper
|
||||
* @return
|
||||
*/
|
||||
@Select(updateStateScheduledSql)
|
||||
List<SarStandardsInfo> getStateScheduledList(@Param("ew") QueryWrapper queryWrapper);
|
||||
|
||||
List<SarStandardsInfo> getSarStandardsInfoPage(@Param("page") SarStandardsInfoEOPage page,@Param("mark")String mark);
|
||||
|
||||
List<SarStandardsInfo> getSarStandardsInfoByNum(@Param("page") SarStandardsInfoEOPage page,@Param("mark")String mark);
|
||||
@@ -84,4 +97,6 @@ public interface SarStandardsInfoDao extends BaseMapper<SarStandardsInfo> {
|
||||
|
||||
List<String> selectIdFormDTBZH(String DTBZHCode);
|
||||
|
||||
List<DSarStandardDTO> dealWithDS(@Param("type") String standType, @Param("status")List<String> strings);
|
||||
|
||||
}
|
||||
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
package com.adc.da.slrs.sarStandardsInfo.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class DSarStandardDTO implements Serializable {
|
||||
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
@ApiModelProperty(value = "主键")
|
||||
@TableId("ID")
|
||||
private String id;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String SSRQ;
|
||||
|
||||
// 新添加字段
|
||||
@ApiModelProperty(value = "文本状态")
|
||||
@TableField("TEXT_STATUS")
|
||||
private String textStatus;
|
||||
|
||||
|
||||
|
||||
}
|
||||
+2
@@ -224,6 +224,8 @@ public class SarStandardsInfo extends BaseEntity {
|
||||
private String ZCCSSRQ;
|
||||
@TableField(exist = false)
|
||||
private String XCXSSRQ;
|
||||
@TableField(exist = false)
|
||||
private String BDTBZH;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String putTime2;
|
||||
|
||||
Reference in New Issue
Block a user