Commit a4869beb authored by 王果's avatar 王果

设备详情方法修改

parent bb1bfc12
......@@ -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.module.jg.api.enums.ConstructionEnum;
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.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.jg.biz.service.*;
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.entity.EquipmentCategory;
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.entity.*;
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.IdxBizJgRegisterInfoMapper;
......@@ -65,16 +41,7 @@ import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.io.IOException;
import java.lang.reflect.Field;
import java.sql.Timestamp;
import java.util.ArrayList;
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 java.util.*;
import static com.alibaba.fastjson.JSON.toJSONString;
......@@ -223,17 +190,22 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
*/
public Map<String, Map<String, Object>> getEquipmentRegisterByRecord(String record) {
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<>();
//使用信息
IdxBizJgUseInfo useInfo = idxBizJgUseInfoService.getOneData(record);
if (!ValidationUtil.isEmpty(useInfo)) {
Map<String, Object> useInfoMap = new HashMap<>();
String[] fields = null;
try {
useInfoMap = this.convertCamelToUnderscore(useInfo, fields);
} catch (IllegalAccessException e) {
e.printStackTrace();
}
useInfoMap.put("USEINFO_SEQ", useInfo.getSequenceNbr());
objMap.putAll(useInfoMap);
}
......@@ -242,11 +214,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
if (!ValidationUtil.isEmpty(designInfo)) {
Map<String, Object> designInfoMap = new HashMap<>();
String[] fields = {"DESIGN_DOC", "DESIGN_STANDARD"};
try {
designInfoMap = this.convertCamelToUnderscore(designInfo, fields);
} catch (IllegalAccessException e) {
e.printStackTrace();
}
designInfoMap.put("DESIGNINFO_SEQ", designInfo.getSequenceNbr());
objMap.putAll(designInfoMap);
}
......@@ -255,11 +223,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
if (!ValidationUtil.isEmpty(factoryInfo)) {
Map<String, Object> factoryInfoMap = new HashMap<>();
String[] fields = {"FACTORY_STANDARD", "PRODUCT_QUALITY_YIELD_PROVE", "INS_USE_MAINTAIN_EXPLAIN"};
try {
factoryInfoMap = this.convertCamelToUnderscore(factoryInfo, fields);
} catch (IllegalAccessException e) {
e.printStackTrace();
}
factoryInfoMap.put("FACTORYINFO_SEQ", factoryInfo.getSequenceNbr());
objMap.putAll(factoryInfoMap);
}
......@@ -268,11 +232,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
if (!ValidationUtil.isEmpty(constructionInfo)) {
Map<String, Object> constructionInfoMap = new HashMap<>();
String[] fields = null;
try {
constructionInfoMap = this.convertCamelToUnderscore(constructionInfo, fields);
} catch (IllegalAccessException e) {
e.printStackTrace();
}
constructionInfoMap.put("CONSTRUCTIONINFO_SEQ", constructionInfo.getSequenceNbr());
objMap.putAll(constructionInfoMap);
}
......@@ -281,11 +241,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
if (!ValidationUtil.isEmpty(registerInfo)) {
Map<String, Object> registerInfoMap = new HashMap<>();
String[] fields = {"PRODUCT_PHOTO"};
try {
registerInfoMap = this.convertCamelToUnderscore(registerInfo, fields);
} catch (IllegalAccessException e) {
e.printStackTrace();
}
registerInfoMap.put("REGISTERINFO_SEQ", registerInfo.getSequenceNbr());
registerInfoMap.put("SEQUENCE_NBR", registerInfo.getSequenceNbr());
objMap.putAll(registerInfoMap);
......@@ -295,11 +251,8 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
if (!ValidationUtil.isEmpty(maintenanceRecordInfo)) {
Map<String, Object> maintenanceRecordInfoMap = new HashMap<>();
String[] fields = null;
try {
maintenanceRecordInfoMap = this.convertCamelToUnderscore(maintenanceRecordInfo, fields);
} catch (IllegalAccessException e) {
e.printStackTrace();
}
maintenanceRecordInfoMap.put("MAINTENANCERECORDINFO_SEQ", maintenanceRecordInfo.getSequenceNbr());
objMap.putAll(maintenanceRecordInfoMap);
}
......@@ -308,11 +261,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
if (!ValidationUtil.isEmpty(supervisionInfo)) {
Map<String, Object> supervisionInfoMap = new HashMap<>();
String[] fields = null;
try {
supervisionInfoMap = this.convertCamelToUnderscore(supervisionInfo, fields);
} catch (IllegalAccessException e) {
e.printStackTrace();
}
supervisionInfoMap.put("SUPERVISIONINFO_SEQ", supervisionInfo.getSequenceNbr());
objMap.putAll(supervisionInfoMap);
}
......@@ -321,11 +270,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
if (!ValidationUtil.isEmpty(otherInfo)) {
Map<String, Object> otherInfoMap = new HashMap<>();
String[] fields = null;
try {
otherInfoMap = this.convertCamelToUnderscore(otherInfo, fields);
} catch (IllegalAccessException e) {
e.printStackTrace();
}
otherInfoMap.put("OTHERINFO_SEQ", otherInfo.getSequenceNbr());
objMap.putAll(otherInfoMap);
}
......@@ -334,11 +279,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
if (!ValidationUtil.isEmpty(inspectionDetectionInfo)) {
Map<String, Object> inspectionDetectionInfoMap = new HashMap<>();
String[] fields = {"INSPECT_REPORT"};
try {
inspectionDetectionInfoMap = this.convertCamelToUnderscore(inspectionDetectionInfo, fields);
} catch (IllegalAccessException e) {
e.printStackTrace();
}
inspectionDetectionInfoMap.put("INSPECTIONDETECTIONINFO_SEQ", inspectionDetectionInfo.getSequenceNbr());
objMap.putAll(inspectionDetectionInfoMap);
}
......@@ -348,11 +289,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
if (!ValidationUtil.isEmpty(elevator)) {
Map<String, Object> elevatorMap = new HashMap<>();
String[] fields = {"EXPLOSIONPROOF_SIGN_COMPLETE"};
try {
elevatorMap = this.convertCamelToUnderscore(elevator, fields);
} catch (IllegalAccessException e) {
e.printStackTrace();
}
elevatorMap.put("ELEVATOR_SEQ", elevator.getSequenceNbr());
objMap.putAll(elevatorMap);
}
......@@ -369,11 +306,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
if (!ValidationUtil.isEmpty(mainParts)) {
Map<String, Object> mainPartsMap = new HashMap<>();
String[] fields = null;
try {
mainPartsMap = this.convertCamelToUnderscore(mainParts, fields);
} catch (IllegalAccessException e) {
e.printStackTrace();
}
mainPartsMap.put("MAINPARTS_SEQ", mainParts.getSequenceNbr());
objMap.putAll(mainPartsMap);
}
......@@ -382,24 +315,16 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
if (!ValidationUtil.isEmpty(protectionDevices)) {
Map<String, Object> protectionDevicesMap = new HashMap<>();
String[] fields = null;
try {
protectionDevicesMap = this.convertCamelToUnderscore(protectionDevices, fields);
} catch (IllegalAccessException e) {
e.printStackTrace();
}
protectionDevicesMap.put("PROTECTIONDEVICES_SEQ", protectionDevices.getSequenceNbr());
objMap.putAll(protectionDevicesMap);
}
if (!ValidationUtil.isEmpty(objMap)) {
resultMap.put(EQUIPMENT_INFO_FORM_ID, objMap);
}
return resultMap;
return objMap;
}
@Override
public Map<String, Object> getDetailByRecord(String record) {
return null;
return getStringObjectMap(record);
}
......@@ -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();
String param = map.getString("SEQUENCE_NBR");
String[] split = param.split(",");
......@@ -796,18 +721,23 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
* @return
* @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<>();
Class<?> clazz = object.getClass();
for (Field field : clazz.getDeclaredFields()) {
field.setAccessible(true);
String fieldName = field.getName();
String underscoreFieldName = StringUtils.camelToUnderline(fieldName).toUpperCase();
Object value = field.get(object);
Object value;
try {
value = field.get(object);
//需要转为jsonArray的字段
if (!ValidationUtil.isEmpty(strToJsonArrayFields) && Arrays.asList(strToJsonArrayFields).contains(underscoreFieldName)) {
value = JSON.parseArray((String) field.get(object));
}
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
}
result.put(underscoreFieldName.toUpperCase(), value);
}
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