Commit 5d89feca authored by suhuiguang's avatar suhuiguang

feat(jg): 压力管道后续业务

1.自测bug修改 2.改造变更登记 3.登记证打印4处口去掉,报废状态的管道
parent 70e9d0a1
...@@ -194,8 +194,6 @@ public class JgChangeRegistrationReformServiceImpl extends BaseService<JgChangeR ...@@ -194,8 +194,6 @@ public class JgChangeRegistrationReformServiceImpl extends BaseService<JgChangeR
@Autowired @Autowired
private ChangeRegisterReformBackupManager backupManager; private ChangeRegisterReformBackupManager backupManager;
@Autowired
private IdxBizJgTechParamsPipelineServiceImpl idxBizJgTechParamsPipelineServiceImpl;
@Autowired @Autowired
private EventPublisher eventPublisher; private EventPublisher eventPublisher;
...@@ -207,6 +205,7 @@ public class JgChangeRegistrationReformServiceImpl extends BaseService<JgChangeR ...@@ -207,6 +205,7 @@ public class JgChangeRegistrationReformServiceImpl extends BaseService<JgChangeR
@Autowired @Autowired
private PieLineDataChangeServiceImpl pieLineDataChangeService; private PieLineDataChangeServiceImpl pieLineDataChangeService;
/*** /***
* @deprecated 根据查询调教获取分页对象 * @deprecated 根据查询调教获取分页对象
* @param dto 查询的dto对象 * @param dto 查询的dto对象
...@@ -657,7 +656,7 @@ public class JgChangeRegistrationReformServiceImpl extends BaseService<JgChangeR ...@@ -657,7 +656,7 @@ public class JgChangeRegistrationReformServiceImpl extends BaseService<JgChangeR
map.put("model", conveterTaskMessageDTO(jgChangeRegistrationReform)); map.put("model", conveterTaskMessageDTO(jgChangeRegistrationReform));
TaskV2Model taskV2Model = commonServiceImpl.updateTaskModel(map); TaskV2Model taskV2Model = commonServiceImpl.updateTaskModel(map);
if(!jgChangeRegistrationReform.getEquipListName().equals(EquipmentClassifityEnum.YLGD.getName())){ // 非压力管道逻辑 if(!jgChangeRegistrationReform.getEquipListName().equals(EquipmentClassifityEnum.YLGD.getName())){ // 非压力管道逻辑
JgChangeRegistrationReformEq jgChangeRegistrationReformEq = jgChangeRegistrationReformEqMapper.selectOne(new QueryWrapper<JgChangeRegistrationReformEq>().eq("equip_transfer_id", jgChangeRegistrationReform.getSequenceNbr())); JgChangeRegistrationReformEq jgChangeRegistrationReformEq = jgChangeRegistrationReformEqServiceImpl.lambdaQuery().eq(JgChangeRegistrationReformEq::getEquipTransferId, jgChangeRegistrationReform.getSequenceNbr()).select(BaseEntity::getSequenceNbr, JgChangeRegistrationReformEq::getEquId).one();
updateTechparamsByEquIdAndCurrentDoucumentId(jgChangeRegistrationReformEq.getEquId(), jgChangeRegistrationReform.getSequenceNbr().toString(), null, jgChangeRegistrationReform.getApplyNo()); updateTechparamsByEquIdAndCurrentDoucumentId(jgChangeRegistrationReformEq.getEquId(), jgChangeRegistrationReform.getSequenceNbr().toString(), null, jgChangeRegistrationReform.getApplyNo());
// 生成流水信息 // 生成流水信息
saveRecord(jgChangeRegistrationReformEq.getEquId(), jgChangeRegistrationReform, taskV2Model); saveRecord(jgChangeRegistrationReformEq.getEquId(), jgChangeRegistrationReform, taskV2Model);
...@@ -1611,7 +1610,7 @@ public class JgChangeRegistrationReformServiceImpl extends BaseService<JgChangeR ...@@ -1611,7 +1610,7 @@ public class JgChangeRegistrationReformServiceImpl extends BaseService<JgChangeR
private void processElseDataByStatus(String oldStatus, JgChangeRegistrationReform jgChangeRegistrationReform) { private void processElseDataByStatus(String oldStatus, JgChangeRegistrationReform jgChangeRegistrationReform) {
switch (oldStatus) { switch (oldStatus) {
case "使用单位待提交": case "使用单位待提交":
// do no thing // do nothing
break; break;
case "已完成": case "已完成":
// 1.技术参数恢复原数据 // 1.技术参数恢复原数据
...@@ -1630,26 +1629,12 @@ public class JgChangeRegistrationReformServiceImpl extends BaseService<JgChangeR ...@@ -1630,26 +1629,12 @@ public class JgChangeRegistrationReformServiceImpl extends BaseService<JgChangeR
Boolean isRollBack = backupManager.restore(jgChangeRegistrationReform.getSequenceNbr() + ""); Boolean isRollBack = backupManager.restore(jgChangeRegistrationReform.getSequenceNbr() + "");
if(isRollBack){ // 进行过编辑逻辑 if(isRollBack){ // 进行过编辑逻辑
// 1.装置重新计算管道长度 // 1.装置重新计算管道长度
this.updateTotalPieLineLength(jgChangeRegistrationReform.getProjectContraptionId()); pieLineDataChangeService.updatePipelineLength(jgChangeRegistrationReform.getProjectContraptionId());
} }
} }
} }
} }
private void updateTotalPieLineLength(String pid) {
List<String> records = idxBizJgUseInfoService.list(new LambdaQueryWrapper<IdxBizJgUseInfo>().in(IdxBizJgUseInfo::getProjectContraptionId, pid)).stream().map(IdxBizJgUseInfo::getRecord).collect(toList());
List<IdxBizJgTechParamsPipeline> paramsPipelines = idxBizJgTechParamsPipelineServiceImpl.list(new LambdaQueryWrapper<IdxBizJgTechParamsPipeline>().in(IdxBizJgTechParamsPipeline::getRecord, records).select(IdxBizJgTechParamsPipeline::getRecord,IdxBizJgTechParamsPipeline::getPipeLength));
double totalLength = paramsPipelines.stream()
.map(IdxBizJgTechParamsPipeline::getPipeLength) // 先提取长度字符串
.filter(Objects::nonNull) // 过滤掉null值
.mapToDouble(Double::parseDouble) // 解析字符串为double并转为DoubleStream
.sum();
LambdaUpdateWrapper<IdxBizJgProjectContraption> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.set(IdxBizJgProjectContraption::getPipelineLength, totalLength);
updateWrapper.eq(BaseEntity::getSequenceNbr, pid);
jgProjectContraptionService.update(updateWrapper);
}
private void finishedTask(JgChangeRegistrationReform jgChangeRegistrationReform) { private void finishedTask(JgChangeRegistrationReform jgChangeRegistrationReform) {
HashMap<String, Object> taskMap = new HashMap<>(); HashMap<String, Object> taskMap = new HashMap<>();
taskMap.put("taskStatus", FlowStatusEnum.TO_BE_FINISHED.getCode()); taskMap.put("taskStatus", FlowStatusEnum.TO_BE_FINISHED.getCode());
...@@ -1744,8 +1729,8 @@ public class JgChangeRegistrationReformServiceImpl extends BaseService<JgChangeR ...@@ -1744,8 +1729,8 @@ public class JgChangeRegistrationReformServiceImpl extends BaseService<JgChangeR
// 编辑过则按照编辑的数据进行恢复管道信息 // 编辑过则按照编辑的数据进行恢复管道信息
Boolean isRollBack = backupManager.restore(jgChangeRegistrationReform.getSequenceNbr() + ""); Boolean isRollBack = backupManager.restore(jgChangeRegistrationReform.getSequenceNbr() + "");
if(isRollBack){ // 进行过编辑逻辑 if(isRollBack){ // 进行过编辑逻辑
// 1.原装置、新装置重新计算管道长度 // 1.原装置、新装置重新计算管道长度-非报废状态的
this.updateTotalPieLineLength(jgChangeRegistrationReform.getProjectContraptionId()); pieLineDataChangeService.updatePipelineLength(jgChangeRegistrationReform.getProjectContraptionId());
} else { //未编辑过,走原有逻辑 } else { //未编辑过,走原有逻辑
JSONObject jsonObject = JSONObject.parseObject(oldTechInfo); JSONObject jsonObject = JSONObject.parseObject(oldTechInfo);
JSONArray piePines = jsonObject.getJSONArray("equipmentLists"); JSONArray piePines = jsonObject.getJSONArray("equipmentLists");
......
...@@ -749,7 +749,7 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN ...@@ -749,7 +749,7 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
//获取告知单信息 //获取告知单信息
byte[] templateToPdfData = WordTemplateUtils.getTemplateToPdfData(tempFileName, "installation-notification-report.ftl", map); byte[] templateToPdfData = WordTemplateUtils.getTemplateToPdfData(tempFileName, "installation-notification-report.ftl", map);
//获取管道和气瓶的基本信息汇总表 //获取管道和气瓶的基本信息汇总表
List<CompletableFuture<byte[]>> exportSummaryBasicInfoData = jgUseRegistrationService.getExportSummaryBasicInfoData(Collections.singletonList(Long.valueOf(sequenceNbr)), jgInstallationNotice.getEquCategoryCode(), "安装告知", Boolean.TRUE, null); List<CompletableFuture<byte[]>> exportSummaryBasicInfoData = jgUseRegistrationService.getExportSummaryBasicInfoData(Collections.singletonList(Long.valueOf(sequenceNbr)), jgInstallationNotice.getEquCategoryCode(), "安装告知", null);
toZipFileByData(response, exportSummaryBasicInfoData, templateToPdfData, jgInstallationNotice.getApplyNo()); toZipFileByData(response, exportSummaryBasicInfoData, templateToPdfData, jgInstallationNotice.getApplyNo());
} else { } else {
WordTemplateUtils.templateToPdfDownload(tempFileName, "installation-notification-report.ftl", map, response); WordTemplateUtils.templateToPdfDownload(tempFileName, "installation-notification-report.ftl", map, response);
......
...@@ -2864,7 +2864,7 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD ...@@ -2864,7 +2864,7 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
} }
/** /**
* 获取装置下的管道信息(根据整个记录去重) * 获取装置下的管道信息-补保护报废的
* *
* @param projectContraptionList 装置 ID 列表 * @param projectContraptionList 装置 ID 列表
* @return 去重后的管道信息 JSON 数组 * @return 去重后的管道信息 JSON 数组
...@@ -2873,14 +2873,11 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD ...@@ -2873,14 +2873,11 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
if (CollectionUtils.isEmpty(projectContraptionList)) { if (CollectionUtils.isEmpty(projectContraptionList)) {
return Collections.emptyList(); return Collections.emptyList();
} }
Set<String> result = new HashSet<>();
return projectContraptionList.stream() return projectContraptionList.stream()
.filter(Objects::nonNull) .filter(Objects::nonNull)
.map(jgProjectContraptionService.getBaseMapper()::selectEquipList) .map(jgProjectContraptionService.getBaseMapper()::selectEquipListByExport)
.filter(Objects::nonNull) .filter(Objects::nonNull)
.flatMap(List::stream) .flatMap(List::stream)
.peek(map -> map.put("productName", map.get("pipeName")))
.filter(map -> result.add(JSONObject.toJSONString(map)))
.collect(toList()); .collect(toList());
} }
...@@ -2909,8 +2906,7 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD ...@@ -2909,8 +2906,7 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
* @param whetherToFilterStatus 是否过滤设备状态 是:true(过滤设备状态为在用),否:false(所有的) * @param whetherToFilterStatus 是否过滤设备状态 是:true(过滤设备状态为在用),否:false(所有的)
* @return * @return
*/ */
public List<CompletableFuture<byte[]>> getExportSummaryBasicInfoData(List<Long> useRegistrationSeqs, String category, String type, public List<CompletableFuture<byte[]>> getExportSummaryBasicInfoData(List<Long> useRegistrationSeqs, String category, String type, Set<String> projectContraptionIdList) {
Boolean whetherToFilterStatus, Set<String> projectContraptionIdList) {
List<CompletableFuture<byte[]>> futureList = new ArrayList<>(); List<CompletableFuture<byte[]>> futureList = new ArrayList<>();
// 总数 // 总数
double total; double total;
...@@ -2923,18 +2919,12 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD ...@@ -2923,18 +2919,12 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
throw new BadRequest("没有查询到汇总信息!"); throw new BadRequest("没有查询到汇总信息!");
} }
JSONArray allEquipment = new JSONArray(); JSONArray allEquipment = new JSONArray();
Set<String> addedEquCodes = new HashSet<>();
if (!"安装告知".equals(type)) { if (!"安装告知".equals(type)) {
List<Map<String, Object>> equipmentList = getEquipInfoList(useRegistrationSeqs, category, projectContraptionIdList); List<Map<String, Object>> equipmentList = getEquipInfoList(useRegistrationSeqs, category, projectContraptionIdList);
if (CollectionUtils.isNotEmpty(equipmentList)) { if (CollectionUtils.isNotEmpty(equipmentList)) {
equipmentList.forEach(map -> { equipmentList.forEach(map -> {
String record = (String) map.get("record"); allEquipment.add(new JSONObject(map));
JYJCResultEnum resultEnum = JYJCResultEnum.getNameByCode(String.valueOf(map.get("inspectConclusion")));
map.put("inspectConclusion", resultEnum != null ? resultEnum.getName() : "");
if ((whetherToFilterStatus || this.checkEquStatusInUse(record))) {
allEquipment.add(new JSONObject(map));
}
}); });
} }
} else { } else {
...@@ -2942,17 +2932,10 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD ...@@ -2942,17 +2932,10 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
JSONObject jsonObject = JSONObject.parseObject(history.getChangeData()); JSONObject jsonObject = JSONObject.parseObject(history.getChangeData());
String useDate = jsonObject.getString("useDate"); String useDate = jsonObject.getString("useDate");
List<Map<String, Object>> deviceList = (List<Map<String, Object>>) jsonObject.get("deviceList"); List<Map<String, Object>> deviceList = (List<Map<String, Object>>) jsonObject.get("deviceList");
if (CollectionUtils.isNotEmpty(deviceList)) { if (CollectionUtils.isNotEmpty(deviceList)) {
Set<String> validCategories = new HashSet<>(Arrays.asList("8300", "8200", "8100"));
deviceList.stream() deviceList.stream()
.map(JSONObject::new) .map(JSONObject::new)
.filter(item -> !validCategories.contains(category) ||
(whetherToFilterStatus || this.checkEquStatusInUse(item.getString("record"))))
.peek(item -> { .peek(item -> {
if (!validCategories.contains(category)) {
addedEquCodes.add(item.getString("equCode"));
}
item.put("useDate", timeToMonths(useDate)); item.put("useDate", timeToMonths(useDate));
}) })
.forEach(allEquipment::add); .forEach(allEquipment::add);
...@@ -3030,7 +3013,7 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD ...@@ -3030,7 +3013,7 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
public void exportSummaryBasicInfo(List<Long> useRegistrationSeqs, HttpServletResponse response, String category, Set<String> projectContraptionIdList) { public void exportSummaryBasicInfo(List<Long> useRegistrationSeqs, HttpServletResponse response, String category, Set<String> projectContraptionIdList) {
JgUseRegistration jgUseRegistration = jgUseRegistrationMapper.selectOne(new QueryWrapper<JgUseRegistration>().lambda() JgUseRegistration jgUseRegistration = jgUseRegistrationMapper.selectOne(new QueryWrapper<JgUseRegistration>().lambda()
.eq(JgUseRegistration::getSequenceNbr, useRegistrationSeqs.get(0)).eq(JgUseRegistration::getIsDelete, false)); .eq(JgUseRegistration::getSequenceNbr, useRegistrationSeqs.get(0)).eq(JgUseRegistration::getIsDelete, false));
List<CompletableFuture<byte[]>> futures = getExportSummaryBasicInfoData(useRegistrationSeqs, category, "", Boolean.FALSE, projectContraptionIdList); List<CompletableFuture<byte[]>> futures = getExportSummaryBasicInfoData(useRegistrationSeqs, category, "", projectContraptionIdList);
if ("8300".equals(category) || "8200".equals(category) || "8100".equals(category)) { if ("8300".equals(category) || "8200".equals(category) || "8100".equals(category)) {
// 文件名前缀 // 文件名前缀
String filePrefix = "压力管道基本信息汇总表_"; String filePrefix = "压力管道基本信息汇总表_";
......
...@@ -86,10 +86,10 @@ public interface IdxBizJgProjectContraptionMapper extends BaseMapper<IdxBizJgPro ...@@ -86,10 +86,10 @@ public interface IdxBizJgProjectContraptionMapper extends BaseMapper<IdxBizJgPro
List<Map<String, Object>> selectEquipListPage(@Param("sequenceNbr") String sequenceNbr, @Param("current") int current, @Param("size") int size); List<Map<String, Object>> selectEquipListPage(@Param("sequenceNbr") String sequenceNbr, @Param("current") int current, @Param("size") int size);
/** /**
* 获取导出传输/公共管道的信息 * 获取指定装置下的管道信息-不包已报废的管道
* *
* @param sequenceNbr * @param sequenceNbr 装置id
* @return * @return 装置下非报废状态的管道
*/ */
List<Map<String, Object>> selectEquipListByExport(@Param("sequenceNbr") String sequenceNbr); List<Map<String, Object>> selectEquipListByExport(@Param("sequenceNbr") String sequenceNbr);
......
...@@ -82,7 +82,7 @@ ...@@ -82,7 +82,7 @@
LEFT JOIN idx_biz_jg_tech_params_pipeline ibjtpp ON ibjui.RECORD = ibjtpp.RECORD LEFT JOIN idx_biz_jg_tech_params_pipeline ibjtpp ON ibjui.RECORD = ibjtpp.RECORD
LEFT JOIN idx_biz_jg_design_info ibjdi ON ibjui.RECORD = ibjdi.RECORD LEFT JOIN idx_biz_jg_design_info ibjdi ON ibjui.RECORD = ibjdi.RECORD
WHERE ibjui.project_contraption_id = #{sequenceNbr} WHERE ibjui.project_contraption_id = #{sequenceNbr}
ORDER BY ibjtpp.REC_DATE ASC ORDER BY ibjtpp.REC_DATE ASC
</select> </select>
<resultMap id="projectContraptionResultMap" type="java.util.Map"> <resultMap id="projectContraptionResultMap" type="java.util.Map">
...@@ -373,7 +373,9 @@ ...@@ -373,7 +373,9 @@
FROM idx_biz_jg_use_info ibjui FROM idx_biz_jg_use_info ibjui
LEFT JOIN idx_biz_jg_tech_params_pipeline ibjtpp ON ibjui.RECORD = ibjtpp.RECORD LEFT JOIN idx_biz_jg_tech_params_pipeline ibjtpp ON ibjui.RECORD = ibjtpp.RECORD
LEFT JOIN idx_biz_jg_design_info ibjdi ON ibjui.RECORD = ibjdi.RECORD LEFT JOIN idx_biz_jg_design_info ibjdi ON ibjui.RECORD = ibjdi.RECORD
WHERE ibjui.project_contraption_id = #{sequenceNbr} WHERE
ibjui.project_contraption_id = #{sequenceNbr}
and (ibjui."EQU_STATE" is null or ibjui."EQU_STATE" <![CDATA[ <> ]]> '3')
ORDER BY ibjtpp.REC_DATE ASC ORDER BY ibjtpp.REC_DATE ASC
</select> </select>
......
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