Commit 894b5621 authored by 刘林's avatar 刘林

fix(jg):超设计使用年限功能开发

parent 828e67de
...@@ -106,4 +106,10 @@ public class JgOverDesignServiceLifeDto extends BaseDto { ...@@ -106,4 +106,10 @@ public class JgOverDesignServiceLifeDto extends BaseDto {
@ApiModelProperty(value = "使用登记编号") @ApiModelProperty(value = "使用登记编号")
private String useRegistrationCode; private String useRegistrationCode;
private String dataType;
private String unitCode;
private String currentUserId;
} }
...@@ -23,8 +23,7 @@ public interface JgOverDesignServiceLifeMapper extends BaseMapper<JgOverDesignSe ...@@ -23,8 +23,7 @@ public interface JgOverDesignServiceLifeMapper extends BaseMapper<JgOverDesignSe
Page<Map<String, Object>> getListPage(@Param("page")Page<Map<String, Object>> page, Page<Map<String, Object>> getListPage(@Param("page")Page<Map<String, Object>> page,
@Param("sort") SortVo sortMap, @Param("sort") SortVo sortMap,
@Param("dto") JgOverDesignServiceLifeDto dto , @Param("dto") JgOverDesignServiceLifeDto dto);
@Param("type") String type);
List<Map<String, Object>> selectEquipList(@Param("records") List<String> records); List<Map<String, Object>> selectEquipList(@Param("records") List<String> records);
} }
...@@ -78,14 +78,14 @@ ...@@ -78,14 +78,14 @@
AND ovds.use_registration_code like concat('%',#{dto.useRegistrationCode},'%') AND ovds.use_registration_code like concat('%',#{dto.useRegistrationCode},'%')
</if> </if>
<if test="dto.receiveOrgCode != null and dto.receiveOrgCode != ''"> <if test="dto.receiveOrgCode != null and dto.receiveOrgCode != ''">
and (ovds.receive_company_code = #{dto.receiveOrgCode} or ovds.transfer_to_user_ids like concat('%',#{currentUserId},'%')) and (ovds.receive_company_code = #{dto.receiveOrgCode} or ovds.transfer_to_user_ids like concat('%',#{dto.currentUserId},'%'))
</if> </if>
<if test="type == 'supervision'"> <if test="dto.dataType == 'supervision' ">
AND (ovds.receive_company_code = #{dto.useUnitCreditCode} or ovds.transfer_to_user_ids like concat('%',#{currentUserId},'%')) AND (ovds.receive_company_code = #{dto.unitCode} or ovds.transfer_to_user_ids like concat('%',#{dto.currentUserId},'%'))
AND ovds.instance_id <![CDATA[<>]]> '' AND ovds.instance_id <![CDATA[<>]]> ''
</if> </if>
<if test="type == 'company'"> <if test="dto.dataType == 'company' ">
AND ovds.use_unit_credit_code = #{dto.useUnitCreditCode} AND ovds.use_unit_credit_code = #{dto.unitCode}
</if> </if>
<if test="dto.applyNo != null and dto.applyNo != ''"> <if test="dto.applyNo != null and dto.applyNo != ''">
and ovds.apply_no like concat('%',#{dto.applyNo},'%') and ovds.apply_no like concat('%',#{dto.applyNo},'%')
...@@ -105,12 +105,16 @@ ...@@ -105,12 +105,16 @@
jfi.FACTORY_NUM, jfi.FACTORY_NUM,
jui.ADDRESS as ADDRESS, jui.ADDRESS as ADDRESS,
jui.RECORD record, jui.RECORD record,
(SELECT name from tz_equipment_category where code = jri.EQU_DEFINE) as EQU_DEFINE,
jri.PRODUCT_NAME, jri.PRODUCT_NAME,
jri.EQU_CODE, jri.EQU_CODE,
jri.USE_ORG_CODE, jri.USE_ORG_CODE,
(SELECT name from tz_equipment_category where code = jri.EQU_LIST) as EQU_LIST, (SELECT name from tz_equipment_category where code = jri.EQU_LIST) as EQU_LIST,
(SELECT name from tz_equipment_category where code = jri.EQU_CATEGORY) as EQU_CATEGORY, (SELECT name from tz_equipment_category where code = jri.EQU_CATEGORY) as EQU_CATEGORY,
(SELECT name from tz_equipment_category where code = jri.EQU_DEFINE) as EQU_DEFINE,
jri.EQU_LIST as EQU_LIST_CODE,
jri.EQU_CATEGORY as EQU_CATEGORY_CODE,
jri.EQU_DEFINE as EQU_DEFINE_CODE,
jfi.PRODUCE_DATE,
(select other.SUPERVISORY_CODE from idx_biz_jg_other_info other where other.RECORD = jui.RECORD) as SUPERVISORY_CODE, (select other.SUPERVISORY_CODE from idx_biz_jg_other_info other where other.RECORD = jui.RECORD) as SUPERVISORY_CODE,
to_char((select NEXT_INSPECT_DATE from idx_biz_jg_inspection_detection_info where "RECORD" = jui."RECORD" ORDER BY INSPECT_DATE DESC limit 1), 'YYYY-MM-DD') as NEXT_INSPECT_DATE to_char((select NEXT_INSPECT_DATE from idx_biz_jg_inspection_detection_info where "RECORD" = jui."RECORD" ORDER BY INSPECT_DATE DESC limit 1), 'YYYY-MM-DD') as NEXT_INSPECT_DATE
FROM idx_biz_jg_use_info jui FROM idx_biz_jg_use_info jui
......
...@@ -105,10 +105,16 @@ public class JgOverDesignServiceLifeController extends BaseController { ...@@ -105,10 +105,16 @@ public class JgOverDesignServiceLifeController extends BaseController {
@RequestParam(value = "sort", required = false) String sort, @RequestParam(value = "sort", required = false) String sort,
JgOverDesignServiceLifeDto dto) { JgOverDesignServiceLifeDto dto) {
ReginParams reginParams = getSelectedOrgInfo(); ReginParams reginParams = getSelectedOrgInfo();
dto.setUseUnitCreditCode(Optional.ofNullable(reginParams.getCompany().getCompanyCode()) dto.setUnitCode(Optional.ofNullable(reginParams.getCompany().getCompanyCode())
.map(code -> code.contains("_") ? code.split("_")[1] : code) .map(code -> code.contains("_") ? code.split("_")[1] : code)
.orElse("")); .orElse(""));
return ResponseHelper.buildResponse(jgOverDesignServiceLifeServiceImpl.getPageList(new Page<>(current, size), sort, dto, reginParams.getCompany().getCompanyType())); if (reginParams.getCompany().getLevel().equals(BaseController.COMPANY_TYPE_COMPANY)) {
dto.setDataType(BaseController.COMPANY_TYPE_COMPANY);
} else {
dto.setDataType(BaseController.COMPANY_TYPE_SUPERVISION);
}
dto.setCurrentUserId(reginParams.getUserModel().getUserId());
return ResponseHelper.buildResponse(jgOverDesignServiceLifeServiceImpl.getPageList(new Page<>(current, size), sort, dto));
} }
/** /**
......
...@@ -2467,6 +2467,7 @@ public class CommonServiceImpl implements ICommonService { ...@@ -2467,6 +2467,7 @@ public class CommonServiceImpl implements ICommonService {
String equCategory = (String) firstEquip.get("EQU_CATEGORY"); String equCategory = (String) firstEquip.get("EQU_CATEGORY");
formDataList = equips.stream().map(v -> { formDataList = equips.stream().map(v -> {
JSONObject formData = new JSONObject(); JSONObject formData = new JSONObject();
formData.putAll(jsonObject);
formData.put("equDefine", equDefine); formData.put("equDefine", equDefine);
formData.put("equCategory", equCategory); formData.put("equCategory", equCategory);
formData.entrySet().removeIf(entry -> entry.getValue() == null); formData.entrySet().removeIf(entry -> entry.getValue() == null);
......
...@@ -120,8 +120,8 @@ public class JgOverDesignServiceLifeServiceImpl extends BaseService<JgOverDesign ...@@ -120,8 +120,8 @@ public class JgOverDesignServiceLifeServiceImpl extends BaseService<JgOverDesign
/** /**
* 分页查询 * 分页查询
*/ */
public Page<Map<String, Object>> getPageList(Page<Map<String, Object>> page, String sort, JgOverDesignServiceLifeDto dto, String companyType) { public Page<Map<String, Object>> getPageList(Page<Map<String, Object>> page, String sort, JgOverDesignServiceLifeDto dto) {
return this.baseMapper.getListPage(page, commonService.sortFieldConversion(sort), dto, companyType); return this.baseMapper.getListPage(page, commonService.sortFieldConversion(sort), dto);
} }
/** /**
...@@ -146,7 +146,7 @@ public class JgOverDesignServiceLifeServiceImpl extends BaseService<JgOverDesign ...@@ -146,7 +146,7 @@ public class JgOverDesignServiceLifeServiceImpl extends BaseService<JgOverDesign
.map(JSONObject::toJSONString) .map(JSONObject::toJSONString)
.ifPresent(overDesignDto::setUseRegistrationFormFile); .ifPresent(overDesignDto::setUseRegistrationFormFile);
map.put("userName", reginParams.getUserModel().getRealName()); map.put("userName", reginParams.getUserModel().getRealName());
Map<String, Object> overDesign = commonService.getRegistrationFormUrl("overDesign", map); Map<String, Object> overDesign = commonService.getRegistrationChangeCertificateUrl(map);
if (Objects.nonNull(overDesign)) { if (Objects.nonNull(overDesign)) {
overDesignDto.setUseRegistrationFormUrl(String.valueOf(overDesign.get("useRegistrationFormUrl"))); overDesignDto.setUseRegistrationFormUrl(String.valueOf(overDesign.get("useRegistrationFormUrl")));
} }
...@@ -602,37 +602,42 @@ public class JgOverDesignServiceLifeServiceImpl extends BaseService<JgOverDesign ...@@ -602,37 +602,42 @@ public class JgOverDesignServiceLifeServiceImpl extends BaseService<JgOverDesign
private void updateEquipMessage(JSONObject jsonObject) { private void updateEquipMessage(JSONObject jsonObject) {
List<Map<String, Object>> equipmentLists = (List<Map<String, Object>>) jsonObject.get("equipmentLists"); List<Map<String, Object>> equipmentLists = (List<Map<String, Object>>) jsonObject.get("equipmentLists");
List<String> useOrgCodes = equipmentLists.stream() List<String> useOrgCodes = equipmentLists.stream()
.map(obj -> ((JSONObject) obj).getString("USE_ORG_CODE")) .map(obj -> Objects.toString(obj.get("USE_ORG_CODE"), ""))
.collect(Collectors.toList()); .collect(Collectors.toList());
List<IdxBizJgDesignInfo> designInfoList = idxBizJgDesignInfoServiceImpl.checkOverDesignRegNum( List<String> records = equipmentLists.stream()
equipmentLists.stream().map(v -> (String) v.get("record")).collect(Collectors.toList()) .map(v -> Objects.toString(v.get("record"), ""))
); .collect(Collectors.toList());
List<IdxBizJgDesignInfo> designInfoList = idxBizJgDesignInfoServiceImpl.checkOverDesignRegNum(records);
if (CollectionUtils.isEmpty(designInfoList)) { if (CollectionUtils.isEmpty(designInfoList)) {
throw new BadRequest("未查询到设备设计信息!"); throw new BadRequest("未查询到设备设计信息!");
}; }
String equListCode = Objects.toString(equipmentLists.get(0).get("EQU_LIST_CODE"), "");
String equListCode = Objects.toString(equipmentLists.get(0).get("EQU_LIST_CODE"));
ZoneId zoneId = ZoneId.systemDefault(); ZoneId zoneId = ZoneId.systemDefault();
designInfoList.forEach(designInfo -> { designInfoList.forEach(designInfo -> {
List<IdxBizJgInspectionDetectionInfo> inspectionList = List<IdxBizJgInspectionDetectionInfo> inspectionList =
iIdxBizJgInspectionDetectionInfoService.queryInspectionListByRecord(designInfo.getRecord()); iIdxBizJgInspectionDetectionInfoService.queryInspectionListByRecord(designInfo.getRecord());
designInfo.setOverDesignRegNum(Math.min(designInfo.getOverDesignRegNum() + 1, 2)); designInfo.setOverDesignRegNum(Math.min(designInfo.getOverDesignRegNum() + 1, 2));
designInfo.setDelayServiceLifeDate(
designInfo.setDelayServiceLifeDate(inspectionList.stream() inspectionList.stream()
.filter(info -> "6000".equals(equListCode) || "WTJY".equals(info.getInspectType())) .filter(info -> "6000".equals(equListCode) || "WTJY".equals(info.getInspectType()))
.findFirst() .findFirst()
.map(info -> "6000".equals(equListCode) ? info.getInspectDate() : info.getNextInspectDate()) .map(info -> {
.map(date -> date.toInstant().atZone(zoneId).toLocalDate().plusYears("6000".equals(equListCode) ? 4 : 0).toString()) Date targetDate = "6000".equals(equListCode) ? info.getInspectDate() : info.getNextInspectDate();
.orElse(null)); return targetDate.toInstant().atZone(zoneId).toLocalDate().plusYears("6000".equals(equListCode) ? 4 : 0).toString();
})
.orElse(null)
);
}); });
List<JgUseRegistrationManage> registrationList = useRegistrationManageService.lambdaQuery()
idxBizJgDesignInfoService.saveOrUpdateBatch(designInfoList); .in(JgUseRegistrationManage::getUseRegistrationCode, useOrgCodes).list();
useRegistrationManageService.lambdaUpdate() if (!CollectionUtils.isEmpty(registrationList)) {
.set(JgUseRegistrationManage::getIsOverDesign, 1) useRegistrationManageService.updateBatchById(
.in(JgUseRegistrationManage::getUseRegistrationCode, useOrgCodes) registrationList.stream().peek(v -> {
.update(); v.setIsOverDesign("1");
v.setVersion(v.getVersion() + 1);
}).collect(Collectors.toList())
);
}
} }
private void buildTask(JgOverDesignServiceLife jgOverDesignServiceLife, WorkflowResultDto workflowResultDto) { private void buildTask(JgOverDesignServiceLife jgOverDesignServiceLife, WorkflowResultDto workflowResultDto) {
......
...@@ -627,6 +627,9 @@ public class JgUseRegistrationManageServiceImpl extends BaseService<JgUseRegistr ...@@ -627,6 +627,9 @@ public class JgUseRegistrationManageServiceImpl extends BaseService<JgUseRegistr
if (ValidationUtil.isEmpty(deviceList.get(0))) { if (ValidationUtil.isEmpty(deviceList.get(0))) {
throw new BadRequest("使用登记证导出失败,监管码为空!"); throw new BadRequest("使用登记证导出失败,监管码为空!");
} }
if ("1".equals(manage.getIsOverDesign())) {
exportParamsMap.put("overDesign", "超设计使用年限");
}
exportParamsMap.put("supervisoryCode", deviceList.get(0).get("SUPERVISORY_CODE")); exportParamsMap.put("supervisoryCode", deviceList.get(0).get("SUPERVISORY_CODE"));
getAuditPassedDate(manage.getAuditPassDate(), exportParamsMap); getAuditPassedDate(manage.getAuditPassDate(), exportParamsMap);
exportParamsMap.put("equList", manage.getEquList()); exportParamsMap.put("equList", manage.getEquList());
......
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