fix:修复缺少行程规划权限的问题

This commit is contained in:
lulz1 2024-07-12 09:11:22 +08:00
parent 2c0924372a
commit 33c505ede5
1 changed files with 8 additions and 4 deletions

View File

@ -154,6 +154,7 @@ public class RouteApprovalDomainService {
// 将权限映射为枚举
Map<String, Set<RoutePermission>> 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<RoutePermission> routePermissionSet = approvalTypeToPermissionSet
.getOrDefault(approvalType, Collections.emptySet());
routeOrder.setRoutePermissionSet(routePermissionSet);
if (approvalType != null && !approvalType.isEmpty()) {
List<String> list = Arrays.stream(approvalType.split("&")).distinct().toList();
Set<RoutePermission> 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()))