Commit 9d3183bd authored by tianbo's avatar tianbo

feature:管道安装告知审批通过修改

parent f498930d
......@@ -323,4 +323,19 @@ public class JgInstallationNoticeDto extends BaseDto {
* 冗余设备种类
*/
private String equListCode;
/**
* 管道工程装置编号
*/
private String projectContraptionNo;
/**
* 管道工程装置设备数量(m)
*/
private String pipelineLength;
/**
* 管道工程装置id
*/
private String projectContraptionId;
}
......@@ -238,6 +238,9 @@
pp."PRESSURE" pressure,
pp."TEMPERATURE" temperature,
pp."MEDIUM" medium,
pp."WORK_PRESSURE" workPressure,
pp."WORK_TEMPERATURE" workTemperature,
pp."WORK_MEDIUM" workMedium,
pp."REMARKS" remarks,
(select INSPECT_ORG_NAME
from idx_biz_jg_inspection_detection_info
......
......@@ -178,6 +178,8 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
@Autowired
private ObjectMapper objectMapper;
@Autowired
private IdxBizJgProjectConstructionMapper projectConstructionMapper;
@Autowired
EventPublisher eventPublisher;
......@@ -219,6 +221,7 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
// 处理设备筛选默认值
installationInfo.put("QUERY_TYPE", "AZ");
installationInfo.put("IS_INTO_MANAGEMENT", "false");
installationInfo.put("isIntoManagement", "false");
// 处理图片
if (!ValidationUtil.isEmpty(installationInfo.get("proxyStatementAttachment"))) {
installationInfo.put("proxyStatementAttachmentList", JSONObject.parseArray(installationInfo.get("proxyStatementAttachment").toString()));
......@@ -335,6 +338,11 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
List<String> ids = jgInstallationNoticeEqs.stream().map(item -> item.getEquId()).collect(Collectors.toList());
// 压力管道从工程装置表查询设备信息
if (PipelineEnum.INDUSTRIAL_PIPELINE.getCode().equals(equCategory)) {
String projectContraptionId = (String) installationInfo.get("projectContraptionId");
IdxBizJgProjectContraption projectContraption = projectContraptionService.getById(projectContraptionId);
installationInfo.put("pipelineLength", projectContraption.getPipelineLength());
installationInfo.put("projectContraptionNo", projectContraption.getProjectContraptionNo());
installationInfo.put("projectContraption", projectContraption.getProjectContraption());
equipListMaps = jgInstallationNoticeMapper.getPipelineEquInfoByRecords(ids);
} else {
Iterable<ESEquipmentCategoryDto> equips = esEquipmentCategory.findAllById(ids);
......@@ -495,9 +503,9 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
ArrayList<JgInstallationNoticeEq> jgInstallationNoticeEqs = new ArrayList<>();
noticeDto.getDeviceList().forEach(item -> {
JgInstallationNoticeEq jgInstallationNoticeEq = new JgInstallationNoticeEq();
jgInstallationNoticeEq.setEquId(String.valueOf(item.get("SEQUENCE_NBR")));
jgInstallationNoticeEq.setEquCategoryCode(String.valueOf(item.get("EQU_CATEGORY_CODE")));
jgInstallationNoticeEq.setEquListCode(String.valueOf(item.get("EQU_LIST_CODE")));
jgInstallationNoticeEq.setEquId(!ValidationUtil.isEmpty(item.get("SEQUENCE_NBR")) ? String.valueOf(item.get("SEQUENCE_NBR")) : String.valueOf(item.get("record")));
jgInstallationNoticeEq.setEquCategoryCode(!ValidationUtil.isEmpty(item.get("EQU_CATEGORY_CODE")) ? String.valueOf(item.get("EQU_CATEGORY_CODE")) : String.valueOf(item.get("equCategory")));
jgInstallationNoticeEq.setEquListCode(!ValidationUtil.isEmpty(item.get("EQU_LIST_CODE")) ? String.valueOf(item.get("EQU_LIST_CODE")) : String.valueOf(item.get("equList")));
jgInstallationNoticeEq.setEquipTransferId(noticeDto.getSequenceNbr().toString());
jgInstallationNoticeEqs.add(jgInstallationNoticeEq);
});
......@@ -771,7 +779,7 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
}
private void repeatUsedEquipCheck(List<Map<String, Object>> equipList, String companyCode) {
equipList.forEach(equipMap -> EquipUsedCheckStrategyContext.getUsedStrategy(PROCESS_INSTALL_NOTICE_KEY).equipRepeatUsedCheck(String.valueOf(equipMap.get("SEQUENCE_NBR")), companyCode));
equipList.forEach(equipMap -> EquipUsedCheckStrategyContext.getUsedStrategy(PROCESS_INSTALL_NOTICE_KEY).equipRepeatUsedCheck(!ValidationUtil.isEmpty(equipMap.get("SEQUENCE_NBR")) ? String.valueOf(equipMap.get("SEQUENCE_NBR")) : String.valueOf(equipMap.get("record")), companyCode));
}
private void updateRedisBatch(List<JgInstallationNotice> jgInstallationNotices) {
......@@ -862,11 +870,8 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
}
dto.setInstallUnitName(reginParams.getCompany().getCompanyName());
dto.setInstallUnitCreditCode(reginParams.getCompany().getCompanyCode());
// dto.setEquList((String.valueOf(obj.get("EQU_LIST"))));
dto.setEntrustingUnitName(dto.getUseUnitName());
dto.setCreateUserCompanyName(reginParams.getCompany().getCompanyName());
// dto.setEquRegisterCode(String.valueOf(obj.get("EQU_CODE")));
// dto.setFactoryNum(String.valueOf(obj.get("FACTORY_NUM")));
if (!CollectionUtils.isEmpty(workflowResultList)) {
dto.setInstanceId(workflowResultList.get(0).getInstanceId());
......@@ -876,13 +881,12 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
}
dto.setCreateUserName(reginParams.getUserModel().getRealName());
dto.setCreateUserId(reginParams.getUserModel().getUserId());
// dto.setEquAddress(obj.getOrDefault("ADDRESS", "").toString());
list.add(dto);
deviceList.forEach(obj -> {
JgInstallationNoticeEq jgRelationEquip = new JgInstallationNoticeEq();
jgRelationEquip.setEquId(String.valueOf(obj.get("SEQUENCE_NBR")));
jgRelationEquip.setEquCategoryCode(String.valueOf(obj.get("EQU_CATEGORY_CODE")));
jgRelationEquip.setEquListCode(String.valueOf(obj.get("EQU_LIST_CODE")));
jgRelationEquip.setEquId(!ValidationUtil.isEmpty(obj.get("SEQUENCE_NBR")) ? String.valueOf(obj.get("SEQUENCE_NBR")) : String.valueOf(obj.get("record")));
jgRelationEquip.setEquCategoryCode(!ValidationUtil.isEmpty(obj.get("EQU_CATEGORY_CODE")) ? String.valueOf(obj.get("EQU_CATEGORY_CODE")) : String.valueOf(obj.get("equCategory")));
jgRelationEquip.setEquListCode(!ValidationUtil.isEmpty(obj.get("EQU_LIST_CODE")) ? String.valueOf(obj.get("EQU_LIST_CODE")) : String.valueOf(obj.get("equList")));
jgRelationEquip.setEquipTransferId(applyNo);
equipList.add(jgRelationEquip);
});
......@@ -1126,7 +1130,7 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
jgInstallationNotice.setNextTaskId(workflowResultDto.getNextTaskId());
TaskV2Model taskV2Model = new TaskV2Model();
if ("0".equals(op)) {
if (StringUtils.isEmpty(workflowResultDto.getNextExecutorRoleIds())) {
if (StringUtils.isEmpty(workflowResultDto.getNextExecutorRoleIds())) { // 审批通过
LambdaQueryWrapper<JgInstallationNoticeEq> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(JgInstallationNoticeEq::getEquipTransferId, dto.getSequenceNbr());
List<JgInstallationNoticeEq> jgRelationEquips = jgInstallationNoticeEqMapper.selectList(queryWrapper);
......@@ -1145,79 +1149,86 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
taskMap.put("model", taskMessageDto);
TaskV2Model taskV2Model1 = commonService.updateTaskModel(taskMap);
String finalYm = ym;
jgRelationEquips.forEach(jgRelationEquip -> {
LambdaQueryWrapper<OtherInfo> queryWrapper1 = new LambdaQueryWrapper<>();
queryWrapper1.eq(OtherInfo::getRecord, jgRelationEquip.getEquId());
OtherInfo tzsJgOtherInfo = tzsJgOtherInfoMapper.selectOne(queryWrapper1);
IdxBizJgRegisterInfo idxBizJgRegisterInfo = getIdxBizJgRegisterInfo(jgRelationEquip);
String equCode = Optional.ofNullable(idxBizJgRegisterInfo.getEquDefine())
.orElse(idxBizJgRegisterInfo.getEquCategory());
String registrationCode = equCode + jgInstallationNotice.getReceiveOrgCreditCode() + finalYm;
ResponseModel<String> responseModel = tzsServiceFeignClient.deviceRegistrationCode(registrationCode);
String deviceRegistrationCode = responseModel.getResult();
Map<String, Object> map = new HashMap<>();
map.put("cityCode", jgInstallationNotice.getCity());
map.put("countyCode", jgInstallationNotice.getCounty());
map.put("equCategory", idxBizJgRegisterInfo.getEquCategory());
map.put("isXiXian", jgInstallationNotice.getIsXixian() == null ? "null" : jgInstallationNotice.getIsXixian().equals("0") ? "null" : "1");
Map<String, Object> mapCode;
ResponseModel<Map<String, Object>> code = tzsServiceFeignClient.createCode(map);
mapCode = code.getResult();
supervisoryCodeInfoMapper.updateStatusBySuperviseCode(mapCode.get("superviseCode").toString());
jgInstallationNotice.setHandleDate(new Date());
//jgInstallationNotice.setInformNumber(deviceRegistrationCode);
jgRelationEquip.setInformNumber(deviceRegistrationCode);
jgInstallationNotice.setSupervisoryCode(mapCode.get("superviseCode").toString());
jgInstallationNotice.setPromoter("");
Map<String, Object> map1 = new HashMap<>();
// 更新其他业务表
if (!ValidationUtil.isEmpty(mapCode.get("code96333"))) {
tzsJgOtherInfo.setCode96333(mapCode.get("code96333").toString());
map1.put("CODE96333", tzsJgOtherInfo.getCode96333());
}
tzsJgOtherInfo.setSupervisoryCode(mapCode.get("superviseCode").toString());
tzsJgOtherInfoMapper.updateById(tzsJgOtherInfo);
// 更新设备监管部门信息
LambdaQueryWrapper<IdxBizJgSupervisionInfo> eq = new QueryWrapper<IdxBizJgSupervisionInfo>().lambda()
.eq(IdxBizJgSupervisionInfo::getRecord, jgRelationEquip.getEquId());
IdxBizJgSupervisionInfo idxBizJgSupervisionInfo = idxBizJgSupervisionInfoMapper.selectOne(eq);
if (!ObjectUtils.isEmpty(jgInstallationNotice.getOrgBranchCode()) && !ObjectUtils.isEmpty(jgInstallationNotice.getOrgBranchName())) {
HashMap<String, Object> parentMessage = (HashMap<String, Object>) Privilege.companyClient.queryByOrgcode(jgInstallationNotice.getOrgBranchCode()).getResult();
// 目前平台返回key为compnay(存在拼写错误)
CompanyModel parentModel = JSON.parseObject(JSON.toJSONString(parentMessage.get("compnay")), CompanyModel.class);
idxBizJgSupervisionInfo.setOrgBranchCode(parentModel.getOrgCode());
idxBizJgSupervisionInfo.setOrgBranchName(parentModel.getCompanyName());
idxBizJgSupervisionInfo.setCompanyOrgBranchCode(parentModel.getCompanyCode());
idxBizJgSupervisionInfoMapper.updateById(idxBizJgSupervisionInfo);
}
// 生成设备代码及更新历史表的的设备代码字段
this.justGenerateEquCode(idxBizJgRegisterInfo, jgInstallationNotice.getReceiveOrgCreditCode(), jgInstallationNotice);
tzsJgRegistrationInfoMapper.updateById(idxBizJgRegisterInfo);
// 更新es
updateEquipEs(jgInstallationNotice, tzsJgOtherInfo, idxBizJgRegisterInfo, idxBizJgSupervisionInfo, map1, dto);
// 记录施工信息表
createConstruction2Db(jgInstallationNotice, jgRelationEquip);
// 更新使用信息
updateJgUseInfo(jgInstallationNotice, jgRelationEquip);
// 生成证记录表主键
long certChangeSeq = sequence.nextId();
// 生成jg证书变更记录
genJgCertificateChangeRecord(jgInstallationNotice, certChangeSeq, registrationCode, idxBizJgRegisterInfo, taskV2Model1);
// 查询设备制造信息
LambdaQueryWrapper<IdxBizJgFactoryInfo> factoryInfoWrapper = new LambdaQueryWrapper<>();
factoryInfoWrapper.eq(IdxBizJgFactoryInfo::getRecord, jgRelationEquip.getEquId());
IdxBizJgFactoryInfo idxBizJgFactoryInfo = idxBizJgFactoryInfoService.getOne(factoryInfoWrapper);
// 生成tzs_jg_certificate_change_record_eq记录
JgCertificateChangeRecordEq changeRecordEq = new JgCertificateChangeRecordEq();
changeRecordEq.setChangeRecordId(String.valueOf(certChangeSeq));//登记证记录主键
changeRecordEq.setEquId(jgRelationEquip.getEquId());//设备主键
changeRecordEq.setProductCode(idxBizJgFactoryInfo.getFactoryNum());
certificateChangeRecordEqService.save(changeRecordEq);
});
// 工程装置id
String projectContraptionId = jgInstallationNotice.getProjectContraptionId();
if (PipelineEnum.INDUSTRIAL_PIPELINE.getCode().equals(jgInstallationNotice.getEquCategoryCode())) {
// 处理工业管道审批后业务数据保存
this.savePipelineData(jgInstallationNotice, jgRelationEquips, finalYm, dto, taskV2Model1);
} else {
jgRelationEquips.forEach(jgRelationEquip -> {
LambdaQueryWrapper<OtherInfo> queryWrapper1 = new LambdaQueryWrapper<>();
queryWrapper1.eq(OtherInfo::getRecord, jgRelationEquip.getEquId());
OtherInfo tzsJgOtherInfo = tzsJgOtherInfoMapper.selectOne(queryWrapper1);
IdxBizJgRegisterInfo idxBizJgRegisterInfo = getIdxBizJgRegisterInfo(jgRelationEquip);
String equCode = Optional.ofNullable(idxBizJgRegisterInfo.getEquDefine())
.orElse(idxBizJgRegisterInfo.getEquCategory());
String registrationCode = equCode + jgInstallationNotice.getReceiveOrgCreditCode() + finalYm;
ResponseModel<String> responseModel = tzsServiceFeignClient.deviceRegistrationCode(registrationCode);
String deviceRegistrationCode = responseModel.getResult();
Map<String, Object> map = new HashMap<>();
map.put("cityCode", jgInstallationNotice.getCity());
map.put("countyCode", jgInstallationNotice.getCounty());
map.put("equCategory", idxBizJgRegisterInfo.getEquCategory());
map.put("isXiXian", jgInstallationNotice.getIsXixian() == null ? "null" : jgInstallationNotice.getIsXixian().equals("0") ? "null" : "1");
Map<String, Object> mapCode;
ResponseModel<Map<String, Object>> code = tzsServiceFeignClient.createCode(map);
mapCode = code.getResult();
supervisoryCodeInfoMapper.updateStatusBySuperviseCode(mapCode.get("superviseCode").toString());
jgInstallationNotice.setHandleDate(new Date());
//jgInstallationNotice.setInformNumber(deviceRegistrationCode);
jgRelationEquip.setInformNumber(deviceRegistrationCode);
jgInstallationNotice.setSupervisoryCode(mapCode.get("superviseCode").toString());
jgInstallationNotice.setPromoter("");
Map<String, Object> map1 = new HashMap<>();
// 更新其他业务表
if (!ValidationUtil.isEmpty(mapCode.get("code96333"))) {
tzsJgOtherInfo.setCode96333(mapCode.get("code96333").toString());
map1.put("CODE96333", tzsJgOtherInfo.getCode96333());
}
tzsJgOtherInfo.setSupervisoryCode(mapCode.get("superviseCode").toString());
tzsJgOtherInfoMapper.updateById(tzsJgOtherInfo);
// 更新设备监管部门信息
LambdaQueryWrapper<IdxBizJgSupervisionInfo> eq = new QueryWrapper<IdxBizJgSupervisionInfo>().lambda()
.eq(IdxBizJgSupervisionInfo::getRecord, jgRelationEquip.getEquId());
IdxBizJgSupervisionInfo idxBizJgSupervisionInfo = idxBizJgSupervisionInfoMapper.selectOne(eq);
if (!ObjectUtils.isEmpty(jgInstallationNotice.getOrgBranchCode()) && !ObjectUtils.isEmpty(jgInstallationNotice.getOrgBranchName())) {
HashMap<String, Object> parentMessage = (HashMap<String, Object>) Privilege.companyClient.queryByOrgcode(jgInstallationNotice.getOrgBranchCode()).getResult();
// 目前平台返回key为compnay(存在拼写错误)
CompanyModel parentModel = JSON.parseObject(JSON.toJSONString(parentMessage.get("compnay")), CompanyModel.class);
idxBizJgSupervisionInfo.setOrgBranchCode(parentModel.getOrgCode());
idxBizJgSupervisionInfo.setOrgBranchName(parentModel.getCompanyName());
idxBizJgSupervisionInfo.setCompanyOrgBranchCode(parentModel.getCompanyCode());
idxBizJgSupervisionInfoMapper.updateById(idxBizJgSupervisionInfo);
}
// 生成设备代码及更新历史表的的设备代码字段
this.justGenerateEquCode(idxBizJgRegisterInfo, jgInstallationNotice.getReceiveOrgCreditCode(), jgInstallationNotice);
tzsJgRegistrationInfoMapper.updateById(idxBizJgRegisterInfo);
// 更新es
updateEquipEs(jgInstallationNotice, tzsJgOtherInfo, idxBizJgRegisterInfo, idxBizJgSupervisionInfo, map1, dto);
// 记录施工信息表
createConstruction2Db(jgInstallationNotice, jgRelationEquip);
// 更新使用信息
updateJgUseInfo(jgInstallationNotice, jgRelationEquip);
// 生成证记录表主键
long certChangeSeq = sequence.nextId();
// 生成jg证书变更记录
genJgCertificateChangeRecord(jgInstallationNotice, certChangeSeq, registrationCode, idxBizJgRegisterInfo.getEquCategory(), taskV2Model1);
// 查询设备制造信息
LambdaQueryWrapper<IdxBizJgFactoryInfo> factoryInfoWrapper = new LambdaQueryWrapper<>();
factoryInfoWrapper.eq(IdxBizJgFactoryInfo::getRecord, jgRelationEquip.getEquId());
IdxBizJgFactoryInfo idxBizJgFactoryInfo = idxBizJgFactoryInfoService.getOne(factoryInfoWrapper);
// 生成tzs_jg_certificate_change_record_eq记录
JgCertificateChangeRecordEq changeRecordEq = new JgCertificateChangeRecordEq();
changeRecordEq.setChangeRecordId(String.valueOf(certChangeSeq));//登记证记录主键
changeRecordEq.setEquId(jgRelationEquip.getEquId());//设备主键
changeRecordEq.setProductCode(idxBizJgFactoryInfo.getFactoryNum());
certificateChangeRecordEqService.save(changeRecordEq);
});
}
// 更新关联设备表
jgInstallationNoticeEqService.updateBatchById(jgRelationEquips);
jgResumeInfoService.saveBatchResume(
......@@ -1226,7 +1237,7 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
.applyNo(jgInstallationNotice.getApplyNo())
.businessType(BusinessTypeEnum.JG_MAINTENANCE_RECORD.getName())
.businessId(String.valueOf(jgInstallationNotice.getSequenceNbr()))
.equId(String.valueOf(v.getEquId()))
.equId(Optional.ofNullable(projectContraptionId).orElse(String.valueOf(v.getEquId()))) // 压力管道使用装置id
.approvalUnit(jgInstallationNotice.getReceiveOrgName())
.approvalUnitCode(jgInstallationNotice.getReceiveOrgCreditCode())
.status("正常")
......@@ -1319,7 +1330,7 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
return tzsJgRegistrationInfoMapper.selectOne(queryWrapper2);
}
private void genJgCertificateChangeRecord(JgInstallationNotice jgInstallationNotice, Long sequenceNbr, String registrationCode, IdxBizJgRegisterInfo idxBizJgRegisterInfo, TaskV2Model taskV2Model1) {
private void genJgCertificateChangeRecord(JgInstallationNotice jgInstallationNotice, Long sequenceNbr, String registrationCode, String equCategory, TaskV2Model taskV2Model1) {
// 生成一条tzs_jg_certificate_change_record记录
JgCertificateChangeRecord jgCertificateChangeRecord = new JgCertificateChangeRecord();
jgCertificateChangeRecord.setApplyNo(jgInstallationNotice.getApplyNo());
......@@ -1333,7 +1344,7 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
jgCertificateChangeRecord.setCertificateNo("");//登记证书唯一码
jgCertificateChangeRecord.setUseUnitCreditCode(jgInstallationNotice.getUseUnitCreditCode());//使用单位统一信用代码
jgCertificateChangeRecord.setUseUnitName(jgInstallationNotice.getUseUnitName());//使用单位名称
jgCertificateChangeRecord.setEquCategory(idxBizJgRegisterInfo.getEquCategory());//设备类别编码
jgCertificateChangeRecord.setEquCategory(equCategory);//设备类别编码
jgCertificateChangeRecord.setCreateDate(new Date());
jgCertificateChangeRecord.setRoutePath(taskV2Model1.getRoutePath());
jgCertificateChangeRecord.setCreateUserId(jgInstallationNotice.getCreateUserId());
......@@ -1449,10 +1460,24 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
queryWrapper.eq(JgInstallationNoticeEq::getEquipTransferId, jgInstallationNotice.getSequenceNbr());
List<JgInstallationNoticeEq> jgInstallationNoticeEqs = jgInstallationNoticeEqMapper.selectList(queryWrapper);
List<String> ids = jgInstallationNoticeEqs.stream().map(item -> item.getEquId()).collect(Collectors.toList());
// Map<String, Object> map = idxBizJgRegisterInfoService.getDetailFieldCamelCaseByRecord(jgRelationEquip.getEquId());
Iterable<ESEquipmentCategoryDto> equips = esEquipmentCategory.findAllById(ids);
List<Map<String, Object>> equipListMaps = getEquipListMaps(equips);
List<Map<String, Object>> equipListMaps = Lists.newArrayList();
String equCategoryCode = jgInstallationNotice.getEquCategoryCode();
Map<String, Object> installationInfo = BeanUtil.beanToMap(jgInstallationNotice, false, true);
// 压力管道从工程装置表查询设备信息
if (PipelineEnum.INDUSTRIAL_PIPELINE.getCode().equals(equCategoryCode)) {
String projectContraptionId = jgInstallationNotice.getProjectContraptionId();
IdxBizJgProjectContraption projectContraption = projectContraptionService.getById(projectContraptionId);
if (!ValidationUtil.isEmpty(projectContraption)) {
installationInfo.put("pipelineLength", projectContraption.getPipelineLength());
installationInfo.put("projectContraptionNo", projectContraption.getProjectContraptionNo());
installationInfo.put("projectContraption", projectContraption.getProjectContraption());
}
equipListMaps = jgInstallationNoticeMapper.getPipelineEquInfoByRecords(ids);
} else {
Iterable<ESEquipmentCategoryDto> equips = esEquipmentCategory.findAllById(ids);
equipListMaps = getEquipListMaps(equips);
}
installationInfo.put("deviceList", equipListMaps);
commonService.saveOrUpdateHistory(BusinessTypeEnum.JG_INSTALLATION_NOTIFICATION.getName(), new JSONObject(installationInfo), null, jgInstallationNotice.getSequenceNbr().toString());
}
......@@ -1773,4 +1798,156 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
noticeStatusOpt.ifPresent(status -> notice.setNoticeStatus(FlowStatusEnum.getNameByType(Long.valueOf(status))));
}).collect(Collectors.toList());
}
private void savePipelineData(JgInstallationNotice jgInstallationNotice, List<JgInstallationNoticeEq> noticeRelationEquips, String finalYm, JgInstallationNoticeDto dto, TaskV2Model taskV2Model1) {
IdxBizJgProjectContraption projectContraption = projectContraptionService.getById(jgInstallationNotice.getProjectContraptionId());
// 生成监管码
Map<String, Object> createCodeMap = new HashMap<>();
createCodeMap.put("cityCode", jgInstallationNotice.getCity());
createCodeMap.put("countyCode", jgInstallationNotice.getCounty());
createCodeMap.put("equCategory", jgInstallationNotice.getEquCategoryCode());
createCodeMap.put("isXiXian", jgInstallationNotice.getIsXixian() == null ? "null" : jgInstallationNotice.getIsXixian().equals("0") ? "null" : "1");
ResponseModel<Map<String, Object>> resultModel = tzsServiceFeignClient.createCode(createCodeMap);
String superviseCode = resultModel.getResult().get("superviseCode").toString();
supervisoryCodeInfoMapper.updateStatusBySuperviseCode(superviseCode);
// 生成告知单编号
String noticeCode = Optional.ofNullable(projectContraption.getEquDefine())
.orElse(projectContraption.getEquCategory());
String registrationCode = noticeCode + jgInstallationNotice.getReceiveOrgCreditCode() + finalYm;
ResponseModel<String> responseModel = tzsServiceFeignClient.deviceRegistrationCode(registrationCode);
String deviceRegistrationCode = responseModel.getResult();
// 更新所属监管部门信息
String orgBranchCode = "";
String orgBranchName = "";
String companyCode = "";
if (!ObjectUtils.isEmpty(jgInstallationNotice.getOrgBranchCode()) && !ObjectUtils.isEmpty(jgInstallationNotice.getOrgBranchName())) {
HashMap<String, Object> parentMessage = (HashMap<String, Object>) Privilege.companyClient.queryByOrgcode(jgInstallationNotice.getOrgBranchCode()).getResult();
// 目前平台返回key为compnay(存在拼写错误)
CompanyModel parentModel = JSON.parseObject(JSON.toJSONString(parentMessage.get("compnay")), CompanyModel.class);
orgBranchCode = parentModel.getOrgCode();
orgBranchName = parentModel.getCompanyName();
companyCode = parentModel.getCompanyCode();
}
// 生成设备代码
String equCode = generateEquCode(projectContraption.getEquList(), projectContraption.getEquCategory(), projectContraption.getEquDefine(), new Date(), jgInstallationNotice.getReceiveOrgCreditCode());
// 更新工程装置信息
projectContraption.setEquCode(equCode);
projectContraption.setSupervisoryCode(superviseCode);
projectContraption.setOrgCode(orgBranchCode);
projectContraption.setOrgName(orgBranchName);
projectContraption.setIsIntoManagement(true);
projectContraption.setUscUnitCreditCode(jgInstallationNotice.getInstallUnitCreditCode());
projectContraption.setUscUnitName(jgInstallationNotice.getInstallUnitName());
projectContraption.setUseUnitName(jgInstallationNotice.getUseUnitName());
projectContraption.setUseUnitCreditCode(jgInstallationNotice.getUseUnitCreditCode());
projectContraptionService.updateById(projectContraption);
// 更新安装告知业务表信息
jgInstallationNotice.setHandleDate(new Date());
jgInstallationNotice.setSupervisoryCode(superviseCode);
jgInstallationNotice.setPromoter("");
// 生成证记录表主键
long certChangeSeq = sequence.nextId();
// 生成jg证书变更记录
genJgCertificateChangeRecord(jgInstallationNotice, certChangeSeq, registrationCode, projectContraption.getEquCategory(), taskV2Model1);
// 生成tzs_jg_certificate_change_record_eq记录
JgCertificateChangeRecordEq changeRecordEq = new JgCertificateChangeRecordEq();
changeRecordEq.setChangeRecordId(String.valueOf(certChangeSeq));//登记证记录主键
changeRecordEq.setEquId(String.valueOf(projectContraption.getSequenceNbr()));//工程装置主键
certificateChangeRecordEqService.save(changeRecordEq);
// 更新工程装置下设备信息
String finalOrgBranchCode = orgBranchCode;
String finalOrgBranchName = orgBranchName;
String finalCompanyCode = companyCode;
noticeRelationEquips.forEach(installationNoticeEq -> {
LambdaQueryWrapper<OtherInfo> queryWrapper1 = new LambdaQueryWrapper<>();
queryWrapper1.eq(OtherInfo::getRecord, installationNoticeEq.getEquId());
OtherInfo tzsJgOtherInfo = tzsJgOtherInfoMapper.selectOne(queryWrapper1);
IdxBizJgRegisterInfo idxBizJgRegisterInfo = getIdxBizJgRegisterInfo(installationNoticeEq);
installationNoticeEq.setInformNumber(deviceRegistrationCode);
// 更新其他业务表
tzsJgOtherInfo.setSupervisoryCode(superviseCode); // 工程装置下的管道设备共享监管码
tzsJgOtherInfoMapper.updateById(tzsJgOtherInfo);
// 更新设备监管部门信息
LambdaQueryWrapper<IdxBizJgSupervisionInfo> eq = new QueryWrapper<IdxBizJgSupervisionInfo>().lambda()
.eq(IdxBizJgSupervisionInfo::getRecord, installationNoticeEq.getEquId());
IdxBizJgSupervisionInfo idxBizJgSupervisionInfo = idxBizJgSupervisionInfoMapper.selectOne(eq);
idxBizJgSupervisionInfo.setOrgBranchCode(finalOrgBranchCode);
idxBizJgSupervisionInfo.setOrgBranchName(finalOrgBranchName);
idxBizJgSupervisionInfo.setCompanyOrgBranchCode(finalCompanyCode);
idxBizJgSupervisionInfoMapper.updateById(idxBizJgSupervisionInfo);
// 和工程装置共享设备代码
idxBizJgRegisterInfo.setEquCode(equCode);
tzsJgRegistrationInfoMapper.updateById(idxBizJgRegisterInfo);
// 更新es
updateEquipEs(jgInstallationNotice, tzsJgOtherInfo, idxBizJgRegisterInfo, idxBizJgSupervisionInfo, new HashMap<>(), dto);
// 记录管道施工信息表
createConstruction2Db(jgInstallationNotice, installationNoticeEq);
// 更新使用信息
updateJgUseInfo(jgInstallationNotice, installationNoticeEq);
});
// 记录工程装置施工信息表
createProjectConstruction2Db(jgInstallationNotice, projectContraption, deviceRegistrationCode, noticeRelationEquips);
}
private String generateEquCode(String equListCode, String equCategoryCode, String equDefineCode, Date now, String receiveCompanyCode) {
CodeGenerateDto codeGenerateDto = new CodeGenerateDto();
codeGenerateDto.setEquList(equListCode);
codeGenerateDto.setEquCategory(equCategoryCode);
codeGenerateDto.setEquDefine(equDefineCode);
codeGenerateDto.setProduceDate(now);
codeGenerateDto.setReceiveCompanyCode(receiveCompanyCode);
return codeUtil.generateEquipmentCode(codeGenerateDto);
}
private void createProjectConstruction2Db(JgInstallationNotice jgInstallationNotice, IdxBizJgProjectContraption projectContraption, String deviceRegistrationCode, List<JgInstallationNoticeEq> noticeRelationEquips) {
IdxBizJgProjectConstruction idxBizJgProjectConstruction = new IdxBizJgProjectConstruction();
idxBizJgProjectConstruction.setUscUnitCreditCode(jgInstallationNotice.getInstallUnitCreditCode());
idxBizJgProjectConstruction.setUscUnitName(jgInstallationNotice.getInstallUnitName());
idxBizJgProjectConstruction.setUscDate(jgInstallationNotice.getInstallStartDate());
idxBizJgProjectConstruction.setRecord(String.valueOf(projectContraption.getSequenceNbr()));
idxBizJgProjectConstruction.setSequenceCode(String.valueOf(projectContraption.getSequenceNbr()));
idxBizJgProjectConstruction.setNoticeId(String.valueOf(jgInstallationNotice.getSequenceNbr()));
idxBizJgProjectConstruction.setInformCode(deviceRegistrationCode);
idxBizJgProjectConstruction.setConstructionLeaderId(jgInstallationNotice.getInstallLeaderId());
idxBizJgProjectConstruction.setConstructionLeaderName(jgInstallationNotice.getInstallLeaderName());
idxBizJgProjectConstruction.setConstructionLeaderPhone(jgInstallationNotice.getInstallLeaderPhone());
idxBizJgProjectConstruction.setAddress(jgInstallationNotice.getAddress());
idxBizJgProjectConstruction.setProvinceName(jgInstallationNotice.getProvinceName());
idxBizJgProjectConstruction.setCityName(jgInstallationNotice.getCityName());
idxBizJgProjectConstruction.setCountyName(jgInstallationNotice.getCountyName());
idxBizJgProjectConstruction.setStreetName(jgInstallationNotice.getStreetName());
idxBizJgProjectConstruction.setIsXixian(jgInstallationNotice.getIsXixian());
idxBizJgProjectConstruction.setProjectContraptionId(String.valueOf(projectContraption.getSequenceNbr()));
idxBizJgProjectConstruction.setEquipRecords(noticeRelationEquips.stream().map(JgInstallationNoticeEq::getEquId).collect(Collectors.joining(",")));
idxBizJgProjectConstruction.setConstructionContractAttachment(idxBizJgProjectConstruction.getConstructionContractAttachment());
idxBizJgProjectConstruction.setProxyStatementAttachment(idxBizJgProjectConstruction.getProxyStatementAttachment());
idxBizJgProjectConstruction.setConstructionOtherAccessories(idxBizJgProjectConstruction.getConstructionOtherAccessories());
idxBizJgProjectConstruction.setRecDate(new Date());
idxBizJgProjectConstruction.setRecUserId(RequestContext.getExeUserId());
// 获取施工类型id
LambdaQueryWrapper<DataDictionary> lambda = new LambdaQueryWrapper<>();
lambda.eq(DataDictionary::getType, CONSTRUCTION_TYPE);
lambda.eq(DataDictionary::getName, CONSTRUCTION_TYPE_NAME);
List<DataDictionary> dataDictionaries = dataDictionaryMapper.selectList(lambda);
if (!CollectionUtils.isEmpty(dataDictionaries)) {
idxBizJgProjectConstruction.setConstructionType(String.valueOf(dataDictionaries.get(0).getSequenceNbr()));
}
projectConstructionMapper.insert(idxBizJgProjectConstruction);
}
}
\ No newline at end of file
......@@ -121,4 +121,6 @@ public class IdxBizJgProjectContraptionDto extends BaseDto {
@ApiModelProperty("数据来源(新增:0、导入:1、复制:复制数据的id 、jg:从监管加入的设备)")
private String dataSource;
@ApiModelProperty("设备代码")
private String equCode;
}
......@@ -250,4 +250,10 @@ public class IdxBizJgProjectContraption extends BaseEntity {
*/
@TableField(exist = false)
private String fullAddress;
/**
* 工程装置设备代码
*/
@TableField("equ_code")
private String equCode;
}
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