Commit c2df9072 authored by 刘林's avatar 刘林

fix(jg):设计年限功能修改

parent f462a6cd
......@@ -132,6 +132,11 @@
jri.EQU_CATEGORY AS equCategoryCode,
jri.EQU_DEFINE AS equDefineCode,
jfi.PRODUCE_DATE AS produceDate,
tjodslq.safety_assessment_name as safetyAssessmentName,
tjodslq.safety_assessment_credit_code as safetyAssessmentCreditCode,
tjodslq.safety_assessment_report as safetyAssessmentReport,
tjodslq.safety_assessment_result as safetyAssessmentResult,
tjodslq.safety_assessment_date as safetyAssessmentDate,
(SELECT SEQUENCE_NBR FROM idx_biz_jg_inspection_detection_info WHERE "RECORD" = jui."RECORD" ORDER BY INSPECT_DATE DESC LIMIT 1) jySeq,
(SELECT INSPECT_ORG_NAME FROM idx_biz_jg_inspection_detection_info WHERE "RECORD" = jui."RECORD" ORDER BY INSPECT_DATE DESC LIMIT 1) inspectOrgName,
(SELECT INSPECT_ORG_CODE FROM idx_biz_jg_inspection_detection_info WHERE "RECORD" = jui."RECORD" ORDER BY INSPECT_DATE DESC LIMIT 1) inspectOrgCode,
......@@ -143,6 +148,7 @@
FROM idx_biz_jg_use_info jui
LEFT JOIN idx_biz_jg_factory_info jfi ON jui.RECORD = jfi.RECORD
LEFT JOIN idx_biz_jg_register_info jri ON jui.RECORD = jri.RECORD
LEFT JOIN tzs_jg_over_design_service_life_eq tjodslq ON jui.RECORD = tjodslq.equ_id
WHERE jui.record IN
<foreach collection="records" item="record" open="(" close=")" separator=",">
#{record}
......
......@@ -700,33 +700,47 @@ public class JgOverDesignServiceLifeServiceImpl extends BaseService<JgOverDesign
}
private void updateDesignInfo(TaskV2Model taskV2Model, JgOverDesignServiceLife jgOverDesignServiceLife, List<Map<String, Object>> equipmentLists, List<IdxBizJgDesignInfo> designInfoList) {
String equListCode = Objects.toString(equipmentLists.get(0).get("equListCode"), "");
ZoneId zoneId = ZoneId.systemDefault();
// String equListCode = Objects.toString(equipmentLists.get(0).get("equListCode"), "");
// ZoneId zoneId = ZoneId.systemDefault();
designInfoList.forEach(designInfo -> {
List<IdxBizJgInspectionDetectionInfo> inspectionList =
iIdxBizJgInspectionDetectionInfoService.queryInspectionListByRecord(designInfo.getRecord());
// List<IdxBizJgInspectionDetectionInfo> inspectionList =
// iIdxBizJgInspectionDetectionInfoService.queryInspectionListByRecord(designInfo.getRecord());
designInfo.setOverDesignRegNum(Math.min(designInfo.getOverDesignRegNum() + 1, 2));
IdxBizJgInspectionDetectionInfo inspectionDetectionInfo = inspectionList.stream()
.filter(info -> "6000".equals(equListCode) || "WTJY".equals(info.getInspectType()))
.findFirst()
.orElse(null);
if (inspectionDetectionInfo != null) {
boolean is6000 = "6000".equals(equListCode);
Date targetDate = is6000 ? inspectionDetectionInfo.getInspectDate() : inspectionDetectionInfo.getNextInspectDate();
if (targetDate != null) {
// 将 targetDate 转换为 Instant,再转换为 LocalDate,避免解析错误
String resultDate = targetDate.toInstant() // 将 Date 转换为 Instant
.atZone(zoneId) // 转为 ZoneDateTime
.toLocalDate() // 转为 LocalDate
.plusYears(is6000 ? 4 : 0) // 根据条件加上年份
.toString(); // 转换为 String 类型
designInfo.setDelayServiceLifeDate(resultDate);
}
}
idxBizJgDesignInfoServiceImpl.saveOrUpdateBatch(designInfoList);
this.saveResumeInfo(taskV2Model, jgOverDesignServiceLife, designInfo);
designInfo.setDelayServiceLifeDate(jgOverDesignServiceLife.getExtendUseDeadline());
// IdxBizJgInspectionDetectionInfo inspectionDetectionInfo = inspectionList.stream()
// .filter(info -> "6000".equals(equListCode) || "WTJY".equals(info.getInspectType()))
// .findFirst()
// .orElse(null);
// if (inspectionDetectionInfo != null) {
// boolean is6000 = "6000".equals(equListCode);
// Date targetDate = is6000 ? inspectionDetectionInfo.getInspectDate() : inspectionDetectionInfo.getNextInspectDate();
// if (targetDate != null) {
// // 将 targetDate 转换为 Instant,再转换为 LocalDate,避免解析错误
// String resultDate = targetDate.toInstant() // 将 Date 转换为 Instant
// .atZone(zoneId) // 转为 ZoneDateTime
// .toLocalDate() // 转为 LocalDate
// .plusYears(is6000 ? 4 : 0) // 根据条件加上年份
// .toString(); // 转换为 String 类型
// designInfo.setDelayServiceLifeDate(resultDate);
// }
// }
});
idxBizJgDesignInfoServiceImpl.saveOrUpdateBatch(designInfoList);
this.saveResumeInfo(taskV2Model, jgOverDesignServiceLife, designInfoList);
}
private void saveResumeInfo(TaskV2Model taskV2Model, JgOverDesignServiceLife jgOverDesignServiceLife, List<IdxBizJgDesignInfo> designInfoList) {
jgResumeInfoService.saveBatchResume(designInfoList.stream().map(eq-> JgResumeInfoDto.builder().applyNo(jgOverDesignServiceLife.getApplyNo())
.businessType(BusinessTypeEnum.JG_MAINTENANCE_NOTIFICATION.getName())
.businessId(String.valueOf(jgOverDesignServiceLife.getSequenceNbr()))
.equId(eq.getRecord())
.approvalUnit(jgOverDesignServiceLife.getReceiveOrgName())
.approvalUnitCode(jgOverDesignServiceLife.getReceiveCompanyCode())
.status("正常")
.changeContent(BusinessTypeEnum.JG_OVER_DESIGN_SERVICE_LIFE.getName() + "业务办理")
.routePath(taskV2Model.getRoutePath())
.build()).collect(Collectors.toList())
);
}
/**
......@@ -763,19 +777,7 @@ public class JgOverDesignServiceLifeServiceImpl extends BaseService<JgOverDesign
}
}
private void saveResumeInfo(TaskV2Model taskV2Model, JgOverDesignServiceLife jgOverDesignServiceLife, IdxBizJgDesignInfo designInfo) {
jgResumeInfoService.createWithModel(JgResumeInfoDto.builder()
.applyNo(jgOverDesignServiceLife.getApplyNo())
.businessType(BusinessTypeEnum.JG_OVER_DESIGN_SERVICE_LIFE.getName())
.businessId(jgOverDesignServiceLife.getSequenceNbr() + "")
.equId(designInfo.getRecord())
.approvalUnit(jgOverDesignServiceLife.getReceiveOrgName())
.approvalUnitCode(jgOverDesignServiceLife.getReceiveCompanyCode())
.status("正常")
.changeContent(BusinessTypeEnum.JG_OVER_DESIGN_SERVICE_LIFE.getName() + "业务办理")
.routePath(taskV2Model.getRoutePath())
.build());
}
private void buildTask(JgOverDesignServiceLife jgOverDesignServiceLife, WorkflowResultDto workflowResultDto) {
// 代办消息
......@@ -914,6 +916,7 @@ public class JgOverDesignServiceLifeServiceImpl extends BaseService<JgOverDesign
.collect(Collectors.toList()));
commonService.convertStringToJsonobject(resultDataMap, new String[]{"otherAccessories"});
commonService.convertStringToJsonobject(resultDataMap, new String[]{"useRegistrationFormFile"});
commonService.convertStringToJsonobject(resultDataMap, new String[]{"safetyAssessmentReport"});
return resultDataMap;
}
......
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