Commit 532238af authored by liufan's avatar liufan

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

parent 96ea288f
......@@ -89,6 +89,13 @@ public class IdxBizJqEquipmentRegisterController extends BaseController {
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
......
......@@ -26,4 +26,6 @@ public interface IIdxBizJgRegisterInfoService {
Page<JSONObject> queryForEquipmentRegisterPage(JSONObject jsonObject);
Map<String, Object> getDetailByRecord(String record);
Map<String, Object> getDetailFieldCamelCaseByRecord(String record);
}
......@@ -34,6 +34,7 @@ import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
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.rdbms.service.BaseService;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
......@@ -191,108 +192,215 @@ 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);
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) {
/**
* @param record 设备Id
* @param fieldType 返回字段类型【CamelCase:驼峰命名,“”:纯大写加下划线】
* @return
*/
private Map<String, Object> getStringObjectMap(String record, String fieldType) {
Map<String, Object> objMap = new HashMap<>();
//使用信息
IdxBizJgUseInfo useInfo = idxBizJgUseInfoService.getOneData(record);
if (!ValidationUtil.isEmpty(useInfo)) {
Map<String, Object> useInfoMap = convertCamelToUnderscore(useInfo, null);
Map<String, Object> useInfoMap = null;
if(!ValidationUtil.isEmpty(fieldType)){
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);
if (!ValidationUtil.isEmpty(designInfo)) {
Map<String, Object> designInfoMap = null;
if(!ValidationUtil.isEmpty(fieldType)){
designInfoMap = Bean.BeantoMap(designInfo);
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"};
Map<String, Object> designInfoMap = convertCamelToUnderscore(designInfo, fields);
designInfoMap = convertCamelToUnderscore(designInfo, fields);
designInfoMap.put("DESIGNINFO_SEQ", designInfo.getSequenceNbr());
}
if(!designInfoMap.isEmpty()) {
objMap.putAll(designInfoMap);
}
}
//制造信息
IdxBizJgFactoryInfo factoryInfo = iIdxBizJgFactoryInfoService.getOneData(record);
if (!ValidationUtil.isEmpty(factoryInfo)) {
Map<String, Object> factoryInfoMap = null;
if(!ValidationUtil.isEmpty(fieldType)){
factoryInfoMap = Bean.BeantoMap(factoryInfo);
String imported = factoryInfo.getImported();
if ("0".equals(imported)) {
factoryInfoMap.put("importedDesc", "否");
} 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"};
Map<String, Object> factoryInfoMap = convertCamelToUnderscore(factoryInfo, fields);
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","是");
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);
}
}
//施工信息
IdxBizJgConstructionInfo constructionInfo = iIdxBizJgConstructionInfoService.getOneData(record);
if (!ValidationUtil.isEmpty(constructionInfo)) {
Map<String, Object> constructionInfoMap = convertCamelToUnderscore(constructionInfo, null);
Map<String, Object> constructionInfoMap = null;
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()) {
objMap.putAll(constructionInfoMap);
}
}
//注册登记
IdxBizJgRegisterInfo registerInfo = this.getOne(new QueryWrapper<IdxBizJgRegisterInfo>().eq("RECORD", record));
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 equDefine = registerInfo.getEquDefine();//设备品种
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);
if(CollectionUtils.isNotEmpty(categoryList2)){
registerInfoMap.put("EQU_DEFINE_DESC",categoryList2.get(0).getName());
Map<String, Object> registerInfoMap = null;
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);
}
}
//维保备案
IdxBizJgMaintenanceRecordInfo maintenanceRecordInfo = iIdxBizJgMaintenanceRecordInfoService.getOneData(record);
if (!ValidationUtil.isEmpty(maintenanceRecordInfo)) {
Map<String, Object> maintenanceRecordInfoMap = convertCamelToUnderscore(maintenanceRecordInfo, null);
Map<String, Object> maintenanceRecordInfoMap = null;
if(!ValidationUtil.isEmpty(fieldType)){
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);
if (!ValidationUtil.isEmpty(supervisionInfo)) {
Map<String, Object> supervisionInfoMap = convertCamelToUnderscore(supervisionInfo, null);
Map<String, Object> supervisionInfoMap = null;
if(!ValidationUtil.isEmpty(fieldType)){
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);
if (!ValidationUtil.isEmpty(otherInfo)) {
Map<String, Object> otherInfoMap = convertCamelToUnderscore(otherInfo, null);
Map<String, Object> otherInfoMap = null;
if(!ValidationUtil.isEmpty(fieldType)){
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);
if (!ValidationUtil.isEmpty(inspectionDetectionInfo)) {
Map<String, Object> inspectionDetectionInfoMap = null;
if(!ValidationUtil.isEmpty(fieldType)){
inspectionDetectionInfoMap = Bean.BeantoMap(inspectionDetectionInfo);
inspectionDetectionInfoMap.put("inspectiondetectioninfoSeq", inspectionDetectionInfo.getSequenceNbr());
inspectionDetectionInfoMap.put("inspectReport", JSON.parseArray(inspectionDetectionInfo.getInspectReport()));
}else {
String[] fields = {"INSPECT_REPORT"};
Map<String, Object> inspectionDetectionInfoMap = convertCamelToUnderscore(inspectionDetectionInfo, fields);
inspectionDetectionInfoMap = convertCamelToUnderscore(inspectionDetectionInfo, fields);
inspectionDetectionInfoMap.put("INSPECTIONDETECTIONINFO_SEQ", inspectionDetectionInfo.getSequenceNbr());
}
if(!inspectionDetectionInfoMap.isEmpty()) {
objMap.putAll(inspectionDetectionInfoMap);
}
}
//电梯
IdxBizJgTechParamsElevator elevator = iIdxBizJgTechParamsElevatorService.getOneData(record);
if (!ValidationUtil.isEmpty(elevator)) {
Map<String, Object> elevatorMap = null;
if(!ValidationUtil.isEmpty(fieldType)){
elevatorMap = Bean.BeantoMap(elevator);
elevatorMap.put("elevatorSeq", elevator.getSequenceNbr());
elevatorMap.put("explosionproofSignComplete", JSON.parseArray(elevator.getExplosionproofSignComplete()));
}else {
String[] fields = {"EXPLOSIONPROOF_SIGN_COMPLETE"};
Map<String, Object> elevatorMap = convertCamelToUnderscore(elevator, fields);
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
//主要零部件
IdxBizJgMainParts mainParts = iIdxBizJgMainPartsService.getOneData(record);
if (!ValidationUtil.isEmpty(mainParts)) {
Map<String, Object> mainPartsMap = convertCamelToUnderscore(mainParts, null);
Map<String, Object> mainPartsMap = null;
if(!ValidationUtil.isEmpty(fieldType)){
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);
if (!ValidationUtil.isEmpty(protectionDevices)) {
Map<String, Object> protectionDevicesMap = convertCamelToUnderscore(protectionDevices, null);
Map<String, Object> protectionDevicesMap = null;
if(!ValidationUtil.isEmpty(fieldType)){
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;
}
@Override
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