Commit 0cf77189 authored by hcing's avatar hcing

fix(jg):台套认领bugfix

parent b3d4bdbb
......@@ -560,7 +560,7 @@ public class EquipClaimServiceImpl {
.filter(s -> s.contains("_"))
.map(s -> s.split("_", 2))
.filter(parts -> parts.length == 2)
.map(parts -> parts[0])
.map(parts -> parts[1])
.orElse(null), null));
useInfo.setUseDate(Objects.toString(equipInfo.get("useDate"), null));
useInfo.setLongitudeLatitude(toJSONString(equipInfo.get("longitudeLatitude")));
......@@ -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
......@@ -751,6 +769,18 @@ public class EquipClaimServiceImpl {
// 有证纳管状态 没填写 给默认值
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);
// 设计信息
IdxBizJgDesignInfo designInfo = JSON.parseObject(toJSONString(equipInfo), IdxBizJgDesignInfo.class);
......@@ -770,6 +800,18 @@ public class EquipClaimServiceImpl {
constructionInfo.setRecord(record);
constructionInfo.setRecDate(timestamp);
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);
// 注册登记信息
IdxBizJgRegisterInfo registerInfo = JSON.parseObject(toJSONString(equipInfo), IdxBizJgRegisterInfo.class);
......@@ -1005,7 +1047,7 @@ public class EquipClaimServiceImpl {
jgUseRegistrationEqServiceImpl.save(useRegEq);
});
// 历史表
JSONObject changeData = getJgUseRegistrationChangeData(equipInfo,projectContraption, applyNo);
JSONObject changeData = getJgUseRegistrationChangeData(equipInfo, projectContraption, applyNo);
JgRegistrationHistory registrationHistory = JgRegistrationHistory.builder()
.registrationClass("使用登记")
.changeData(JSON.toJSONString(changeData))
......@@ -1094,9 +1136,10 @@ public class EquipClaimServiceImpl {
/**
* 组装使用登记表单的回显数据
*
* @return
*/
private JSONObject getJgUseRegistrationChangeData(JSONObject equipInfo,IdxBizJgProjectContraption proCon, String spplyNo) {
private JSONObject getJgUseRegistrationChangeData(JSONObject equipInfo, IdxBizJgProjectContraption proCon, String spplyNo) {
CompanyBo company = getSelectedOrgInfo().getCompany();
JSONObject jsonObject = new JSONObject();
jsonObject.putAll(equipInfo);
......@@ -1131,7 +1174,7 @@ public class EquipClaimServiceImpl {
JSONArray pipeArray = JSON.parseArray(toJSONString(equipInfo.get(PIPELINE_LIST)));
pipeArray.forEach(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("useRegistrationCode", equipInfo.get(USE_REGISTRATION_CODE).toString());
......@@ -1183,7 +1226,7 @@ public class EquipClaimServiceImpl {
for (Map<String, Object> pipeline : pipelineList) {
boolean hasRecord = !ObjectUtils.isEmpty(pipeline.get("record"));
String record = hasRecord ? pipeline.get("record").toString() : UUID.randomUUID().toString();
pipeline.put("record",record);
pipeline.put("record", record);
// 更新时工业管道(8300)检验检测信息
IdxBizJgInspectionDetectionInfo inspectionDetectionInfo = JSON.parseObject(toJSONString(pipeline), IdxBizJgInspectionDetectionInfo.class);
if (!ValidationUtil.isEmpty(inspectionDetectionInfo)) {
......@@ -1191,7 +1234,7 @@ public class EquipClaimServiceImpl {
Optional<Map<String, Object>> optional = inspectionAndTestingInstitutions.stream().filter(x -> x.get("useCode").equals(inspectionDetectionInfo.getInspectOrgCode())).findFirst();
Map<String, Object> mapOrDefault = optional.orElse(Collections.emptyMap());
inspectionDetectionInfo.setInspectOrgName((String) mapOrDefault.getOrDefault("useUnit", inspectionDetectionInfo.getInspectOrgName()));
inspectionDetectionInfo.setInspectConclusion((String) pipeline.getOrDefault("inspectConclusionCode", "" ));
inspectionDetectionInfo.setInspectConclusion((String) pipeline.getOrDefault("inspectConclusionCode", ""));
inspectionDetectionInfo.setRecord(record);
inspectionDetectionInfo.setRecDate(nowDate);
inspectionDetectionInfo.setSequenceNbr(null);
......@@ -1418,7 +1461,7 @@ public class EquipClaimServiceImpl {
if (!toUpdateParamsPipelineList.isEmpty()) {
iIdxBizJgTechParamsPipelineService.updateBatchByRecord(toUpdateParamsPipelineList);
}
equipInfo.put(PIPELINE_LIST,pipelineList);
equipInfo.put(PIPELINE_LIST, pipelineList);
esEquipmentCategory.saveAll(esEquipmentCategoryList);
}
......@@ -1444,12 +1487,12 @@ public class EquipClaimServiceImpl {
.eq(IdxBizJgProjectContraption::getIsDelete, Boolean.FALSE)
.isNull(IdxBizJgProjectContraption::getProjectContraptionParentId));
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> 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());
boolean noCommonElements = Collections.disjoint(oldPipelineNumber, newPipelineNumber);
if (!noCommonElements){
if (!noCommonElements) {
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