From 33c505ede5445adbe62b7b253a8a4a6da9c9f08c Mon Sep 17 00:00:00 2001 From: lulz1 Date: Fri, 12 Jul 2024 09:11:22 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E4=BF=AE=E5=A4=8D=E7=BC=BA=E5=B0=91?= =?UTF-8?q?=E8=A1=8C=E7=A8=8B=E8=A7=84=E5=88=92=E6=9D=83=E9=99=90=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/service/RouteApprovalDomainService.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/chint/domain/service/RouteApprovalDomainService.java b/src/main/java/com/chint/domain/service/RouteApprovalDomainService.java index 855a372b..5f0982ea 100644 --- a/src/main/java/com/chint/domain/service/RouteApprovalDomainService.java +++ b/src/main/java/com/chint/domain/service/RouteApprovalDomainService.java @@ -154,6 +154,7 @@ public class RouteApprovalDomainService { // 将权限映射为枚举 Map> approvalTypeToPermissionSet = approvalTypeToPermissions.entrySet().stream() .collect(Collectors.toMap(Map.Entry::getKey, entry -> entry.getValue().stream() + .flatMap(it-> Arrays.stream(it.split("&"))) .distinct() .map(permission -> Enum.valueOf(RoutePermission.class, permission)) .collect(Collectors.toSet()))); @@ -163,12 +164,15 @@ public class RouteApprovalDomainService { ApproveOrderNo approveOrderNo = routeOrder.getApproveOrderNo(); String approvalType = accountCompanyToApprovalType.getOrDefault(approveOrderNo.getAccountCompany(), sysCodeToApprovalType.get(approveOrderNo.getSysCode())); - Set routePermissionSet = approvalTypeToPermissionSet - .getOrDefault(approvalType, Collections.emptySet()); - routeOrder.setRoutePermissionSet(routePermissionSet); - if (approvalType != null && !approvalType.isEmpty()) { List list = Arrays.stream(approvalType.split("&")).distinct().toList(); + Set routePermissions = list + .stream() + .flatMap(it -> Optional.ofNullable(approvalTypeToPermissionSet.get(it)) + .orElse(Collections.emptySet()) + .stream()) + .collect(Collectors.toSet()); + routeOrder.setRoutePermissionSet(routePermissions); routeOrder.setPermissionConfigSet(byPermissionNameIn .stream() .filter(it -> list.contains(it.getPermissionName()))