Commit 8cdc799d authored by 麻笑宇's avatar 麻笑宇

1.大屏业务模块详情api返回处理

parent a64779ac
package com.yeejoin.amos.boot.module.statistcs.biz.service.impl;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
......@@ -22,6 +23,7 @@ import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.client.RestTemplate;
import org.typroject.tyboot.core.foundation.context.RequestContext;
......@@ -130,6 +132,7 @@ public class DPSubServiceImpl {
String renderType = tab.getString("renderType");
Object resultConvert = JsonValueUtils.getValueByKey(tab, "dataConfig", "dataConfig.resultConvert");
Object api = JsonValueUtils.getValueByKey(tab, "dataConfig", "dataConfig.api");
JSONArray subResultParams = tab.getJSONArray("subResultParams");
tab.put("param", param);
JSONObject map = content.getJSONObject(tab.getString("key"));
......@@ -143,6 +146,16 @@ public class DPSubServiceImpl {
ResponseModel responseModel = this.getApiResult((JSONObject) api, !ValidationUtil.isEmpty(resultConvert) ? resultConvert.toString() : null);
if (!ValidationUtil.isEmpty(responseModel.getResult())) {
apiResult = responseModel.getResult();
if(!CollectionUtils.isEmpty(subResultParams)){
for(Object subParam : subResultParams) {
if(StrUtil.isNotBlank(((JSONObject) apiResult).getString(subParam + ""))) {
String[] s1 = ((JSONObject) apiResult).getString(subParam + "").split("_");
if(s1.length > 1) {
((JSONObject) apiResult).put(subParam + "", s1[1]);
}
}
}
}
}else{
apiResult = new JSONObject();
}
......
......@@ -17,7 +17,9 @@
"responseSuccess": "data.result.installationInfo"
}
}
}
},
"subResultParams": ["province","city","county","orgBranchCode","factoryUseSiteStreet","installLeaderName",
"useUnitCreditCode","propertyUnitName"]
}
],
"content": {
......
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