Commit 65d8783e authored by tianbo's avatar tianbo

refactor(amos-boot-module-jg): 优化设备信息查询逻辑- 仅对特定设备类型查询施工信息和维保信息

- 厂车、流动式起重机和气瓶不查询施工信息- 仅电梯查询维保信息
parent f64e6dee
...@@ -1505,25 +1505,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -1505,25 +1505,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
objMap.putAll(filterMap); objMap.putAll(filterMap);
} }
} }
// 施工信息 【一对多,暂时只取最新一条数据】
IdxBizJgConstructionInfo constructionInfo = iIdxBizJgConstructionInfoService.queryNewestDetailByRecord(record);
if (!ValidationUtil.isEmpty(constructionInfo)) {
Map<String, Object> constructionInfoMap;
if (!ValidationUtil.isEmpty(fieldType)) {
constructionInfoMap = Bean.BeantoMap(constructionInfo);
constructionInfoMap.put("constructioninfoSeq", constructionInfo.getSequenceNbr());
} else {
constructionInfoMap = convertCamelToUnderscore(constructionInfo, null);
constructionInfoMap.put("CONSTRUCTIONINFO_SEQ", constructionInfo.getSequenceNbr());
}
if (!constructionInfoMap.isEmpty()) {
Map<String, Object> filterMap = constructionInfoMap.entrySet()
.stream()
.filter(e -> e.getValue() != null && e.getValue() != "")
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
objMap.putAll(filterMap);
}
}
// 注册登记 // 注册登记
IdxBizJgRegisterInfo registerInfo = this.getOne(new QueryWrapper<IdxBizJgRegisterInfo>().eq("RECORD", record)); IdxBizJgRegisterInfo registerInfo = this.getOne(new QueryWrapper<IdxBizJgRegisterInfo>().eq("RECORD", record));
if (!ValidationUtil.isEmpty(registerInfo)) { if (!ValidationUtil.isEmpty(registerInfo)) {
...@@ -1567,27 +1549,57 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -1567,27 +1549,57 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
} }
objMap.put("useRegistrationCode", registerInfo.getUseOrgCode()); objMap.put("useRegistrationCode", registerInfo.getUseOrgCode());
} }
// 维保备案【一对多,暂时只取最新一条数据】 String equListStr = (String) objMap.get("EQU_LIST");
IdxBizJgMaintenanceRecordInfo maintenanceRecordInfo = iIdxBizJgMaintenanceRecordInfoService.queryNewestDetailByRecord(record); String equCategoryStr = (String) objMap.get("EQU_CATEGORY");
if (!ValidationUtil.isEmpty(maintenanceRecordInfo)) {
Map<String, Object> maintenanceRecordInfoMap; // 仅做施工告知的设备查询施工信息。厂车=5000、流动式起重机=4400、气瓶=2300不查询施工信息
if (fieldType != null && !fieldType.isEmpty()) { if (!(EquipmentClassifityEnum.CC.getCode().equals(equListStr) || "4400".equals(equCategoryStr) || CylinderTypeEnum.CYLINDER.getCode().equals(equCategoryStr))) {
maintenanceRecordInfoMap = Bean.BeantoMap(maintenanceRecordInfo); // 施工信息 【一对多,暂时只取最新一条数据】
maintenanceRecordInfoMap.put("repairInform", JSON.parse(maintenanceRecordInfo.getRepairInform())); IdxBizJgConstructionInfo constructionInfo = iIdxBizJgConstructionInfoService.queryNewestDetailByRecord(record);
maintenanceRecordInfoMap.put("maintenancerecordinfoSeq", maintenanceRecordInfo.getSequenceNbr()); if (!ValidationUtil.isEmpty(constructionInfo)) {
} else { Map<String, Object> constructionInfoMap;
String[] toArrayFields = {"REPAIR_INFORM"}; if (!ValidationUtil.isEmpty(fieldType)) {
maintenanceRecordInfoMap = convertCamelToUnderscore(maintenanceRecordInfo, toArrayFields); constructionInfoMap = Bean.BeantoMap(constructionInfo);
maintenanceRecordInfoMap.put("MAINTENANCERECORDINFO_SEQ", maintenanceRecordInfo.getSequenceNbr()); constructionInfoMap.put("constructioninfoSeq", constructionInfo.getSequenceNbr());
} else {
constructionInfoMap = convertCamelToUnderscore(constructionInfo, null);
constructionInfoMap.put("CONSTRUCTIONINFO_SEQ", constructionInfo.getSequenceNbr());
}
if (!constructionInfoMap.isEmpty()) {
Map<String, Object> filterMap = constructionInfoMap.entrySet()
.stream()
.filter(e -> e.getValue() != null && e.getValue() != "")
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
objMap.putAll(filterMap);
}
} }
if (!maintenanceRecordInfoMap.isEmpty()) { }
Map<String, Object> filterMap = maintenanceRecordInfoMap.entrySet()
.stream() // 仅电梯查询维保信息
.filter(e -> e.getValue() != null && e.getValue() != "") if (EquipmentClassifityEnum.DT.getCode().equals(equListStr)) {
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)); // 维保备案【一对多,暂时只取最新一条数据】
objMap.putAll(filterMap); IdxBizJgMaintenanceRecordInfo maintenanceRecordInfo = iIdxBizJgMaintenanceRecordInfoService.queryNewestDetailByRecord(record);
if (!ValidationUtil.isEmpty(maintenanceRecordInfo)) {
Map<String, Object> maintenanceRecordInfoMap;
if (fieldType != null && !fieldType.isEmpty()) {
maintenanceRecordInfoMap = Bean.BeantoMap(maintenanceRecordInfo);
maintenanceRecordInfoMap.put("repairInform", JSON.parse(maintenanceRecordInfo.getRepairInform()));
maintenanceRecordInfoMap.put("maintenancerecordinfoSeq", maintenanceRecordInfo.getSequenceNbr());
} else {
String[] toArrayFields = {"REPAIR_INFORM"};
maintenanceRecordInfoMap = convertCamelToUnderscore(maintenanceRecordInfo, toArrayFields);
maintenanceRecordInfoMap.put("MAINTENANCERECORDINFO_SEQ", maintenanceRecordInfo.getSequenceNbr());
}
if (!maintenanceRecordInfoMap.isEmpty()) {
Map<String, Object> filterMap = maintenanceRecordInfoMap.entrySet()
.stream()
.filter(e -> e.getValue() != null && e.getValue() != "")
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
objMap.putAll(filterMap);
}
} }
} }
// 监督管理 // 监督管理
IdxBizJgSupervisionInfo supervisionInfo = iIdxBizJgSupervisionInfoService.getOneData(record); IdxBizJgSupervisionInfo supervisionInfo = iIdxBizJgSupervisionInfoService.getOneData(record);
if (!ValidationUtil.isEmpty(supervisionInfo)) { if (!ValidationUtil.isEmpty(supervisionInfo)) {
...@@ -1657,7 +1669,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -1657,7 +1669,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
//处理前端返回特种气瓶(车用气瓶)和特种气瓶(非车用气瓶) //处理前端返回特种气瓶(车用气瓶)和特种气瓶(非车用气瓶)
String equDefineStr = (String) objMap.get("EQU_DEFINE"); String equDefineStr = (String) objMap.get("EQU_DEFINE");
String whetherVehicleCylinderStr = (String)objMap.get("WHETHER_VEHICLE_CYLINDER"); String whetherVehicleCylinderStr = (String)objMap.get("WHETHER_VEHICLE_CYLINDER");
String equCategoryStr = (String)objMap.get("EQU_CATEGORY");
if(CylinderTypeEnum.CYLINDER.getCode().equals(equCategoryStr)){ if(CylinderTypeEnum.CYLINDER.getCode().equals(equCategoryStr)){
if(CylinderTypeEnum.SPECIAL_CYLINDER.getCode().equals(equDefineStr)){ if(CylinderTypeEnum.SPECIAL_CYLINDER.getCode().equals(equDefineStr)){
if("1".equals(whetherVehicleCylinderStr)){ if("1".equals(whetherVehicleCylinderStr)){
...@@ -1677,29 +1689,40 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -1677,29 +1689,40 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
* @return * @return
*/ */
public String judgeTheBusinessAccordingByRecord(String record, Map<String, Object> objMap) { public String judgeTheBusinessAccordingByRecord(String record, Map<String, Object> objMap) {
String equListStr = (String) objMap.get("EQU_LIST");
String equCategoryStr = (String) objMap.get("EQU_CATEGORY");
String business = ""; String business = "";
// TODO 兼容历史有证、无证数据,根本原因idx_biz_jg_construction_info施工信息字段不全,字段补全后还是要查idx_biz_jg_construction_info,否则改造告知 // 仅做施工告知的设备查询施工信息。厂车=5000、流动式起重机=4400、气瓶=2300不查询施工信息
// 安装信息,优先查询安装告知信息没有再查设备的施工信息表 if (!(EquipmentClassifityEnum.CC.getCode().equals(equListStr) || "4400".equals(equCategoryStr) || CylinderTypeEnum.CYLINDER.getCode().equals(equCategoryStr))) {
// 安装告知信息表查询,做过安装告知的施工信息优先
Map<String, Object> constructInfo = jgUseRegistrationMapper.getiInstallDetail(record); // TODO 兼容历史有证、无证数据,根本原因idx_biz_jg_construction_info施工信息字段不全,字段补全后还是要查idx_biz_jg_construction_info,否则改造告知
if(constructInfo == null){ // 安装信息,优先查询安装告知信息没有再查设备的施工信息表
// 施工信息表查询 // 安装告知信息表查询,做过安装告知的施工信息优先
constructInfo = jgUseRegistrationMapper.getiInstallDetailByIdx(record); Map<String, Object> constructInfo = jgUseRegistrationMapper.getiInstallDetail(record);
} if(constructInfo == null){
if (!ObjectUtils.isEmpty(constructInfo)) { // 施工信息表查询
business = business + ",安装告知"; constructInfo = jgUseRegistrationMapper.getiInstallDetailByIdx(record);
objMap.putAll(constructInfo); }
objMap.put("insOtherAccessories", JSON.parse(Optional.ofNullable(constructInfo.get("insOtherAccessories")).orElse("").toString())); if (!ObjectUtils.isEmpty(constructInfo)) {
objMap.put("installProxyStatementAttachment", JSON.parse(Optional.ofNullable(constructInfo.get("installProxyStatementAttachment")).orElse("").toString())); business = business + ",安装告知";
objMap.put("installContractAttachment", JSON.parse(Optional.ofNullable(constructInfo.get("installContractAttachment")).orElse("").toString())); objMap.putAll(constructInfo);
} objMap.put("insOtherAccessories", JSON.parse(Optional.ofNullable(constructInfo.get("insOtherAccessories")).orElse("").toString()));
// 维保备案 objMap.put("installProxyStatementAttachment", JSON.parse(Optional.ofNullable(constructInfo.get("installProxyStatementAttachment")).orElse("").toString()));
Map<String, Object> maintenanceDetail = jgUseRegistrationMapper.getMaintenanceDetailByIdx(record); objMap.put("installContractAttachment", JSON.parse(Optional.ofNullable(constructInfo.get("installContractAttachment")).orElse("").toString()));
if (!ObjectUtils.isEmpty(maintenanceDetail)) { }
business = business + ",维保合同备案"; }
objMap.putAll(maintenanceDetail);
objMap.put("maintenanceContract", JSON.parse(Optional.ofNullable(maintenanceDetail.get("maintenanceContract")).orElse("").toString())); // 仅电梯查询维保信息
objMap.put("maintOtherAccessories", JSON.parse(Optional.ofNullable(maintenanceDetail.get("maintOtherAccessories")).orElse("").toString())); if (EquipmentClassifityEnum.DT.getCode().equals(equListStr)) {
// 维保备案
Map<String, Object> maintenanceDetail = jgUseRegistrationMapper.getMaintenanceDetailByIdx(record);
if (!ObjectUtils.isEmpty(maintenanceDetail)) {
business = business + ",维保合同备案";
objMap.putAll(maintenanceDetail);
objMap.put("maintenanceContract", JSON.parse(Optional.ofNullable(maintenanceDetail.get("maintenanceContract")).orElse("").toString()));
objMap.put("maintOtherAccessories", JSON.parse(Optional.ofNullable(maintenanceDetail.get("maintOtherAccessories")).orElse("").toString()));
}
} }
// 使用登记 // 使用登记
Map<String, Object> useRegistrationDetail = jgUseRegistrationMapper.getUseRegistrationDetail(record); Map<String, Object> useRegistrationDetail = jgUseRegistrationMapper.getUseRegistrationDetail(record);
......
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