Commit 0731dbc2 authored by suhuiguang's avatar suhuiguang

1.压力管道按照装置报检

parent c60c35d8
package com.yeejoin.amos.boot.module.jyjc.api.entity;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import org.typroject.tyboot.core.rdbms.orm.entity.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.util.Date;
/**
* 检验检测历史数据表
*
* @author system_generator
* @date 2025-01-14
*/
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName(value = "tz_jyjc_inspection_history", autoResultMap = true)
public class JyjcInspectionHistory extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* 来源seq
*/
@TableField("s_seq")
private Long sSeq;
/**
* 推送数据
*/
@TableField(value = "history_data", typeHandler = JacksonTypeHandler.class)
private JSONObject historyData;
/**
* 备注
*/
@TableField("remark")
private String remark;
/**
* 来源类型
*/
@TableField("s_type")
private String sType;
}
...@@ -124,6 +124,13 @@ public interface JyjcInspectionApplicationMapper extends BaseMapper<JyjcInspecti ...@@ -124,6 +124,13 @@ public interface JyjcInspectionApplicationMapper extends BaseMapper<JyjcInspecti
* @return List<Map<String, Object>> * @return List<Map<String, Object>>
*/ */
List<Map<String, Object>> selectPieLineListOfInspect(@Param("records") List<String> records); List<Map<String, Object>> selectPieLineListOfInspect(@Param("records") List<String> records);
/**
* 查询指定管道的信息,样式为汇总表样式-无检验信息
* @param records 管道ids
* @return List<Map<String, Object>>
*/
List<Map<String, Object>> selectPieLineListOfNoInspectInfo(@Param("records") List<String> records);
} }
package com.yeejoin.amos.boot.module.jyjc.api.mapper;
import com.yeejoin.amos.boot.module.jyjc.api.entity.JyjcInspectionHistory;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* 检验检测历史数据表 Mapper 接口
*
* @author system_generator
* @date 2025-01-14
*/
public interface JyjcInspectionHistoryMapper extends BaseMapper<JyjcInspectionHistory> {
}
package com.yeejoin.amos.boot.module.jyjc.api.model;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.typroject.tyboot.core.rdbms.model.BaseModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 检验检测历史数据表
*
* @author system_generator
* @date 2025-01-14
*/
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(value="JyjcInspectionHistoryModel", description="检验检测历史数据表")
public class JyjcInspectionHistoryModel extends BaseModel {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "来源seq")
private Long sSeq;
@ApiModelProperty(value = "推送数据")
private String historyData;
@ApiModelProperty(value = "备注")
private String remark;
@ApiModelProperty(value = "来源类型")
private String sType;
}
package com.yeejoin.amos.boot.module.jyjc.api.service;
/**
* 检验检测历史数据表接口类
*
* @author system_generator
* @date 2025-01-14
*/
public interface IJyjcInspectionHistoryService {}
...@@ -25,4 +25,11 @@ public interface IJyjcInspectionResultParamService { ...@@ -25,4 +25,11 @@ public interface IJyjcInspectionResultParamService {
* @return 字段列表 * @return 字段列表
*/ */
List<Map<String,Object>> getParamByEquipTypeCode(String equipTypeCode); List<Map<String,Object>> getParamByEquipTypeCode(String equipTypeCode);
/**
* 根据
* @param sequenceNbr
* @return
*/
JyjcInspectionResultParam getOneParamByResultSeq(Long sequenceNbr);
} }
...@@ -682,6 +682,50 @@ ...@@ -682,6 +682,50 @@
LEFT JOIN idx_biz_jg_register_info ri on ri."RECORD" = ui."RECORD" LEFT JOIN idx_biz_jg_register_info ri on ri."RECORD" = ui."RECORD"
LEFT JOIN idx_biz_jg_tech_params_pipeline pp ON pp."RECORD" = ui."RECORD" LEFT JOIN idx_biz_jg_tech_params_pipeline pp ON pp."RECORD" = ui."RECORD"
</sql> </sql>
<sql id="page-list-pipeline-no-inspect">
SELECT
ui."USE_UNIT_NAME" useUnitName,
ui."USE_UNIT_CREDIT_CODE" useUnitCreditCode,
ui."PROJECT_CONTRAPTION_ID" as projectContraptionId,
to_char(ui."USE_DATE", 'YYYY-MM') useDate,
(SELECT DESIGN_UNIT_NAME from idx_biz_jg_design_info where "RECORD" = ui."RECORD") designUnitName,
(SELECT USC_UNIT_NAME from idx_biz_jg_construction_info where "RECORD" = ui."RECORD" ORDER BY USC_DATE DESC limit 1) uscUnitName,
to_char((SELECT USC_DATE from idx_biz_jg_construction_info where "RECORD" = ui."RECORD" ORDER BY USC_DATE DESC limit 1), 'YYYY-MM') uscDate,
ui."RECORD" record,
ui.IS_INTO_MANAGEMENT as isIntoManagement,
ri."EQU_CODE" equCode,
ri."EQU_LIST" equList,
(select name from tz_equipment_category where code = ri."EQU_LIST") equListName,
ri."EQU_CATEGORY" equCategory,
(select name from tz_equipment_category where code = ri."EQU_CATEGORY") equCategoryName,
ri."EQU_DEFINE" equDefine,
(select name from tz_equipment_category where code = ri."EQU_DEFINE") equDefineName,
-- 历史遗留问题 故 as
pp."PIPE_NAME" as productName,
ri."BRAND_NAME" brandName,
ri."EQU_TYPE" equType,
ri."EQU_CODE_TYPE" equCodeType,
ri."WHETHER_VEHICLE_CYLINDER" whetherVehicleCylinder,
ri."USE_ORG_CODE" useOrgCode,
pp."DEVICE_NAME" deviceName,
(select name from cb_data_dictionary where code = pp."DEVICE_LEVEL" and type = 'GBI') deviceLevel,
pp."PIPE_NAME" pipeName,
pp."PIPELINE_NUMBER" pipelineNumber,
pp."NOMINAL_DIAMETER" nominalDiameter,
pp."WALL_THICKNESS" wallThickness,
pp."PIPE_LENGTH" pipeLength,
pp."PRESSURE" pressure,
pp."TEMPERATURE" temperature,
pp."MEDIUM" medium,
pp."REMARKS" remarks,
pp."WORK_PRESSURE" AS workPressure,
pp."WORK_TEMPERATURE" AS workTemperature,
pp."WORK_MEDIUM" AS workMedium
FROM
idx_biz_jg_use_info ui
LEFT JOIN idx_biz_jg_register_info ri on ri."RECORD" = ui."RECORD"
LEFT JOIN idx_biz_jg_tech_params_pipeline pp ON pp."RECORD" = ui."RECORD"
</sql>
<select id="selectPieLineListByProjectId" resultType="java.util.Map"> <select id="selectPieLineListByProjectId" resultType="java.util.Map">
select * from ( select * from (
<include refid="page-list-pipeline"/> <include refid="page-list-pipeline"/>
...@@ -700,4 +744,13 @@ ...@@ -700,4 +744,13 @@
</foreach> </foreach>
ORDER BY ui.REC_DATE DESC ORDER BY ui.REC_DATE DESC
</select> </select>
<select id="selectPieLineListOfNoInspectInfo" resultType="java.util.Map">
<include refid="page-list-pipeline-no-inspect"/>
WHERE
ui.record in
<foreach collection="records" item="record" open="(" close=")" separator=",">
#{record}
</foreach>
ORDER BY ui.REC_DATE DESC
</select>
</mapper> </mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.amos.boot.module.jyjc.api.mapper.JyjcInspectionHistoryMapper">
</mapper>
...@@ -71,7 +71,6 @@ import org.redisson.api.RLock; ...@@ -71,7 +71,6 @@ import org.redisson.api.RLock;
import org.redisson.api.RedissonClient; import org.redisson.api.RedissonClient;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Lazy; import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
...@@ -172,6 +171,9 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec ...@@ -172,6 +171,9 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec
@Resource @Resource
private SnowflakeIdUtil sequence; private SnowflakeIdUtil sequence;
@Resource
private JyjcInspectionHistoryServiceImpl inspectionHistoryService;
@NotNull @NotNull
public static List<DictionarieModel> getDictionarieModels(String bizType) { public static List<DictionarieModel> getDictionarieModels(String bizType) {
...@@ -431,7 +433,7 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec ...@@ -431,7 +433,7 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec
} }
private void setEquipCategoryIfPieLine(JyjcInspectionApplicationModel model, JyjcInspectionApplicationEquip equipInfo, JyjcInspectionApplicationEquipDto equipDto) { private void setEquipCategoryIfPieLine(JyjcInspectionApplicationModel model, JyjcInspectionApplicationEquip equipInfo, JyjcInspectionApplicationEquipDto equipDto) {
if(model.getEquipClassify().equals(EquipmentClassifityEnum.YLGD.getCode())){ if (model.getEquipClassify().equals(EquipmentClassifityEnum.YLGD.getCode())) {
equipInfo.setEquipUnicode(model.getProjectContraptionId()); equipInfo.setEquipUnicode(model.getProjectContraptionId());
equipInfo.setEquList(equipDto.getEquList()); equipInfo.setEquList(equipDto.getEquList());
equipInfo.setEquCategory(equipDto.getEquCategory()); equipInfo.setEquCategory(equipDto.getEquCategory());
...@@ -443,7 +445,7 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec ...@@ -443,7 +445,7 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec
} }
private String buildTaskContent(JyjcInspectionApplicationModel model){ private String buildTaskContent(JyjcInspectionApplicationModel model) {
return String.format("来自%s%s的业务办理,【申请单号:%s】", model.getEquList(), StringUtils.isNotBlank(model.getSupervisoryCode()) ? "【" + model.getSupervisoryCode() + "】" : "", model.getApplicationNo()); return String.format("来自%s%s的业务办理,【申请单号:%s】", model.getEquList(), StringUtils.isNotBlank(model.getSupervisoryCode()) ? "【" + model.getSupervisoryCode() + "】" : "", model.getApplicationNo());
} }
...@@ -603,13 +605,33 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec ...@@ -603,13 +605,33 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec
Map<String, Object> map = BeanUtil.beanToMap(model); Map<String, Object> map = BeanUtil.beanToMap(model);
// 附件 // 附件
Map<String, Object> attMap = getAttachmentMap(sequenceNbr); Map<String, Object> attMap = getAttachmentMap(sequenceNbr);
if(model.getEquipClassify().equals(EquipmentClassifityEnum.YLGD.getCode())){ // 已完成的显示json数据 需兼容老数据
// 压力管道 if (model.getStatus().equals(String.valueOf(FlowStatusEnum.TO_BE_FINISHED.getCode()))) {
map.putAll(getDeviceListByProjectContraption2(model)); JyjcInspectionHistory inspectionHistory = inspectionHistoryService.getBySSeq(sequenceNbr);
if (inspectionHistory != null) {
// 新报检单记录历史数据的逻辑
map.putAll(inspectionHistory.getHistoryData());
} else {
// 历史单位之前未记录历史数据的逻辑
if (model.getEquipClassify().equals(EquipmentClassifityEnum.YLGD.getCode())) {
// 压力管道
map.putAll(getDeviceListByProjectContraption2(model));
} else {
// 其他设备
List<Map<String, Object>> arrayList = getEquipInfoList(sequenceNbr, model);
map.put("equip", arrayList);
}
}
} else { } else {
// 其他设备 // 未审批完成的显示实时数据
List<Map<String, Object>> arrayList = getEquipInfoList(sequenceNbr, model); if (model.getEquipClassify().equals(EquipmentClassifityEnum.YLGD.getCode())) {
map.put("equip", arrayList); // 压力管道
map.putAll(getDeviceListByProjectContraption2(model));
} else {
// 其他设备
List<Map<String, Object>> arrayList = getEquipInfoList(sequenceNbr, model);
map.put("equip", arrayList);
}
} }
map.putAll(attMap); map.putAll(attMap);
map.put("companyType", companyType); map.put("companyType", companyType);
...@@ -722,7 +744,7 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec ...@@ -722,7 +744,7 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec
List<JyjcInspectionResult> resultModels = new ArrayList<>(); List<JyjcInspectionResult> resultModels = new ArrayList<>();
List<JgResumeInfoDto> jgResumeInfoDtoList = new ArrayList<>(); List<JgResumeInfoDto> jgResumeInfoDtoList = new ArrayList<>();
Date now = DateUtil.date(); Date now = DateUtil.date();
if(model.getEquipClassify().equals(EquipmentClassifityEnum.YLGD.getCode())){ if (model.getEquipClassify().equals(EquipmentClassifityEnum.YLGD.getCode())) {
List<String> codes = tzsServiceFeignClient.applicationFormCode(ApplicationFormTypeEnum.JG.getCode(), 1).getResult(); List<String> codes = tzsServiceFeignClient.applicationFormCode(ApplicationFormTypeEnum.JG.getCode(), 1).getResult();
JyjcInspectionResult resultModel = new JyjcInspectionResult(); JyjcInspectionResult resultModel = new JyjcInspectionResult();
resultModel.setInspectionUnitCode(model.getInspectionUnitCode()); resultModel.setInspectionUnitCode(model.getInspectionUnitCode());
...@@ -741,21 +763,21 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec ...@@ -741,21 +763,21 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec
// 装置信息查询 // 装置信息查询
resultModel.setEquipUnicode(model.getProjectContraptionId()); resultModel.setEquipUnicode(model.getProjectContraptionId());
IdxBizJgProjectContraption projectContraption = idxBizJgProjectContraptionMapper.selectById(model.getProjectContraptionId()); IdxBizJgProjectContraption projectContraption = idxBizJgProjectContraptionMapper.selectById(model.getProjectContraptionId());
if(projectContraption != null){ if (projectContraption != null) {
resultModel.setEquipUnicode(projectContraption.getSequenceNbr() + ""); resultModel.setEquipUnicode(projectContraption.getSequenceNbr() + "");
resultModel.setSupervisoryCode(projectContraption.getSupervisoryCode()); resultModel.setSupervisoryCode(projectContraption.getSupervisoryCode());
resultModel.setEquCategory(projectContraption.getEquCategory()); resultModel.setEquCategory(projectContraption.getEquCategory());
resultModel.setEquList(projectContraption.getEquList()); resultModel.setEquList(projectContraption.getEquList());
resultModel.setEquDefine(projectContraption.getEquDefine()); resultModel.setEquDefine(projectContraption.getEquDefine());
} }
Long resultSeq = sequence.nextId(); Long resultSeq = sequence.nextId();
resultModel.setSequenceNbr(resultSeq); resultModel.setSequenceNbr(resultSeq);
resultModel.setIsExistNc(false); resultModel.setIsExistNc(false);
resultModel.setManageType("batch"); resultModel.setManageType("batch");
this.setResultTypeByBizType(resultModel, model.getBizType()); this.setResultTypeByBizType(resultModel, model.getBizType());
resultModels.add(resultModel); resultModels.add(resultModel);
// TODO 以管道汇总样式表暂存json,在结果录入后,将数据更新技术参数,考虑老数据 // TODO 以管道汇总样式表暂存json,在结果录入后,将数据更新技术参数,考虑老数据
Map<String, Object> paramDetail = getDeviceListByProjectContraption2(model); Map<String, Object> paramDetail = getDeviceListByProjectContraption3(model);
JyjcInspectionResultParam resultParam = new JyjcInspectionResultParam(); JyjcInspectionResultParam resultParam = new JyjcInspectionResultParam();
resultParam.setResultSeq(resultModel.getSequenceNbr()); resultParam.setResultSeq(resultModel.getSequenceNbr());
resultParam.setParamJson(JSON.toJSONString(paramDetail)); resultParam.setParamJson(JSON.toJSONString(paramDetail));
...@@ -787,7 +809,7 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec ...@@ -787,7 +809,7 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec
resultModel.setEquList(applicationEquipModels.get(i).getEquList()); resultModel.setEquList(applicationEquipModels.get(i).getEquList());
resultModel.setIsExistNc(false); resultModel.setIsExistNc(false);
this.setResultTypeByBizType(resultModel, model.getBizType()); this.setResultTypeByBizType(resultModel, model.getBizType());
Long resultSeq = sequence.nextId(); Long resultSeq = sequence.nextId();
resultModel.setSequenceNbr(resultSeq); resultModel.setSequenceNbr(resultSeq);
resultModels.add(resultModel); resultModels.add(resultModel);
// TODO 暂存json,在结果录入后,将数据更新技术参数-检验详情使用 考虑兼容老数据 // TODO 暂存json,在结果录入后,将数据更新技术参数-检验详情使用 考虑兼容老数据
...@@ -799,6 +821,7 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec ...@@ -799,6 +821,7 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec
// 报检信息推送 TODO // 报检信息推送 TODO
// this.pushInspectionApplication(model); // this.pushInspectionApplication(model);
this.saveBatchResume(jgResumeInfoDtoList); this.saveBatchResume(jgResumeInfoDtoList);
this.createHisAfterReceive(model);
// 更新流程中的流程数据 // 更新流程中的流程数据
commonService.saveExecuteFlowData2Redis(model.getProcessInstanceId(), this.buildInstanceRuntimeData(entity)); commonService.saveExecuteFlowData2Redis(model.getProcessInstanceId(), this.buildInstanceRuntimeData(entity));
} catch (InterruptedException e) { } catch (InterruptedException e) {
...@@ -810,6 +833,19 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec ...@@ -810,6 +833,19 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec
} }
} }
public void createHisAfterReceive(JyjcInspectionApplicationModel model) {
if (model.getEquipClassify().equals(EquipmentClassifityEnum.YLGD.getCode())) {
JSONObject hisData = getDeviceListByProjectContraption2(model);
inspectionHistoryService.saveBySeq(model.getSequenceNbr(), hisData, model.getInspectionType());
} else {
List<Map<String, Object>> arrayList = getEquipInfoList(model.getSequenceNbr(), model);
JSONObject hisData = new JSONObject();
hisData.put("equip", arrayList);
inspectionHistoryService.saveBySeq(model.getSequenceNbr(), hisData, model.getInspectionType());
}
}
private void saveBatchResume(List<JgResumeInfoDto> jgResumeInfoDtoList) { private void saveBatchResume(List<JgResumeInfoDto> jgResumeInfoDtoList) {
try { try {
jgFeignClient.saveBatchResume(jgResumeInfoDtoList); jgFeignClient.saveBatchResume(jgResumeInfoDtoList);
...@@ -1391,7 +1427,7 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec ...@@ -1391,7 +1427,7 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec
public IPage<IdxBizJgProjectContraption> getJgProjectContraptionPage(String inspectionType, Page<IdxBizJgProjectContraption> page, String companyCode, String equCategory) { public IPage<IdxBizJgProjectContraption> getJgProjectContraptionPage(String inspectionType, Page<IdxBizJgProjectContraption> page, String companyCode, String equCategory) {
// 兼容个人业务 // 兼容个人业务
if(companyCode.contains("_")){ if (companyCode.contains("_")) {
companyCode = companyCode.split("_")[1]; companyCode = companyCode.split("_")[1];
} }
// 定期检验,查询当前使用单位,工业管道: 查询当前使用单位下已纳管且有使用登记证的装置,且非流程中的 ;公用管道、长输管道:已纳管且做过检验的,且非流程中的 // 定期检验,查询当前使用单位,工业管道: 查询当前使用单位下已纳管且有使用登记证的装置,且非流程中的 ;公用管道、长输管道:已纳管且做过检验的,且非流程中的
...@@ -1400,7 +1436,8 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec ...@@ -1400,7 +1436,8 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec
/** /**
* 查询指定装置下的装置基本信息、施工信息、管道信息(前缀装置列表已进行过滤,故不进行状态的过滤) * 查询指定装置下的装置基本信息、施工/使用信息、管道信息(前缀装置列表已进行过滤,故不进行状态的过滤)--报检发起使用
*
* @param projectContraptionSeq 装置id * @param projectContraptionSeq 装置id
* @return 装置的详情 * @return 装置的详情
*/ */
...@@ -1413,55 +1450,98 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec ...@@ -1413,55 +1450,98 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec
re.put("projectContraptionId", projectContraptionSeq); re.put("projectContraptionId", projectContraptionSeq);
re.put("projectContraptionNo", projectContraption.getProjectContraptionNo()); re.put("projectContraptionNo", projectContraption.getProjectContraptionNo());
re.put("pipelineLength", projectContraption.getPipelineLength()); re.put("pipelineLength", projectContraption.getPipelineLength());
this.setConstructionInfo(projectContraptionSeq, re); re.put("useRegistrationCode ", projectContraption.getUseRegistrationCode());
this.setInstallAddress(projectContraption, re);
this.setUseAddress(projectContraption, re);
return re; return re;
} }
/** /**
* 查询指定报检单据下的装置管道信息 * 使用地点-使用登记完成后回把使用登记的地点信息写到装置表。定期检验时显示
* @param projectContraption 装置
* @param re 返回结果:增加使用地点(工业管道是使用登记时的地址);公用、长输管道是安装地址(无使用登记证)
*/
private void setUseAddress(IdxBizJgProjectContraption projectContraption, Map<String, Object> re) {
re.put("useAddress", getDetailAddress(projectContraption));
}
/**
* 查询指定报检单据下的装置管道信息-----报检详情使用与getDeviceListByProjectContraption区别,指定了管道
*
* @param applicationModel 报检单据信息 * @param applicationModel 报检单据信息
* @return 装置的详情 * @return 装置的详情
*/ */
public Map<String, Object> getDeviceListByProjectContraption2(JyjcInspectionApplicationModel applicationModel) { public JSONObject getDeviceListByProjectContraption2(JyjcInspectionApplicationModel applicationModel) {
IdxBizJgProjectContraption projectContraption = idxBizJgProjectContraptionMapper.selectById(applicationModel.getProjectContraptionId()); IdxBizJgProjectContraption projectContraption = idxBizJgProjectContraptionMapper.selectById(applicationModel.getProjectContraptionId());
List<JyjcInspectionApplicationEquipModel> applicationEquipModels = applicationEquipService.listApplicationEquipByApplicationSeq(applicationModel.getSequenceNbr()); List<JyjcInspectionApplicationEquipModel> applicationEquipModels = applicationEquipService.listApplicationEquipByApplicationSeq(applicationModel.getSequenceNbr());
List<String> records = applicationEquipModels.stream().map(JyjcInspectionApplicationEquipModel::getEquipUnicode).collect(Collectors.toList()); List<String> records = applicationEquipModels.stream().map(JyjcInspectionApplicationEquipModel::getEquipUnicode).collect(Collectors.toList());
Map<String, Object> re = new HashMap<>(); JSONObject jsonObject = new JSONObject();
List<Map<String, Object>> equList = this.getBaseMapper().selectPieLineListOfInspect(records); List<Map<String, Object>> equList = this.getBaseMapper().selectPieLineListOfInspect(records);
re.put("equip", equList); jsonObject.put("equip", equList);
re.put("projectContraption", projectContraption.getProjectContraption()); jsonObject.put("projectContraption", projectContraption.getProjectContraption());
re.put("projectContraptionId", applicationModel.getProjectContraptionId()); jsonObject.put("projectContraptionId", applicationModel.getProjectContraptionId());
re.put("projectContraptionNo", projectContraption.getProjectContraptionNo()); jsonObject.put("projectContraptionNo", projectContraption.getProjectContraptionNo());
re.put("pipelineLength", calTotalLength(equList)); jsonObject.put("pipelineLength", calTotalLength(equList));
this.setConstructionInfo(applicationModel.getProjectContraptionId(), re); jsonObject.put("useRegistrationCode ", projectContraption.getUseRegistrationCode());
return re; this.setInstallAddress(projectContraption, jsonObject);
this.setUseAddress(projectContraption, jsonObject);
return jsonObject;
} }
private String calTotalLength(List<Map<String, Object>> equList){ private void setInstallAddress(IdxBizJgProjectContraption projectContraption, Map<String, Object> re) {
double pipeLengthSum = equList.stream().map(r->r.get("pipeLength")).filter(Objects::nonNull).mapToDouble(l->Double.parseDouble(String.valueOf(l))).sum(); re.put("installAddress", getDetailAddress(projectContraption));
BigDecimal pipeLengthSumBig = new BigDecimal(String.valueOf(pipeLengthSum)).setScale(3, RoundingMode.HALF_UP);
return pipeLengthSumBig.toPlainString();
} }
/**
* 安装地址:安装告知完成后,此字段为安装地址
* @param projectContraption 装置
* @param jsonObject 增加安装地址
*/
private void setInstallAddress(IdxBizJgProjectContraption projectContraption, JSONObject jsonObject) {
jsonObject.put("installAddress", getDetailAddress(projectContraption));
}
private void setConstructionInfo(String projectContraptionSeq, Map<String, Object> re) { /**
LambdaQueryWrapper<IdxBizJgProjectConstruction> queryWrapper = new LambdaQueryWrapper<>(); * 管道报检结果-管道详情页签-数据缓存---与getDeviceListByProjectContraption2区别,汇总表内不包含检验信息
queryWrapper.eq(IdxBizJgProjectConstruction::getProjectContraptionId, projectContraptionSeq) * @param applicationModel 申请单
.orderByDesc(IdxBizJgProjectConstruction::getUscDate).last("limit 1"); * @return 无检验信息的汇总管道-检验结果页面专用
IdxBizJgProjectConstruction construction = idxBizJgProjectConstructionMapper.selectOne(queryWrapper); */
if(construction != null){ public JSONObject getDeviceListByProjectContraption3(JyjcInspectionApplicationModel applicationModel) {
re.put("installAddress", getDetailAddress(construction)); JSONObject jsonObject = new JSONObject();
} IdxBizJgProjectContraption projectContraption = idxBizJgProjectContraptionMapper.selectById(applicationModel.getProjectContraptionId());
List<JyjcInspectionApplicationEquipModel> applicationEquipModels = applicationEquipService.listApplicationEquipByApplicationSeq(applicationModel.getSequenceNbr());
List<String> records = applicationEquipModels.stream().map(JyjcInspectionApplicationEquipModel::getEquipUnicode).collect(Collectors.toList());
List<Map<String, Object>> equList = this.getBaseMapper().selectPieLineListOfNoInspectInfo(records);
jsonObject.put("equip", equList);
jsonObject.put("projectContraption", projectContraption.getProjectContraption());
jsonObject.put("projectContraptionId", applicationModel.getProjectContraptionId());
jsonObject.put("projectContraptionNo", projectContraption.getProjectContraptionNo());
jsonObject.put("pipelineLength", calTotalLength(equList));
jsonObject.put("useRegistrationCode ", projectContraption.getUseRegistrationCode());
this.setInstallAddress(projectContraption, jsonObject);
this.setUseAddress(projectContraption, jsonObject);
return jsonObject;
}
private String calTotalLength(List<Map<String, Object>> equList) {
double pipeLengthSum = equList.stream().map(r -> r.get("pipeLength")).filter(Objects::nonNull).mapToDouble(l -> Double.parseDouble(String.valueOf(l))).sum();
BigDecimal pipeLengthSumBig = new BigDecimal(String.valueOf(pipeLengthSum)).setScale(3, RoundingMode.HALF_UP);
return pipeLengthSumBig.toPlainString();
} }
private String trimIfNull(String str){
if(StringUtils.isBlank(str)){ private String trimIfNull(String str) {
if (StringUtils.isBlank(str)) {
return ""; return "";
} }
return str.trim(); return str.trim();
} }
private String getDetailAddress(IdxBizJgProjectConstruction construction){ private String getDetailAddress(IdxBizJgProjectConstruction construction) {
return trimIfNull(construction.getProvinceName()) + trimIfNull(construction.getCityName()) + trimIfNull(construction.getCountyName()) + trimIfNull(construction.getStreetName()); return trimIfNull(construction.getProvinceName()) + trimIfNull(construction.getCityName()) + trimIfNull(construction.getCountyName()) + trimIfNull(construction.getStreetName() + trimIfNull(construction.getAddress()));
}
private String getDetailAddress(IdxBizJgProjectContraption projectContraption) {
return trimIfNull(projectContraption.getProvinceName()) + trimIfNull(projectContraption.getCityName()) + trimIfNull(projectContraption.getCountyName()) + trimIfNull(projectContraption.getStreetName() + trimIfNull(projectContraption.getAddress()));
} }
} }
\ No newline at end of file
package com.yeejoin.amos.boot.module.jyjc.biz.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.yeejoin.amos.boot.module.jyjc.api.entity.JyjcInspectionHistory;
import com.yeejoin.amos.boot.module.jyjc.api.mapper.JyjcInspectionHistoryMapper;
import com.yeejoin.amos.boot.module.jyjc.api.model.JyjcInspectionHistoryModel;
import com.yeejoin.amos.boot.module.jyjc.api.service.IJyjcInspectionHistoryService;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import java.util.Date;
/**
* 检验检测历史数据表服务实现类
*
* @author system_generator
* @date 2025-01-14
*/
@Service
public class JyjcInspectionHistoryServiceImpl extends BaseService<JyjcInspectionHistoryModel, JyjcInspectionHistory, JyjcInspectionHistoryMapper> implements IJyjcInspectionHistoryService {
public JyjcInspectionHistory getBySSeq(Long sSeq) {
return this.getOne(new LambdaQueryWrapper<JyjcInspectionHistory>().eq(JyjcInspectionHistory::getSSeq, sSeq));
}
public void saveBySeq(Long sSeq, JSONObject hisData, String sType) {
JyjcInspectionHistory history = this.getBySSeq(sSeq);
if (history != null) {
history.setHistoryData(hisData);
this.updateById(history);
} else {
history = new JyjcInspectionHistory();
history.setHistoryData(hisData);
history.setSSeq(sSeq);
history.setRecDate(new Date());
history.setSType(sType);
super.saveOrUpdate(history);
}
}
}
\ No newline at end of file
...@@ -60,4 +60,11 @@ public class JyjcInspectionResultParamServiceImpl extends BaseService<JyjcInspec ...@@ -60,4 +60,11 @@ public class JyjcInspectionResultParamServiceImpl extends BaseService<JyjcInspec
} }
return paramList; return paramList;
} }
@Override
public JyjcInspectionResultParam getOneParamByResultSeq(Long sequenceNbr) {
LambdaQueryWrapper<JyjcInspectionResultParam> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(JyjcInspectionResultParam::getResultSeq, sequenceNbr);
return this.baseMapper.selectOne(wrapper);
}
} }
\ No newline at end of file
...@@ -8,6 +8,9 @@ import com.alibaba.fastjson.JSONObject; ...@@ -8,6 +8,9 @@ import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yeejoin.amos.boot.biz.common.excel.ExcelUtil; import com.yeejoin.amos.boot.biz.common.excel.ExcelUtil;
import com.yeejoin.amos.boot.biz.common.utils.SnowflakeIdUtil; import com.yeejoin.amos.boot.biz.common.utils.SnowflakeIdUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
...@@ -16,15 +19,18 @@ import com.yeejoin.amos.boot.biz.common.utils.RedisKey; ...@@ -16,15 +19,18 @@ import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils; import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.common.api.dao.ESEquipmentCategory; import com.yeejoin.amos.boot.module.common.api.dao.ESEquipmentCategory;
import com.yeejoin.amos.boot.module.common.api.dto.ESEquipmentCategoryDto; import com.yeejoin.amos.boot.module.common.api.dto.ESEquipmentCategoryDto;
import com.yeejoin.amos.boot.module.jg.api.dto.DynamicColumnDto;
import com.yeejoin.amos.boot.module.jg.api.mapper.CommonMapper;
import com.yeejoin.amos.boot.module.jyjc.api.common.StringUtil; import com.yeejoin.amos.boot.module.jyjc.api.common.StringUtil;
import com.yeejoin.amos.boot.module.jyjc.api.entity.JyjcInspectionApplication;
import com.yeejoin.amos.boot.module.jyjc.api.entity.JyjcInspectionResult; import com.yeejoin.amos.boot.module.jyjc.api.entity.JyjcInspectionResult;
import com.yeejoin.amos.boot.module.jyjc.api.entity.JyjcInspectionResultAttachment; import com.yeejoin.amos.boot.module.jyjc.api.entity.JyjcInspectionResultAttachment;
import com.yeejoin.amos.boot.module.jyjc.api.entity.JyjcInspectionResultParam; import com.yeejoin.amos.boot.module.jyjc.api.entity.JyjcInspectionResultParam;
import com.yeejoin.amos.boot.module.jyjc.api.enums.BizTypeEnum; import com.yeejoin.amos.boot.module.jyjc.api.enums.BizTypeEnum;
import com.yeejoin.amos.boot.module.jyjc.api.enums.EquipCategoryEnum; import com.yeejoin.amos.boot.module.jyjc.api.enums.EquipCategoryEnum;
import com.yeejoin.amos.boot.module.jyjc.api.enums.ResultStatusEnum; import com.yeejoin.amos.boot.module.jyjc.api.enums.ResultStatusEnum;
import com.yeejoin.amos.boot.module.jyjc.api.mapper.JyjcInspectionApplicationMapper;
import com.yeejoin.amos.boot.module.jyjc.api.mapper.JyjcInspectionResultMapper; import com.yeejoin.amos.boot.module.jyjc.api.mapper.JyjcInspectionResultMapper;
import com.yeejoin.amos.boot.module.jyjc.api.model.JyjcInspectionApplicationModel;
import com.yeejoin.amos.boot.module.jyjc.api.model.JyjcInspectionResultDataModel; import com.yeejoin.amos.boot.module.jyjc.api.model.JyjcInspectionResultDataModel;
import com.yeejoin.amos.boot.module.jyjc.api.model.JyjcInspectionResultModel; import com.yeejoin.amos.boot.module.jyjc.api.model.JyjcInspectionResultModel;
import com.yeejoin.amos.boot.module.jyjc.api.service.IJyjcInspectionResultAttachmentService; import com.yeejoin.amos.boot.module.jyjc.api.service.IJyjcInspectionResultAttachmentService;
...@@ -36,7 +42,8 @@ import com.yeejoin.amos.boot.module.jyjc.biz.event.UseInfoSaveToDbEvent; ...@@ -36,7 +42,8 @@ import com.yeejoin.amos.boot.module.jyjc.biz.event.UseInfoSaveToDbEvent;
import com.yeejoin.amos.boot.module.jyjc.biz.event.publisher.BizEmqPublisher; import com.yeejoin.amos.boot.module.jyjc.biz.event.publisher.BizEmqPublisher;
import com.yeejoin.amos.boot.module.jyjc.biz.event.publisher.EventPublisher; import com.yeejoin.amos.boot.module.jyjc.biz.event.publisher.EventPublisher;
import com.yeejoin.amos.boot.module.jyjc.biz.util.JsonUtils; import com.yeejoin.amos.boot.module.jyjc.biz.util.JsonUtils;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgProjectContraption; import com.yeejoin.amos.boot.module.ymt.api.entity.AbstractEquipBaseEntity;
import com.yeejoin.amos.boot.module.ymt.api.entity.EquipTechParamPipeline;
import com.yeejoin.amos.boot.module.ymt.api.entity.InspectionDetectionInfo; import com.yeejoin.amos.boot.module.ymt.api.entity.InspectionDetectionInfo;
import com.yeejoin.amos.boot.module.ymt.api.entity.TzsUserInfo; import com.yeejoin.amos.boot.module.ymt.api.entity.TzsUserInfo;
import com.yeejoin.amos.boot.module.ymt.api.enums.EquipmentClassifityEnum; import com.yeejoin.amos.boot.module.ymt.api.enums.EquipmentClassifityEnum;
...@@ -77,7 +84,6 @@ public class JyjcInspectionResultServiceImpl extends BaseService<JyjcInspectionR ...@@ -77,7 +84,6 @@ public class JyjcInspectionResultServiceImpl extends BaseService<JyjcInspectionR
private static final String JYJC_SUBMIT_FILE_JYBG = "JYBG"; private static final String JYJC_SUBMIT_FILE_JYBG = "JYBG";
private static final String JYJC_SUBMIT_KEY = "inspectResult"; private static final String JYJC_SUBMIT_KEY = "inspectResult";
private static final String JYJC_PIELINE = "pieLine";
private static final String JYJC_RESULT_STATUS = "2"; private static final String JYJC_RESULT_STATUS = "2";
@Autowired @Autowired
...@@ -123,10 +129,16 @@ public class JyjcInspectionResultServiceImpl extends BaseService<JyjcInspectionR ...@@ -123,10 +129,16 @@ public class JyjcInspectionResultServiceImpl extends BaseService<JyjcInspectionR
private ESEquipmentCategory esEquipmentCategory; private ESEquipmentCategory esEquipmentCategory;
@Autowired @Autowired
JyjcInspectionApplicationMapper inspectionApplicationMapper; JyjcInspectionApplicationServiceImpl inspectionApplicationService;
@Autowired @Autowired
private IdxBizJgProjectContraptionMapper idxBizJgProjectContraptionMapper; private CommonMapper jgCommonMapper;
@Autowired
private ObjectMapper objectMapper;
@Autowired
private EquipTechParamPipelineMapper techParamPipelineMapper;
/** /**
* 检验检测单位分页查询 * 检验检测单位分页查询
...@@ -284,34 +296,131 @@ public class JyjcInspectionResultServiceImpl extends BaseService<JyjcInspectionR ...@@ -284,34 +296,131 @@ public class JyjcInspectionResultServiceImpl extends BaseService<JyjcInspectionR
if (!CollectionUtils.isEmpty(paramList)) { if (!CollectionUtils.isEmpty(paramList)) {
resultParamService.saveOrUpdateBatch(paramList); resultParamService.saveOrUpdateBatch(paramList);
} }
JyjcInspectionResultModel dbResultModel = this.queryBySeq(model.getSequenceNbr());
// 更新使用信息、检验信息、技术参数
this.updateTechParamAndInspectInfo(dbResultModel, jybgFile);
// 更新单据信息的json(公共)
this.updateHisDataAfterResultUpdate(dbResultModel);
return dbResultModel;
}
//插入操作历史记录 private void updateTechParamAndInspectInfo(JyjcInspectionResultModel model, JyjcInspectionResultAttachment jybgFile){
InspectionDetectionInfo info = new InspectionDetectionInfo(); if(model.getEquList().equals(EquipmentClassifityEnum.YLGD.getCode())){
QueryWrapper<InspectionDetectionInfo> wrapper = new QueryWrapper<>(); // 管道逻辑: 循环更新技术参数、检验信息更新或者插入、使用信息更新(数据库及es)
wrapper.lambda().eq(InspectionDetectionInfo::getInspectReportNo, model.getResultNo()); JyjcInspectionResultParam param = iJyjcInspectionResultParamService.getOneParamByResultSeq(model.getSequenceNbr());
List<InspectionDetectionInfo> list = inspectionDetectionInfoMapper.selectList(wrapper); if (!ObjectUtils.isEmpty(param.getParamJson())) {
if (CollectionUtils.isEmpty(list)) { JSONObject paramObj = JSON.parseObject(param.getParamJson());
extracted(model, info, jybgFile); try {
info.setSequenceNbr(sequence.nextId() + ""); List<Map<String, Object>> equips = objectMapper.readValue(
inspectionDetectionInfoMapper.insert(info); objectMapper.writeValueAsString(paramObj.get("equip")),
// 对方不查询库 所以无事务操作 new TypeReference<ArrayList<Map<String, Object>>>() {
bizEmqPublisher.sendInspectionMsgAfterSave(info, "insert"); }
);
equips.forEach(e->{
String record = String.valueOf(e.get("record"));
// 1.更新管道的技术参数
EquipTechParamPipeline techParamPipeline = new EquipTechParamPipeline();
BeanUtil.copyProperties(e, techParamPipeline,true);
LambdaUpdateWrapper<EquipTechParamPipeline> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.eq(AbstractEquipBaseEntity::getRecord, record);
updateWrapper.set(EquipTechParamPipeline::getNominalDiameter, techParamPipeline.getNominalDiameter());
updateWrapper.set(EquipTechParamPipeline::getWallThickness, techParamPipeline.getWallThickness());
updateWrapper.set(EquipTechParamPipeline::getPipeLength, techParamPipeline.getPipeLength());
updateWrapper.set(EquipTechParamPipeline::getPressure, techParamPipeline.getPressure());
updateWrapper.set(EquipTechParamPipeline::getTemperature, techParamPipeline.getTemperature());
updateWrapper.set(EquipTechParamPipeline::getMedium, techParamPipeline.getMedium());
updateWrapper.set(EquipTechParamPipeline::getWorkMedium, techParamPipeline.getWorkMedium());
updateWrapper.set(EquipTechParamPipeline::getWorkPressure, techParamPipeline.getWorkPressure());
updateWrapper.set(EquipTechParamPipeline::getWorkTemperature, techParamPipeline.getWorkTemperature());
updateWrapper.set(EquipTechParamPipeline::getRemarks, techParamPipeline.getRemarks());
techParamPipelineMapper.update(null,updateWrapper);
// 2.检验信息更新或者插入
InspectionDetectionInfo info = new InspectionDetectionInfo();
LambdaQueryWrapper<InspectionDetectionInfo> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(InspectionDetectionInfo::getInspectReportNo, model.getResultNo());
wrapper.eq(InspectionDetectionInfo::getRecord, record);
wrapper.eq(InspectionDetectionInfo::getInspectOrgCode, model.getInspectionUnitCode());
List<InspectionDetectionInfo> list = inspectionDetectionInfoMapper.selectList(wrapper);
if (CollectionUtils.isEmpty(list)) {
// 无则插入
extracted(model, info, jybgFile, record);
info.setSequenceNbr(sequence.nextId() + "");
inspectionDetectionInfoMapper.insert(info);
// 对方不查询库 所以无事务操作
bizEmqPublisher.sendInspectionMsgAfterSave(info, "insert");
} else {
// 已经维护过则更新
info = list.get(0);
extracted(model, info, jybgFile, record);
inspectionDetectionInfoMapper.updateById(info);
// 对方不查询库 所以无事务操作
bizEmqPublisher.sendInspectionMsgAfterSave(info, "update");
}
// 3.更新使用信息表,最新检验信息
useInfoMapper.updateByRecord(record, model.getNextInspectionDate(), model.getInspectionType(), model.getApplicationNo());
// 4.更新es下次检验日期
this.updateEquipNextInspectDate(model, record);
});
} catch (JsonProcessingException e) {
throw new RuntimeException(e);
}
}
} else { } else {
info = list.get(0); // 台套逻辑: 单条更新技术参数、检验信息更新或者插入、使用信息更新(数据库及es)
extracted(model, info, jybgFile); // 1.动态更新技术参数
inspectionDetectionInfoMapper.updateById(info); List<DynamicColumnDto> columns = new ArrayList<>();
// 对方不查询库 所以无事务操作 JyjcInspectionResultParam param = iJyjcInspectionResultParamService.getOneParamByResultSeq(model.getSequenceNbr());
bizEmqPublisher.sendInspectionMsgAfterSave(info, "update"); if (param != null) {
if (!ObjectUtils.isEmpty(param.getParamJson())) {
JSONObject paramObj = JSON.parseObject(param.getParamJson());
paramObj.forEach((k,v)->{
DynamicColumnDto columnDto = new DynamicColumnDto();
columnDto.setColumnName(String.format("\"%s\"", StrUtil.toUnderlineCase(k).toUpperCase()));
columnDto.setColumnValue(v == null ? null : String.valueOf(v));
columns.add(columnDto);
});
String tableName = this.getTableName(param.getParamType());
jgCommonMapper.updateTechParamDynamic(tableName, model.getEquipUnicode(), columns);
}
}
// 2.检验信息更新或者插入
InspectionDetectionInfo info = new InspectionDetectionInfo();
QueryWrapper<InspectionDetectionInfo> wrapper = new QueryWrapper<>();
wrapper.lambda().eq(InspectionDetectionInfo::getInspectReportNo, model.getResultNo());
List<InspectionDetectionInfo> list = inspectionDetectionInfoMapper.selectList(wrapper);
if (CollectionUtils.isEmpty(list)) {
extracted(model, info, jybgFile, model.getEquipUnicode());
info.setSequenceNbr(sequence.nextId() + "");
inspectionDetectionInfoMapper.insert(info);
// 对方不查询库 所以无事务操作
bizEmqPublisher.sendInspectionMsgAfterSave(info, "insert");
} else {
info = list.get(0);
extracted(model, info, jybgFile, model.getEquipUnicode());
inspectionDetectionInfoMapper.updateById(info);
// 对方不查询库 所以无事务操作
bizEmqPublisher.sendInspectionMsgAfterSave(info, "update");
}
// 3.更新使用信息表最新的检验信息
useInfoMapper.updateByRecord(model.getEquipUnicode(), model.getNextInspectionDate(), model.getInspectionType(), model.getApplicationNo());
// 4.es更新下次检验日期
this.updateEquipNextInspectDate(model, model.getEquipUnicode());
} }
//更新使用信息表
useInfoMapper.updateByRecord(model.getEquipUnicode(), model.getNextInspectionDate(), model.getInspectionType(), model.getApplicationNo());
this.updateEquipNextInspectDate(model);
return model;
} }
private void updateEquipNextInspectDate(JyjcInspectionResultModel model) { private String getTableName(String paramType) {
return String.format("\"%s\"", StrUtil.toUnderlineCase(paramType));
}
private void updateHisDataAfterResultUpdate(JyjcInspectionResultModel model) {
JyjcInspectionApplication application = inspectionApplicationService.getOne(new LambdaQueryWrapper<JyjcInspectionApplication>().eq(JyjcInspectionApplication::getApplicationNo, model.getApplicationNo()));
inspectionApplicationService.createHisAfterReceive(BeanUtil.copyProperties(application, JyjcInspectionApplicationModel.class));
}
private void updateEquipNextInspectDate(JyjcInspectionResultModel model, String record) {
if (model.getNextInspectionDate() != null) { if (model.getNextInspectionDate() != null) {
Optional<ESEquipmentCategoryDto> optional = esEquipmentCategory.findById(model.getEquipUnicode()); Optional<ESEquipmentCategoryDto> optional = esEquipmentCategory.findById(record);
if (optional.isPresent()) { if (optional.isPresent()) {
ESEquipmentCategoryDto esEquipmentCategoryDto = optional.get(); ESEquipmentCategoryDto esEquipmentCategoryDto = optional.get();
esEquipmentCategoryDto.setNEXT_INSPECT_DATE(model.getNextInspectionDate().getTime()); esEquipmentCategoryDto.setNEXT_INSPECT_DATE(model.getNextInspectionDate().getTime());
...@@ -320,10 +429,10 @@ public class JyjcInspectionResultServiceImpl extends BaseService<JyjcInspectionR ...@@ -320,10 +429,10 @@ public class JyjcInspectionResultServiceImpl extends BaseService<JyjcInspectionR
} }
} }
private void extracted(JyjcInspectionResultModel model, InspectionDetectionInfo info, JyjcInspectionResultAttachment jybgFile) { private void extracted(JyjcInspectionResultModel model, InspectionDetectionInfo info, JyjcInspectionResultAttachment jybgFile, String record) {
info.setInspectOrgName(model.getInspectionUnitName()); info.setInspectOrgName(model.getInspectionUnitName());
info.setInspectType(model.getInspectionType()); info.setInspectType(model.getInspectionType());
info.setRecord(model.getEquipUnicode()); info.setRecord(record);
info.setInspectDate(model.getInspectionDate()); info.setInspectDate(model.getInspectionDate());
info.setInspectStaff(getInspectUserName(model)); info.setInspectStaff(getInspectUserName(model));
info.setInspectStaffCode(model.getInspector()); info.setInspectStaffCode(model.getInspector());
...@@ -332,7 +441,7 @@ public class JyjcInspectionResultServiceImpl extends BaseService<JyjcInspectionR ...@@ -332,7 +441,7 @@ public class JyjcInspectionResultServiceImpl extends BaseService<JyjcInspectionR
// json字段暂时注释 // json字段暂时注释
// info.setProblemRemark(model.getNonConformance()); // info.setProblemRemark(model.getNonConformance());
info.setNextInspectDate(model.getNextInspectionDate()); info.setNextInspectDate(model.getNextInspectionDate());
info.setSequenceCode(model.getEquipUnicode()); info.setSequenceCode(record);
info.setInspectOrgCode(model.getInspectionUnitCode()); info.setInspectOrgCode(model.getInspectionUnitCode());
info.setInspectReportNo(model.getResultNo()); info.setInspectReportNo(model.getResultNo());
info.setRecDate(new Date()); info.setRecDate(new Date());
......
...@@ -171,5 +171,6 @@ ...@@ -171,5 +171,6 @@
</otherwise> </otherwise>
</choose> </choose>
and not EXISTS (SELECt 1 FROM tz_jyjc_inspection_application a where a.status='6611' and a.application_unit_code=#{companyCode} and a.project_contraption_id = pc.sequence_nbr) and not EXISTS (SELECt 1 FROM tz_jyjc_inspection_application a where a.status='6611' and a.application_unit_code=#{companyCode} and a.project_contraption_id = pc.sequence_nbr)
and (pc.project_contraption_parent_id is null or pc.project_contraption_parent_id = '')
</select> </select>
</mapper> </mapper>
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