From c30ba149f939b56b0328e0d3e015fd4dc9c340fc Mon Sep 17 00:00:00 2001 From: anthonywj Date: Fri, 1 Mar 2024 11:44:09 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=87=E6=8D=A2=E5=88=86=E6=94=AF=E5=A4=87?= =?UTF-8?q?=E4=BB=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../auth/SysCustomConfigController.java | 43 +++++++++---------- 1 file changed, 21 insertions(+), 22 deletions(-) diff --git a/src/main/java/com/glxp/api/controller/auth/SysCustomConfigController.java b/src/main/java/com/glxp/api/controller/auth/SysCustomConfigController.java index 8552aa72f..d89e84d48 100644 --- a/src/main/java/com/glxp/api/controller/auth/SysCustomConfigController.java +++ b/src/main/java/com/glxp/api/controller/auth/SysCustomConfigController.java @@ -38,7 +38,6 @@ import java.util.stream.Collectors; /** * 用户信息 - * */ @Validated @RequiredArgsConstructor @@ -128,7 +127,7 @@ public class SysCustomConfigController extends BaseController { @AuthRuleAnnotation("") @PostMapping("/getConfigs") @Log(title = "界面配置管理") - public BaseResponse getConfigs(@RequestBody SysCustomConfigRequest request,BindingResult bindingResult) { + public BaseResponse getConfigs(@RequestBody SysCustomConfigRequest request, BindingResult bindingResult) { if (bindingResult.hasErrors()) { return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage()); @@ -143,40 +142,40 @@ public class SysCustomConfigController extends BaseController { detailRequest.setIsShow("1"); // detailRequest.setType(request.getType()); List detailList = sysCustomConfigDetailService.filterSysCustomConfigDetail(detailRequest); - Map> map = detailList.stream().collect( + Map> map = detailList.stream().collect( Collectors.groupingBy(SysCustomConfigDetailEntity::getType)); - List tableList = map.get("1") == null? Lists.newArrayList():map.get("1"); - List queryList = map.get("2") == null? Lists.newArrayList():map.get("2"); - List fromList = map.get("3") == null? Lists.newArrayList():map.get("3"); + List tableList = map.get("1") == null ? Lists.newArrayList() : map.get("1"); + List queryList = map.get("2") == null ? Lists.newArrayList() : map.get("2"); + List fromList = map.get("3") == null ? Lists.newArrayList() : map.get("3"); List fromSortList = fromList.stream().sorted(Comparator.comparing(SysCustomConfigDetailEntity::getLineNumber)).collect(Collectors.toList()); - Map> fromMap = fromSortList.stream().collect( - Collectors.groupingBy(SysCustomConfigDetailEntity::getLineNumber,LinkedHashMap::new,Collectors.toList())); + Map> fromMap = fromSortList.stream().collect( + Collectors.groupingBy(SysCustomConfigDetailEntity::getLineNumber, LinkedHashMap::new, Collectors.toList())); List fromDetailList = Lists.newArrayList(); for (Map.Entry> entry : fromMap.entrySet()) { SysCustomConfigFromDetailResponse sysCustomConfigFromDetailResponse = new SysCustomConfigFromDetailResponse(); sysCustomConfigFromDetailResponse.setNumber(entry.getKey()); List entities = entry.getValue(); - entities.stream().forEach(s->{ - if(StringUtils.isNotEmpty(s.getCheckRules())){ + entities.stream().forEach(s -> { + if (StringUtils.isNotEmpty(s.getCheckRules())) { String replacedJsonString = s.getCheckRules().replaceAll("(\\w+)(\\s*:\\s*)", "\"$1\"$2"); JSONArray object = JSONArray.parseArray(replacedJsonString); s.setCheckRulesObj(object); } - if(StringUtils.isNotEmpty(s.getLableRule())){ + if (StringUtils.isNotEmpty(s.getLableRule())) { JSONObject objectLaber = JSONObject.parseObject(s.getLableRule()); List mapList = Lists.newArrayList(); Iterator it = objectLaber.keySet().iterator(); String inputType = s.getInputType(); - while(it.hasNext()) { - Map mapTemp = Maps.newHashMap(); + while (it.hasNext()) { + Map mapTemp = Maps.newHashMap(); String key = (String) it.next(); String value = objectLaber.getString(key); mapTemp.put("label", value); - if("number".equals(inputType)){ + if ("number".equals(inputType)) { mapTemp.put("value", Integer.parseInt(key)); - }else{ + } else { mapTemp.put("value", key); } mapList.add(mapTemp); @@ -188,23 +187,23 @@ public class SysCustomConfigController extends BaseController { fromDetailList.add(sysCustomConfigFromDetailResponse); } - tableList.stream().forEach(s->{ - if(StringUtils.isNotEmpty(s.getLableRule())) { + tableList.stream().forEach(s -> { + if (StringUtils.isNotEmpty(s.getLableRule())) { JSONObject objectLaber = JSONObject.parseObject(s.getLableRule()); s.setLableRuleObj(objectLaber); } - if(StringUtils.isNotEmpty(s.getButtonRule())){ + if (StringUtils.isNotEmpty(s.getButtonRule())) { JSONArray objectButton = JSONArray.parseArray(s.getButtonRule()); s.setButtonRulObj(objectButton); } }); - queryList.stream().forEach(s->{ - if(StringUtils.isNotEmpty(s.getLableRule())){ + queryList.stream().forEach(s -> { + if (StringUtils.isNotEmpty(s.getLableRule())) { JSONObject objectLaber = JSONObject.parseObject(s.getLableRule()); List mapList = Lists.newArrayList(); Iterator it = objectLaber.keySet().iterator(); - while(it.hasNext()) { - Map mapTemp = Maps.newHashMap(); + while (it.hasNext()) { + Map mapTemp = Maps.newHashMap(); String key = (String) it.next(); String value = objectLaber.getString(key); mapTemp.put("label", value);