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
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));
if (!ValidationUtil.isEmpty(registerInfo)) {
......@@ -1567,27 +1549,57 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
}
objMap.put("useRegistrationCode", registerInfo.getUseOrgCode());
}
// 维保备案【一对多,暂时只取最新一条数据】
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());
String equListStr = (String) objMap.get("EQU_LIST");
String equCategoryStr = (String) objMap.get("EQU_CATEGORY");
// 仅做施工告知的设备查询施工信息。厂车=5000、流动式起重机=4400、气瓶=2300不查询施工信息
if (!(EquipmentClassifityEnum.CC.getCode().equals(equListStr) || "4400".equals(equCategoryStr) || CylinderTypeEnum.CYLINDER.getCode().equals(equCategoryStr))) {
// 施工信息 【一对多,暂时只取最新一条数据】
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);
}
}
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);
}
// 仅电梯查询维保信息
if (EquipmentClassifityEnum.DT.getCode().equals(equListStr)) {
// 维保备案【一对多,暂时只取最新一条数据】
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);
if (!ValidationUtil.isEmpty(supervisionInfo)) {
......@@ -1657,7 +1669,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
//处理前端返回特种气瓶(车用气瓶)和特种气瓶(非车用气瓶)
String equDefineStr = (String) objMap.get("EQU_DEFINE");
String whetherVehicleCylinderStr = (String)objMap.get("WHETHER_VEHICLE_CYLINDER");
String equCategoryStr = (String)objMap.get("EQU_CATEGORY");
if(CylinderTypeEnum.CYLINDER.getCode().equals(equCategoryStr)){
if(CylinderTypeEnum.SPECIAL_CYLINDER.getCode().equals(equDefineStr)){
if("1".equals(whetherVehicleCylinderStr)){
......@@ -1677,29 +1689,40 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
* @return
*/
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 = "";
// TODO 兼容历史有证、无证数据,根本原因idx_biz_jg_construction_info施工信息字段不全,字段补全后还是要查idx_biz_jg_construction_info,否则改造告知
// 安装信息,优先查询安装告知信息没有再查设备的施工信息表
// 安装告知信息表查询,做过安装告知的施工信息优先
Map<String, Object> constructInfo = jgUseRegistrationMapper.getiInstallDetail(record);
if(constructInfo == null){
// 施工信息表查询
constructInfo = jgUseRegistrationMapper.getiInstallDetailByIdx(record);
}
if (!ObjectUtils.isEmpty(constructInfo)) {
business = business + ",安装告知";
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()));
objMap.put("installContractAttachment", JSON.parse(Optional.ofNullable(constructInfo.get("installContractAttachment")).orElse("").toString()));
}
// 维保备案
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()));
// 仅做施工告知的设备查询施工信息。厂车=5000、流动式起重机=4400、气瓶=2300不查询施工信息
if (!(EquipmentClassifityEnum.CC.getCode().equals(equListStr) || "4400".equals(equCategoryStr) || CylinderTypeEnum.CYLINDER.getCode().equals(equCategoryStr))) {
// TODO 兼容历史有证、无证数据,根本原因idx_biz_jg_construction_info施工信息字段不全,字段补全后还是要查idx_biz_jg_construction_info,否则改造告知
// 安装信息,优先查询安装告知信息没有再查设备的施工信息表
// 安装告知信息表查询,做过安装告知的施工信息优先
Map<String, Object> constructInfo = jgUseRegistrationMapper.getiInstallDetail(record);
if(constructInfo == null){
// 施工信息表查询
constructInfo = jgUseRegistrationMapper.getiInstallDetailByIdx(record);
}
if (!ObjectUtils.isEmpty(constructInfo)) {
business = business + ",安装告知";
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()));
objMap.put("installContractAttachment", JSON.parse(Optional.ofNullable(constructInfo.get("installContractAttachment")).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);
......
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