feat: There is no way the,Laws

This commit is contained in:
super_liu
2021-11-01 17:59:24 +08:00
parent f54c8ea63b
commit cab90f06ee
16 changed files with 1315 additions and 45 deletions
@@ -0,0 +1,39 @@
package com.adc.da.workFlow.controller;
import com.adc.da.base.web.BaseController;
import com.adc.da.http.ResponseMessage;
import com.adc.da.http.Result;
import com.adc.da.slrs.sarStandardsInfo.entity.ActSarItemsEO;
import com.adc.da.workFlow.service.ActSarItemsEOService;
import com.adc.da.workFlow.service.ActSarItemsLawsEOService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/${restPath}/lawss/actSarItemsLaws")
@Api(description = "|ActSarItemsEO|")
public class ActSarItemsLawsEOController extends BaseController<ActSarItemsEO> {
@Autowired
private ActSarItemsLawsEOService actSarItemsEOService;
// private static final Logger logger = LoggerFactory.getLogger(AttFileEOController.class);
@ApiOperation(value = "|SarLawsStandInfo|政策入库流程")
@PostMapping("/processCreateLaws")
public ResponseMessage processCreateLaws(String infoJson) throws Exception {
if (StringUtils.isNotBlank(infoJson)) {
actSarItemsEOService.processCreateLaws(infoJson);
return Result.success("入库成功");
} else {
return Result.error("传入数据json不能为空");
}
}
}
@@ -1,9 +1,11 @@
package com.adc.da.workFlow.dao;
import com.adc.da.slrs.sarStandardsInfo.entity.ActSarItemsEO;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public interface ActSarItemsEODao {
List<ActSarItemsEO> queryByPage(ActSarItemsEO actSarItemsEO);
@@ -0,0 +1,918 @@
package com.adc.da.workFlow.service;
import com.adc.da.common.PropertyTypeEnum;
import com.adc.da.common.SarConformStateEnum;
import com.adc.da.common.SarStateColorEnum;
import com.adc.da.common.SarTypeEnum;
import com.adc.da.login.util.UserUtils;
import com.adc.da.slrs.SarCompResAssess.entity.SarCompResAssess;
import com.adc.da.slrs.SarCompResAssess.service.ISarCompResAssessService;
import com.adc.da.slrs.SarCompStatusInfo.dao.SarCompStatusInfoDao;
import com.adc.da.slrs.SarCompStatusInfo.entity.SarCompStatusInfo;
import com.adc.da.slrs.SarFileSplitItems.entity.SarFileSplitItems;
import com.adc.da.slrs.SarFileSplitItems.service.ISarFileSplitItemsService;
import com.adc.da.slrs.SarStandItemVal.dao.SarStandItemValDao;
import com.adc.da.slrs.SarStandItemVal.entity.SarStandItemVal;
import com.adc.da.slrs.sarLawsAttrInfo.dao.SarLawsAttrInfoDao;
import com.adc.da.slrs.sarLawsAttrInfo.service.ISarLawsAttrInfoService;
import com.adc.da.slrs.sarLawsItemVal.dao.SarLawsItemValDao;
import com.adc.da.slrs.sarLawsItems.dao.SarLawsItemsDao;
import com.adc.da.slrs.sarLawsItems.entity.SarLawsItems;
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.sarStandItems.dao.SarStandItemsDao;
import com.adc.da.slrs.sarStandItems.entity.SarStandItems;
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.sysInfo.service.SysInfoEOService;
import com.adc.da.sys.constant.ValueStateEnum;
import com.adc.da.util.UUIDUtils;
import com.adc.da.utils.util.InitStandAttrUtil;
import com.adc.da.workFlow.dao.ActSarItemsEODao;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.SerializerFeature;
import org.apache.commons.lang.StringUtils;
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.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import java.text.SimpleDateFormat;
import java.util.*;
@Service("actSarItemsLawsEOService")
@Transactional(value = "transactionManager", readOnly = false, propagation = Propagation.REQUIRED, rollbackFor = Throwable.class)
public class ActSarItemsLawsEOService {
private static final Logger logger = LoggerFactory.getLogger(ActSarItemsLawsEOService.class);
@Autowired
private ActSarItemsEODao actSarItemsEODao;
@Autowired
private SarLawsItemsDao sarLawsItemsDao;
@Autowired
private SysInfoEOService sysInfoEOService;
@Autowired
private ISarLawsStandInfoService sarLawsStandInfoService;
@Autowired
private ISarLawsAttrInfoService iSarLawsAttrInfoService;
@Autowired
private ISarUpdLogService sarUpdLogEOService;
@Autowired
private SarCompStatusInfoDao sarCompStatusInfoEODao;
@Autowired
private ISarCompResAssessService sarCompResAssessEOService;
@Autowired
private ISarFileSplitItemsService sarFileSplitItemsEOService;
@Autowired
private SarLawsItemValDao sarLawsItemValDao;
@Value("${elas.flag}")
private boolean elasflag;
/**
* 标准解读流程入库"
* @param standJson
* @throws Exception
*/
public void createStandardRead(String standJson) throws Exception{
JSONObject object = JSONObject.parseObject(standJson);
String fileName = object.getString("fileName");
String fileType = object.getString("fileType");
String creationTime = object.getString("creationTime");
String creationUser = object.getString("creationUser");
String standId = object.getString("standId");
//数组去重
JSONArray responUserList1 = object.getJSONArray("itemList");
for (Object obj:responUserList1) {
JSONObject object1 = (JSONObject) obj;
JSONArray preResponUserList = object1.getJSONArray("zxUserId");
String oldNumber = object1.getString("oldNumber");
String itemsNum = object1.getString("itemsNum");
String itemsName = object1.getString("itemsName");
String itemsTitle = object1.getString("itemsTitle");
String applyArcticId = object1.getString("applyArcticId");
String applyArctic = object1.getString("applyArctic");
String changePoint = object1.getString("changePoint");
String technicalRequir = object1.getString("technicalRequir");
String onlineData = object1.getString("onlineData");
String newData = object1.getString("newData");
String complianceRequir = object1.getString("complianceRequir");
String complianceState = object1.getString("complianceState");
}
}
/***
* @Description: 国内外标准流程入库"
* @Author: yangxuenan
* @Date: 2020/12/7 13:48
* @Param: [standJson]
* @Return: void
*/
public void processCreateLaws(String standJson) throws Exception{
Map<String,Object> standMap = new HashMap();
standMap = JSONObject.parseObject(standJson);
if (standMap != null && !standMap.isEmpty()) {
String prcNum = String.valueOf(standMap.get("prcNum"));
String prcName = String.valueOf(standMap.get("prcName"));
String standType = String.valueOf(standMap.get("standType"));
// String isJudge = String.valueOf(standMap.get("ifIn")); //是否经过技术评估
SarLawsStandInfo sarLawsStandInfo = new SarLawsStandInfo();
// if(standMap.containsKey("standId")) {
// if (standMap.get("standId") != null && !standMap.get("standId").toString().equals("")) {
// String resId = standMap.get("standId").toString();
// //此处说明是带入的形式
// sarStandardsInfoEO.setId(resId);
// SarCompResAssess assessInfoByResId = sarCompResAssessEOService.ssessInfoByResId(resId);
// if (assessInfoByResId != null) {
// assessInfoByResId.setProcessState("2");
// sarCompResAssessEOService.updateByPrimaryKeySelective(assessInfoByResId);
// }
// }
// }
Map<String,Object> attInfoMap = new HashMap<>();
List<String> jsonArray = new ArrayList<>();
Object breakVal = null;
Object itemList = null;
for (Map.Entry<String,Object> entry : standMap.entrySet()) {
String field = entry.getKey().toUpperCase();
Object value = entry.getValue();
if (InitStandAttrUtil.queryFieldListLaws.contains(field)) {
if (value != null && value instanceof JSONArray) {
String valStr = String.valueOf(value);
List<String> valueArr = JSONArray.parseArray(valStr,String.class);
if (valueArr != null && !valueArr.isEmpty()) {
String newValue = "";
for (String val : valueArr) {
newValue += val + ",";
}
newValue = newValue.substring(0,newValue.length()-1);
value = newValue;
}
}
attInfoMap.put(field,value);
} else {
createStandBaseField(sarLawsStandInfo,entry.getKey(),value);
}
}
//处理文件
//此处需要处理之前的文件信息,防止文件丢失
// attInfoMap = saveFileMsg(attInfoMap,sarStandardsInfoEO.getFileIds(),sarStandardsInfoEO.getTextStatus());
String resData = JSON.toJSONString(attInfoMap, SerializerFeature.WriteMapNullValue);
sarLawsStandInfo.setSarStandAttrEOStr(resData);
// 根据标准号判断数据是否已存在
//2021年4月9日 此处检查当前是否存在standId
String lawsNumber = "";
if(StringUtils.isNotBlank(sarLawsStandInfo.getLawsNumber()) && !"null".equals(sarLawsStandInfo.getLawsNumber())){
lawsNumber = sarLawsStandInfo.getLawsNumber();
}
List<SarLawsStandInfo> lawsList = sarLawsStandInfoService.selectStandardsByStandNumber(lawsNumber);
// if (StringUtils.isBlank(sarStandardsInfoEO.getMenuId()) && "INLAND".equals(sarStandardsInfoEO.getStandType())) {
// sarStandardsInfoEO.setMenuId("64df1d5522bb49c09af2");
// sarStandardsInfoEO.setCountry("CN");
// } else if (StringUtils.isBlank(sarStandardsInfoEO.getMenuId()) && "FOREIGN".equals(sarStandardsInfoEO.getStandType())) {
// sarStandardsInfoEO.setMenuId("22179d54d4e640098e29");
// }
//此处判断是否是带入的标准
if(StringUtils.isNotBlank(sarLawsStandInfo.getId())) {
SarLawsStandInfo query = new SarLawsStandInfo();
query.setId(sarLawsStandInfo.getId());
sarLawsStandInfoService.attrInfoDetails(query);
Map<String, Object> attrInfoMap = query.getAttrInfoMap();
if(attInfoMap!=null && !attInfoMap.isEmpty()){
updateStandFileFieldData(attInfoMap,attrInfoMap);
resData = JSON.toJSONString(attInfoMap, SerializerFeature.WriteMapNullValue);
sarLawsStandInfo.setSarStandAttrEOStr(resData);
}
// 查询原相关流程
String relatePro = iSarLawsAttrInfoService.selectFieldValByLawsId("XGLC",sarLawsStandInfo.getId());
if (StringUtils.isNotBlank(relatePro)) {
String[] processSplit = relatePro.split(",");
Set<String> processSet = new HashSet<>();
for(String sData:processSplit){
processSet.add(sData);
}
processSet.add(prcNum);
relatePro = StringUtils.join(processSet.toArray(), ",");
} else {
relatePro = prcNum;
}
// 编辑标准
sarLawsStandInfoService.updateSarLawsStandInfo(sarLawsStandInfo);
// 编辑相关流程
iSarLawsAttrInfoService.updateLawsInfo(sarLawsStandInfo.getId(),"XGLC",relatePro);
String content = "新增一条相关流程:" +prcName+" "+prcNum;
sarUpdLogEOService.createBaseLog(sarLawsStandInfo.getId(),standType+"_STAND",content);
}else if (lawsList != null && !lawsList.isEmpty()) {//Id不存在,但是标准号存在的情况
String standId = lawsList.get(0).getId();
SarLawsStandInfo query = new SarLawsStandInfo();
query.setId(standId);
sarLawsStandInfoService.attrInfoDetails(query);
Map<String, Object> attrInfoMap = query.getAttrInfoMap();
if(attInfoMap!=null && !attInfoMap.isEmpty()){
updateStandFileFieldData(attInfoMap,attrInfoMap);
resData = JSON.toJSONString(attInfoMap, SerializerFeature.WriteMapNullValue);
sarLawsStandInfo.setSarStandAttrEOStr(resData);
}
// 查询原相关流程
String relatePro = iSarLawsAttrInfoService.selectFieldValByLawsId("XGLC",standId);
if (StringUtils.isNotBlank(relatePro)) {
String[] processSplit = relatePro.split(",");
Set<String> processSet = new HashSet<>();
for(String sData:processSplit){
processSet.add(sData);
}
processSet.add(prcNum);
relatePro = StringUtils.join(processSet.toArray(), ",");
} else {
relatePro = prcNum;
}
// 编辑标准
sarLawsStandInfo.setId(standId);
sarLawsStandInfoService.updateSarLawsStandInfo(sarLawsStandInfo);
// 编辑相关流程
iSarLawsAttrInfoService.updateLawsInfo(standId,"XGLC",relatePro);
String content = "新增一条相关流程:" +prcName+" "+prcNum;
sarUpdLogEOService.createBaseLog(standId,standType+"_STAND",content);
} else {//标准号、ID都不存在的情况
// 新增方法
sarLawsStandInfoService.createSarStandardsInfo(sarLawsStandInfo);
// 编辑相关流程
iSarLawsAttrInfoService.updateLawsInfo(sarLawsStandInfo.getId(),"XGLC",prcNum);
}
List<SarStandItems> allItems = new ArrayList<>();
//开始处理条款数据,从去重后的结果中直接处理即可
// if(itemData!=null && !itemData.isEmpty()){
// // allItems =
// saveStandItemsData(itemData, sarStandardsInfoEO);
// }
//技术评估结果入库 重构技术评估结果入库内容
// if ("0".equals(isJudge)) {
// saveCompStatusInfo(sarStandardsInfoEO,breakVal,allItems,prcNum);
// }
}
}
/***
* 标准法规入库流程中技术评估结果入库归档操作
* @param sarStandardsInfoEO
* @param allItems
* @param prcNum
*/
public void saveCompStatusInfo (SarStandardsInfo sarStandardsInfoEO,Object taskBreak,List<SarStandItems> allItems,String prcNum) throws Exception {
//首先将入库的标准条款通过之前的拆分库ID转换成入库后的条款的对应关系
Map<String,String> itemConvertDataMap = new HashMap<>();
if(allItems!=null && !allItems.isEmpty()){
for(SarStandItems itemsEO:allItems){
itemConvertDataMap.put(itemsEO.getOldId(),itemsEO.getId());
}
}
//获取本次入库的标准ID和类型
String standId = sarStandardsInfoEO.getId();//标准ID
//主要时区分国内、国外
String sarType = sarStandardsInfoEO.getStandType()+"_STAND";
//判断填写表单是哦服存在
if(taskBreak!=null){
List<SarCompStatusInfo> compStatusInfoEOS = new ArrayList<>();
//解析表单数据
String compResultStr = String.valueOf(taskBreak);
List<String> jsonArray = JSONArray.parseArray(compResultStr, String.class);
//判断数据是否正常
if (jsonArray != null && !jsonArray.isEmpty()) {
//当入库时只有标准时 itemList是空的
for (String jsonStr : jsonArray) {
if (StringUtils.isNotBlank(jsonStr)) {
Map<String, Object> jsonMap = JSONObject.parseObject(jsonStr);
if(jsonMap.containsKey("itemsList")){//开始读取条款集合数据处理结果
String itemsList = jsonMap.get("itemsList").toString();
//获取条款级别的评估集合列表
List<String> itemCompStrList = JSONArray.parseArray(itemsList, String.class);
if(itemCompStrList!=null && !itemCompStrList.isEmpty()){
for(String itemCompDataStr : itemCompStrList){
//解析每个人填写的具体评估结果
Map<String, Object> itemDataMap = JSONObject.parseObject(itemCompDataStr);
if(itemDataMap.containsKey("pgForm")){
String pgResult = itemDataMap.get("pgForm").toString();
//新旧条款ID转换
String oldItemId = itemDataMap.containsKey("id")?itemDataMap.get("id").toString():null;
//获取到评估表单
SarCompStatusInfo sarCompStatusInfoEO = JSONObject.parseObject(pgResult,SarCompStatusInfo.class);
sarCompStatusInfoEO.setId(UUIDUtils.randomUUID(32));
sarCompStatusInfoEO.setSarType(sarType);
sarCompStatusInfoEO.setSarId(standId);
//评估结果
sarCompStatusInfoEO.setSarState(itemDataMap.containsKey("jspg")?itemDataMap.get("jspg").toString():null);
//新旧条款号转换存储
if(StringUtils.isNotBlank(oldItemId)){
sarCompStatusInfoEO.setSarItemId(itemConvertDataMap.get(oldItemId));
sarCompStatusInfoEO.setSarItemState(sarCompStatusInfoEO.getSarState());
}
sarCompStatusInfoEO.setPrcNum(prcNum);
sarCompStatusInfoEO.setColor(convertColorByState(sarCompStatusInfoEO.getSarState()));//此处需要处理
sarCompStatusInfoEO.setPrcState(null);//技术评估不需要状态
sarCompStatusInfoEO.setCreationTime(new Date());
//评估人处理
sarCompStatusInfoEO.setCompPerson(itemDataMap.containsKey("foFillUser")?itemDataMap.get("foFillUser").toString():null);
sarCompStatusInfoEO.setCompTime(new Date());
compStatusInfoEOS.add(sarCompStatusInfoEO);
}
}
}else{
if(jsonMap.containsKey("pgForm")){
String pgResult = jsonMap.get("pgForm").toString();
//获取到评估表单
SarCompStatusInfo sarCompStatusInfoEO = JSONObject.parseObject(pgResult,SarCompStatusInfo.class);
sarCompStatusInfoEO.setId(UUIDUtils.randomUUID(32));
sarCompStatusInfoEO.setSarType(sarType);
sarCompStatusInfoEO.setSarId(standId);
sarCompStatusInfoEO.setSarState(jsonMap.containsKey("jspg")?jsonMap.get("jspg").toString():null);
sarCompStatusInfoEO.setPrcNum(prcNum);
sarCompStatusInfoEO.setColor(convertColorByState(sarCompStatusInfoEO.getSarState()));//此处需要处理
sarCompStatusInfoEO.setPrcState(null);//技术评估不需要状态
sarCompStatusInfoEO.setCreationTime(new Date());
sarCompStatusInfoEO.setCompPerson(jsonMap.containsKey("foFillUser")?jsonMap.get("foFillUser").toString():null);
sarCompStatusInfoEO.setCompTime(new Date());
compStatusInfoEOS.add(sarCompStatusInfoEO);
}
}
}else{//只有标准的情况下
//获取
if(jsonMap.containsKey("pgForm")){
String pgResult = jsonMap.get("pgForm").toString();
//获取到评估表单
SarCompStatusInfo sarCompStatusInfoEO = JSONObject.parseObject(pgResult,SarCompStatusInfo.class);
sarCompStatusInfoEO.setId(UUIDUtils.randomUUID(32));
sarCompStatusInfoEO.setSarType(sarType);
sarCompStatusInfoEO.setSarId(standId);
sarCompStatusInfoEO.setSarState(jsonMap.containsKey("jspg")?jsonMap.get("jspg").toString():null);
sarCompStatusInfoEO.setPrcNum(prcNum);
sarCompStatusInfoEO.setColor(convertColorByState(sarCompStatusInfoEO.getSarState()));//此处需要处理
sarCompStatusInfoEO.setPrcState(null);//技术评估不需要状态
sarCompStatusInfoEO.setCreationTime(new Date());
sarCompStatusInfoEO.setCompPerson(jsonMap.containsKey("foFillUser")?jsonMap.get("foFillUser").toString():null);
sarCompStatusInfoEO.setCompTime(new Date());
compStatusInfoEOS.add(sarCompStatusInfoEO);
}
}
}
}
}
//最后开始将评估结果入库同时将评估结果汇总后给出标准的评估结果
saveJSPGResultDataList(compStatusInfoEOS);
}
}
/**
* 入库技术评估结果
* @param compResultData
*/
private void saveJSPGResultDataList(List<SarCompStatusInfo> compResultData) throws Exception {
if(compResultData!=null && !compResultData.isEmpty()){
//1、将数据存储到记录表中
//2、汇总本次评估的结果 更新所有清单中的状态 此处有坑,如果标准评估后又在新的清单中添加的时候状态可能就是空的,
// 此时就会显示空,所以需要更换实现方法
//需要中间需要增加一层技术评估的结果,但是代价太大,2021年3月21日 无法在今天修改完,需要于2021年3月22日 整体想下这块,
// 目前的实现思路时有问题的
//正确逻辑时: 现将当前的评估结果记录到所有的技术评估结果中,然后汇总本次的评估结果内容到当前标准的技术评估汇总表中
//汇总后形成最新的评估内容,此时有2种做法 1、不记录上一次的状态 直接更新 2、记录上一次状态,新增一条整体评估结果记录
//在清单查询的时候 查询当前标准的最新一次评估结果,将评估结果不再清单中直接显示,而是在汇总表中的信息进行修改,这样能够达到
//单一标准不论在任何时间添加到清单的时候都可以查看,同时在标准的技术评估状态的时候也可以直接调用即可。不用每次评估完都需要更新
//技术清单的逻辑
/**
* 整体表关系如下:
* 基础库: 国内标准库 海外标准库 政策库
* 技术评估汇总表 资源的汇总结果记录
* 详细评估内容记录表 资源本身每次评估的详细记录
* 清单: 根据标准号到资源的汇总记录表中查询汇总结果 直接展现即可
* 目前缺少的就是资源的汇总结果记录缺失,导致查询的时候可能汇总结果会有问题
*/
//开始汇总数据以及状态变更
//首先先检查当前标准在汇总表中是否存在
Map<String,Map<String,Integer>> assessMap = new HashMap<>();
Map<String, SarCompResAssess> compResAssessEOMap = new HashMap<>();
for(SarCompStatusInfo data : compResultData){
//评估结果转换
String state = sysInfoEOService.changeCompStatus(data.getSarState());
String itemSate = sysInfoEOService.changeCompStatus(data.getSarItemState());
data.setSarState(state);
data.setSarItemState(itemSate);
if(StringUtils.equals("INLAND",data.getSarType())){
data.setSarType(SarTypeEnum.INLAND_STAND.getValue());
}else if(StringUtils.equals("FOREIGN",data.getSarType())){
data.setSarType(SarTypeEnum.FOREIGN_STAND.getValue());
}
SarCompResAssess info =null;
if(assessMap.containsKey(data.getSarId())){
info = compResAssessEOMap.get(data.getSarId());
}else{
info= sarCompResAssessEOService.getAssessInfoByResId(data.getSarId());
if(info==null){
info = new SarCompResAssess();
info.setId(UUIDUtils.randomUUID(32));
info.setAssessTime(new Date());
info.setCreatedTime(new Date());
info.setModifyTime(new Date());
info.setProcessNum(data.getPrcNum());
info.setResId(data.getSarId());
info.setResType(data.getSarType());
sarCompResAssessEOService.save(info);
}
compResAssessEOMap.put(data.getSarId(),info);
}
//汇总结果
if(!assessMap.containsKey(info.getResId())){
Map<String,Integer> accessData = new HashMap<>();
accessData.put(state,1);
assessMap.put(info.getResId(),accessData);
}else{
Map<String, Integer> accessData = assessMap.get(info.getResId());
if(accessData.containsKey(state)){
Integer stateNum = accessData.get(state);
accessData.put(state,stateNum+1);
assessMap.put(info.getResId(),accessData);
}else{
accessData.put(state,1);
assessMap.put(info.getResId(),accessData);
}
}
//入库操作
sarCompStatusInfoEODao.insert(data);
}
//开始遍历状态集合
for (Map.Entry entry : compResAssessEOMap.entrySet()) {
String compId = entry.getKey().toString();//汇总ID
SarCompResAssess compResAssessEO = (SarCompResAssess) entry.getValue();
Map<String, Integer> stringIntegerMap = assessMap.get(compId);
if(stringIntegerMap!=null){
if(stringIntegerMap.containsKey(SarConformStateEnum.UNFIT.getValue()+"")){//只要包含不符合的就是不符合
compResAssessEO.setAssessResult(SarConformStateEnum.UNFIT.getValue());
compResAssessEO.setAssessColor(SarStateColorEnum.YELLOW.getValue());
}else if(stringIntegerMap.size() ==1){//只有一种情况的
if(stringIntegerMap.containsKey(SarConformStateEnum.FIT.getValue()+"")){
compResAssessEO.setAssessResult(SarConformStateEnum.FIT.getValue());
compResAssessEO.setAssessColor(SarStateColorEnum.GREEN.getValue());
}else if(stringIntegerMap.containsKey(SarConformStateEnum.CHECK.getValue()+"")){
compResAssessEO.setAssessResult(SarConformStateEnum.CHECK.getValue());
compResAssessEO.setAssessColor(SarStateColorEnum.YELLOW.getValue());
}else if(stringIntegerMap.containsKey(SarConformStateEnum.NOT_INVOLVE.getValue()+"")){
compResAssessEO.setAssessResult(SarConformStateEnum.NOT_INVOLVE.getValue());
compResAssessEO.setAssessColor(SarStateColorEnum.NA.getValue());
}
}else if(stringIntegerMap.containsKey(SarConformStateEnum.CHECK.getValue()+"")){
compResAssessEO.setAssessResult(SarConformStateEnum.CHECK.getValue());
compResAssessEO.setAssessColor(SarStateColorEnum.YELLOW.getValue());
}else if(stringIntegerMap.containsKey(SarConformStateEnum.NOT_INVOLVE.getValue()+"")){
compResAssessEO.setAssessResult(SarConformStateEnum.NOT_INVOLVE.getValue());
compResAssessEO.setAssessColor(SarStateColorEnum.NA.getValue());
}else{
compResAssessEO.setAssessResult(SarConformStateEnum.FIT.getValue());
compResAssessEO.setAssessColor(SarStateColorEnum.GREEN.getValue());
}
// else {//不包含不符合的并且单一情况并不存在的也就是说是 部分符合或者待确认的
// if(stringIntegerMap.containsKey(SarConformStateEnum.FIT.getValue()+"")){
// compResAssessEO.setAssessResult(SarConformStateEnum.PART_FIT.getValue());
// compResAssessEO.setAssessColor(SarStateColorEnum.YELLOW.getValue());
// }else{
// compResAssessEO.setAssessResult(SarConformStateEnum.CHECK.getValue());
// compResAssessEO.setAssessColor(SarStateColorEnum.NA.getValue());
// }
// }
}
compResAssessEO.setProcessState("2");
compResAssessEO.setModifyTime(new Date());
if(StringUtils.equals("INLAND",compResAssessEO.getResType())){
compResAssessEO.setResType(SarTypeEnum.INLAND_STAND.getValue());
}else if(StringUtils.equals("FOREIGN",compResAssessEO.getResType())){
compResAssessEO.setResType(SarTypeEnum.FOREIGN_STAND.getValue());
}
//更新汇总后的结果
sarCompResAssessEOService.updateById(compResAssessEO);
}
}
}
private String convertColorByState(String stateStr){
String colorStr = "";
switch (stateStr){
case "1":
colorStr = SarStateColorEnum.GREEN.getValue();
break;
case "2":
colorStr = SarStateColorEnum.YELLOW.getValue();
break;
case "3":
colorStr = SarStateColorEnum.YELLOW.getValue();
case "4":
colorStr = SarStateColorEnum.NA.getValue();
}
return colorStr;
}
public String changeStatus (String textStatus) {
String status = "";
switch (textStatus) {
case "草稿": status="CA";break;
case "征求意见稿": status="ZQYJG";break;
case "报批稿": status="BPG";break;
case "送审稿": status="SSG";break;
case "发布稿(必读)": status="FBGBJBD";break;
}
return status;
}
/**
* 处理条款信息转换
* @param itemsEO
* @param field
* @param value
* @throws Exception
*/
public void createItemsBaseField (SarLawsItems itemsEO,String field,Object value) throws Exception{
String valueStr = "";
if (value != null) {
valueStr = String.valueOf(value);
}
switch (field) {
case "itemsName": itemsEO.setItemsName(valueStr); break;
case "FO":
List<String> jsonArray = JSONArray.parseArray(valueStr,String.class);
String fo = "";
if (jsonArray != null && !jsonArray.isEmpty()) {
for (String json : jsonArray) {
fo += json + ",";
}
fo = fo.substring(0,fo.length()-1);
itemsEO.setFoUser(fo);
}
break;
case "itemsNum": itemsEO.setItemsNum(valueStr); break;
case "termsConditions": itemsEO.setTermsConditions(valueStr); break;
case "svpps": itemsEO.setSvpps(valueStr); break;
case "role": itemsEO.setDutyEngineer(valueStr); break;
case "parts": itemsEO.setResponsibleUnit(valueStr); break;
case "FORoleId": itemsEO.setFo(valueStr); break;
case "id": itemsEO.setOldId(valueStr); break;
case "jspg": itemsEO.setJspg(valueStr); break;
case "pgForm":
if (StringUtils.isNotBlank(valueStr)) {
SarCompStatusInfo list = JSONObject.parseObject(valueStr,SarCompStatusInfo.class);
itemsEO.setPgForm(list);
};
break;
default: break;
}
}
/**
* 处理保存标准条款信息数据
* @return
*/
// private List<SarLawsItems> saveStandItemsData(List<Map<String,Object>> itemDataList,SarLawsStandInfo sarStandardsInfoEO) throws Exception {
// String standId = sarStandardsInfoEO.getId();
// String fileType = changeStatus(sarStandardsInfoEO.getLawsTextState());
// List<SarLawsItems> itemsEOList = new ArrayList<>();//添加的条款信息
// List<SarLawsItems> upItemsEOList = new ArrayList<>();//更新的条款数据
// List<String> delValItemIds = new ArrayList<>();//需要删除重新添加的条款数据集合
// List<SarStandItemVal> itemValEOS = new ArrayList<>();//批量更新进去的条款参数集合
// List<SarFileSplitItems> UpSarFileSplitItemsList = new ArrayList<>();
// for(Map<String,Object> itemData:itemDataList){
// String itemStr = itemData.get("itemStr").toString();//条款的具体内容
// Map<String,String> itemAttrInfo = (Map<String, String>) itemData.get("itemAttrInfo");//条款的属性字段
// Map<String,Object> itemMap = new HashMap();
// //此处需要查询拆分库数据,将之前的拆分数据带入到当前标准中同时检查当前分解单中是否已经包含相关的条款信息,
// // 如果是则更新,如果没有则添加
// itemMap = JSONObject.parseObject(itemStr);;
// if (itemMap != null && !itemMap.isEmpty()) {
// if(itemMap.containsKey("resId")){
// //存在
// String splitItemId = String.valueOf(itemMap.get("resId"));
// if(StringUtils.isNotBlank(splitItemId)){
// SarFileSplitItems splitItemsEO = sarFileSplitItemsEOService.getById(splitItemId);
// if(splitItemsEO!=null){
// //拆分库有数据,检查当前的表单中是否有数据,如果有则直接获取后更新即可
// SarLawsItems nowItemEO = sarLawsItemsDao.selectById(splitItemId);
// if(nowItemEO!=null){
// //更新数据
// nowItemEO.setItemsNum(splitItemsEO.getItemsNum());
// nowItemEO.setItemsName(splitItemsEO.getItemsName());
// nowItemEO.setApplyArctic(splitItemsEO.getApplyArctic());
// nowItemEO.setLawsId(standId);
// nowItemEO.setTermsConditions(splitItemsEO.getItermsConditions());
// nowItemEO.setParts(splitItemsEO.getSvpps());
// nowItemEO.setCreationUser(UserUtils.getUserId());
// nowItemEO.setValidFlag(0);
// if(null!=fileType){
// nowItemEO.setFileType(fileType);
// }
// nowItemEO.setRemarks(splitItemsEO.getRemarks());
// nowItemEO.setModifyTime(new Date());
//
// nowItemEO.setClaimType(splitItemsEO.getClaimType());
// nowItemEO.setBusStandCover(splitItemsEO.getBusStandCover());
// nowItemEO.setResponsibleUnit(itemAttrInfo.get("ZRBM"));
// nowItemEO.setFo(itemAttrInfo.get("FO"));
// nowItemEO.setDutyEngineer(itemAttrInfo.get("XMPGJS"));
// nowItemEO.setSvpps(itemAttrInfo.get("SVPPS"));
// upItemsEOList.add(nowItemEO);
// }else{
// SarLawsItems itemsEO = new SarLawsItems();
// itemsEO.setId(splitItemId);
// itemsEO.setCreationTime(new Date());
// itemsEO.setModifyTime(new Date());
// itemsEO.setValidFlag(0);
// itemsEO.setLawsId(standId);
// itemsEO.setFileType(fileType);
// for (Map.Entry<String,Object> entry : itemMap.entrySet()) {
// String field = entry.getKey();
// Object value = entry.getValue();
// createItemsBaseField(itemsEO,field,value);
// }
// itemsEO.setItemsNum(splitItemsEO.getItemsNum());
// itemsEO.setItemsName(splitItemsEO.getItemsName());
// itemsEO.setApplyArctic(splitItemsEO.getApplyArctic());
// itemsEO.setTermsConditions(splitItemsEO.getItermsConditions());
// itemsEO.setParts(splitItemsEO.getSvpps());
// itemsEO.setCreationUser(UserUtils.getUserId());
// itemsEO.setRemarks(splitItemsEO.getRemarks());
// itemsEO.setClaimType(splitItemsEO.getClaimType());
// itemsEO.setBusStandCover(splitItemsEO.getBusStandCover());
// itemsEO.setResponsibleUnit(itemAttrInfo.get("ZRBM"));
// itemsEO.setFo(itemAttrInfo.get("FO"));
// itemsEO.setDutyEngineer(itemAttrInfo.get("XMPGJS"));
// itemsEO.setSvpps(itemAttrInfo.get("SVPPS"));
// //开始处理后续逻辑
// itemsEOList.add(itemsEO);
// }
// //apply数据
// if(StringUtils.isNotEmpty(splitItemsEO.getApplyArctic())){
// delValItemIds.add(splitItemsEO.getId());
// String[] applyarr = splitItemsEO.getApplyArctic().trim().split(",");
// for(String applya:applyarr){
// SarStandItemVal sarStandItemValEO = new SarStandItemVal();
// sarStandItemValEO.setValidFlag(ValueStateEnum.VALUE_TRUE.getValue());
// sarStandItemValEO.setCreationTime(new Date());
// sarStandItemValEO.setModifyTime(new Date());
// sarStandItemValEO.setItemId(splitItemsEO.getId());
// sarStandItemValEO.setId(UUIDUtils.randomUUID20());
// sarStandItemValEO.setPropertyType(PropertyTypeEnum.APPLY_ARCTIC.getValue());
// sarStandItemValEO.setPropertyVal(applya);
// itemValEOS.add(sarStandItemValEO);
// }
// }
// //TODO 开始处理拆分库数据
// splitItemsEO.setModifyTime(new Date());
// splitItemsEO.setResponsibleUnit(itemAttrInfo.get("ZRBM"));
// splitItemsEO.setFo(itemAttrInfo.get("FO"));
// splitItemsEO.setDutyEngineer(itemAttrInfo.get("XMPGJS"));
// splitItemsEO.setSvpps(itemAttrInfo.get("SVPPS"));
// UpSarFileSplitItemsList.add(splitItemsEO);
// }else{
// logger.error("拆分库中找不到对应数据了,数据不见了 /(ㄒoㄒ)/~~"+itemStr);
// }
// }else{
// logger.error("流程中携带的拆分库ID不见了 Σ(っ °Д °;)っ "+itemStr);
// }
// }else{
// //不存在 说明数据出现问题了
// logger.error("流程中携带的拆分库ID,数据不见了 /(ㄒoㄒ)/~~"+itemStr);
//
// }
// }
// }
// //更新拆分库数据
// if(UpSarFileSplitItemsList!=null && !UpSarFileSplitItemsList.isEmpty()){
// for(SarFileSplitItems items : UpSarFileSplitItemsList){
// sarFileSplitItemsEOService.updateById(items);
// }
// }
// //执行批量新增操作
// if(itemsEOList != null && !itemsEOList.isEmpty()){
// sarLawsItemsDao.insertForeach(itemsEOList);
//
// }
// //执行批量修改操作
// if(upItemsEOList != null && !upItemsEOList.isEmpty()){
// sarLawsItemsDao.updateForeach(upItemsEOList);
//
// }
// //执行适用车型批量操作
// if(itemValEOS != null && !itemValEOS.isEmpty()){
// sarLawsItemValDao.deleteByItemsIds(delValItemIds);
// sarLawsItemValDao.insertForeach(itemValEOS);
// }
// return itemsEOList;
// }
private void updateStandFileFieldData(Map<String,Object> addAttInfoMap,Map<String,Object> oldAttInfoMap){
if(oldAttInfoMap.containsKey("CA")){
String fileStr = (String) oldAttInfoMap.get("CA");
if(StringUtils.isNotBlank(fileStr)){
String newFileStr =addAttInfoMap.containsKey("CA")?(String)addAttInfoMap.get("CA"):null;
if(StringUtils.isNotBlank(newFileStr)){
String[] fileSplit = fileStr.split(",");
String[] newFileSplit = newFileStr.split(",");
Set<String> fileSet = new HashSet<>();
for(String sData:fileSplit){
fileSet.add(sData);
}
for(String sData:newFileSplit){
fileSet.add(sData);
}
addAttInfoMap.put("CA",StringUtils.join(fileSet.toArray(), ","));
}else{
addAttInfoMap.put("CA",fileStr);
}
}
}else if(oldAttInfoMap.containsKey("ZQYJG")){
String fileStr = (String) oldAttInfoMap.get("ZQYJG");
if(StringUtils.isNotBlank(fileStr)){
String newFileStr =addAttInfoMap.containsKey("ZQYJG")?(String)addAttInfoMap.get("ZQYJG"):null;
if(StringUtils.isNotBlank(newFileStr)){
String[] fileSplit = fileStr.split(",");
String[] newFileSplit = newFileStr.split(",");
Set<String> fileSet = new HashSet<>();
for(String sData:fileSplit){
fileSet.add(sData);
}
for(String sData:newFileSplit){
fileSet.add(sData);
}
addAttInfoMap.put("ZQYJG",StringUtils.join(fileSet.toArray(), ","));
}else{
addAttInfoMap.put("ZQYJG",fileStr);
}
}
}else if(oldAttInfoMap.containsKey("BPG")){
String fileStr = (String) oldAttInfoMap.get("BPG");
if(StringUtils.isNotBlank(fileStr)){
String newFileStr =addAttInfoMap.containsKey("BPG")?(String)addAttInfoMap.get("BPG"):null;
if(StringUtils.isNotBlank(newFileStr)){
String[] fileSplit = fileStr.split(",");
String[] newFileSplit = newFileStr.split(",");
Set<String> fileSet = new HashSet<>();
for(String sData:fileSplit){
fileSet.add(sData);
}
for(String sData:newFileSplit){
fileSet.add(sData);
}
addAttInfoMap.put("BPG",StringUtils.join(fileSet.toArray(), ","));
}else{
addAttInfoMap.put("BPG",fileStr);
}
}
}else if(oldAttInfoMap.containsKey("SSG")){
String fileStr = (String) oldAttInfoMap.get("SSG");
if(StringUtils.isNotBlank(fileStr)){
String newFileStr =addAttInfoMap.containsKey("SSG")?(String)addAttInfoMap.get("SSG"):null;
if(StringUtils.isNotBlank(newFileStr)){
String[] fileSplit = fileStr.split(",");
String[] newFileSplit = newFileStr.split(",");
Set<String> fileSet = new HashSet<>();
for(String sData:fileSplit){
fileSet.add(sData);
}
for(String sData:newFileSplit){
fileSet.add(sData);
}
addAttInfoMap.put("SSG",StringUtils.join(fileSet.toArray(), ","));
}else{
addAttInfoMap.put("SSG",fileStr);
}
}
}else if(oldAttInfoMap.containsKey("ZBJBD")){
String fileStr = (String) oldAttInfoMap.get("ZBJBD");
if(StringUtils.isNotBlank(fileStr)){
String newFileStr =addAttInfoMap.containsKey("ZBJBD")?(String)addAttInfoMap.get("ZBJBD"):null;
if(StringUtils.isNotBlank(newFileStr)){
String[] fileSplit = fileStr.split(",");
String[] newFileSplit = newFileStr.split(",");
Set<String> fileSet = new HashSet<>();
for(String sData:fileSplit){
fileSet.add(sData);
}
for(String sData:newFileSplit){
fileSet.add(sData);
}
addAttInfoMap.put("ZBJBD",StringUtils.join(fileSet.toArray(), ","));
}else{
addAttInfoMap.put("ZBJBD",fileStr);
}
}
}else if(oldAttInfoMap.containsKey("FBGBJBD")){
String fileStr = (String) oldAttInfoMap.get("FBGBJBD");
if(StringUtils.isNotBlank(fileStr)){
String newFileStr =addAttInfoMap.containsKey("FBGBJBD")?(String)addAttInfoMap.get("FBGBJBD"):null;
if(StringUtils.isNotBlank(newFileStr)){
String[] fileSplit = fileStr.split(",");
String[] newFileSplit = newFileStr.split(",");
Set<String> fileSet = new HashSet<>();
for(String sData:fileSplit){
fileSet.add(sData);
}
for(String sData:newFileSplit){
fileSet.add(sData);
}
addAttInfoMap.put("FBGBJBD",StringUtils.join(fileSet.toArray(), ","));
}else{
addAttInfoMap.put("FBGBJBD",fileStr);
}
}
}
}
public Map<String,Object> saveFileMsg (Map<String,Object> attInfoMap,String fileIds,String textStatus) {
switch (textStatus) {
case "草案": attInfoMap.put("CA",fileIds);break;
case "征求意见稿": attInfoMap.put("ZQYJG",fileIds);break;
case "报批稿": attInfoMap.put("BPG",fileIds);break;
case "送审稿": attInfoMap.put("SSG",fileIds);break;
case "增补件(必读)":attInfoMap.put("ZBJBD",fileIds);break;
case "发布稿(必读)": attInfoMap.put("FBGBJBD",fileIds);break;
}
return attInfoMap;
}
/**
* 处理标准基础库字段
* @param sarLawsStandInfo
* @param field
* @param value
* @throws Exception
*/
public void createStandBaseField (SarLawsStandInfo sarLawsStandInfo,String field,Object value) throws Exception{
String valueStr = "";
if (value != null) {
valueStr = String.valueOf(value);
}
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
switch (field) {
case "country": sarLawsStandInfo.setCountry(valueStr); break;
case "id": sarLawsStandInfo.setId(valueStr); break;
case "lawsType": sarLawsStandInfo.setLawsType(valueStr); break;
case "lawsNumber": sarLawsStandInfo.setLawsNumber(valueStr); break;
case "lawsName": sarLawsStandInfo.setLawsName(valueStr); break;
case "lawsEnName": sarLawsStandInfo.setLawsEnName(valueStr); break;
case "lawsNo": sarLawsStandInfo.setLawsNo(valueStr); break;
case "issueTime":
if (StringUtils.isNotBlank(valueStr)) {
sarLawsStandInfo.setIssueTime(valueStr);
}
break;
case "issueCompany": sarLawsStandInfo.setIssueCompany(valueStr); break;
case "commentCycleStart":
if (StringUtils.isNotBlank(valueStr)) {
sarLawsStandInfo.setCommentCycleStart(valueStr);
}
break;
case "commentCycleEnd":
if (StringUtils.isNotBlank(valueStr)) {
sarLawsStandInfo.setCommentCycleEnd(valueStr);
}
break;
case "lawsTextState": sarLawsStandInfo.setLawsTextState(valueStr); break;
case "lawsSyqy": sarLawsStandInfo.setLawsSyqy(valueStr); break;
case "lawsSycx": sarLawsStandInfo.setLawsSycx(valueStr); break;
case "isRelateAccess": sarLawsStandInfo.setIsRelateAccess(valueStr); break;
case "lawsYear": sarLawsStandInfo.setLawsYear(valueStr); break;
case "lawsNotisyncNum": sarLawsStandInfo.setLawsNotisyncNum(valueStr); break;
case "lawsBulletin": sarLawsStandInfo.setLawsBulletin(valueStr); break;
case "lawsLabel": sarLawsStandInfo.setLawsLabel(valueStr); break;
case "lawsRemark": sarLawsStandInfo.setLawsRemark(valueStr); break;
case "prcNum": sarLawsStandInfo.setProcessNum(valueStr); break;
case "menuId": sarLawsStandInfo.setMenuId(valueStr); break;
case "fileWord":
if (StringUtils.isNotBlank(sarLawsStandInfo.getFileIds()) && StringUtils.isNotBlank(valueStr)) {
valueStr = sarLawsStandInfo.getFileIds() + "," + valueStr;
}
sarLawsStandInfo.setFileIds(valueStr); break;
case "filePdf":
if (StringUtils.isNotBlank(sarLawsStandInfo.getFileIds()) && StringUtils.isNotBlank(valueStr)) {
valueStr = sarLawsStandInfo.getFileIds() + "," + valueStr;
}
sarLawsStandInfo.setFileIds(valueStr);
break;
default: break;
}
}
}