Commit 11cbd3b7 authored by hezhuozhi's avatar hezhuozhi

【需求】管道变更/单位变更

parent 0b1dc212
......@@ -959,9 +959,9 @@ public class JgChangeRegistrationNameServiceImpl extends BaseService<JgChangeReg
equList.forEach(info -> {
JSONObject equInfo = JSONObject.parseObject(info.toString());
JgCertificateChangeRecordEq jgCertificateChangeRecordEq = new JgCertificateChangeRecordEq();
jgCertificateChangeRecordEq.setEquId(equInfo.get("SEQUENCE_NBR").toString());
jgCertificateChangeRecordEq.setEquId(Objects.isNull(equInfo.get("SEQUENCE_NBR"))? null : equInfo.get("SEQUENCE_NBR").toString());
jgCertificateChangeRecordEq.setChangeRecordId(jgCertificateChangeRecord.getSequenceNbr().toString());
jgCertificateChangeRecordEq.setProductCode(equInfo.get("FACTORY_NUM").toString());
jgCertificateChangeRecordEq.setProductCode(Objects.isNull(equInfo.get("FACTORY_NUM"))? null : equInfo.get("FACTORY_NUM").toString());
jgCertificateChangeRecordEqs.add(jgCertificateChangeRecordEq);
});
}
......
......@@ -1310,6 +1310,9 @@ public class JgChangeRegistrationUnitServiceImpl extends BaseService<JgChangeReg
useRegistrationManageService.updateById(registrationManage);
//新增使用登记证和设备变更记录
this.saveRecordByProjectContraption(registrationManage,registration);
//通过装置Id查询出设备进行更新 更新其他关联表
this.updateRelationTable(idxBizJgProjectContraption.getSequenceNbr(),registration,Boolean.FALSE,null);
} else {
IdxBizJgProjectContraption idxBizJgProjectContraption = projectContraptionService.getBaseMapper().selectById(Long.valueOf(sequenceNbr));
//查询使用登记表eq 查询和装置关联的管道,取第一个用于生成登记编号
......@@ -1359,12 +1362,60 @@ public class JgChangeRegistrationUnitServiceImpl extends BaseService<JgChangeReg
projectContraptionService.updateById(idxBizJgProjectContraption);
//新增使用登记证和设备变更记录
this.saveRecordByProjectContraption(registrationManage,registration);
//通过装置Id查询出设备进行更新 更新其他关联表
this.updateRelationTable(idxBizJgProjectContraption.getSequenceNbr(),registration,Boolean.TRUE,code);
}
}
}
/**
* 更新关系表
* @param sequenceNbr
* @param registration
* @param flag
* @param useOrgCode
*/
private void updateRelationTable(Long sequenceNbr, JgChangeRegistrationUnit registration, Boolean flag,String useOrgCode) {
LambdaQueryWrapper<JgChangeRegistrationUnitEq> unitEqWrapper = new LambdaQueryWrapper<>();
unitEqWrapper.eq(JgChangeRegistrationUnitEq::getProjectContraptionId,sequenceNbr)
.eq(JgChangeRegistrationUnitEq::getIsDelete,false);
List<JgChangeRegistrationUnitEq> changeRegistrationUnitEqs = registrationUnitEqService.list();
if(!CollectionUtils.isEmpty(changeRegistrationUnitEqs)){
for (JgChangeRegistrationUnitEq jgChangeRegistrationUnitEq : changeRegistrationUnitEqs) {
String equipId = jgChangeRegistrationUnitEq.getEquId();
LambdaQueryWrapper<OtherInfo> queryWrapper1 = new LambdaQueryWrapper<>();
queryWrapper1.eq(OtherInfo::getRecord, equipId);
OtherInfo tzsJgOtherInfo = tzsJgOtherInfoMapper.selectOne(queryWrapper1);
if (ObjectUtils.isNotEmpty(tzsJgOtherInfo)) {
LambdaQueryWrapper<UseInfo> queryWrapper2 = new LambdaQueryWrapper<>();
queryWrapper2.eq(UseInfo::getRecord, equipId);
UseInfo useInfo = useInfoMapper.selectOne(queryWrapper2);
if (ObjectUtils.isNotEmpty(useInfo)) {
useInfo.setUseUnitName(registration.getNewUseUnitName());
useInfo.setUseUnitCreditCode(registration.getNewUseUnitCreditCode());
useInfoMapper.updateById(useInfo);
}
//修改ES中使用单位信息和使用单位代码
Map<String, Map<String, Object>> resultMap = new HashMap<>();
Map<String, Object> map1 = new HashMap<>();
String[] companyCode = registration.getNewUseUnitCreditCode().split("_");
map1.put("USE_UNIT_CREDIT_CODE", companyCode.length > 1 ? companyCode[1] : registration.getNewUseUnitCreditCode());
map1.put("USE_UNIT_NAME", registration.getNewUseUnitName());
map1.put("REC_DATE", new Date());// 更新时间
if(Boolean.TRUE.equals(flag)){
map1.put("USE_ORG_CODE", useOrgCode);
}
resultMap.put(equipId, map1);
tzsServiceFeignClient.commonUpdateEsDataByIds(resultMap);
//修改各类告知列表,置为废弃
this.updataInvalidStatusByHistory(equipId, registration.getApplyNo());
}
}
}
}
/**
* 保存装置单位变更记录
* @param registrationManage
*/
......
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