feat: There is no way the, update state 30%
This commit is contained in:
@@ -0,0 +1,246 @@
|
||||
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.stereotype.Component;
|
||||
|
||||
import java.sql.Clob;
|
||||
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 = "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("hc99551723c");
|
||||
// 即将实施
|
||||
list.add("hb0iy9z23c");
|
||||
QueryWrapper wrapper = new QueryWrapper();
|
||||
wrapper.eq("A.VALID_FLAG","0");
|
||||
wrapper.in("A.TEXT_STATUS",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 dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||
|
||||
LocalDateTime parse = LocalDateTime.parse(s, dtf);
|
||||
// 实施日期是否大于当前日期
|
||||
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 dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||
|
||||
LocalDateTime parse = LocalDateTime.parse(s, dtf);
|
||||
// 实施日期是否小于当前时间
|
||||
return parse.isBefore(now);
|
||||
}
|
||||
return false;
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
return !dateIsBeforeList.isEmpty();
|
||||
}
|
||||
return false;
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
// N个实施日期中大于当前日期 执行逻辑
|
||||
if(!getStateScheduledListToIsAfter.isEmpty()){
|
||||
execStandDate(getStateScheduledListToIsAfter,"hb0iy9z23c");
|
||||
}
|
||||
|
||||
// N个实施日期中小于当前时间 执行逻辑
|
||||
if(!getStateScheduledListToIsBefore.isEmpty()){
|
||||
execStandDate(getStateScheduledListToIsAfter,"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 = "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");
|
||||
|
||||
|
||||
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 {
|
||||
for (SarBussionessStand info : infoList) {
|
||||
info.setTextStatusBuss(textStatusStand);
|
||||
bussAttrInfoShowSearchDetails(info);
|
||||
if (info.getAttrInfoMap() != null) {
|
||||
info.setSarStandAttrEOStr(JSONObject.toJSONString(info.getAttrInfoMap()));
|
||||
}
|
||||
createStandMQService.sendBussStandMQ(info,"update"); }
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取属性字段
|
||||
* @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,279 @@
|
||||
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 42 17 * * ?")
|
||||
// @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.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 = "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");
|
||||
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
+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";
|
||||
|
||||
/**
|
||||
* 自动更新文本状态通用查询
|
||||
* @param queryWrapper
|
||||
* @return
|
||||
*/
|
||||
@Select(updateStateScheduledSql)
|
||||
List<SarBussionessStand> getStateScheduledList(@Param("ew") QueryWrapper queryWrapper);
|
||||
|
||||
List<SarBussionessStand> queryByBussStateSync(SarBussionessStand sarBussionessStand);
|
||||
|
||||
SarBussionessStand getStandInfoByReviseStatus(String reviseStatus);
|
||||
|
||||
+12
@@ -3,8 +3,10 @@ package com.adc.da.slrs.sarStandardsInfo.dao;
|
||||
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 +23,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);
|
||||
|
||||
Reference in New Issue
Block a user