Commit 9e9766f2 authored by 刘林's avatar 刘林

fix(jg):超设计使用年限bug修改

parent 269cb894
...@@ -3,48 +3,47 @@ ...@@ -3,48 +3,47 @@
<mapper namespace="com.yeejoin.amos.boot.module.jg.api.mapper.JgOverDesignServiceLifeMapper"> <mapper namespace="com.yeejoin.amos.boot.module.jg.api.mapper.JgOverDesignServiceLifeMapper">
<select id="queryForFlowingEquipList" resultType="com.yeejoin.amos.boot.module.jg.api.dto.CompanyEquipCountDto"> <select id="queryForFlowingEquipList" resultType="com.yeejoin.amos.boot.module.jg.api.dto.CompanyEquipCountDto">
select a.use_unit_credit_code as companyCode, SELECT a.use_unit_credit_code AS companyCode,
GROUP_CONCAT(b.equ_id) as records GROUP_CONCAT(b.equ_id) AS records
from TZS_JG_OVER_DESIGN_SERVICE_LIFE a, FROM tzs_jg_over_design_service_life a,
TZS_JG_OVER_DESIGN_SERVICE_LIFE_EQ b tzs_jg_over_design_service_life_eq b
where a.sequence_nbr = b.over_design_id WHERE a.sequence_nbr = b.over_design_id
and a.status in ('待受理') AND a.status IN ('待受理')
GROUP BY a.use_unit_credit_code GROUP BY a.use_unit_credit_code
</select> </select>
<sql id="page_list"> <sql id="pageList">
WITH crteq_limited AS ( WITH crteq_limited AS (
SELECT *,ROW_NUMBER() OVER (PARTITION BY over_design_id ORDER BY rec_date desc) as rn SELECT *,ROW_NUMBER() OVER (PARTITION BY over_design_id ORDER BY rec_date desc) AS rn
FROM TZS_JG_OVER_DESIGN_SERVICE_LIFE_EQ) FROM tzs_jg_over_design_service_life_eq)
SELECT SELECT
ovds.sequence_nbr as sequenceNbr, ovds.sequence_nbr AS sequenceNbr,
DATE_FORMAT(ovds.rec_date,'%Y-%m-%d') as regDate, DATE_FORMAT(ovds.rec_date,'%Y-%m-%d') AS regDate,
DATE_FORMAT(ovds.create_date,'%Y-%m-%d') as createDate, DATE_FORMAT(ovds.create_date,'%Y-%m-%d') AS createDate,
ovds.status, ovds.status,
ovds.receive_org_name as receiveOrgName, ovds.receive_org_name AS receiveOrgName,
ovds.apply_no as applyNo, ovds.apply_no AS applyNo,
ovds.next_execute_ids AS nextExecuteIds, ovds.next_execute_ids AS nextExecuteIds,
ovds.promoter, ovds.promoter,
DATE_FORMAT(ovds.rec_date,'%Y-%m-%d') as recDate, DATE_FORMAT(ovds.rec_date,'%Y-%m-%d') AS recDate,
ovds.instance_id as instanceId, ovds.instance_id AS instanceId,
ovds.use_registration_code as useRegistrationCode, ovds.use_registration_code AS useRegistrationCode,
ovds.next_execute_user_ids as nextExecuteUserIds, ovds.next_execute_user_ids AS nextExecuteUserIds,
ovds.create_user_id as createUserId, ovds.create_user_id AS createUserId,
ovds.next_task_id as nextTaskId, ovds.next_tASk_id AS nextTASkId,
ovds.USE_UNIT_NAME as useUnitName, ovds.USE_UNIT_NAME AS useUnitName,
jri.PRODUCT_NAME as productName, jri.PRODUCT_NAME AS productName,
jri.EQU_CODE as equCode, jri.EQU_CODE AS equCode,
concat(use."PROVINCE_NAME", '', use."CITY_NAME", '', use."COUNTY_NAME", '', use."STREET_NAME") as allAddress, (SELECT name FROM tz_equipment_category WHERE code = jri.EQU_LIST) AS equList,
(SELECT name from tz_equipment_category WHERE code = jri.EQU_LIST) AS equList, (SELECT name FROM tz_equipment_category WHERE code = jri.EQU_CATEGORY) AS equCategory,
(SELECT name from tz_equipment_category where code = jri.EQU_CATEGORY) as equCategory, (SELECT name FROM tz_equipment_category WHERE code = jri.EQU_DEFINE) AS equDefine
(SELECT name from tz_equipment_category where code = jri.EQU_DEFINE) as equDefine FROM tzs_jg_over_design_service_life ovds
FROM TZS_JG_OVER_DESIGN_SERVICE_LIFE ovds
LEFT JOIN crteq_limited ovdseq ON ovds.sequence_nbr = ovdseq.over_design_id AND ovdseq.rn = 1 LEFT JOIN crteq_limited ovdseq ON ovds.sequence_nbr = ovdseq.over_design_id AND ovdseq.rn = 1
LEFT JOIN idx_biz_jg_register_info jri on ovdseq.equ_id = jri.RECORD LEFT JOIN idx_biz_jg_register_info jri ON ovdseq.equ_id = jri.RECORD
LEFT JOIN idx_biz_jg_use_info use on ovdseq.equ_id = use.RECORD LEFT JOIN idx_biz_jg_use_info use ON ovdseq.equ_id = use.RECORD
</sql> </sql>
<select id="getListPage" resultType="java.util.Map"> <select id="getListPage" resultType="java.util.Map">
<include refid="page_list"/> <include refid="pageList"/>
<where> <where>
and ovds.is_delete = 0 and ovds.is_delete = 0
<if test="dto.equCategory != null and dto.equCategory != ''"> <if test="dto.equCategory != null and dto.equCategory != ''">
...@@ -99,34 +98,32 @@ ...@@ -99,34 +98,32 @@
</select> </select>
<select id="selectEquipList" resultType="java.util.Map"> <select id="selectEquipList" resultType="java.util.Map">
select jui.RECORD as SEQUENCE_NBR, SELECT jui.RECORD AS sequenceNbr,
jfi.PRODUCE_UNIT_NAME, jfi.PRODUCE_UNIT_NAME AS produceUnitName,
jui.USE_INNER_CODE, jfi.FACTORY_NUM AS factoryNum,
jfi.FACTORY_NUM, jui.RECORD AS record,
jui.ADDRESS as ADDRESS, jri.PRODUCT_NAME AS productName,
jui.RECORD record, jri.EQU_CODE AS equCode,
jri.PRODUCT_NAME, jri.USE_ORG_CODE AS useOrgCode,
jri.EQU_CODE, (SELECT name FROM tz_equipment_category WHERE code = jri.EQU_LIST) AS equList,
jri.USE_ORG_CODE, (SELECT name FROM tz_equipment_category WHERE code = jri.EQU_CATEGORY) AS equCategory,
(SELECT name from tz_equipment_category where code = jri.EQU_LIST) as EQU_LIST, (SELECT name FROM tz_equipment_category WHERE code = jri.EQU_DEFINE) AS equDefine,
(SELECT name from tz_equipment_category where code = jri.EQU_CATEGORY) as EQU_CATEGORY, jri.EQU_LIST AS equListCode,
(SELECT name from tz_equipment_category where code = jri.EQU_DEFINE) as EQU_DEFINE, jri.EQU_CATEGORY AS equCategoryCode,
jri.EQU_LIST as EQU_LIST_CODE, jri.EQU_DEFINE AS equDefineCode,
jri.EQU_CATEGORY as EQU_CATEGORY_CODE, jfi.PRODUCE_DATE AS produceDate,
jri.EQU_DEFINE as EQU_DEFINE_CODE, (SELECT SEQUENCE_NBR FROM idx_biz_jg_inspection_detection_info WHERE "RECORD" = jui."RECORD" ORDER BY INSPECT_DATE DESC LIMIT 1) jySeq,
jfi.PRODUCE_DATE, (SELECT INSPECT_ORG_NAME FROM idx_biz_jg_inspection_detection_info WHERE "RECORD" = jui."RECORD" ORDER BY INSPECT_DATE DESC LIMIT 1) inspectOrgName,
(select SEQUENCE_NBR from idx_biz_jg_inspection_detection_info where "RECORD" = jui."RECORD" AND INSPECT_TYPE = 'WTJY' ORDER BY INSPECT_DATE DESC limit 1) jySeq, (SELECT INSPECT_ORG_CODE FROM idx_biz_jg_inspection_detection_info WHERE "RECORD" = jui."RECORD" ORDER BY INSPECT_DATE DESC LIMIT 1) inspectOrgCode,
(select INSPECT_ORG_NAME from idx_biz_jg_inspection_detection_info where "RECORD" = jui."RECORD" AND INSPECT_TYPE = 'WTJY' ORDER BY INSPECT_DATE DESC limit 1) INSPECT_ORG_NAME, (SELECT INSPECT_REPORT_NO FROM idx_biz_jg_inspection_detection_info WHERE "RECORD" = jui."RECORD" ORDER BY INSPECT_DATE DESC LIMIT 1) inspectReportNo,
(select INSPECT_ORG_CODE from idx_biz_jg_inspection_detection_info where "RECORD" = jui."RECORD" AND INSPECT_TYPE = 'WTJY' ORDER BY INSPECT_DATE DESC limit 1) INSPECT_ORG_CODE, (SELECT INSPECT_CONCLUSION FROM idx_biz_jg_inspection_detection_info WHERE "RECORD" = jui."RECORD" ORDER BY INSPECT_DATE DESC LIMIT 1) inspectConclusionCode,
(select INSPECT_REPORT_NO from idx_biz_jg_inspection_detection_info where "RECORD" = jui."RECORD" AND INSPECT_TYPE = 'WTJY' ORDER BY INSPECT_DATE DESC limit 1) INSPECT_REPORT_NO, (SELECT NAME FROM cb_data_dictionary WHERE type = 'JYJL' and code = (SELECT INSPECT_CONCLUSION FROM idx_biz_jg_inspection_detection_info WHERE "RECORD" = jui."RECORD" ORDER BY INSPECT_DATE DESC LIMIT 1)) inspectConclusion,
(select INSPECT_CONCLUSION from idx_biz_jg_inspection_detection_info where "RECORD" = jui."RECORD" AND INSPECT_TYPE = 'WTJY' ORDER BY INSPECT_DATE DESC limit 1) INSPECT_CONCLUSION_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') nextInspectDate,
(select name from cb_data_dictionary where type = 'JYJL' and code = (select INSPECT_CONCLUSION from idx_biz_jg_inspection_detection_info where "RECORD" = jui."RECORD" AND INSPECT_TYPE = 'WTJY' ORDER BY INSPECT_DATE DESC limit 1)) INSPECT_CONCLUSION, (SELECT INSPECT_REPORT FROM idx_biz_jg_inspection_detection_info WHERE "RECORD" = jui."RECORD" ORDER BY INSPECT_DATE DESC LIMIT 1) inspectReport
to_char((select NEXT_INSPECT_DATE from idx_biz_jg_inspection_detection_info where "RECORD" = jui."RECORD" AND INSPECT_TYPE = 'WTJY' ORDER BY INSPECT_DATE DESC limit 1), 'YYYY-MM-DD') NEXT_INSPECT_DATE,
(select INSPECT_REPORT from idx_biz_jg_inspection_detection_info where "RECORD" = jui."RECORD" AND INSPECT_TYPE = 'WTJY' ORDER BY INSPECT_DATE DESC limit 1) INSPECT_REPORT
FROM idx_biz_jg_use_info jui 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_factory_info jfi ON jui.RECORD = jfi.RECORD
LEFT JOIN idx_biz_jg_register_info jri on jui.RECORD = jri.RECORD LEFT JOIN idx_biz_jg_register_info jri ON jui.RECORD = jri.RECORD
WHERE jui.record in WHERE jui.record IN
<foreach collection="records" item="record" open="(" close=")" separator=","> <foreach collection="records" item="record" open="(" close=")" separator=",">
#{record} #{record}
</foreach> </foreach>
......
...@@ -1449,7 +1449,7 @@ ...@@ -1449,7 +1449,7 @@
select select
count(1) as inUseNumber count(1) as inUseNumber
from from
"tzs_jg_use_registration_eq" ae tzs_jg_use_registration_eq ae
JOIN tzs_jg_use_registration A ON A.sequence_nbr = ae.equip_transfer_id JOIN tzs_jg_use_registration A ON A.sequence_nbr = ae.equip_transfer_id
JOIN "tzs_jg_equip_transfer_eq" tjete ON ae.equ_id = tjete."equ_id" JOIN "tzs_jg_equip_transfer_eq" tjete ON ae.equ_id = tjete."equ_id"
JOIN tzs_jg_equip_transfer tjet ON tjete."equip_transfer_id" = tjet."sequence_nbr" JOIN tzs_jg_equip_transfer tjet ON tjete."equip_transfer_id" = tjet."sequence_nbr"
...@@ -1461,11 +1461,11 @@ ...@@ -1461,11 +1461,11 @@
select select
count(1) as inUseNumber count(1) as inUseNumber
from from
"TZS_JG_OVER_DESIGN_SERVICE_LIFE_EQ" ae tzs_jg_over_design_service_life_eq ae
JOIN TZS_JG_OVER_DESIGN_SERVICE_LIFE a ON a.sequence_nbr = ae.over_design_id JOIN tzs_jg_over_design_service_life a ON a.sequence_nbr = ae.over_design_id
where a.use_registration_code LIKE CONCAT('%',#{code},'%') where a.use_registration_code LIKE CONCAT('%',#{code},'%')
AND a.is_delete = 0 AND a.is_delete = 0
AND a.status != '已作废' AND a.status != '已作废'
)x )
</select> </select>
</mapper> </mapper>
...@@ -230,19 +230,6 @@ public class IdxBizJgProjectContraptionController extends BaseController { ...@@ -230,19 +230,6 @@ public class IdxBizJgProjectContraptionController extends BaseController {
return ResponseHelper.buildResponse(idxBizJgProjectContraptionServiceImpl.getNewInspectionDetailByRecord(record)); return ResponseHelper.buildResponse(idxBizJgProjectContraptionServiceImpl.getNewInspectionDetailByRecord(record));
} }
/**
* 获取最新检验信息详情
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/getNewWTJYInspectionDetailByRecord")
@ApiOperation(httpMethod = "GET", value = "获取最新检验信息详情", notes = "获取最新检验信息详情")
public ResponseModel<Map<String, Object>> getNewWTJYInspectionDetailByRecord(@RequestParam("record") String record,
@RequestParam("equListCode") String equListCode) {
return ResponseHelper.buildResponse(idxBizJgProjectContraptionServiceImpl.getNewWTJYInspectionDetailByRecord(record,equListCode));
}
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/summaryBasicInfo/export") @GetMapping(value = "/summaryBasicInfo/export")
@ApiOperation(httpMethod = "GET", value = "导出基本信息汇总表(长输/公用管道)", notes = "导出基本信息汇总表(长输/公用管道)") @ApiOperation(httpMethod = "GET", value = "导出基本信息汇总表(长输/公用管道)", notes = "导出基本信息汇总表(长输/公用管道)")
......
...@@ -164,4 +164,17 @@ public class JgOverDesignServiceLifeController extends BaseController { ...@@ -164,4 +164,17 @@ public class JgOverDesignServiceLifeController extends BaseController {
public ResponseModel<JgOverDesignServiceLife> invalid(@RequestBody JgOverDesignServiceLifeDto dto) { public ResponseModel<JgOverDesignServiceLife> invalid(@RequestBody JgOverDesignServiceLifeDto dto) {
return ResponseHelper.buildResponse(jgOverDesignServiceLifeServiceImpl.invalid(dto.getSequenceNbr(), dto.getCancelReason())); return ResponseHelper.buildResponse(jgOverDesignServiceLifeServiceImpl.invalid(dto.getSequenceNbr(), dto.getCancelReason()));
} }
/**
* 获取最新检验信息详情
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/getNewWTJYInspectionDetailByRecord")
@ApiOperation(httpMethod = "GET", value = "获取最新检验信息详情", notes = "获取最新检验信息详情")
public ResponseModel<Map<String, Object>> getNewWTJYInspectionDetailByRecord(@RequestParam("record") String record,
@RequestParam("equListCode") String equListCode) {
return ResponseHelper.buildResponse(jgOverDesignServiceLifeServiceImpl.getNewWTJYInspectionDetailByRecord(record,equListCode));
}
} }
...@@ -2,6 +2,7 @@ package com.yeejoin.amos.boot.module.jg.biz.controller; ...@@ -2,6 +2,7 @@ package com.yeejoin.amos.boot.module.jg.biz.controller;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.google.common.base.CaseFormat;
import com.yeejoin.amos.boot.biz.common.bo.CompanyBo; import com.yeejoin.amos.boot.biz.common.bo.CompanyBo;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams; import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.controller.BaseController; import com.yeejoin.amos.boot.biz.common.controller.BaseController;
...@@ -20,7 +21,6 @@ import org.typroject.tyboot.core.restful.doc.TycloudOperation; ...@@ -20,7 +21,6 @@ import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest; import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import org.typroject.tyboot.core.restful.utils.ResponseHelper; import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel; import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.util.Arrays; import java.util.Arrays;
...@@ -260,6 +260,43 @@ public class JgUseRegistrationManageController extends BaseController { ...@@ -260,6 +260,43 @@ public class JgUseRegistrationManageController extends BaseController {
} }
/** /**
* 根据证id批量查询证下面所有设备
* @param current
* @param size
* @param enableType
* @param sequenceNbrs
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/queryEquForPageByCertificateSeqList")
@ApiOperation(httpMethod = "GET", value = "根据证id批量查询证下面所有设备", notes = "根据证id批量查询证下面所有设备")
public ResponseModel<Page<JSONObject>> queryEquForPageByCertificateSeqList(@RequestParam(value = "current") int current,
@RequestParam(value = "size") int size,
@RequestParam(value = "enableType", required = false) String enableType,
@RequestParam(value = "sequenceNbrs", required = false) String sequenceNbrs) {
if (ObjectUtils.isEmpty(sequenceNbrs)) {
throw new BadRequest("请先选择使用登记证");
}
List<Long> collect = Arrays.stream(sequenceNbrs.split(","))
.map(Long::parseLong)
.collect(Collectors.toList());
Page<JSONObject> result = jgUseRegistrationManageServiceImpl.queryEquForPageByCertificateSeqList(enableType, collect, current, size);
result.setRecords(result.getRecords().stream().map(this::convertKeysToCamelCase).collect(Collectors.toList()));
return ResponseHelper.buildResponse(result);
}
/**
* 将 JSON 对象的 Key 由 UPPER_UNDERSCORE 转换为 lowerCamelCase
*/
private JSONObject convertKeysToCamelCase(JSONObject jsonObject) {
JSONObject newJson = new JSONObject();
jsonObject.forEach((key, value) ->
newJson.put(CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, key), value)
);
return newJson;
}
/**
* 证的 相关打印 * 证的 相关打印
* @param response 响应 * @param response 响应
* @param printType certificateNormalPrint:使用登记证 普打 * @param printType certificateNormalPrint:使用登记证 普打
......
...@@ -81,6 +81,7 @@ import org.springframework.beans.factory.annotation.Value; ...@@ -81,6 +81,7 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Lazy; import org.springframework.context.annotation.Lazy;
import org.springframework.core.io.ClassPathResource; import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource; import org.springframework.core.io.Resource;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
...@@ -93,7 +94,6 @@ import org.typroject.tyboot.core.foundation.utils.Bean; ...@@ -93,7 +94,6 @@ import org.typroject.tyboot.core.foundation.utils.Bean;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil; import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest; import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import org.typroject.tyboot.core.restful.utils.ResponseModel; import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.annotation.PostConstruct; import javax.annotation.PostConstruct;
import javax.servlet.ServletOutputStream; import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
...@@ -2456,7 +2456,6 @@ public class CommonServiceImpl implements ICommonService { ...@@ -2456,7 +2456,6 @@ public class CommonServiceImpl implements ICommonService {
return formData; return formData;
} }
//多个证进行批量生成
public List<JSONObject> buildFileForOverDesign(JSONObject jsonObject) { public List<JSONObject> buildFileForOverDesign(JSONObject jsonObject) {
List<JSONObject> formDataList = new ArrayList<>(); List<JSONObject> formDataList = new ArrayList<>();
if (jsonObject.containsKey("equipmentLists")) { if (jsonObject.containsKey("equipmentLists")) {
...@@ -2467,8 +2466,8 @@ public class CommonServiceImpl implements ICommonService { ...@@ -2467,8 +2466,8 @@ public class CommonServiceImpl implements ICommonService {
.collect(Collectors.toList()); .collect(Collectors.toList());
if (!CollectionUtils.isEmpty(equips)) { if (!CollectionUtils.isEmpty(equips)) {
Map<String, Object> firstEquip = equips.get(0); Map<String, Object> firstEquip = equips.get(0);
String equDefine = (String) firstEquip.get("EQU_DEFINE"); String equDefine = Objects.toString(firstEquip.get("equDefine"),"--");
String equCategory = (String) firstEquip.get("EQU_CATEGORY"); String equCategory = Objects.toString(firstEquip.get("equCategory"),"");
formDataList = equips.stream().map(v -> { formDataList = equips.stream().map(v -> {
JSONObject formData = new JSONObject(); JSONObject formData = new JSONObject();
formData.putAll(jsonObject); formData.putAll(jsonObject);
...@@ -2481,27 +2480,25 @@ public class CommonServiceImpl implements ICommonService { ...@@ -2481,27 +2480,25 @@ public class CommonServiceImpl implements ICommonService {
.ifPresent(type -> formData.put("registrationType", RegistrationTypeEnum.getNameByType(type))); .ifPresent(type -> formData.put("registrationType", RegistrationTypeEnum.getNameByType(type)));
Optional.ofNullable(Objects.toString(jsonObject.get("equListCode"), "")) Optional.ofNullable(Objects.toString(jsonObject.get("equListCode"), ""))
.ifPresent(code -> formData.put("equList", EquipmentClassifityEnum.getNameByCode(code))); .ifPresent(code -> formData.put("equList", EquipmentClassifityEnum.getNameByCode(code)));
String useRegistrationCode = Objects.toString(v.get("USE_ORG_CODE"), ""); String useRegistrationCode = Objects.toString(v.get("useOrgCode"), "");
JgUseRegistrationManage manage = jgUseRegistrationManageService.lambdaQuery() JgUseRegistrationManage manage = jgUseRegistrationManageService.lambdaQuery()
.eq(JgUseRegistrationManage::getUseRegistrationCode, useRegistrationCode) .eq(JgUseRegistrationManage::getUseRegistrationCode, useRegistrationCode)
.eq(JgUseRegistrationManage::getIsDelete, 0) .eq(JgUseRegistrationManage::getIsDelete, 0)
.eq(JgUseRegistrationManage::getCertificateStatus, CertificateStatusEnum.YIDENGJI.getName()) .eq(JgUseRegistrationManage::getCertificateStatus, CertificateStatusEnum.YIDENGJI.getName())
.one(); .one();
formData.put("equCode", v.get("equCode"));
formData.put("equCode", v.get("EQU_CODE")); formData.put("useRegistrationCode", v.get("useOrgCode"));
formData.put("useRegistrationCode", v.get("USE_ORG_CODE")); formData.put("produceUnitName", v.get("produceUnitName"));
formData.put("produceUnitName", v.get("PRODUCE_UNIT_NAME")); formData.put("produceDate", LocalDateTime.parse(Objects.toString(v.get("produceDate")), inputFormatter)
formData.put("produceDate", LocalDateTime.parse(Objects.toString(v.get("PRODUCE_DATE")), inputFormatter)
.format(outputFormatter)); .format(outputFormatter));
formData.put("factoryNum", v.get("FACTORY_NUM")); formData.put("factoryNum", v.get("factoryNum"));
formData.put("productName", v.get("PRODUCT_NAME")); formData.put("productName", v.get("productName"));
formData.put("useUnitName", v.get("USE_UNIT_NAME")); formData.put("useUnitName", v.get("useUnitName"));
if (manage != null && manage.getAuditPassDate() != null) { if (manage != null && manage.getAuditPassDate() != null) {
formData.put("auditPassDate", new SimpleDateFormat("yyyy-MM-dd").format(manage.getAuditPassDate())); formData.put("auditPassDate", new SimpleDateFormat("yyyy-MM-dd").format(manage.getAuditPassDate()));
} }
formData.put("receiveCompanyOrgName", manage != null ? manage.getReceiveOrgName() : null); formData.put("receiveCompanyOrgName", manage != null ? manage.getReceiveOrgName() : null);
formData.put("applyNo", manage != null ? manage.getApplyNo() : null); formData.put("applyNo", jsonObject.get("applyNo"));
formData.put("cruDate", DateUtils.convertDateToString(new Date(), DateUtils.CHN_DATE_PATTERN)); formData.put("cruDate", DateUtils.convertDateToString(new Date(), DateUtils.CHN_DATE_PATTERN));
return formData; return formData;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
...@@ -2585,7 +2582,18 @@ public class CommonServiceImpl implements ICommonService { ...@@ -2585,7 +2582,18 @@ public class CommonServiceImpl implements ICommonService {
@Override @Override
public Map<String, Object> getRegistrationChangeCertificateUrl(JSONObject jsonObject) { public Map<String, Object> getRegistrationChangeCertificateUrl(JSONObject jsonObject) {
String applyNo = jsonObject.getString("applyNo");
if (StringUtils.isEmpty(applyNo)) {
ResponseModel<List<String>> listResponseModel = tzsServiceFeignClient.applicationFormCode(ApplicationFormTypeEnum.CSJ.getCode(), 1);
if (!ObjectUtils.isEmpty(listResponseModel) && listResponseModel.getStatus() != HttpStatus.OK.value()) {
throw new BadRequest("超设计使用年限变更申请单单号获取失败!");
}
applyNo = listResponseModel.getResult().get(0);
}
jsonObject.put("applyNo", applyNo);
List<JSONObject> formDataList = buildFileForOverDesign(jsonObject); List<JSONObject> formDataList = buildFileForOverDesign(jsonObject);
Map<String, Object> result = new HashMap<>();
String wordPath = "use-registration-change-certificate.ftl"; String wordPath = "use-registration-change-certificate.ftl";
String fileName = "特种设备使用登记变更证明_"; String fileName = "特种设备使用登记变更证明_";
List<File> generatedFiles = new ArrayList<>(); List<File> generatedFiles = new ArrayList<>();
...@@ -2594,31 +2602,33 @@ public class CommonServiceImpl implements ICommonService { ...@@ -2594,31 +2602,33 @@ public class CommonServiceImpl implements ICommonService {
try { try {
List<File> pdfFiles = formDataList.stream() List<File> pdfFiles = formDataList.stream()
.map(formData -> { .map(formData -> {
File pdfFile = null;
try { try {
pdfFile = wordToPdf(fileName, wordPath, formData); File pdfFile = wordToPdf(fileName, wordPath, formData);
if (pdfFile != null && pdfFile.exists()) generatedFiles.add(pdfFile);
return pdfFile;
} catch (Exception e) { } catch (Exception e) {
throw new RuntimeException(e); log.error("PDF 生成失败", e);
} return null;
if (pdfFile != null && pdfFile.exists()) {
generatedFiles.add(pdfFile);
} }
return pdfFile;
}) })
.filter(Objects::nonNull) .filter(Objects::nonNull)
.collect(Collectors.toList()); .collect(Collectors.toList());
if (!pdfFiles.isEmpty()) { if (!pdfFiles.isEmpty()) {
mergedPdfFile = mergePdfFiles(pdfFiles, fileName + "合并.pdf"); mergedPdfFile = mergePdfFiles(pdfFiles, fileName + "合并.pdf");
if (mergedPdfFile.exists()) { if (mergedPdfFile.exists()) generatedFiles.add(mergedPdfFile);
generatedFiles.add(mergedPdfFile);
}
} }
String uploadedUrl = uploadFile(mergedPdfFile, "useRegistrationFormFiles"); String uploadedUrl = uploadFile(mergedPdfFile, "useRegistrationFormFiles");
return Collections.singletonMap("useRegistrationFormUrl", uploadedUrl); result.put("useRegistrationFormUrl", uploadedUrl);
result.put("applyNo", applyNo);
return result;
} catch (Exception e) { } catch (Exception e) {
log.error("生成或上传文件失败", e); log.error("生成或上传文件失败", e);
throw new RuntimeException("文件处理失败", e); throw new RuntimeException("文件处理失败", e);
} finally { } finally {
System.gc();
try {
Thread.sleep(100);
} catch (InterruptedException ignored) {}
generatedFiles.forEach(this::deleteFileSafely); generatedFiles.forEach(this::deleteFileSafely);
} }
} }
......
...@@ -748,22 +748,4 @@ public class IdxBizJgProjectContraptionServiceImpl extends BaseService<IdxBizJgP ...@@ -748,22 +748,4 @@ public class IdxBizJgProjectContraptionServiceImpl extends BaseService<IdxBizJgP
result.put("jySeq", info.getSequenceNbr()); result.put("jySeq", info.getSequenceNbr());
return result; return result;
} }
public Map<String, Object> getNewWTJYInspectionDetailByRecord(String record, String equListCode) {
return detectionInfoService.queryInspectionListByRecord(record).stream()
.filter(v -> "6000".equals(equListCode) || "WTJY".equals(v.getInspectType()))
.findFirst()
.map(info -> {
Map<String, Object> result = new HashMap<>(Bean.BeantoMap(info));
result.put("inspectReport", JSON.parseArray(info.getInspectReport()));
result.put("inspectConclusionCode", info.getInspectConclusion());
result.put("inspectConclusion",
Optional.ofNullable(dataDictionaryServiceImpl.getByCode(info.getInspectConclusion(), "JYJL"))
.map(DataDictionary::getName)
.orElse(""));
result.put("jySeq", info.getSequenceNbr());
return result;
})
.orElse(Collections.emptyMap());
}
} }
\ No newline at end of file
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