Commit 0cf77189 authored by hcing's avatar hcing

fix(jg):台套认领bugfix

parent b3d4bdbb
...@@ -560,7 +560,7 @@ public class EquipClaimServiceImpl { ...@@ -560,7 +560,7 @@ public class EquipClaimServiceImpl {
.filter(s -> s.contains("_")) .filter(s -> s.contains("_"))
.map(s -> s.split("_", 2)) .map(s -> s.split("_", 2))
.filter(parts -> parts.length == 2) .filter(parts -> parts.length == 2)
.map(parts -> parts[0]) .map(parts -> parts[1])
.orElse(null), null)); .orElse(null), null));
useInfo.setUseDate(Objects.toString(equipInfo.get("useDate"), null)); useInfo.setUseDate(Objects.toString(equipInfo.get("useDate"), null));
useInfo.setLongitudeLatitude(toJSONString(equipInfo.get("longitudeLatitude"))); useInfo.setLongitudeLatitude(toJSONString(equipInfo.get("longitudeLatitude")));
...@@ -725,6 +725,24 @@ public class EquipClaimServiceImpl { ...@@ -725,6 +725,24 @@ public class EquipClaimServiceImpl {
} }
/** /**
* 根据code获取市区县名字
*
* @param key key
* @param codeKey codeKey
* @param mapData 表单信息
* @return name
*/
private String getRegionName(String key, String codeKey, JSONObject mapData) {
return Optional.ofNullable((List<LinkedHashMap>) redisUtils.get(key))
.flatMap(list -> list.stream()
.filter(item -> String.valueOf(item.get("regionCode"))
.equals(String.valueOf(mapData.get(codeKey))))
.map(item -> (String) item.get("regionName"))
.findFirst())
.orElse("");
}
/**
* 认领 更新设备信息 * 认领 更新设备信息
* *
* @param equipInfo * @param equipInfo
...@@ -751,6 +769,18 @@ public class EquipClaimServiceImpl { ...@@ -751,6 +769,18 @@ public class EquipClaimServiceImpl {
// 有证纳管状态 没填写 给默认值 // 有证纳管状态 没填写 给默认值
useInfo.setEquState(EquimentEnum.ZAIYONG.getCode().toString()); useInfo.setEquState(EquimentEnum.ZAIYONG.getCode().toString());
} }
if (!ObjectUtils.isEmpty(useInfo.getProvince())) {
useInfo.setProvinceName("陕西省");
}
if (!ObjectUtils.isEmpty(useInfo.getCity())) {
useInfo.setCityName(this.getRegionName("CITY", "CITY".toLowerCase(), equipInfo));
}
if (!ObjectUtils.isEmpty(useInfo.getCounty())) {
useInfo.setCountyName(this.getRegionName("REGION", "COUNTY".toLowerCase(), equipInfo));
}
if (!ObjectUtils.isEmpty(useInfo.getFactoryUseSiteStreet())) {
useInfo.setStreetName(this.getRegionName("STREET", "factoryUseSiteStreet", equipInfo));
}
idxBizJgUseInfoService.saveOrUpdateData(useInfo); idxBizJgUseInfoService.saveOrUpdateData(useInfo);
// 设计信息 // 设计信息
IdxBizJgDesignInfo designInfo = JSON.parseObject(toJSONString(equipInfo), IdxBizJgDesignInfo.class); IdxBizJgDesignInfo designInfo = JSON.parseObject(toJSONString(equipInfo), IdxBizJgDesignInfo.class);
...@@ -770,6 +800,18 @@ public class EquipClaimServiceImpl { ...@@ -770,6 +800,18 @@ public class EquipClaimServiceImpl {
constructionInfo.setRecord(record); constructionInfo.setRecord(record);
constructionInfo.setRecDate(timestamp); constructionInfo.setRecDate(timestamp);
constructionInfo.setSequenceNbr(Objects.toString(equipInfo.get("CONSTRUCTIONINFO_SEQ"))); constructionInfo.setSequenceNbr(Objects.toString(equipInfo.get("CONSTRUCTIONINFO_SEQ")));
if (!ObjectUtils.isEmpty(constructionInfo.getConstructionProvince())) {
constructionInfo.setConstructionProvinceName("陕西省");
}
if (!ObjectUtils.isEmpty(constructionInfo.getConstructionCity())) {
constructionInfo.setConstructionCityName(this.getRegionName("CITY", "constructionCity", equipInfo));
}
if (!ObjectUtils.isEmpty(constructionInfo.getConstructionCounty())) {
constructionInfo.setConstructionCountyName(this.getRegionName("REGION", "constructionCounty", equipInfo));
}
if (!ObjectUtils.isEmpty(constructionInfo.getConstructionStreet())) {
constructionInfo.setConstructionStreetName(this.getRegionName("STREET", "constructionStreet", equipInfo));
}
iIdxBizJgConstructionInfoService.saveOrUpdateData(constructionInfo); iIdxBizJgConstructionInfoService.saveOrUpdateData(constructionInfo);
// 注册登记信息 // 注册登记信息
IdxBizJgRegisterInfo registerInfo = JSON.parseObject(toJSONString(equipInfo), IdxBizJgRegisterInfo.class); IdxBizJgRegisterInfo registerInfo = JSON.parseObject(toJSONString(equipInfo), IdxBizJgRegisterInfo.class);
...@@ -1005,7 +1047,7 @@ public class EquipClaimServiceImpl { ...@@ -1005,7 +1047,7 @@ public class EquipClaimServiceImpl {
jgUseRegistrationEqServiceImpl.save(useRegEq); jgUseRegistrationEqServiceImpl.save(useRegEq);
}); });
// 历史表 // 历史表
JSONObject changeData = getJgUseRegistrationChangeData(equipInfo,projectContraption, applyNo); JSONObject changeData = getJgUseRegistrationChangeData(equipInfo, projectContraption, applyNo);
JgRegistrationHistory registrationHistory = JgRegistrationHistory.builder() JgRegistrationHistory registrationHistory = JgRegistrationHistory.builder()
.registrationClass("使用登记") .registrationClass("使用登记")
.changeData(JSON.toJSONString(changeData)) .changeData(JSON.toJSONString(changeData))
...@@ -1094,9 +1136,10 @@ public class EquipClaimServiceImpl { ...@@ -1094,9 +1136,10 @@ public class EquipClaimServiceImpl {
/** /**
* 组装使用登记表单的回显数据 * 组装使用登记表单的回显数据
*
* @return * @return
*/ */
private JSONObject getJgUseRegistrationChangeData(JSONObject equipInfo,IdxBizJgProjectContraption proCon, String spplyNo) { private JSONObject getJgUseRegistrationChangeData(JSONObject equipInfo, IdxBizJgProjectContraption proCon, String spplyNo) {
CompanyBo company = getSelectedOrgInfo().getCompany(); CompanyBo company = getSelectedOrgInfo().getCompany();
JSONObject jsonObject = new JSONObject(); JSONObject jsonObject = new JSONObject();
jsonObject.putAll(equipInfo); jsonObject.putAll(equipInfo);
...@@ -1131,7 +1174,7 @@ public class EquipClaimServiceImpl { ...@@ -1131,7 +1174,7 @@ public class EquipClaimServiceImpl {
JSONArray pipeArray = JSON.parseArray(toJSONString(equipInfo.get(PIPELINE_LIST))); JSONArray pipeArray = JSON.parseArray(toJSONString(equipInfo.get(PIPELINE_LIST)));
pipeArray.forEach(item -> { pipeArray.forEach(item -> {
JSONObject itemObj = JSON.parseObject(toJSONString(item)); JSONObject itemObj = JSON.parseObject(toJSONString(item));
itemObj.put("productName",itemObj.get("pipeName")); itemObj.put("productName", itemObj.get("pipeName"));
}); });
jsonObject.put("equipmentLists", pipeArray); jsonObject.put("equipmentLists", pipeArray);
jsonObject.put("useRegistrationCode", equipInfo.get(USE_REGISTRATION_CODE).toString()); jsonObject.put("useRegistrationCode", equipInfo.get(USE_REGISTRATION_CODE).toString());
...@@ -1183,7 +1226,7 @@ public class EquipClaimServiceImpl { ...@@ -1183,7 +1226,7 @@ public class EquipClaimServiceImpl {
for (Map<String, Object> pipeline : pipelineList) { for (Map<String, Object> pipeline : pipelineList) {
boolean hasRecord = !ObjectUtils.isEmpty(pipeline.get("record")); boolean hasRecord = !ObjectUtils.isEmpty(pipeline.get("record"));
String record = hasRecord ? pipeline.get("record").toString() : UUID.randomUUID().toString(); String record = hasRecord ? pipeline.get("record").toString() : UUID.randomUUID().toString();
pipeline.put("record",record); pipeline.put("record", record);
// 更新时工业管道(8300)检验检测信息 // 更新时工业管道(8300)检验检测信息
IdxBizJgInspectionDetectionInfo inspectionDetectionInfo = JSON.parseObject(toJSONString(pipeline), IdxBizJgInspectionDetectionInfo.class); IdxBizJgInspectionDetectionInfo inspectionDetectionInfo = JSON.parseObject(toJSONString(pipeline), IdxBizJgInspectionDetectionInfo.class);
if (!ValidationUtil.isEmpty(inspectionDetectionInfo)) { if (!ValidationUtil.isEmpty(inspectionDetectionInfo)) {
...@@ -1191,7 +1234,7 @@ public class EquipClaimServiceImpl { ...@@ -1191,7 +1234,7 @@ public class EquipClaimServiceImpl {
Optional<Map<String, Object>> optional = inspectionAndTestingInstitutions.stream().filter(x -> x.get("useCode").equals(inspectionDetectionInfo.getInspectOrgCode())).findFirst(); Optional<Map<String, Object>> optional = inspectionAndTestingInstitutions.stream().filter(x -> x.get("useCode").equals(inspectionDetectionInfo.getInspectOrgCode())).findFirst();
Map<String, Object> mapOrDefault = optional.orElse(Collections.emptyMap()); Map<String, Object> mapOrDefault = optional.orElse(Collections.emptyMap());
inspectionDetectionInfo.setInspectOrgName((String) mapOrDefault.getOrDefault("useUnit", inspectionDetectionInfo.getInspectOrgName())); inspectionDetectionInfo.setInspectOrgName((String) mapOrDefault.getOrDefault("useUnit", inspectionDetectionInfo.getInspectOrgName()));
inspectionDetectionInfo.setInspectConclusion((String) pipeline.getOrDefault("inspectConclusionCode", "" )); inspectionDetectionInfo.setInspectConclusion((String) pipeline.getOrDefault("inspectConclusionCode", ""));
inspectionDetectionInfo.setRecord(record); inspectionDetectionInfo.setRecord(record);
inspectionDetectionInfo.setRecDate(nowDate); inspectionDetectionInfo.setRecDate(nowDate);
inspectionDetectionInfo.setSequenceNbr(null); inspectionDetectionInfo.setSequenceNbr(null);
...@@ -1418,7 +1461,7 @@ public class EquipClaimServiceImpl { ...@@ -1418,7 +1461,7 @@ public class EquipClaimServiceImpl {
if (!toUpdateParamsPipelineList.isEmpty()) { if (!toUpdateParamsPipelineList.isEmpty()) {
iIdxBizJgTechParamsPipelineService.updateBatchByRecord(toUpdateParamsPipelineList); iIdxBizJgTechParamsPipelineService.updateBatchByRecord(toUpdateParamsPipelineList);
} }
equipInfo.put(PIPELINE_LIST,pipelineList); equipInfo.put(PIPELINE_LIST, pipelineList);
esEquipmentCategory.saveAll(esEquipmentCategoryList); esEquipmentCategory.saveAll(esEquipmentCategoryList);
} }
...@@ -1444,12 +1487,12 @@ public class EquipClaimServiceImpl { ...@@ -1444,12 +1487,12 @@ public class EquipClaimServiceImpl {
.eq(IdxBizJgProjectContraption::getIsDelete, Boolean.FALSE) .eq(IdxBizJgProjectContraption::getIsDelete, Boolean.FALSE)
.isNull(IdxBizJgProjectContraption::getProjectContraptionParentId)); .isNull(IdxBizJgProjectContraption::getProjectContraptionParentId));
boolean hasThisProCon = !ObjectUtils.isEmpty(oldProCon); boolean hasThisProCon = !ObjectUtils.isEmpty(oldProCon);
if (hasThisProCon){ if (hasThisProCon) {
List<String> records = idxBizJgUseInfoService.lambdaQuery().select(IdxBizJgUseInfo::getRecord).eq(IdxBizJgUseInfo::getProjectContraptionId, oldProCon.getSequenceNbr()).list().stream().map(IdxBizJgUseInfo::getRecord).collect(Collectors.toList()); List<String> records = idxBizJgUseInfoService.lambdaQuery().select(IdxBizJgUseInfo::getRecord).eq(IdxBizJgUseInfo::getProjectContraptionId, oldProCon.getSequenceNbr()).list().stream().map(IdxBizJgUseInfo::getRecord).collect(Collectors.toList());
List<String> oldPipelineNumber = iIdxBizJgTechParamsPipelineService.lambdaQuery().select(IdxBizJgTechParamsPipeline::getPipelineNumber).in(IdxBizJgTechParamsPipeline::getRecord,records).list().stream().map(IdxBizJgTechParamsPipeline::getPipelineNumber).collect(Collectors.toList()); List<String> oldPipelineNumber = iIdxBizJgTechParamsPipelineService.lambdaQuery().select(IdxBizJgTechParamsPipeline::getPipelineNumber).in(IdxBizJgTechParamsPipeline::getRecord, records).list().stream().map(IdxBizJgTechParamsPipeline::getPipelineNumber).collect(Collectors.toList());
List<String> newPipelineNumber = pipelineList.stream().map(item -> item.get("pipelineNumber").toString()).collect(Collectors.toList()); List<String> newPipelineNumber = pipelineList.stream().map(item -> item.get("pipelineNumber").toString()).collect(Collectors.toList());
boolean noCommonElements = Collections.disjoint(oldPipelineNumber, newPipelineNumber); boolean noCommonElements = Collections.disjoint(oldPipelineNumber, newPipelineNumber);
if (!noCommonElements){ if (!noCommonElements) {
throw new BadRequest("管道编号与本单位原装置下的重复!"); throw new BadRequest("管道编号与本单位原装置下的重复!");
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment