Commit a4869beb authored by 王果's avatar 王果

设备详情方法修改

parent bb1bfc12
...@@ -10,34 +10,10 @@ import com.yeejoin.amos.boot.biz.common.utils.RedisKey; ...@@ -10,34 +10,10 @@ 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.jg.api.enums.ConstructionEnum; import com.yeejoin.amos.boot.module.jg.api.enums.ConstructionEnum;
import com.yeejoin.amos.boot.module.jg.biz.dao.ESEquipmentCategory; import com.yeejoin.amos.boot.module.jg.biz.dao.ESEquipmentCategory;
import com.yeejoin.amos.boot.module.jg.biz.service.ICommonService; import com.yeejoin.amos.boot.module.jg.biz.service.*;
import com.yeejoin.amos.boot.module.jg.biz.service.IIdxBizJgConstructionInfoService;
import com.yeejoin.amos.boot.module.jg.biz.service.IIdxBizJgDesignInfoService;
import com.yeejoin.amos.boot.module.jg.biz.service.IIdxBizJgFactoryInfoService;
import com.yeejoin.amos.boot.module.jg.biz.service.IIdxBizJgInspectionDetectionInfoService;
import com.yeejoin.amos.boot.module.jg.biz.service.IIdxBizJgMainPartsService;
import com.yeejoin.amos.boot.module.jg.biz.service.IIdxBizJgMaintenanceRecordInfoService;
import com.yeejoin.amos.boot.module.jg.biz.service.IIdxBizJgOtherInfoService;
import com.yeejoin.amos.boot.module.jg.biz.service.IIdxBizJgProtectionDevicesService;
import com.yeejoin.amos.boot.module.jg.biz.service.IIdxBizJgRegisterInfoService;
import com.yeejoin.amos.boot.module.jg.biz.service.IIdxBizJgSupervisionInfoService;
import com.yeejoin.amos.boot.module.jg.biz.service.IIdxBizJgTechParamsElevatorService;
import com.yeejoin.amos.boot.module.jg.biz.service.IIdxBizJgUseInfoService;
import com.yeejoin.amos.boot.module.ymt.api.dto.ESEquipmentCategoryDto; import com.yeejoin.amos.boot.module.ymt.api.dto.ESEquipmentCategoryDto;
import com.yeejoin.amos.boot.module.ymt.api.dto.IdxBizJgRegisterInfoDto; import com.yeejoin.amos.boot.module.ymt.api.dto.IdxBizJgRegisterInfoDto;
import com.yeejoin.amos.boot.module.ymt.api.entity.EquipmentCategory; import com.yeejoin.amos.boot.module.ymt.api.entity.*;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgConstructionInfo;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgDesignInfo;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgFactoryInfo;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgInspectionDetectionInfo;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgMainParts;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgMaintenanceRecordInfo;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgOtherInfo;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgProtectionDevices;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgRegisterInfo;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgSupervisionInfo;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgTechParamsElevator;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgUseInfo;
import com.yeejoin.amos.boot.module.ymt.api.enums.EquimentEnum; import com.yeejoin.amos.boot.module.ymt.api.enums.EquimentEnum;
import com.yeejoin.amos.boot.module.ymt.api.mapper.CategoryOtherInfoMapper; import com.yeejoin.amos.boot.module.ymt.api.mapper.CategoryOtherInfoMapper;
import com.yeejoin.amos.boot.module.ymt.api.mapper.IdxBizJgRegisterInfoMapper; import com.yeejoin.amos.boot.module.ymt.api.mapper.IdxBizJgRegisterInfoMapper;
...@@ -65,16 +41,7 @@ import org.typroject.tyboot.core.restful.utils.ResponseModel; ...@@ -65,16 +41,7 @@ import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.io.IOException; import java.io.IOException;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.util.ArrayList; import java.util.*;
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.UUID;
import static com.alibaba.fastjson.JSON.toJSONString; import static com.alibaba.fastjson.JSON.toJSONString;
...@@ -223,17 +190,22 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -223,17 +190,22 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
*/ */
public Map<String, Map<String, Object>> getEquipmentRegisterByRecord(String record) { public Map<String, Map<String, Object>> getEquipmentRegisterByRecord(String record) {
Map<String, Map<String, Object>> resultMap = new HashMap<>(); Map<String, Map<String, Object>> resultMap = new HashMap<>();
Map<String, Object> objMap = getStringObjectMap(record);
if (!ValidationUtil.isEmpty(objMap)) {
resultMap.put(EQUIPMENT_INFO_FORM_ID, objMap);
}
return resultMap;
}
private Map<String, Object> getStringObjectMap(String record) {
Map<String, Object> objMap = new HashMap<>(); Map<String, Object> objMap = new HashMap<>();
//使用信息 //使用信息
IdxBizJgUseInfo useInfo = idxBizJgUseInfoService.getOneData(record); IdxBizJgUseInfo useInfo = idxBizJgUseInfoService.getOneData(record);
if (!ValidationUtil.isEmpty(useInfo)) { if (!ValidationUtil.isEmpty(useInfo)) {
Map<String, Object> useInfoMap = new HashMap<>(); Map<String, Object> useInfoMap = new HashMap<>();
String[] fields = null; String[] fields = null;
try {
useInfoMap = this.convertCamelToUnderscore(useInfo, fields); useInfoMap = this.convertCamelToUnderscore(useInfo, fields);
} catch (IllegalAccessException e) {
e.printStackTrace();
}
useInfoMap.put("USEINFO_SEQ", useInfo.getSequenceNbr()); useInfoMap.put("USEINFO_SEQ", useInfo.getSequenceNbr());
objMap.putAll(useInfoMap); objMap.putAll(useInfoMap);
} }
...@@ -242,11 +214,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -242,11 +214,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
if (!ValidationUtil.isEmpty(designInfo)) { if (!ValidationUtil.isEmpty(designInfo)) {
Map<String, Object> designInfoMap = new HashMap<>(); Map<String, Object> designInfoMap = new HashMap<>();
String[] fields = {"DESIGN_DOC", "DESIGN_STANDARD"}; String[] fields = {"DESIGN_DOC", "DESIGN_STANDARD"};
try {
designInfoMap = this.convertCamelToUnderscore(designInfo, fields); designInfoMap = this.convertCamelToUnderscore(designInfo, fields);
} catch (IllegalAccessException e) {
e.printStackTrace();
}
designInfoMap.put("DESIGNINFO_SEQ", designInfo.getSequenceNbr()); designInfoMap.put("DESIGNINFO_SEQ", designInfo.getSequenceNbr());
objMap.putAll(designInfoMap); objMap.putAll(designInfoMap);
} }
...@@ -255,11 +223,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -255,11 +223,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
if (!ValidationUtil.isEmpty(factoryInfo)) { if (!ValidationUtil.isEmpty(factoryInfo)) {
Map<String, Object> factoryInfoMap = new HashMap<>(); Map<String, Object> factoryInfoMap = new HashMap<>();
String[] fields = {"FACTORY_STANDARD", "PRODUCT_QUALITY_YIELD_PROVE", "INS_USE_MAINTAIN_EXPLAIN"}; String[] fields = {"FACTORY_STANDARD", "PRODUCT_QUALITY_YIELD_PROVE", "INS_USE_MAINTAIN_EXPLAIN"};
try {
factoryInfoMap = this.convertCamelToUnderscore(factoryInfo, fields); factoryInfoMap = this.convertCamelToUnderscore(factoryInfo, fields);
} catch (IllegalAccessException e) {
e.printStackTrace();
}
factoryInfoMap.put("FACTORYINFO_SEQ", factoryInfo.getSequenceNbr()); factoryInfoMap.put("FACTORYINFO_SEQ", factoryInfo.getSequenceNbr());
objMap.putAll(factoryInfoMap); objMap.putAll(factoryInfoMap);
} }
...@@ -268,11 +232,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -268,11 +232,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
if (!ValidationUtil.isEmpty(constructionInfo)) { if (!ValidationUtil.isEmpty(constructionInfo)) {
Map<String, Object> constructionInfoMap = new HashMap<>(); Map<String, Object> constructionInfoMap = new HashMap<>();
String[] fields = null; String[] fields = null;
try {
constructionInfoMap = this.convertCamelToUnderscore(constructionInfo, fields); constructionInfoMap = this.convertCamelToUnderscore(constructionInfo, fields);
} catch (IllegalAccessException e) {
e.printStackTrace();
}
constructionInfoMap.put("CONSTRUCTIONINFO_SEQ", constructionInfo.getSequenceNbr()); constructionInfoMap.put("CONSTRUCTIONINFO_SEQ", constructionInfo.getSequenceNbr());
objMap.putAll(constructionInfoMap); objMap.putAll(constructionInfoMap);
} }
...@@ -281,11 +241,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -281,11 +241,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
if (!ValidationUtil.isEmpty(registerInfo)) { if (!ValidationUtil.isEmpty(registerInfo)) {
Map<String, Object> registerInfoMap = new HashMap<>(); Map<String, Object> registerInfoMap = new HashMap<>();
String[] fields = {"PRODUCT_PHOTO"}; String[] fields = {"PRODUCT_PHOTO"};
try {
registerInfoMap = this.convertCamelToUnderscore(registerInfo, fields); registerInfoMap = this.convertCamelToUnderscore(registerInfo, fields);
} catch (IllegalAccessException e) {
e.printStackTrace();
}
registerInfoMap.put("REGISTERINFO_SEQ", registerInfo.getSequenceNbr()); registerInfoMap.put("REGISTERINFO_SEQ", registerInfo.getSequenceNbr());
registerInfoMap.put("SEQUENCE_NBR", registerInfo.getSequenceNbr()); registerInfoMap.put("SEQUENCE_NBR", registerInfo.getSequenceNbr());
objMap.putAll(registerInfoMap); objMap.putAll(registerInfoMap);
...@@ -295,11 +251,8 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -295,11 +251,8 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
if (!ValidationUtil.isEmpty(maintenanceRecordInfo)) { if (!ValidationUtil.isEmpty(maintenanceRecordInfo)) {
Map<String, Object> maintenanceRecordInfoMap = new HashMap<>(); Map<String, Object> maintenanceRecordInfoMap = new HashMap<>();
String[] fields = null; String[] fields = null;
try {
maintenanceRecordInfoMap = this.convertCamelToUnderscore(maintenanceRecordInfo, fields); maintenanceRecordInfoMap = this.convertCamelToUnderscore(maintenanceRecordInfo, fields);
} catch (IllegalAccessException e) {
e.printStackTrace();
}
maintenanceRecordInfoMap.put("MAINTENANCERECORDINFO_SEQ", maintenanceRecordInfo.getSequenceNbr()); maintenanceRecordInfoMap.put("MAINTENANCERECORDINFO_SEQ", maintenanceRecordInfo.getSequenceNbr());
objMap.putAll(maintenanceRecordInfoMap); objMap.putAll(maintenanceRecordInfoMap);
} }
...@@ -308,11 +261,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -308,11 +261,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
if (!ValidationUtil.isEmpty(supervisionInfo)) { if (!ValidationUtil.isEmpty(supervisionInfo)) {
Map<String, Object> supervisionInfoMap = new HashMap<>(); Map<String, Object> supervisionInfoMap = new HashMap<>();
String[] fields = null; String[] fields = null;
try {
supervisionInfoMap = this.convertCamelToUnderscore(supervisionInfo, fields); supervisionInfoMap = this.convertCamelToUnderscore(supervisionInfo, fields);
} catch (IllegalAccessException e) {
e.printStackTrace();
}
supervisionInfoMap.put("SUPERVISIONINFO_SEQ", supervisionInfo.getSequenceNbr()); supervisionInfoMap.put("SUPERVISIONINFO_SEQ", supervisionInfo.getSequenceNbr());
objMap.putAll(supervisionInfoMap); objMap.putAll(supervisionInfoMap);
} }
...@@ -321,11 +270,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -321,11 +270,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
if (!ValidationUtil.isEmpty(otherInfo)) { if (!ValidationUtil.isEmpty(otherInfo)) {
Map<String, Object> otherInfoMap = new HashMap<>(); Map<String, Object> otherInfoMap = new HashMap<>();
String[] fields = null; String[] fields = null;
try {
otherInfoMap = this.convertCamelToUnderscore(otherInfo, fields); otherInfoMap = this.convertCamelToUnderscore(otherInfo, fields);
} catch (IllegalAccessException e) {
e.printStackTrace();
}
otherInfoMap.put("OTHERINFO_SEQ", otherInfo.getSequenceNbr()); otherInfoMap.put("OTHERINFO_SEQ", otherInfo.getSequenceNbr());
objMap.putAll(otherInfoMap); objMap.putAll(otherInfoMap);
} }
...@@ -334,11 +279,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -334,11 +279,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
if (!ValidationUtil.isEmpty(inspectionDetectionInfo)) { if (!ValidationUtil.isEmpty(inspectionDetectionInfo)) {
Map<String, Object> inspectionDetectionInfoMap = new HashMap<>(); Map<String, Object> inspectionDetectionInfoMap = new HashMap<>();
String[] fields = {"INSPECT_REPORT"}; String[] fields = {"INSPECT_REPORT"};
try {
inspectionDetectionInfoMap = this.convertCamelToUnderscore(inspectionDetectionInfo, fields); inspectionDetectionInfoMap = this.convertCamelToUnderscore(inspectionDetectionInfo, fields);
} catch (IllegalAccessException e) {
e.printStackTrace();
}
inspectionDetectionInfoMap.put("INSPECTIONDETECTIONINFO_SEQ", inspectionDetectionInfo.getSequenceNbr()); inspectionDetectionInfoMap.put("INSPECTIONDETECTIONINFO_SEQ", inspectionDetectionInfo.getSequenceNbr());
objMap.putAll(inspectionDetectionInfoMap); objMap.putAll(inspectionDetectionInfoMap);
} }
...@@ -348,11 +289,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -348,11 +289,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
if (!ValidationUtil.isEmpty(elevator)) { if (!ValidationUtil.isEmpty(elevator)) {
Map<String, Object> elevatorMap = new HashMap<>(); Map<String, Object> elevatorMap = new HashMap<>();
String[] fields = {"EXPLOSIONPROOF_SIGN_COMPLETE"}; String[] fields = {"EXPLOSIONPROOF_SIGN_COMPLETE"};
try {
elevatorMap = this.convertCamelToUnderscore(elevator, fields); elevatorMap = this.convertCamelToUnderscore(elevator, fields);
} catch (IllegalAccessException e) {
e.printStackTrace();
}
elevatorMap.put("ELEVATOR_SEQ", elevator.getSequenceNbr()); elevatorMap.put("ELEVATOR_SEQ", elevator.getSequenceNbr());
objMap.putAll(elevatorMap); objMap.putAll(elevatorMap);
} }
...@@ -369,11 +306,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -369,11 +306,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
if (!ValidationUtil.isEmpty(mainParts)) { if (!ValidationUtil.isEmpty(mainParts)) {
Map<String, Object> mainPartsMap = new HashMap<>(); Map<String, Object> mainPartsMap = new HashMap<>();
String[] fields = null; String[] fields = null;
try {
mainPartsMap = this.convertCamelToUnderscore(mainParts, fields); mainPartsMap = this.convertCamelToUnderscore(mainParts, fields);
} catch (IllegalAccessException e) {
e.printStackTrace();
}
mainPartsMap.put("MAINPARTS_SEQ", mainParts.getSequenceNbr()); mainPartsMap.put("MAINPARTS_SEQ", mainParts.getSequenceNbr());
objMap.putAll(mainPartsMap); objMap.putAll(mainPartsMap);
} }
...@@ -382,24 +315,16 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -382,24 +315,16 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
if (!ValidationUtil.isEmpty(protectionDevices)) { if (!ValidationUtil.isEmpty(protectionDevices)) {
Map<String, Object> protectionDevicesMap = new HashMap<>(); Map<String, Object> protectionDevicesMap = new HashMap<>();
String[] fields = null; String[] fields = null;
try {
protectionDevicesMap = this.convertCamelToUnderscore(protectionDevices, fields); protectionDevicesMap = this.convertCamelToUnderscore(protectionDevices, fields);
} catch (IllegalAccessException e) {
e.printStackTrace();
}
protectionDevicesMap.put("PROTECTIONDEVICES_SEQ", protectionDevices.getSequenceNbr()); protectionDevicesMap.put("PROTECTIONDEVICES_SEQ", protectionDevices.getSequenceNbr());
objMap.putAll(protectionDevicesMap); objMap.putAll(protectionDevicesMap);
} }
return objMap;
if (!ValidationUtil.isEmpty(objMap)) {
resultMap.put(EQUIPMENT_INFO_FORM_ID, objMap);
}
return resultMap;
} }
@Override @Override
public Map<String, Object> getDetailByRecord(String record) { public Map<String, Object> getDetailByRecord(String record) {
return null; return getStringObjectMap(record);
} }
...@@ -500,7 +425,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -500,7 +425,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
} }
//通用匹配规则,其他条件构建 //通用匹配规则,其他条件构建
if(!ObjectUtils.isEmpty(map.getString("SEQUENCE_NBR"))){ if (!ObjectUtils.isEmpty(map.getString("SEQUENCE_NBR"))) {
BoolQueryBuilder seqBuilder = QueryBuilders.boolQuery(); BoolQueryBuilder seqBuilder = QueryBuilders.boolQuery();
String param = map.getString("SEQUENCE_NBR"); String param = map.getString("SEQUENCE_NBR");
String[] split = param.split(","); String[] split = param.split(",");
...@@ -796,18 +721,23 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -796,18 +721,23 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
* @return * @return
* @throws IllegalAccessException * @throws IllegalAccessException
*/ */
public static Map<String, Object> convertCamelToUnderscore(Object object, String[] strToJsonArrayFields) throws IllegalAccessException { public static Map<String, Object> convertCamelToUnderscore(Object object, String[] strToJsonArrayFields) {
Map<String, Object> result = new HashMap<>(); Map<String, Object> result = new HashMap<>();
Class<?> clazz = object.getClass(); Class<?> clazz = object.getClass();
for (Field field : clazz.getDeclaredFields()) { for (Field field : clazz.getDeclaredFields()) {
field.setAccessible(true); field.setAccessible(true);
String fieldName = field.getName(); String fieldName = field.getName();
String underscoreFieldName = StringUtils.camelToUnderline(fieldName).toUpperCase(); String underscoreFieldName = StringUtils.camelToUnderline(fieldName).toUpperCase();
Object value = field.get(object); Object value;
try {
value = field.get(object);
//需要转为jsonArray的字段 //需要转为jsonArray的字段
if (!ValidationUtil.isEmpty(strToJsonArrayFields) && Arrays.asList(strToJsonArrayFields).contains(underscoreFieldName)) { if (!ValidationUtil.isEmpty(strToJsonArrayFields) && Arrays.asList(strToJsonArrayFields).contains(underscoreFieldName)) {
value = JSON.parseArray((String) field.get(object)); value = JSON.parseArray((String) field.get(object));
} }
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
}
result.put(underscoreFieldName.toUpperCase(), value); result.put(underscoreFieldName.toUpperCase(), value);
} }
return result; return result;
......
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