Merge remote-tracking branch 'origin/fix_foton_20230613' into fix_foton_20230613
This commit is contained in:
@@ -195,7 +195,7 @@ public class ProcessTimer {
|
||||
busMes.setJson(jsonObject.toJSONString());
|
||||
busMes.setUserId(jsonObject.getString("revisionId"));
|
||||
Wrapper<String> wrapper=workFlowFeignClient.completeTaskByUserId(busMes);
|
||||
log.info("政策课题组会后流程已发起");
|
||||
log.info("政策课题组会后流程已发起,任务ID:{},UserID:{}",busMes.getTaskIds(),busMes.getUserId());
|
||||
}
|
||||
}
|
||||
log.info("=================================政策课题组会后流程定时任务启动=====================================");
|
||||
@@ -226,7 +226,7 @@ public class ProcessTimer {
|
||||
busMes.setUserId(result);
|
||||
|
||||
Wrapper<String> wrapper=workFlowFeignClient.completeTaskByUserId(busMes);
|
||||
System.out.println("标准化活动会后流程自动发起");
|
||||
log.info("标准化活动会后流程自动发起,任务IDS:{},UserID:{}",busMes.getTaskIds(),busMes.getUserId());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+247
-247
@@ -1,250 +1,250 @@
|
||||
package com.adc.da.scheduledState.server;
|
||||
|
||||
import com.adc.da.common.GetBeanUtil;
|
||||
import com.adc.da.common.SarTypeEnum;
|
||||
import com.adc.da.mq.CreateStandMQService;
|
||||
import com.adc.da.person.service.IPersonCollectEOService;
|
||||
import com.adc.da.search.bean.SearchCenter;
|
||||
import com.adc.da.search.server.ResetSearchCenterService;
|
||||
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.sarUpdLog.service.ISarUpdLogService;
|
||||
import com.adc.da.sys.dao.DicTypeEODao;
|
||||
import com.adc.da.utils.util.FieldConvertUtil;
|
||||
import com.adc.da.utils.util.InitStandAttrUtil;
|
||||
import com.adc.da.utils.util.Utils;
|
||||
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 java.sql.Clob;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Description: TODO
|
||||
* @author: super_liu
|
||||
* @date: 2022年01月25日 3:34
|
||||
*/
|
||||
|
||||
@Slf4j
|
||||
public class UpdateStateBussSyncFz implements Runnable {
|
||||
Logger logger = LoggerFactory.getLogger(UpdateStateBussSyncFz.class);
|
||||
|
||||
private DicTypeEODao dicTypeEODao;
|
||||
|
||||
private SarStandItemsDao standItemsDao;
|
||||
|
||||
private CreateStandMQService createStandMQService;
|
||||
|
||||
private IPersonCollectEOService personCollectEOService;
|
||||
|
||||
private SarBussionessStandDao sarBussionessStandDao;
|
||||
|
||||
private ISarBussionessStandService iSarBussionessStandService;
|
||||
|
||||
private ISarBussStandAttrInfoService sarBussStandAttrInfoService;
|
||||
|
||||
private SarBussStandAttrInfoDao sarBussStandAttrInfoEODao;
|
||||
|
||||
private ISarUpdLogService sarUpdLogEOService;
|
||||
|
||||
/**
|
||||
* 根据配置文件设置是否开启定时器
|
||||
*/
|
||||
@Value("${isNotScheduled}")
|
||||
private boolean isNotScheduled; //是否开启定时器
|
||||
|
||||
public UpdateStateBussSyncFz(){
|
||||
sarBussionessStandDao = GetBeanUtil.getApplicationContext().getBean(SarBussionessStandDao.class);
|
||||
createStandMQService = GetBeanUtil.getApplicationContext().getBean(CreateStandMQService.class);
|
||||
iSarBussionessStandService = GetBeanUtil.getApplicationContext().getBean(ISarBussionessStandService.class);
|
||||
dicTypeEODao = GetBeanUtil.getApplicationContext().getBean(DicTypeEODao.class);
|
||||
personCollectEOService = GetBeanUtil.getApplicationContext().getBean(IPersonCollectEOService.class);
|
||||
sarBussStandAttrInfoEODao = GetBeanUtil.getApplicationContext().getBean(SarBussStandAttrInfoDao.class);
|
||||
sarUpdLogEOService = GetBeanUtil.getApplicationContext().getBean(ISarUpdLogService.class);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 每天0点1分执行 企标标准文本状态被代替逻辑 自动变更作废状态
|
||||
*/
|
||||
@Override
|
||||
public void run() {
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
||||
// 每天0点1分执行 企标标准文本状态被代替逻辑 自动变更作废状态
|
||||
// @Scheduled(cron="0 0 1 1 * ?")
|
||||
// @Scheduled(cron="*/60 * * * * ?")
|
||||
// @Scheduled(cron = "0 1 0 * * ?")
|
||||
// @Async
|
||||
// public void BussScheduledToAbolish(){
|
||||
// if(isNotScheduled){
|
||||
//package com.adc.da.scheduledState.server;
|
||||
//
|
||||
//import com.adc.da.common.GetBeanUtil;
|
||||
//import com.adc.da.common.SarTypeEnum;
|
||||
//import com.adc.da.mq.CreateStandMQService;
|
||||
//import com.adc.da.person.service.IPersonCollectEOService;
|
||||
//import com.adc.da.search.bean.SearchCenter;
|
||||
//import com.adc.da.search.server.ResetSearchCenterService;
|
||||
//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.sarUpdLog.service.ISarUpdLogService;
|
||||
//import com.adc.da.sys.dao.DicTypeEODao;
|
||||
//import com.adc.da.utils.util.FieldConvertUtil;
|
||||
//import com.adc.da.utils.util.InitStandAttrUtil;
|
||||
//import com.adc.da.utils.util.Utils;
|
||||
//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 java.sql.Clob;
|
||||
//import java.util.*;
|
||||
//import java.util.stream.Collectors;
|
||||
//
|
||||
///**
|
||||
// * @Description: TODO
|
||||
// * @author: super_liu
|
||||
// * @date: 2022年01月25日 3:34
|
||||
// */
|
||||
//
|
||||
//@Slf4j
|
||||
//public class UpdateStateBussSyncFz implements Runnable {
|
||||
// Logger logger = LoggerFactory.getLogger(UpdateStateBussSyncFz.class);
|
||||
//
|
||||
// private DicTypeEODao dicTypeEODao;
|
||||
//
|
||||
// private SarStandItemsDao standItemsDao;
|
||||
//
|
||||
// private CreateStandMQService createStandMQService;
|
||||
//
|
||||
// private IPersonCollectEOService personCollectEOService;
|
||||
//
|
||||
// private SarBussionessStandDao sarBussionessStandDao;
|
||||
//
|
||||
// private ISarBussionessStandService iSarBussionessStandService;
|
||||
//
|
||||
// private ISarBussStandAttrInfoService sarBussStandAttrInfoService;
|
||||
//
|
||||
// private SarBussStandAttrInfoDao sarBussStandAttrInfoEODao;
|
||||
//
|
||||
// private ISarUpdLogService sarUpdLogEOService;
|
||||
//
|
||||
// /**
|
||||
// * 根据配置文件设置是否开启定时器
|
||||
// */
|
||||
// @Value("${isNotScheduled}")
|
||||
// private boolean isNotScheduled; //是否开启定时器
|
||||
//
|
||||
// public UpdateStateBussSyncFz(){
|
||||
// sarBussionessStandDao = GetBeanUtil.getApplicationContext().getBean(SarBussionessStandDao.class);
|
||||
// createStandMQService = GetBeanUtil.getApplicationContext().getBean(CreateStandMQService.class);
|
||||
// iSarBussionessStandService = GetBeanUtil.getApplicationContext().getBean(ISarBussionessStandService.class);
|
||||
// dicTypeEODao = GetBeanUtil.getApplicationContext().getBean(DicTypeEODao.class);
|
||||
// personCollectEOService = GetBeanUtil.getApplicationContext().getBean(IPersonCollectEOService.class);
|
||||
// sarBussStandAttrInfoEODao = GetBeanUtil.getApplicationContext().getBean(SarBussStandAttrInfoDao.class);
|
||||
// sarUpdLogEOService = GetBeanUtil.getApplicationContext().getBean(ISarUpdLogService.class);
|
||||
// }
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * 每天0点1分执行 企标标准文本状态被代替逻辑 自动变更作废状态
|
||||
// */
|
||||
// @Override
|
||||
// public void run() {
|
||||
// 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");
|
||||
|
||||
saveUpdateLog(info,textStatusStand);
|
||||
|
||||
// 只批量更新文本字段
|
||||
SarBussionessStand newInfo = new SarBussionessStand();
|
||||
newInfo.setTextStatusBuss(textStatusStand);
|
||||
newInfo.setId(info.getId());
|
||||
newInfo.setModifyTime(new Date());
|
||||
list.add(newInfo);
|
||||
}
|
||||
|
||||
if(!list.isEmpty()){
|
||||
iSarBussionessStandService.updateBatchById(list);
|
||||
}
|
||||
}
|
||||
|
||||
public void saveUpdateLog(SarBussionessStand sarStandardsInfoEO, String textStatusStand){
|
||||
try {
|
||||
Map<String, Object> newMap = new HashMap<>();
|
||||
newMap.put("textStatus", verifyObj(textStatusStand));
|
||||
Map<String, Object> oldMap = new HashMap<>();
|
||||
oldMap.put("textStatus", verifyObj(sarStandardsInfoEO.getTextStatusBuss()));
|
||||
|
||||
String content = sarStandardsInfoEO.getStandCode() + " 《" + sarStandardsInfoEO.getStandName() + "》";
|
||||
sarUpdLogEOService.createUpdateLog(SarTypeEnum.BUSINESS.getValue(),sarStandardsInfoEO.getId(),oldMap,newMap,content);
|
||||
}catch (Exception e){
|
||||
System.out.println(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private Object verifyObj(Object str) {
|
||||
return str == null ? "" : str;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取属性字段
|
||||
* @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 = null;
|
||||
if(Utils.isJson(entry.getValue().toString())){
|
||||
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点1分执行 企标标准文本状态被代替逻辑 自动变更作废状态
|
||||
//// @Scheduled(cron="0 0 1 1 * ?")
|
||||
//// @Scheduled(cron="*/60 * * * * ?")
|
||||
//// @Scheduled(cron = "0 1 0 * * ?")
|
||||
//// @Async
|
||||
//// public void BussScheduledToAbolish(){
|
||||
//// if(isNotScheduled){
|
||||
////
|
||||
//// }
|
||||
//// }
|
||||
//
|
||||
//
|
||||
// @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");
|
||||
//
|
||||
// saveUpdateLog(info,textStatusStand);
|
||||
//
|
||||
// // 只批量更新文本字段
|
||||
// SarBussionessStand newInfo = new SarBussionessStand();
|
||||
// newInfo.setTextStatusBuss(textStatusStand);
|
||||
// newInfo.setId(info.getId());
|
||||
// newInfo.setModifyTime(new Date());
|
||||
// list.add(newInfo);
|
||||
// }
|
||||
//
|
||||
// if(!list.isEmpty()){
|
||||
// iSarBussionessStandService.updateBatchById(list);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public void saveUpdateLog(SarBussionessStand sarStandardsInfoEO, String textStatusStand){
|
||||
// try {
|
||||
// Map<String, Object> newMap = new HashMap<>();
|
||||
// newMap.put("textStatus", verifyObj(textStatusStand));
|
||||
// Map<String, Object> oldMap = new HashMap<>();
|
||||
// oldMap.put("textStatus", verifyObj(sarStandardsInfoEO.getTextStatusBuss()));
|
||||
//
|
||||
// String content = sarStandardsInfoEO.getStandCode() + " 《" + sarStandardsInfoEO.getStandName() + "》";
|
||||
// sarUpdLogEOService.createUpdateLog(SarTypeEnum.BUSINESS.getValue(),sarStandardsInfoEO.getId(),oldMap,newMap,content);
|
||||
// }catch (Exception e){
|
||||
// System.out.println(e.getMessage());
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// private Object verifyObj(Object str) {
|
||||
// return str == null ? "" : str;
|
||||
// }
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * 获取属性字段
|
||||
// * @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 = null;
|
||||
// if(Utils.isJson(entry.getValue().toString())){
|
||||
// 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);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//}
|
||||
|
||||
+298
-298
@@ -1,298 +1,298 @@
|
||||
package com.adc.da.scheduledState.server;
|
||||
|
||||
import com.adc.da.common.GetBeanUtil;
|
||||
import com.adc.da.mq.CreateStandMQService;
|
||||
import com.adc.da.person.service.IPersonCollectEOService;
|
||||
import com.adc.da.search.bean.SearchCenter;
|
||||
import com.adc.da.search.server.ResetSearchCenterService;
|
||||
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.slrs.sarUpdLog.service.ISarUpdLogService;
|
||||
import com.adc.da.slrs.sysLog.entity.SysLog;
|
||||
import com.adc.da.sys.dao.DicTypeEODao;
|
||||
import com.adc.da.utils.util.FieldConvertUtil;
|
||||
import com.adc.da.utils.util.InitStandAttrUtil;
|
||||
import com.adc.da.utils.util.Utils;
|
||||
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 java.sql.Clob;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Description: TODO
|
||||
* @author: super_liu
|
||||
* @date: 2022年01月25日 3:34
|
||||
*/
|
||||
|
||||
@Slf4j
|
||||
public class UpdateStateStandSyncFz implements Runnable {
|
||||
Logger logger = LoggerFactory.getLogger(UpdateStateStandSyncFz.class);
|
||||
|
||||
private DicTypeEODao dicTypeEODao;
|
||||
|
||||
private SarStandItemsDao standItemsDao;
|
||||
|
||||
private CreateStandMQService createStandMQService;
|
||||
|
||||
private IPersonCollectEOService personCollectEOService;
|
||||
|
||||
private SarStandAttrInfoDao sarStandAttrInfoEODao;
|
||||
|
||||
private SarStandardsInfoDao sarStandardsInfoDao;
|
||||
|
||||
private ISarStandardsInfoService iSarStandardsInfoService;
|
||||
|
||||
private ISarStandAttrInfoService sarStandAttrInfoEOService;
|
||||
|
||||
private ISarUpdLogService sarUpdLogEOService;
|
||||
|
||||
|
||||
/**
|
||||
* 根据配置文件设置是否开启定时器
|
||||
*/
|
||||
@Value("${isNotScheduled}")
|
||||
private boolean isNotScheduled; //是否开启定时器
|
||||
|
||||
|
||||
public UpdateStateStandSyncFz(){
|
||||
dicTypeEODao = GetBeanUtil.getApplicationContext().getBean(DicTypeEODao.class);
|
||||
standItemsDao = GetBeanUtil.getApplicationContext().getBean(SarStandItemsDao.class);
|
||||
createStandMQService = GetBeanUtil.getApplicationContext().getBean(CreateStandMQService.class);
|
||||
personCollectEOService = GetBeanUtil.getApplicationContext().getBean(IPersonCollectEOService.class);
|
||||
sarStandAttrInfoEODao = GetBeanUtil.getApplicationContext().getBean(SarStandAttrInfoDao.class);
|
||||
sarStandardsInfoDao = GetBeanUtil.getApplicationContext().getBean(SarStandardsInfoDao.class);
|
||||
iSarStandardsInfoService = GetBeanUtil.getApplicationContext().getBean(ISarStandardsInfoService.class);
|
||||
sarStandAttrInfoEOService = GetBeanUtil.getApplicationContext().getBean(ISarStandAttrInfoService.class);
|
||||
sarUpdLogEOService = GetBeanUtil.getApplicationContext().getBean(ISarUpdLogService.class);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 每天0点1分执行 国内标准文本状态被代替逻辑 标准自动变更废止
|
||||
*/
|
||||
@Override
|
||||
public void run() {
|
||||
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<>();
|
||||
List<SarStandardsInfo> bdtStandToNotGBList = 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());
|
||||
int bdtStandNumCount = bdtList.size();
|
||||
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);
|
||||
//被代替标准号中所有有效标准的状态都是现行有效状态
|
||||
List<SarStandardsInfo> fzList = queryGBList.stream().filter(info1 ->
|
||||
"vsaga7nwub".equals(info1.getTextStatus()) || "qke0ckro2p".equals(info1.getTextStatus())
|
||||
|| "chblaarg77".equals(info1.getTextStatus())).collect(Collectors.toList());
|
||||
// 检查当前标准是否为GB类
|
||||
if(StringUtils.equals(info.getStandSort(),"GB")){
|
||||
if(fzList.size() == bdtStandNumCount){//当所有标准都是现行有效状态时
|
||||
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);
|
||||
}
|
||||
}
|
||||
}else{//非GB类
|
||||
if(fzList.size()>0){
|
||||
bdtStandToNotGBList.add(info);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
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.error(e.getMessage(),e);
|
||||
}
|
||||
}
|
||||
|
||||
@Async
|
||||
public void execStandDate(List<SarStandardsInfo> infoList, String textStatusStand) throws Exception {
|
||||
List<SarStandardsInfo> list = new ArrayList<>();
|
||||
for (SarStandardsInfo info : infoList) {
|
||||
saveUpdateLog(info,textStatusStand);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
public void saveUpdateLog(SarStandardsInfo sarStandardsInfoEO, String textStatusStand){
|
||||
try {
|
||||
Map<String, Object> newMap = new HashMap<>();
|
||||
newMap.put("textStatus", verifyObj(textStatusStand));
|
||||
Map<String, Object> oldMap = new HashMap<>();
|
||||
oldMap.put("textStatus", verifyObj(sarStandardsInfoEO.getTextStatus()));
|
||||
|
||||
// 增加关联事件
|
||||
String number = sarStandardsInfoEO.getStandSort() + " " + sarStandardsInfoEO.getStandNumber();
|
||||
if (StringUtils.isNotBlank(sarStandardsInfoEO.getStandYear())) {
|
||||
number += "-" + sarStandardsInfoEO.getStandYear();
|
||||
}
|
||||
String content = number + " 《" + sarStandardsInfoEO.getStandName() + "》";
|
||||
sarUpdLogEOService.createUpdateLog(sarStandardsInfoEO.getStandType() + "_STAND", sarStandardsInfoEO.getId(), oldMap, newMap, content);
|
||||
}catch (Exception e){
|
||||
System.out.println(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private Object verifyObj(Object str) {
|
||||
return str == null ? "" : str;
|
||||
}
|
||||
|
||||
|
||||
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 = null;
|
||||
if(Utils.isJson(entry.getValue().toString())){
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
//package com.adc.da.scheduledState.server;
|
||||
//
|
||||
//import com.adc.da.common.GetBeanUtil;
|
||||
//import com.adc.da.mq.CreateStandMQService;
|
||||
//import com.adc.da.person.service.IPersonCollectEOService;
|
||||
//import com.adc.da.search.bean.SearchCenter;
|
||||
//import com.adc.da.search.server.ResetSearchCenterService;
|
||||
//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.slrs.sarUpdLog.service.ISarUpdLogService;
|
||||
//import com.adc.da.slrs.sysLog.entity.SysLog;
|
||||
//import com.adc.da.sys.dao.DicTypeEODao;
|
||||
//import com.adc.da.utils.util.FieldConvertUtil;
|
||||
//import com.adc.da.utils.util.InitStandAttrUtil;
|
||||
//import com.adc.da.utils.util.Utils;
|
||||
//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 java.sql.Clob;
|
||||
//import java.util.*;
|
||||
//import java.util.stream.Collectors;
|
||||
//
|
||||
///**
|
||||
// * @Description: TODO
|
||||
// * @author: super_liu
|
||||
// * @date: 2022年01月25日 3:34
|
||||
// */
|
||||
//
|
||||
//@Slf4j
|
||||
//public class UpdateStateStandSyncFz implements Runnable {
|
||||
// Logger logger = LoggerFactory.getLogger(UpdateStateStandSyncFz.class);
|
||||
//
|
||||
// private DicTypeEODao dicTypeEODao;
|
||||
//
|
||||
// private SarStandItemsDao standItemsDao;
|
||||
//
|
||||
// private CreateStandMQService createStandMQService;
|
||||
//
|
||||
// private IPersonCollectEOService personCollectEOService;
|
||||
//
|
||||
// private SarStandAttrInfoDao sarStandAttrInfoEODao;
|
||||
//
|
||||
// private SarStandardsInfoDao sarStandardsInfoDao;
|
||||
//
|
||||
// private ISarStandardsInfoService iSarStandardsInfoService;
|
||||
//
|
||||
// private ISarStandAttrInfoService sarStandAttrInfoEOService;
|
||||
//
|
||||
// private ISarUpdLogService sarUpdLogEOService;
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * 根据配置文件设置是否开启定时器
|
||||
// */
|
||||
// @Value("${isNotScheduled}")
|
||||
// private boolean isNotScheduled; //是否开启定时器
|
||||
//
|
||||
//
|
||||
// public UpdateStateStandSyncFz(){
|
||||
// dicTypeEODao = GetBeanUtil.getApplicationContext().getBean(DicTypeEODao.class);
|
||||
// standItemsDao = GetBeanUtil.getApplicationContext().getBean(SarStandItemsDao.class);
|
||||
// createStandMQService = GetBeanUtil.getApplicationContext().getBean(CreateStandMQService.class);
|
||||
// personCollectEOService = GetBeanUtil.getApplicationContext().getBean(IPersonCollectEOService.class);
|
||||
// sarStandAttrInfoEODao = GetBeanUtil.getApplicationContext().getBean(SarStandAttrInfoDao.class);
|
||||
// sarStandardsInfoDao = GetBeanUtil.getApplicationContext().getBean(SarStandardsInfoDao.class);
|
||||
// iSarStandardsInfoService = GetBeanUtil.getApplicationContext().getBean(ISarStandardsInfoService.class);
|
||||
// sarStandAttrInfoEOService = GetBeanUtil.getApplicationContext().getBean(ISarStandAttrInfoService.class);
|
||||
// sarUpdLogEOService = GetBeanUtil.getApplicationContext().getBean(ISarUpdLogService.class);
|
||||
// }
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * 每天0点1分执行 国内标准文本状态被代替逻辑 标准自动变更废止
|
||||
// */
|
||||
// @Override
|
||||
// public void run() {
|
||||
// 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<>();
|
||||
// List<SarStandardsInfo> bdtStandToNotGBList = 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());
|
||||
// int bdtStandNumCount = bdtList.size();
|
||||
// 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);
|
||||
// //被代替标准号中所有有效标准的状态都是现行有效状态
|
||||
// List<SarStandardsInfo> fzList = queryGBList.stream().filter(info1 ->
|
||||
// "vsaga7nwub".equals(info1.getTextStatus()) || "qke0ckro2p".equals(info1.getTextStatus())
|
||||
// || "chblaarg77".equals(info1.getTextStatus())).collect(Collectors.toList());
|
||||
// // 检查当前标准是否为GB类
|
||||
// if(StringUtils.equals(info.getStandSort(),"GB")){
|
||||
// if(fzList.size() == bdtStandNumCount){//当所有标准都是现行有效状态时
|
||||
// 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);
|
||||
// }
|
||||
// }
|
||||
// }else{//非GB类
|
||||
// if(fzList.size()>0){
|
||||
// bdtStandToNotGBList.add(info);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
//
|
||||
// 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.error(e.getMessage(),e);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Async
|
||||
// public void execStandDate(List<SarStandardsInfo> infoList, String textStatusStand) throws Exception {
|
||||
// List<SarStandardsInfo> list = new ArrayList<>();
|
||||
// for (SarStandardsInfo info : infoList) {
|
||||
// saveUpdateLog(info,textStatusStand);
|
||||
// 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);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public void saveUpdateLog(SarStandardsInfo sarStandardsInfoEO, String textStatusStand){
|
||||
// try {
|
||||
// Map<String, Object> newMap = new HashMap<>();
|
||||
// newMap.put("textStatus", verifyObj(textStatusStand));
|
||||
// Map<String, Object> oldMap = new HashMap<>();
|
||||
// oldMap.put("textStatus", verifyObj(sarStandardsInfoEO.getTextStatus()));
|
||||
//
|
||||
// // 增加关联事件
|
||||
// String number = sarStandardsInfoEO.getStandSort() + " " + sarStandardsInfoEO.getStandNumber();
|
||||
// if (StringUtils.isNotBlank(sarStandardsInfoEO.getStandYear())) {
|
||||
// number += "-" + sarStandardsInfoEO.getStandYear();
|
||||
// }
|
||||
// String content = number + " 《" + sarStandardsInfoEO.getStandName() + "》";
|
||||
// sarUpdLogEOService.createUpdateLog(sarStandardsInfoEO.getStandType() + "_STAND", sarStandardsInfoEO.getId(), oldMap, newMap, content);
|
||||
// }catch (Exception e){
|
||||
// System.out.println(e.getMessage());
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// private Object verifyObj(Object str) {
|
||||
// return str == null ? "" : str;
|
||||
// }
|
||||
//
|
||||
//
|
||||
// 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 = null;
|
||||
// if(Utils.isJson(entry.getValue().toString())){
|
||||
// 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);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//}
|
||||
|
||||
+4
-1
@@ -75,7 +75,8 @@ public class StateSync {
|
||||
if(isNotScheduled){
|
||||
try{
|
||||
Thread.sleep(2000);
|
||||
logger.info("月初:"+Thread.currentThread().getName() + " cron=0 0 1 1 * ? --- " + new Date()+"---START-01");
|
||||
// logger.info("月初:"+Thread.currentThread().getName() + " cron=0 0 1 1 * ? --- " + new Date()+"---START-01");
|
||||
logger.info("每天凌晨:{}, corn=0 0 0 * * ? --- {},START-01",Thread.currentThread().getName(),new Date());
|
||||
// String nowFirst = DateUtil.firstOneDay(DateUtil.printDate(new Date()));
|
||||
// String nowFin = DateUtil.finOneDay(DateUtil.printDate(new Date()));
|
||||
// String nowFinByQuery = DateUtil.addDay(DateUtil.finOneDay(DateUtil.printDate(new Date())),1);
|
||||
@@ -162,12 +163,14 @@ public class StateSync {
|
||||
// 复审表操作逻辑 新增
|
||||
if(!insList.isEmpty()){
|
||||
bussionessStandStateService.saveBatch(insList);
|
||||
insList.forEach(each -> logger.info("复审表操作逻辑 新增:企业标准信息复审ID:{},标准ID:{},标准名称:{}",each.getId(),each.getStandId(),each.getStandName()));
|
||||
}
|
||||
|
||||
// 复审表操作逻辑 更新
|
||||
if(!updList.isEmpty()){
|
||||
// List<SarBussionessStandState> updListResult = updList.stream().peek(p -> p.setModifyTime(DateUtil.printDateAll(new Date()))).collect(Collectors.toList());
|
||||
bussionessStandStateService.updateBatchById(updList);
|
||||
updList.forEach(each -> logger.info("复审表操作逻辑 更新:企业标准信息复审ID:{},标准ID:{},标准名称:{}",each.getId(),each.getStandId(),each.getStandName()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -61,12 +61,6 @@ public class OnlyofficePdfUtil {
|
||||
HttpEntity entityRes = response.getEntity();
|
||||
if (entityRes != null) {
|
||||
InputStream content = entityRes.getContent();
|
||||
// byte[] getData = readInputStream(content);
|
||||
// File file = new File(filePath);
|
||||
// FileOutputStream fos = new FileOutputStream(file);
|
||||
// fos.write(getData);
|
||||
// fos.close();
|
||||
// File file = new File(Objects.requireNonNull(this.getClass().getClassLoader().getResource("")).getPath()+ filePdfName);
|
||||
File file = new File(filePath);
|
||||
FileUtils.copyInputStreamToFile(content,file);
|
||||
content.close();
|
||||
@@ -103,8 +97,6 @@ public class OnlyofficePdfUtil {
|
||||
}
|
||||
|
||||
public static String convertFile(String onlyOfficeUrl,String titleName,String key, String onlineFilePath) throws Exception{
|
||||
//String url = "http://47.92.92.38:8103/7.2.1-34/ConvertService.ashx";
|
||||
// String url = "http://10.100.5.116:8088/7.2.1-34/ConvertService.ashx";
|
||||
Map<String,Object> map = new HashMap<>();
|
||||
map.put("async",false);
|
||||
map.put("filetype","docx");
|
||||
@@ -114,7 +106,6 @@ public class OnlyofficePdfUtil {
|
||||
// map.put("url","https://10.100.5.111:3306/file/"+onlineFilePath);
|
||||
map.put("url","https://srms.foton.com.cn/file/"+onlineFilePath);
|
||||
logger.info("=======================================https://srms.foton.com.cn/file/"+onlineFilePath);
|
||||
//map.put("url","https://srms.foton.com.cn/file/model/task_768330d8/task_768330d8_top_768330d8_node.docx");
|
||||
JSONObject requestJson = new JSONObject(map);
|
||||
logger.info("=========================post参数:{}",requestJson);
|
||||
// 创建HttpClientBuilder
|
||||
@@ -130,7 +121,6 @@ public class OnlyofficePdfUtil {
|
||||
.setConnectTimeout(60000)
|
||||
.build();
|
||||
httpPost.setConfig(requestConfig);
|
||||
// httpPost.addHeader("Content-Type","application/json");
|
||||
CloseableHttpResponse response = null;
|
||||
try {
|
||||
//设置post请求方式为JSON
|
||||
|
||||
Reference in New Issue
Block a user