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

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

parent 828e67de
......@@ -106,4 +106,10 @@ public class JgOverDesignServiceLifeDto extends BaseDto {
@ApiModelProperty(value = "使用登记编号")
private String useRegistrationCode;
private String dataType;
private String unitCode;
private String currentUserId;
}
......@@ -23,8 +23,7 @@ public interface JgOverDesignServiceLifeMapper extends BaseMapper<JgOverDesignSe
Page<Map<String, Object>> getListPage(@Param("page")Page<Map<String, Object>> page,
@Param("sort") SortVo sortMap,
@Param("dto") JgOverDesignServiceLifeDto dto ,
@Param("type") String type);
@Param("dto") JgOverDesignServiceLifeDto dto);
List<Map<String, Object>> selectEquipList(@Param("records") List<String> records);
}
......@@ -78,14 +78,14 @@
AND ovds.use_registration_code like concat('%',#{dto.useRegistrationCode},'%')
</if>
<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 test="type == 'supervision'">
AND (ovds.receive_company_code = #{dto.useUnitCreditCode} or ovds.transfer_to_user_ids like concat('%',#{currentUserId},'%'))
<if test="dto.dataType == 'supervision' ">
AND (ovds.receive_company_code = #{dto.unitCode} or ovds.transfer_to_user_ids like concat('%',#{dto.currentUserId},'%'))
AND ovds.instance_id <![CDATA[<>]]> ''
</if>
<if test="type == 'company'">
AND ovds.use_unit_credit_code = #{dto.useUnitCreditCode}
<if test="dto.dataType == 'company' ">
AND ovds.use_unit_credit_code = #{dto.unitCode}
</if>
<if test="dto.applyNo != null and dto.applyNo != ''">
and ovds.apply_no like concat('%',#{dto.applyNo},'%')
......@@ -105,12 +105,16 @@
jfi.FACTORY_NUM,
jui.ADDRESS as ADDRESS,
jui.RECORD record,
(SELECT name from tz_equipment_category where code = jri.EQU_DEFINE) as EQU_DEFINE,
jri.PRODUCT_NAME,
jri.EQU_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_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,
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
......
......@@ -105,10 +105,16 @@ public class JgOverDesignServiceLifeController extends BaseController {
@RequestParam(value = "sort", required = false) String sort,
JgOverDesignServiceLifeDto dto) {
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)
.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 {
String equCategory = (String) firstEquip.get("EQU_CATEGORY");
formDataList = equips.stream().map(v -> {
JSONObject formData = new JSONObject();
formData.putAll(jsonObject);
formData.put("equDefine", equDefine);
formData.put("equCategory", equCategory);
formData.entrySet().removeIf(entry -> entry.getValue() == null);
......
......@@ -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) {
return this.baseMapper.getListPage(page, commonService.sortFieldConversion(sort), dto, 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);
}
/**
......@@ -146,7 +146,7 @@ public class JgOverDesignServiceLifeServiceImpl extends BaseService<JgOverDesign
.map(JSONObject::toJSONString)
.ifPresent(overDesignDto::setUseRegistrationFormFile);
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)) {
overDesignDto.setUseRegistrationFormUrl(String.valueOf(overDesign.get("useRegistrationFormUrl")));
}
......@@ -602,37 +602,42 @@ public class JgOverDesignServiceLifeServiceImpl extends BaseService<JgOverDesign
private void updateEquipMessage(JSONObject jsonObject) {
List<Map<String, Object>> equipmentLists = (List<Map<String, Object>>) jsonObject.get("equipmentLists");
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());
List<IdxBizJgDesignInfo> designInfoList = idxBizJgDesignInfoServiceImpl.checkOverDesignRegNum(
equipmentLists.stream().map(v -> (String) v.get("record")).collect(Collectors.toList())
);
List<String> records = equipmentLists.stream()
.map(v -> Objects.toString(v.get("record"), ""))
.collect(Collectors.toList());
List<IdxBizJgDesignInfo> designInfoList = idxBizJgDesignInfoServiceImpl.checkOverDesignRegNum(records);
if (CollectionUtils.isEmpty(designInfoList)) {
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();
designInfoList.forEach(designInfo -> {
List<IdxBizJgInspectionDetectionInfo> inspectionList =
iIdxBizJgInspectionDetectionInfoService.queryInspectionListByRecord(designInfo.getRecord());
designInfo.setOverDesignRegNum(Math.min(designInfo.getOverDesignRegNum() + 1, 2));
designInfo.setDelayServiceLifeDate(inspectionList.stream()
.filter(info -> "6000".equals(equListCode) || "WTJY".equals(info.getInspectType()))
.findFirst()
.map(info -> "6000".equals(equListCode) ? info.getInspectDate() : info.getNextInspectDate())
.map(date -> date.toInstant().atZone(zoneId).toLocalDate().plusYears("6000".equals(equListCode) ? 4 : 0).toString())
.orElse(null));
designInfo.setDelayServiceLifeDate(
inspectionList.stream()
.filter(info -> "6000".equals(equListCode) || "WTJY".equals(info.getInspectType()))
.findFirst()
.map(info -> {
Date targetDate = "6000".equals(equListCode) ? info.getInspectDate() : info.getNextInspectDate();
return targetDate.toInstant().atZone(zoneId).toLocalDate().plusYears("6000".equals(equListCode) ? 4 : 0).toString();
})
.orElse(null)
);
});
idxBizJgDesignInfoService.saveOrUpdateBatch(designInfoList);
useRegistrationManageService.lambdaUpdate()
.set(JgUseRegistrationManage::getIsOverDesign, 1)
.in(JgUseRegistrationManage::getUseRegistrationCode, useOrgCodes)
.update();
List<JgUseRegistrationManage> registrationList = useRegistrationManageService.lambdaQuery()
.in(JgUseRegistrationManage::getUseRegistrationCode, useOrgCodes).list();
if (!CollectionUtils.isEmpty(registrationList)) {
useRegistrationManageService.updateBatchById(
registrationList.stream().peek(v -> {
v.setIsOverDesign("1");
v.setVersion(v.getVersion() + 1);
}).collect(Collectors.toList())
);
}
}
private void buildTask(JgOverDesignServiceLife jgOverDesignServiceLife, WorkflowResultDto workflowResultDto) {
......
......@@ -627,6 +627,9 @@ public class JgUseRegistrationManageServiceImpl extends BaseService<JgUseRegistr
if (ValidationUtil.isEmpty(deviceList.get(0))) {
throw new BadRequest("使用登记证导出失败,监管码为空!");
}
if ("1".equals(manage.getIsOverDesign())) {
exportParamsMap.put("overDesign", "超设计使用年限");
}
exportParamsMap.put("supervisoryCode", deviceList.get(0).get("SUPERVISORY_CODE"));
getAuditPassedDate(manage.getAuditPassDate(), exportParamsMap);
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