Commit 532238af authored by liufan's avatar liufan

优化:设备详情接口,返回字段驼峰命名

parent 96ea288f
...@@ -89,6 +89,13 @@ public class IdxBizJqEquipmentRegisterController extends BaseController { ...@@ -89,6 +89,13 @@ public class IdxBizJqEquipmentRegisterController extends BaseController {
return ResponseHelper.buildResponse(idxBizJgRegisterInfoService.getDetailByRecord(record)); return ResponseHelper.buildResponse(idxBizJgRegisterInfoService.getDetailByRecord(record));
} }
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping (value = "/detailFieldCamelCase")
@ApiOperation(httpMethod = "GET", value = "根据record查询设备注册信息详情,返回字段驼峰命名", notes = "根据record查询设备注册信息详情,返回字段驼峰命名")
public ResponseModel<Map<String, Object>> getDetailFieldCamelCase(@RequestParam String record) {
return ResponseHelper.buildResponse(idxBizJgRegisterInfoService.getDetailFieldCamelCaseByRecord(record));
}
/** /**
* 查询设备注册列表 * 查询设备注册列表
* @param map * @param map
......
...@@ -26,4 +26,6 @@ public interface IIdxBizJgRegisterInfoService { ...@@ -26,4 +26,6 @@ public interface IIdxBizJgRegisterInfoService {
Page<JSONObject> queryForEquipmentRegisterPage(JSONObject jsonObject); Page<JSONObject> queryForEquipmentRegisterPage(JSONObject jsonObject);
Map<String, Object> getDetailByRecord(String record); Map<String, Object> getDetailByRecord(String record);
Map<String, Object> getDetailFieldCamelCaseByRecord(String record);
} }
...@@ -34,6 +34,7 @@ import org.springframework.http.HttpStatus; ...@@ -34,6 +34,7 @@ import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.core.foundation.context.RequestContext; import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.utils.Bean;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil; import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService; import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.typroject.tyboot.core.restful.utils.ResponseHelper; import org.typroject.tyboot.core.restful.utils.ResponseHelper;
...@@ -191,107 +192,214 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -191,107 +192,214 @@ 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); Map<String, Object> objMap = getStringObjectMap(record, "");
if (!ValidationUtil.isEmpty(objMap)) { if (!ValidationUtil.isEmpty(objMap)) {
resultMap.put(EQUIPMENT_INFO_FORM_ID, objMap); resultMap.put(EQUIPMENT_INFO_FORM_ID, objMap);
} }
return resultMap; return resultMap;
} }
private Map<String, Object> getStringObjectMap(String record) {
/**
* @param record 设备Id
* @param fieldType 返回字段类型【CamelCase:驼峰命名,“”:纯大写加下划线】
* @return
*/
private Map<String, Object> getStringObjectMap(String record, String fieldType) {
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 = convertCamelToUnderscore(useInfo, null); Map<String, Object> useInfoMap = null;
useInfoMap.put("USEINFO_SEQ", useInfo.getSequenceNbr()); if(!ValidationUtil.isEmpty(fieldType)){
objMap.putAll(useInfoMap); useInfoMap = Bean.BeantoMap(useInfo);
useInfoMap.put("useinfoSeq", useInfo.getSequenceNbr());
}else {
useInfoMap = convertCamelToUnderscore(useInfo, null);
useInfoMap.put("USEINFO_SEQ", useInfo.getSequenceNbr());
}
if(!useInfoMap.isEmpty()){
objMap.putAll(useInfoMap);
}
} }
//设计制造 //设计制造
IdxBizJgDesignInfo designInfo = iIdxBizJgDesignInfoService.getOneData(record); IdxBizJgDesignInfo designInfo = iIdxBizJgDesignInfoService.getOneData(record);
if (!ValidationUtil.isEmpty(designInfo)) { if (!ValidationUtil.isEmpty(designInfo)) {
String[] fields = {"DESIGN_DOC", "DESIGN_STANDARD"}; Map<String, Object> designInfoMap = null;
Map<String, Object> designInfoMap = convertCamelToUnderscore(designInfo, fields); if(!ValidationUtil.isEmpty(fieldType)){
designInfoMap.put("DESIGNINFO_SEQ", designInfo.getSequenceNbr()); designInfoMap = Bean.BeantoMap(designInfo);
objMap.putAll(designInfoMap); designInfoMap.put("designinfoSeq", designInfo.getSequenceNbr());
designInfoMap.put("designDoc", JSON.parseArray(designInfo.getDesignDoc()));
designInfoMap.put("designStandard", JSON.parseArray(designInfo.getDesignStandard()));
}else {
String[] fields = {"DESIGN_DOC", "DESIGN_STANDARD"};
designInfoMap = convertCamelToUnderscore(designInfo, fields);
designInfoMap.put("DESIGNINFO_SEQ", designInfo.getSequenceNbr());
}
if(!designInfoMap.isEmpty()) {
objMap.putAll(designInfoMap);
}
} }
//制造信息 //制造信息
IdxBizJgFactoryInfo factoryInfo = iIdxBizJgFactoryInfoService.getOneData(record); IdxBizJgFactoryInfo factoryInfo = iIdxBizJgFactoryInfoService.getOneData(record);
if (!ValidationUtil.isEmpty(factoryInfo)) { if (!ValidationUtil.isEmpty(factoryInfo)) {
String[] fields = {"FACTORY_STANDARD", "PRODUCT_QUALITY_YIELD_PROVE", "INS_USE_MAINTAIN_EXPLAIN"}; Map<String, Object> factoryInfoMap = null;
Map<String, Object> factoryInfoMap = convertCamelToUnderscore(factoryInfo, fields); if(!ValidationUtil.isEmpty(fieldType)){
String imported = factoryInfo.getImported(); factoryInfoMap = Bean.BeantoMap(factoryInfo);
if("0".equals(imported)){ String imported = factoryInfo.getImported();
factoryInfoMap.put("IMPORTED_DESC","否"); if ("0".equals(imported)) {
}else if("1".equals(imported)){ factoryInfoMap.put("importedDesc", "否");
factoryInfoMap.put("IMPORTED_DESC","是"); } else if ("1".equals(imported)) {
factoryInfoMap.put("importedDesc", "是");
}
factoryInfoMap.put("factoryinfoSeq", factoryInfo.getSequenceNbr());
factoryInfoMap.put("factoryStandard", JSON.parseArray(factoryInfo.getFactoryStandard()));
factoryInfoMap.put("productQualityYieldProve", JSON.parseArray(factoryInfo.getProductQualityYieldProve()));
factoryInfoMap.put("insUseMaintainExplain", JSON.parseArray(factoryInfo.getInsUseMaintainExplain()));
}else {
String[] fields = {"FACTORY_STANDARD", "PRODUCT_QUALITY_YIELD_PROVE", "INS_USE_MAINTAIN_EXPLAIN"};
factoryInfoMap = convertCamelToUnderscore(factoryInfo, fields);
String imported = factoryInfo.getImported();
if ("0".equals(imported)) {
factoryInfoMap.put("IMPORTED_DESC", "否");
} else if ("1".equals(imported)) {
factoryInfoMap.put("IMPORTED_DESC", "是");
}
factoryInfoMap.put("FACTORYINFO_SEQ", factoryInfo.getSequenceNbr());
}
if(!factoryInfoMap.isEmpty()) {
objMap.putAll(factoryInfoMap);
} }
factoryInfoMap.put("FACTORYINFO_SEQ", factoryInfo.getSequenceNbr());
objMap.putAll(factoryInfoMap);
} }
//施工信息 //施工信息
IdxBizJgConstructionInfo constructionInfo = iIdxBizJgConstructionInfoService.getOneData(record); IdxBizJgConstructionInfo constructionInfo = iIdxBizJgConstructionInfoService.getOneData(record);
if (!ValidationUtil.isEmpty(constructionInfo)) { if (!ValidationUtil.isEmpty(constructionInfo)) {
Map<String, Object> constructionInfoMap = convertCamelToUnderscore(constructionInfo, null); Map<String, Object> constructionInfoMap = null;
constructionInfoMap.put("CONSTRUCTIONINFO_SEQ", constructionInfo.getSequenceNbr()); if(!ValidationUtil.isEmpty(fieldType)){
objMap.putAll(constructionInfoMap); constructionInfoMap = Bean.BeantoMap(constructionInfo);
constructionInfoMap.put("constructioninfoSeq", constructionInfo.getSequenceNbr());
}else {
constructionInfoMap = convertCamelToUnderscore(constructionInfo, null);
constructionInfoMap.put("CONSTRUCTIONINFO_SEQ", constructionInfo.getSequenceNbr());
}
if(!constructionInfoMap.isEmpty()) {
objMap.putAll(constructionInfoMap);
}
} }
//注册登记 //注册登记
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)) {
String[] fields = {"PRODUCT_PHOTO"};
Map<String, Object> registerInfoMap = convertCamelToUnderscore(registerInfo, fields);
registerInfoMap.put("REGISTERINFO_SEQ", registerInfo.getSequenceNbr());
registerInfoMap.put("SEQUENCE_NBR", registerInfo.getSequenceNbr());
String equCategory = registerInfo.getEquCategory();//设备类别 String equCategory = registerInfo.getEquCategory();//设备类别
String equDefine = registerInfo.getEquDefine();//设备品种 String equDefine = registerInfo.getEquDefine();//设备品种
List<EquipmentCategory> categoryList1 = commonService.getEquipmentCategoryList(equCategory, null); List<EquipmentCategory> categoryList1 = commonService.getEquipmentCategoryList(equCategory, null);
if(CollectionUtils.isNotEmpty(categoryList1)){
registerInfoMap.put("EQU_CATEGORY_DESC",categoryList1.get(0).getName());
}
List<EquipmentCategory> categoryList2 = commonService.getEquipmentCategoryList(equDefine, null); List<EquipmentCategory> categoryList2 = commonService.getEquipmentCategoryList(equDefine, null);
if(CollectionUtils.isNotEmpty(categoryList2)){ Map<String, Object> registerInfoMap = null;
registerInfoMap.put("EQU_DEFINE_DESC",categoryList2.get(0).getName()); if(!ValidationUtil.isEmpty(fieldType)){
registerInfoMap = Bean.BeantoMap(registerInfo);
registerInfoMap.put("registerinfoSeq", registerInfo.getSequenceNbr());
registerInfoMap.put("sequenceNbr", registerInfo.getSequenceNbr());
registerInfoMap.put("productPhoto", JSON.parseArray(registerInfo.getProductPhoto()));
if (CollectionUtils.isNotEmpty(categoryList1)) {
registerInfoMap.put("equCategoryDesc", categoryList1.get(0).getName());
}
if (CollectionUtils.isNotEmpty(categoryList2)) {
registerInfoMap.put("equDefineDesc", categoryList2.get(0).getName());
}
}else {
String[] fields = {"PRODUCT_PHOTO"};
registerInfoMap = convertCamelToUnderscore(registerInfo, fields);
registerInfoMap.put("REGISTERINFO_SEQ", registerInfo.getSequenceNbr());
registerInfoMap.put("SEQUENCE_NBR", registerInfo.getSequenceNbr());
if (CollectionUtils.isNotEmpty(categoryList1)) {
registerInfoMap.put("EQU_CATEGORY_DESC", categoryList1.get(0).getName());
}
if (CollectionUtils.isNotEmpty(categoryList2)) {
registerInfoMap.put("EQU_DEFINE_DESC", categoryList2.get(0).getName());
}
}
if(!registerInfoMap.isEmpty()) {
objMap.putAll(registerInfoMap);
} }
objMap.putAll(registerInfoMap);
} }
//维保备案 //维保备案
IdxBizJgMaintenanceRecordInfo maintenanceRecordInfo = iIdxBizJgMaintenanceRecordInfoService.getOneData(record); IdxBizJgMaintenanceRecordInfo maintenanceRecordInfo = iIdxBizJgMaintenanceRecordInfoService.getOneData(record);
if (!ValidationUtil.isEmpty(maintenanceRecordInfo)) { if (!ValidationUtil.isEmpty(maintenanceRecordInfo)) {
Map<String, Object> maintenanceRecordInfoMap = convertCamelToUnderscore(maintenanceRecordInfo, null); Map<String, Object> maintenanceRecordInfoMap = null;
maintenanceRecordInfoMap.put("MAINTENANCERECORDINFO_SEQ", maintenanceRecordInfo.getSequenceNbr()); if(!ValidationUtil.isEmpty(fieldType)){
objMap.putAll(maintenanceRecordInfoMap); maintenanceRecordInfoMap = Bean.BeantoMap(maintenanceRecordInfo);
maintenanceRecordInfoMap.put("maintenancerecordinfoSeq", maintenanceRecordInfo.getSequenceNbr());
}else {
maintenanceRecordInfoMap = convertCamelToUnderscore(maintenanceRecordInfo, null);
maintenanceRecordInfoMap.put("MAINTENANCERECORDINFO_SEQ", maintenanceRecordInfo.getSequenceNbr());
}
if(!maintenanceRecordInfoMap.isEmpty()) {
objMap.putAll(maintenanceRecordInfoMap);
}
} }
//监督管理 //监督管理
IdxBizJgSupervisionInfo supervisionInfo = iIdxBizJgSupervisionInfoService.getOneData(record); IdxBizJgSupervisionInfo supervisionInfo = iIdxBizJgSupervisionInfoService.getOneData(record);
if (!ValidationUtil.isEmpty(supervisionInfo)) { if (!ValidationUtil.isEmpty(supervisionInfo)) {
Map<String, Object> supervisionInfoMap = convertCamelToUnderscore(supervisionInfo, null); Map<String, Object> supervisionInfoMap = null;
supervisionInfoMap.put("SUPERVISIONINFO_SEQ", supervisionInfo.getSequenceNbr()); if(!ValidationUtil.isEmpty(fieldType)){
objMap.putAll(supervisionInfoMap); supervisionInfoMap = Bean.BeantoMap(supervisionInfo);
supervisionInfoMap.put("supervisioninfoSeq", supervisionInfo.getSequenceNbr());
}else {
supervisionInfoMap = convertCamelToUnderscore(supervisionInfo, null);
supervisionInfoMap.put("SUPERVISIONINFO_SEQ", supervisionInfo.getSequenceNbr());
}
if(!supervisionInfoMap.isEmpty()) {
objMap.putAll(supervisionInfoMap);
}
} }
//其他信息 //其他信息
IdxBizJgOtherInfo otherInfo = iIdxBizJgOtherInfoService.getOneData(record); IdxBizJgOtherInfo otherInfo = iIdxBizJgOtherInfoService.getOneData(record);
if (!ValidationUtil.isEmpty(otherInfo)) { if (!ValidationUtil.isEmpty(otherInfo)) {
Map<String, Object> otherInfoMap = convertCamelToUnderscore(otherInfo, null); Map<String, Object> otherInfoMap = null;
otherInfoMap.put("OTHERINFO_SEQ", otherInfo.getSequenceNbr()); if(!ValidationUtil.isEmpty(fieldType)){
objMap.putAll(otherInfoMap); otherInfoMap = Bean.BeantoMap(otherInfo);
otherInfoMap.put("otherinfoSeq", otherInfo.getSequenceNbr());
}else {
otherInfoMap = convertCamelToUnderscore(otherInfo, null);
otherInfoMap.put("OTHERINFO_SEQ", otherInfo.getSequenceNbr());
}
if(!otherInfoMap.isEmpty()) {
objMap.putAll(otherInfoMap);
}
} }
//检验检测 //检验检测
IdxBizJgInspectionDetectionInfo inspectionDetectionInfo = iIdxBizJgInspectionDetectionInfoService.getOneData(record); IdxBizJgInspectionDetectionInfo inspectionDetectionInfo = iIdxBizJgInspectionDetectionInfoService.getOneData(record);
if (!ValidationUtil.isEmpty(inspectionDetectionInfo)) { if (!ValidationUtil.isEmpty(inspectionDetectionInfo)) {
String[] fields = {"INSPECT_REPORT"}; Map<String, Object> inspectionDetectionInfoMap = null;
Map<String, Object> inspectionDetectionInfoMap = convertCamelToUnderscore(inspectionDetectionInfo, fields); if(!ValidationUtil.isEmpty(fieldType)){
inspectionDetectionInfoMap.put("INSPECTIONDETECTIONINFO_SEQ", inspectionDetectionInfo.getSequenceNbr()); inspectionDetectionInfoMap = Bean.BeantoMap(inspectionDetectionInfo);
objMap.putAll(inspectionDetectionInfoMap); inspectionDetectionInfoMap.put("inspectiondetectioninfoSeq", inspectionDetectionInfo.getSequenceNbr());
inspectionDetectionInfoMap.put("inspectReport", JSON.parseArray(inspectionDetectionInfo.getInspectReport()));
}else {
String[] fields = {"INSPECT_REPORT"};
inspectionDetectionInfoMap = convertCamelToUnderscore(inspectionDetectionInfo, fields);
inspectionDetectionInfoMap.put("INSPECTIONDETECTIONINFO_SEQ", inspectionDetectionInfo.getSequenceNbr());
}
if(!inspectionDetectionInfoMap.isEmpty()) {
objMap.putAll(inspectionDetectionInfoMap);
}
} }
//电梯 //电梯
IdxBizJgTechParamsElevator elevator = iIdxBizJgTechParamsElevatorService.getOneData(record); IdxBizJgTechParamsElevator elevator = iIdxBizJgTechParamsElevatorService.getOneData(record);
if (!ValidationUtil.isEmpty(elevator)) { if (!ValidationUtil.isEmpty(elevator)) {
String[] fields = {"EXPLOSIONPROOF_SIGN_COMPLETE"}; Map<String, Object> elevatorMap = null;
Map<String, Object> elevatorMap = convertCamelToUnderscore(elevator, fields); if(!ValidationUtil.isEmpty(fieldType)){
elevatorMap.put("ELEVATOR_SEQ", elevator.getSequenceNbr()); elevatorMap = Bean.BeantoMap(elevator);
objMap.putAll(elevatorMap); elevatorMap.put("elevatorSeq", elevator.getSequenceNbr());
elevatorMap.put("explosionproofSignComplete", JSON.parseArray(elevator.getExplosionproofSignComplete()));
}else {
String[] fields = {"EXPLOSIONPROOF_SIGN_COMPLETE"};
elevatorMap = convertCamelToUnderscore(elevator, fields);
elevatorMap.put("ELEVATOR_SEQ", elevator.getSequenceNbr());
}
if(!elevatorMap.isEmpty()) {
objMap.putAll(elevatorMap);
}
} }
//厂车 //厂车
//索道 //索道
...@@ -304,23 +412,42 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -304,23 +412,42 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
//主要零部件 //主要零部件
IdxBizJgMainParts mainParts = iIdxBizJgMainPartsService.getOneData(record); IdxBizJgMainParts mainParts = iIdxBizJgMainPartsService.getOneData(record);
if (!ValidationUtil.isEmpty(mainParts)) { if (!ValidationUtil.isEmpty(mainParts)) {
Map<String, Object> mainPartsMap = convertCamelToUnderscore(mainParts, null); Map<String, Object> mainPartsMap = null;
mainPartsMap.put("MAINPARTS_SEQ", mainParts.getSequenceNbr()); if(!ValidationUtil.isEmpty(fieldType)){
objMap.putAll(mainPartsMap); mainPartsMap = Bean.BeantoMap(mainParts);
mainPartsMap.put("mainpartsSeq", mainParts.getSequenceNbr());
}else {
mainPartsMap = convertCamelToUnderscore(mainParts, null);
mainPartsMap.put("MAINPARTS_SEQ", mainParts.getSequenceNbr());
}
if(!mainPartsMap.isEmpty()) {
objMap.putAll(mainPartsMap);
}
} }
//安全附件 //安全附件
IdxBizJgProtectionDevices protectionDevices = iIdxBizJgProtectionDevicesService.getOneData(record); IdxBizJgProtectionDevices protectionDevices = iIdxBizJgProtectionDevicesService.getOneData(record);
if (!ValidationUtil.isEmpty(protectionDevices)) { if (!ValidationUtil.isEmpty(protectionDevices)) {
Map<String, Object> protectionDevicesMap = convertCamelToUnderscore(protectionDevices, null); Map<String, Object> protectionDevicesMap = null;
protectionDevicesMap.put("PROTECTIONDEVICES_SEQ", protectionDevices.getSequenceNbr()); if(!ValidationUtil.isEmpty(fieldType)){
objMap.putAll(protectionDevicesMap); protectionDevicesMap = Bean.BeantoMap(protectionDevices);
protectionDevicesMap.put("protectiondevicesSeq", protectionDevices.getSequenceNbr());
}else {
protectionDevicesMap = convertCamelToUnderscore(protectionDevices, null);
protectionDevicesMap.put("PROTECTIONDEVICES_SEQ", protectionDevices.getSequenceNbr());
}
if(!protectionDevicesMap.isEmpty()) {
objMap.putAll(protectionDevicesMap);
}
} }
return objMap; return objMap;
} }
@Override
public Map<String, Object> getDetailByRecord(String record) { public Map<String, Object> getDetailByRecord(String record) {
return getStringObjectMap(record); return getStringObjectMap(record, "");
}
public Map<String, Object> getDetailFieldCamelCaseByRecord(String record) {
return getStringObjectMap(record, "CamelCase");
} }
......
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