Commit 6aaa225f authored by 邢磊's avatar 邢磊 Committed by tianbo

*)调整详情接口改成单tab调用

parent 374a820f
...@@ -36,7 +36,7 @@ public class DPSubController { ...@@ -36,7 +36,7 @@ public class DPSubController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST", value = "动态详情页", notes = "动态详情页") @ApiOperation(httpMethod = "POST", value = "动态详情页", notes = "动态详情页")
@PostMapping(value = "/{template}") @PostMapping(value = "/{template}")
public ResponseModel<JSONObject> commonQuery(@PathVariable String template, @RequestBody Map<String, Object> param) { public ResponseModel<JSONObject> commonQuery(@PathVariable String template, @RequestParam(value = "tabKey", required = false) String tabKey, @RequestBody Map<String, Object> param) {
if (template.equals("company")) { // 企业 if (template.equals("company")) { // 企业
Assert.notNull(param.get("useUnitCode"), "企业统一信用代码不能为空"); Assert.notNull(param.get("useUnitCode"), "企业统一信用代码不能为空");
if (ValidationUtil.isEmpty(param.get("useUnit"))){ if (ValidationUtil.isEmpty(param.get("useUnit"))){
...@@ -97,7 +97,7 @@ public class DPSubController { ...@@ -97,7 +97,7 @@ public class DPSubController {
} else { } else {
throw new RuntimeException("暂无模板"); throw new RuntimeException("暂无模板");
} }
return ResponseHelper.buildResponse(subService.commonQuery(template, param)); return ResponseHelper.buildResponse(subService.commonQuery(template, tabKey, param));
} }
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
......
...@@ -65,7 +65,7 @@ public class DPSubServiceImpl { ...@@ -65,7 +65,7 @@ public class DPSubServiceImpl {
@Value("${supervisionCode.prefix:https://sxtzsb.sxsei.com:19435/tzs?code=}") @Value("${supervisionCode.prefix:https://sxtzsb.sxsei.com:19435/tzs?code=}")
private String supervisionCodePrefix; private String supervisionCodePrefix;
public JSONObject commonQuery(String template, @RequestBody Map<String, Object> param) { public JSONObject commonQuery(String template, String tabKey, @RequestBody Map<String, Object> param) {
JSONObject result; JSONObject result;
String templateJson = DpSubUtils.getFileContent(template + ".json"); String templateJson = DpSubUtils.getFileContent(template + ".json");
...@@ -79,10 +79,15 @@ public class DPSubServiceImpl { ...@@ -79,10 +79,15 @@ public class DPSubServiceImpl {
} }
//2、解析结构 //2、解析结构
result = JSON.parseObject(templateJson); result = JSON.parseObject(templateJson);
JSONArray tabs = result.getJSONArray("tabs"); List<JSONObject> tabList = result.getJSONArray("tabs").stream().map(obj -> (JSONObject) obj).collect(Collectors.toList());
if (!ValidationUtil.isEmpty(tabKey)){
tabList = tabList.stream().filter(obj -> tabKey.equals(obj.getString("key"))).collect(Collectors.toList());
} else if (!ValidationUtil.isEmpty(tabList)){
tabList = tabList.subList(0, 1);
}
JSONObject content = result.getJSONObject("content"); JSONObject content = result.getJSONObject("content");
tabs.stream().forEach(x -> { tabList.stream().forEach(tab -> {
JSONObject tab = (JSONObject) x;
long s = System.currentTimeMillis(); long s = System.currentTimeMillis();
tab.put("template", template); tab.put("template", template);
this.buildContent(content, tab, param); this.buildContent(content, tab, param);
......
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