Commit 3f555ab7 authored by tianbo's avatar tianbo

fix(jg): 修复设备状态判断和装置变更逻辑

- 添加无报废管道设备时的装置变更处理逻辑 - 实现新证号生成时的装置和管道信息更新
parent 244ea76a
...@@ -2540,14 +2540,14 @@ public class JgChangeRegistrationUnitServiceImpl extends BaseService<JgChangeReg ...@@ -2540,14 +2540,14 @@ public class JgChangeRegistrationUnitServiceImpl extends BaseService<JgChangeReg
List<Long> projectSeqs = projectsUnderSameUseOrgCodeNotInThisApply.stream().map(IdxBizJgProjectContraption::getSequenceNbr).collect(Collectors.toList()); List<Long> projectSeqs = projectsUnderSameUseOrgCodeNotInThisApply.stream().map(IdxBizJgProjectContraption::getSequenceNbr).collect(Collectors.toList());
Integer usedEquipCount = idxBizJgUseInfoService.lambdaQuery() Integer usedEquipCount = idxBizJgUseInfoService.lambdaQuery()
.in(IdxBizJgUseInfo::getProjectContraptionId, projectSeqs) .in(IdxBizJgUseInfo::getProjectContraptionId, projectSeqs)
.notIn(IdxBizJgUseInfo::getEquState, EquipmentEnum.BAOFEI.getCode().toString(), EquipmentEnum.BAOFEI.getCode().toString()) .notIn(IdxBizJgUseInfo::getEquState, EquipmentEnum.BAOFEI.getCode().toString(), EquipmentEnum.ZHUXIAO.getCode().toString())
.select(IdxBizJgUseInfo::getRecord) .select(IdxBizJgUseInfo::getRecord)
.count(); .count();
if (usedEquipCount == 0) { if (usedEquipCount == 0) {
// 所有装置下没有在用的管道,则更新原使用登记证状态为已注销 // 所有装置下没有在用的管道,则更新原使用登记证状态为已注销
useRegistrationManageService.lambdaUpdate() useRegistrationManageService.lambdaUpdate()
.eq(JgUseRegistrationManage::getUseRegistrationCode, useRegistrationCode) .eq(JgUseRegistrationManage::getUseRegistrationCode, useRegistrationCode)
.set(JgUseRegistrationManage::getCertificateStatus, CertificateStatusEnum.YIZHUXIAO.getCode()) .set(JgUseRegistrationManage::getCertificateStatus, CertificateStatusEnum.YIZHUXIAO.getName())
.update(); .update();
} }
} }
...@@ -2650,13 +2650,39 @@ public class JgChangeRegistrationUnitServiceImpl extends BaseService<JgChangeReg ...@@ -2650,13 +2650,39 @@ public class JgChangeRegistrationUnitServiceImpl extends BaseService<JgChangeReg
idxBizJgOtherInfoService.updateBatchById(batch); idxBizJgOtherInfoService.updateBatchById(batch);
} }
// 重新计算新老装置长度 // 重新计算新装置长度
pipelineDataChangeService.updatePipelineLength(String.valueOf(oldProjectContraption.getSequenceNbr()));
pipelineDataChangeService.updatePipelineLength(String.valueOf(newProjectContraption.getSequenceNbr())); pipelineDataChangeService.updatePipelineLength(String.valueOf(newProjectContraption.getSequenceNbr()));
targetProjectContraption = newProjectContraption; targetProjectContraption = newProjectContraption;
// 新装置ID加人到待生成履历装置ID // 新装置ID加人到待生成履历装置ID
projectContraptionIds.add(String.valueOf(newProjectContraption.getSequenceNbr())); projectContraptionIds.add(String.valueOf(newProjectContraption.getSequenceNbr()));
} else {
// 没有报废的管道设备,直接将装置变更到新单位;
// 如果是新生成证号,则更新装置和管道对应证号信息
if (isNewCode) {
targetProjectContraption.setUseRegistrationCode(useRegistrationCode);
projectContraptionService.updateById(targetProjectContraption);
List<List<IdxBizJgRegisterInfo>> registerInfoBatches = new ArrayList<>();
for (int i = 0; i < registerInfos.size(); i += ONE_BATCH_SIZE) {
registerInfoBatches.add(registerInfos.subList(i, Math.min(i + ONE_BATCH_SIZE, registerInfos.size())));
}
for (List<IdxBizJgRegisterInfo> batch : registerInfoBatches) {
batch.forEach(registerInfo -> registerInfo.setUseOrgCode(useRegistrationCode));
idxBizJgRegisterInfoService.updateBatchById(batch);
}
List<List<IdxBizJgUseInfo>> useInfoBatches = new ArrayList<>();
for (int i = 0; i < useInfosForNotScrap.size(); i += ONE_BATCH_SIZE) {
useInfoBatches.add(useInfosForNotScrap.subList(i, Math.min(i + ONE_BATCH_SIZE, useInfosForNotScrap.size())));
}
for (List<IdxBizJgUseInfo> batch : useInfoBatches) {
batch.forEach(useInfo -> {
useInfo.setEquState(String.valueOf(EquipmentEnum.ZAIYONG.getCode()));
});
idxBizJgUseInfoService.updateBatchById(batch);
}
}
} }
this.updateProjectContraptionAndRegistrationManage(registrationUnit, targetProjectContraption, useRegistrationCode, targetEqIdList, isNewCode); this.updateProjectContraptionAndRegistrationManage(registrationUnit, targetProjectContraption, useRegistrationCode, targetEqIdList, isNewCode);
this.updateUseInfoAndEs(targetEqIdList, registrationUnit, isNewCode, isNewCode ? useRegistrationCode : null); this.updateUseInfoAndEs(targetEqIdList, registrationUnit, isNewCode, isNewCode ? useRegistrationCode : null);
......
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