Commit 6493ec41 authored by 刘凡's avatar 刘凡

*)模板配置表单中的部分API,减少网络请求

parent 34711e95
...@@ -3,6 +3,9 @@ package com.yeejoin.amos.boot.module.jyjc.biz.service.impl; ...@@ -3,6 +3,9 @@ package com.yeejoin.amos.boot.module.jyjc.biz.service.impl;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.boot.biz.common.entity.DataDictionary;
import com.yeejoin.amos.boot.biz.common.service.impl.DataDictionaryServiceImpl;
import com.yeejoin.amos.boot.biz.common.utils.MenuFrom;
import com.yeejoin.amos.boot.module.jyjc.biz.util.DpSubUtils; import com.yeejoin.amos.boot.module.jyjc.biz.util.DpSubUtils;
import com.yeejoin.amos.boot.module.jyjc.biz.util.JsonValueUtils; import com.yeejoin.amos.boot.module.jyjc.biz.util.JsonValueUtils;
import com.yeejoin.amos.boot.module.jyjc.biz.util.RestTemplateUtils; import com.yeejoin.amos.boot.module.jyjc.biz.util.RestTemplateUtils;
...@@ -47,6 +50,9 @@ public class DPSubServiceImpl { ...@@ -47,6 +50,9 @@ public class DPSubServiceImpl {
@LoadBalanced @LoadBalanced
private RestTemplate restTemplate; private RestTemplate restTemplate;
@Autowired
DataDictionaryServiceImpl iDataDictionaryService;
public JSONObject commonQuery(String template, @RequestBody Map<String, Object> param) { public JSONObject commonQuery(String template, @RequestBody Map<String, Object> param) {
JSONObject result = new JSONObject(); JSONObject result = new JSONObject();
String templateJson = DpSubUtils.getFileContent(template + ".json"); String templateJson = DpSubUtils.getFileContent(template + ".json");
...@@ -378,11 +384,25 @@ public class DPSubServiceImpl { ...@@ -378,11 +384,25 @@ public class DPSubServiceImpl {
Object value = apiResult.get(fieldKey); Object value = apiResult.get(fieldKey);
Object paramFieldKeys = JsonValueUtils.getValueByKey(tab, "dataConfig", "dataConfig.paramFieldKeys"); Object paramFieldKeys = JsonValueUtils.getValueByKey(tab, "dataConfig", "dataConfig.paramFieldKeys");
Object dictionaryFieldKeys = JsonValueUtils.getValueByKey(tab, "dataConfig", "dataConfig.dictionaryFieldKeys");
JSONObject param = tab.getJSONObject("param"); JSONObject param = tab.getJSONObject("param");
jsonObject.put("type", "text"); jsonObject.put("type", "text");
jsonObject.put("value", value); jsonObject.put("value", value);
if (!ValidationUtil.isEmpty(paramFieldKeys) && ((JSONArray) paramFieldKeys).contains(fieldKey)){ if (!ValidationUtil.isEmpty(paramFieldKeys) && ((JSONArray) paramFieldKeys).contains(fieldKey)){
jsonObject.put("value", param.getString(fieldKey)); jsonObject.put("value", param.getString(fieldKey));
} else if(!ValidationUtil.isEmpty(dictionaryFieldKeys) && ((JSONArray) dictionaryFieldKeys).stream().anyMatch(map -> fieldKey.equals(((JSONObject) map).getString("fieldKey")))){
((JSONArray) dictionaryFieldKeys).stream().filter(map -> fieldKey.equals(((JSONObject) map).getString("fieldKey"))).findFirst().ifPresent(y -> {
JSONObject yObj = (JSONObject) y;
String dictionaryType = yObj.getString("dictionaryType");
try {
List<DataDictionary> dataDictionaryList = iDataDictionaryService.getByType(dictionaryType);
dataDictionaryList.stream().filter(dataDictionary -> dataDictionary.getCode().equals(value)).findFirst().ifPresent(map -> {
jsonObject.put("value", map.getName());
});
} catch (Exception e) {
throw new RuntimeException(e);
}
});
} else { } else {
if ("upload".equals(xObj.getString("componentKey"))) { if ("upload".equals(xObj.getString("componentKey"))) {
JSONArray attachmentUploadDatas = matinfo.getJSONArray("datas"); JSONArray attachmentUploadDatas = matinfo.getJSONArray("datas");
......
...@@ -14,7 +14,17 @@ ...@@ -14,7 +14,17 @@
"useCode": "{useUnitCode}" "useCode": "{useUnitCode}"
} }
}, },
"resultConvert": "" "resultConvert": "",
"dictionaryFieldKeys": [
{
"fieldKey": "industrySupervisor",
"dictionaryType": "HYZGBM"
},
{
"fieldKey": "registeredOrganCode",
"dictionaryType": "DJJG"
}
]
} }
}, },
{ {
......
...@@ -17,7 +17,21 @@ ...@@ -17,7 +17,21 @@
"responseSuccess": "data.result.equipInfo" "responseSuccess": "data.result.equipInfo"
} }
}, },
"paramFieldKeys": ["EQU_LIST","EQU_CATEGORY","EQU_DEFINE"] "paramFieldKeys": ["EQU_LIST","EQU_CATEGORY","EQU_DEFINE"],
"dictionaryFieldKeys": [
{
"fieldKey": "IMPORTED",
"dictionaryType": "BOOLEN"
},
{
"fieldKey": "USE_PLACE",
"dictionaryType": "ADDRESS"
},
{
"fieldKey": "INSPECT_CONCLUSION",
"dictionaryType": "JYJL"
}
]
} }
}, },
{ {
...@@ -35,7 +49,21 @@ ...@@ -35,7 +49,21 @@
"ruleData": { "ruleData": {
"responseSuccess": "data.result.equipParams" "responseSuccess": "data.result.equipParams"
} }
} },
"dictionaryFieldKeys": [
{
"fieldKey": "DEVICE_LEVEL",
"dictionaryType": "GLJB"
},
{
"fieldKey": "FUEL_TYPE",
"dictionaryType": "GLZL"
},
{
"fieldKey": "NAME_OF_PRESSURE_PARTS",
"dictionaryType": "GLBJMC"
}
]
} }
}, },
{ {
......
...@@ -17,7 +17,21 @@ ...@@ -17,7 +17,21 @@
"responseSuccess": "data.result.equipInfo" "responseSuccess": "data.result.equipInfo"
} }
}, },
"paramFieldKeys": ["EQU_LIST","EQU_CATEGORY","EQU_DEFINE"] "paramFieldKeys": ["EQU_LIST","EQU_CATEGORY","EQU_DEFINE"],
"dictionaryFieldKeys": [
{
"fieldKey": "IMPORTED",
"dictionaryType": "BOOLEN"
},
{
"fieldKey": "USE_PLACE",
"dictionaryType": "ADDRESS"
},
{
"fieldKey": "INSPECT_CONCLUSION",
"dictionaryType": "JYJL"
}
]
} }
}, },
{ {
...@@ -35,7 +49,25 @@ ...@@ -35,7 +49,25 @@
"ruleData": { "ruleData": {
"responseSuccess": "data.result.equipParams" "responseSuccess": "data.result.equipParams"
} }
} },
"dictionaryFieldKeys": [
{
"fieldKey": "QP_LOSSLESS",
"dictionaryType": "RQJCFF"
},
{
"fieldKey": "RQJCFF",
"dictionaryType": "RQJCFF"
},
{
"fieldKey": "MAIN_STRUCTURE_TYPE",
"dictionaryType": "RQJG"
},
{
"fieldKey": "CHECK_LOSSLESS",
"dictionaryType": "RQJCFF"
}
]
} }
}, },
{ {
......
...@@ -17,7 +17,21 @@ ...@@ -17,7 +17,21 @@
"responseSuccess": "data.result.equipInfo" "responseSuccess": "data.result.equipInfo"
} }
}, },
"paramFieldKeys": ["EQU_LIST","EQU_CATEGORY","EQU_DEFINE"] "paramFieldKeys": ["EQU_LIST","EQU_CATEGORY","EQU_DEFINE"],
"dictionaryFieldKeys": [
{
"fieldKey": "IMPORTED",
"dictionaryType": "BOOLEN"
},
{
"fieldKey": "USE_PLACE",
"dictionaryType": "ADDRESS"
},
{
"fieldKey": "INSPECT_CONCLUSION",
"dictionaryType": "JYJL"
}
]
} }
}, },
{ {
...@@ -35,7 +49,21 @@ ...@@ -35,7 +49,21 @@
"ruleData": { "ruleData": {
"responseSuccess": "data.result.equipParams" "responseSuccess": "data.result.equipParams"
} }
} },
"dictionaryFieldKeys": [
{
"fieldKey": "CONTROL_MODE",
"dictionaryType": "KZFS"
},
{
"fieldKey": "EXPLOSIONPROOF_GRADE",
"dictionaryType": "FBDJ"
},
{
"fieldKey": "JACKING_TYPE",
"dictionaryType": "DSXS"
}
]
} }
}, },
{ {
......
...@@ -17,7 +17,21 @@ ...@@ -17,7 +17,21 @@
"responseSuccess": "data.result.equipInfo" "responseSuccess": "data.result.equipInfo"
} }
}, },
"paramFieldKeys": ["EQU_LIST","EQU_CATEGORY","EQU_DEFINE"] "paramFieldKeys": ["EQU_LIST","EQU_CATEGORY","EQU_DEFINE"],
"dictionaryFieldKeys": [
{
"fieldKey": "IMPORTED",
"dictionaryType": "BOOLEN"
},
{
"fieldKey": "USE_PLACE",
"dictionaryType": "ADDRESS"
},
{
"fieldKey": "INSPECT_CONCLUSION",
"dictionaryType": "JYJL"
}
]
} }
}, },
{ {
...@@ -35,7 +49,17 @@ ...@@ -35,7 +49,17 @@
"ruleData": { "ruleData": {
"responseSuccess": "data.result.equipParams" "responseSuccess": "data.result.equipParams"
} }
} },
"dictionaryFieldKeys": [
{
"fieldKey": "WORK_LEVEL",
"dictionaryType": "GZJB"
},
{
"fieldKey": "select_bq8h7v9tj1",
"dictionaryType": "FBDJ"
}
]
} }
}, },
{ {
......
...@@ -17,7 +17,21 @@ ...@@ -17,7 +17,21 @@
"responseSuccess": "data.result.equipInfo" "responseSuccess": "data.result.equipInfo"
} }
}, },
"paramFieldKeys": ["EQU_LIST","EQU_CATEGORY","EQU_DEFINE"] "paramFieldKeys": ["EQU_LIST","EQU_CATEGORY","EQU_DEFINE"],
"dictionaryFieldKeys": [
{
"fieldKey": "IMPORTED",
"dictionaryType": "BOOLEN"
},
{
"fieldKey": "USE_PLACE",
"dictionaryType": "ADDRESS"
},
{
"fieldKey": "INSPECT_CONCLUSION",
"dictionaryType": "JYJL"
}
]
} }
}, },
{ {
...@@ -35,7 +49,13 @@ ...@@ -35,7 +49,13 @@
"ruleData": { "ruleData": {
"responseSuccess": "data.result.equipParams" "responseSuccess": "data.result.equipParams"
} }
} },
"dictionaryFieldKeys": [
{
"fieldKey": "PROTECT_GRADE",
"dictionaryType": "FBDJ"
}
]
} }
}, },
{ {
......
...@@ -17,7 +17,21 @@ ...@@ -17,7 +17,21 @@
"responseSuccess": "data.result.equipInfo" "responseSuccess": "data.result.equipInfo"
} }
}, },
"paramFieldKeys": ["EQU_LIST","EQU_CATEGORY","EQU_DEFINE"] "paramFieldKeys": ["EQU_LIST","EQU_CATEGORY","EQU_DEFINE"],
"dictionaryFieldKeys": [
{
"fieldKey": "IMPORTED",
"dictionaryType": "BOOLEN"
},
{
"fieldKey": "USE_PLACE",
"dictionaryType": "ADDRESS"
},
{
"fieldKey": "INSPECT_CONCLUSION",
"dictionaryType": "JYJL"
}
]
} }
}, },
{ {
......
...@@ -17,7 +17,21 @@ ...@@ -17,7 +17,21 @@
"responseSuccess": "data.result.equipInfo" "responseSuccess": "data.result.equipInfo"
} }
}, },
"paramFieldKeys": ["EQU_LIST","EQU_CATEGORY","EQU_DEFINE"] "paramFieldKeys": ["EQU_LIST","EQU_CATEGORY","EQU_DEFINE"],
"dictionaryFieldKeys": [
{
"fieldKey": "IMPORTED",
"dictionaryType": "BOOLEN"
},
{
"fieldKey": "USE_PLACE",
"dictionaryType": "ADDRESS"
},
{
"fieldKey": "INSPECT_CONCLUSION",
"dictionaryType": "JYJL"
}
]
} }
}, },
{ {
...@@ -35,7 +49,13 @@ ...@@ -35,7 +49,13 @@
"ruleData": { "ruleData": {
"responseSuccess": "data.result.equipParams" "responseSuccess": "data.result.equipParams"
} }
} },
"dictionaryFieldKeys": [
{
"fieldKey": "GDLB",
"dictionaryType": "GDLB"
}
]
} }
}, },
{ {
......
...@@ -17,7 +17,21 @@ ...@@ -17,7 +17,21 @@
"responseSuccess": "data.result.equipInfo" "responseSuccess": "data.result.equipInfo"
} }
}, },
"paramFieldKeys": ["EQU_LIST","EQU_CATEGORY","EQU_DEFINE"] "paramFieldKeys": ["EQU_LIST","EQU_CATEGORY","EQU_DEFINE"],
"dictionaryFieldKeys": [
{
"fieldKey": "IMPORTED",
"dictionaryType": "BOOLEN"
},
{
"fieldKey": "USE_PLACE",
"dictionaryType": "ADDRESS"
},
{
"fieldKey": "INSPECT_CONCLUSION",
"dictionaryType": "JYJL"
}
]
} }
}, },
{ {
...@@ -35,7 +49,13 @@ ...@@ -35,7 +49,13 @@
"ruleData": { "ruleData": {
"responseSuccess": "data.result.equipParams" "responseSuccess": "data.result.equipParams"
} }
} },
"dictionaryFieldKeys": [
{
"fieldKey": "CARRIER_LINE",
"dictionaryType": "YZS"
}
]
} }
}, },
{ {
......
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