浏览代码

feature(工作流权限申请单推送内容修改): 工作流权限申请单推送内容修改

工作流权限申请单推送内容修改
mazq 3 年之前
父节点
当前提交
aaf4d2949b

+ 22 - 24
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/business/impl/AuthApplyBusiness.java

@@ -547,37 +547,35 @@ public class AuthApplyBusiness implements IAuthApplyBusiness
         ResourceInfoDTO resourceInfoDTO = new ResourceInfoDTO();
         resourceInfoDTO.setVisitorName(applicantName);
         resourceInfoDTO.setVisitorCode(applicantIdcard);
-        //funCodes拼接appCode
-        List<String> nameList = new ArrayList<>();
-        List<String> codeList = new ArrayList<>();
+        //拼接funCodes和appCode成json数组
         Map<String, List<AppFunApplyContent>> collect = contentList
                 .stream()
                 .collect(Collectors.groupingBy(AppFunApplyContent::getAppId));
+        JSONArray codeArray = new JSONArray();
+        JSONArray nameArray = new JSONArray();
         for (Map.Entry<String, List<AppFunApplyContent>> entry : collect.entrySet()) {
-            String appCode = entry.getKey();
-            List<AppFunApplyContent> list = entry.getValue();
-            String funCodes = list
+            List<AppFunApplyContent> value = entry.getValue();
+            AppFunApplyContent applyContent = value.get(0);
+            JSONObject codeJson = new JSONObject();
+            codeJson.put("appCode", applyContent.getAppCode());
+            List<String> functionCodesList = value
                     .stream()
                     .map(AppFunApplyContent::getFunCode)
-                    .collect(Collectors.joining(StrUtil.SLASH));
-            String codeJoin = Joiner
-                    .on(StrUtil.COLON)
-                    .join(appCode, funCodes);
-            codeList.add(codeJoin);
-
-            String funNames = list
-                    .stream()
+                    .distinct().collect(Collectors.toList());
+            codeJson.put("functionCode", functionCodesList);
+            codeArray.add(codeJson);
+
+            String appName = applyContent.getAppName();
+            JSONObject nameJson = new JSONObject();
+            nameJson.put("appName", appName);
+            List<String> functionNameList = value.stream()
                     .map(AppFunApplyContent::getFunName)
-                    .collect(Collectors.joining(StrUtil.SLASH));
-            AppFunApplyContent appFunApplyContent = list.get(0);
-            String appName = appFunApplyContent.getAppName();
-            String nameJoin = Joiner
-                    .on(StrUtil.COLON)
-                    .join(appName, funNames);
-            nameList.add(nameJoin);
-        }
-        resourceInfoDTO.setVisitResourceCode(String.join(StrUtil.COMMA, codeList));
-        resourceInfoDTO.setVisitResourceName(String.join(StrUtil.COMMA, nameList));
+                    .collect(Collectors.toList());
+            nameJson.put("functionName", functionNameList);
+            nameArray.add(nameJson);
+        }
+        resourceInfoDTO.setVisitResourceCode(codeArray.toJSONString());
+        resourceInfoDTO.setVisitResourceName(nameArray.toJSONString());
         approvalWorkFlowDTO.setResourceInfo(resourceInfoDTO);
     }