Commit 0e9c6c4d authored by suhuiguang's avatar suhuiguang

feat(大编辑):管道增减功能开发

1.改造变更登记作废、使用登记作废调整
parent f7492288
......@@ -1606,52 +1606,59 @@ public class JgChangeRegistrationReformServiceImpl extends BaseService<JgChangeR
// 压力管道
case YLGD:
JSONObject jsonObject = JSONObject.parseObject(oldTechInfo);
JSONArray piePines = jsonObject.getJSONArray("equipmentLists");
// 装置和设备es中的安改维单位信息恢复
String uscUnitCreditCode = jsonObject.getString(USC_UNIT_CREDIT_CODE);
String uscUnitName = jsonObject.getString(USC_UNIT_NAME);
jgProjectContraptionService.lambdaUpdate()
.eq(IdxBizJgProjectContraption::getSequenceNbr, jgChangeRegistrationReform.getProjectContraptionId())
.set(IdxBizJgProjectContraption::getUscUnitCreditCode, uscUnitCreditCode)
.set(IdxBizJgProjectContraption::getUscUnitName, uscUnitName)
.update();
for(int i = 0; i < piePines.size(); i++){
JSONObject item = piePines.getJSONObject(i);
String rcd = item.getString("record");
// 删除
iIdxBizJgTechParamsPipelineService.remove(new LambdaQueryWrapper<IdxBizJgTechParamsPipeline>().eq(IdxBizJgTechParamsPipeline::getRecord, rcd));
// 插入
IdxBizJgTechParamsPipeline pipeline = BeanUtil.copyProperties(item, IdxBizJgTechParamsPipeline.class);
pipeline.setSequenceNbr(sequence.nextId() + "");
iIdxBizJgTechParamsPipelineService.save(pipeline);
// es
Map<String, Map<String, Object>> resultMap = MapBuilder.<String, Map<String, Object>>create()
.put(rcd, MapBuilder.<String, Object>create()
.put(USC_UNIT_NAME, uscUnitName)
.put(USC_UNIT_CREDIT_CODE, uscUnitCreditCode)
.build())
.build();
tzsServiceFeignClient.commonUpdateEsDataByIds(resultMap);
}
// 检验信息恢复
JSONObject inspectData = jsonObject.getJSONObject("inspectData");
if(inspectData != null){
// 被更新前的检验信息
JSONArray oData = Optional.ofNullable(inspectData.getJSONArray("oData")).orElse(new JSONArray());
// 改造登记本次插入的检验信息主键sequenceNbr数组
JSONArray insertIds = Optional.ofNullable(inspectData.getJSONArray("insertIds")).orElse(new JSONArray());
// 更新的检验信息换成原来的
for(int i = 0; i < oData.size(); i++){
JSONObject item = oData.getJSONObject(i);
InspectionDetectionInfo inspectionDetectionInfo = BeanUtil.copyProperties(item, InspectionDetectionInfo.class);
inspectionDetectionInfoMapper.deleteById(inspectionDetectionInfo.getSequenceNbr());
inspectionDetectionInfoMapper.insert(inspectionDetectionInfo);
// 编辑过则按照编辑的数据进行恢复管道信息
Boolean isRollBack = backupManager.restore(jgChangeRegistrationReform.getSequenceNbr() + "");
if(isRollBack){ // 进行过编辑逻辑
// 1.原装置、新装置重新计算管道长度
this.updateTotalPieLineLength(jgChangeRegistrationReform.getProjectContraptionId());
} else { //未编辑过,走原有逻辑
JSONObject jsonObject = JSONObject.parseObject(oldTechInfo);
JSONArray piePines = jsonObject.getJSONArray("equipmentLists");
// 装置和设备es中的安改维单位信息恢复
String uscUnitCreditCode = jsonObject.getString(USC_UNIT_CREDIT_CODE);
String uscUnitName = jsonObject.getString(USC_UNIT_NAME);
jgProjectContraptionService.lambdaUpdate()
.eq(IdxBizJgProjectContraption::getSequenceNbr, jgChangeRegistrationReform.getProjectContraptionId())
.set(IdxBizJgProjectContraption::getUscUnitCreditCode, uscUnitCreditCode)
.set(IdxBizJgProjectContraption::getUscUnitName, uscUnitName)
.update();
for(int i = 0; i < piePines.size(); i++){
JSONObject item = piePines.getJSONObject(i);
String rcd = item.getString("record");
// 删除
iIdxBizJgTechParamsPipelineService.remove(new LambdaQueryWrapper<IdxBizJgTechParamsPipeline>().eq(IdxBizJgTechParamsPipeline::getRecord, rcd));
// 插入
IdxBizJgTechParamsPipeline pipeline = BeanUtil.copyProperties(item, IdxBizJgTechParamsPipeline.class);
pipeline.setSequenceNbr(sequence.nextId() + "");
iIdxBizJgTechParamsPipelineService.save(pipeline);
// es
Map<String, Map<String, Object>> resultMap = MapBuilder.<String, Map<String, Object>>create()
.put(rcd, MapBuilder.<String, Object>create()
.put(USC_UNIT_NAME, uscUnitName)
.put(USC_UNIT_CREDIT_CODE, uscUnitCreditCode)
.build())
.build();
tzsServiceFeignClient.commonUpdateEsDataByIds(resultMap);
}
// 新插入的删除
if(!insertIds.isEmpty()){
List<String> ids = insertIds.toJavaList(String.class);
inspectionDetectionInfoMapper.deleteBatchIds(ids);
// 检验信息恢复
JSONObject inspectData = jsonObject.getJSONObject("inspectData");
if(inspectData != null){
// 被更新前的检验信息
JSONArray oData = Optional.ofNullable(inspectData.getJSONArray("oData")).orElse(new JSONArray());
// 改造登记本次插入的检验信息主键sequenceNbr数组
JSONArray insertIds = Optional.ofNullable(inspectData.getJSONArray("insertIds")).orElse(new JSONArray());
// 更新的检验信息换成原来的
for(int i = 0; i < oData.size(); i++){
JSONObject item = oData.getJSONObject(i);
InspectionDetectionInfo inspectionDetectionInfo = BeanUtil.copyProperties(item, InspectionDetectionInfo.class);
inspectionDetectionInfoMapper.deleteById(inspectionDetectionInfo.getSequenceNbr());
inspectionDetectionInfoMapper.insert(inspectionDetectionInfo);
}
// 新插入的删除
if(!insertIds.isEmpty()){
List<String> ids = insertIds.toJavaList(String.class);
inspectionDetectionInfoMapper.deleteBatchIds(ids);
}
}
}
break;
......
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