From 94dc0287250addd82eeffc87f0647ae5e0d89d6d Mon Sep 17 00:00:00 2001 From: guoyuqi Date: Fri, 20 Dec 2024 16:59:03 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E5=B7=A5=E4=BD=9C=E5=8F=B0):=20=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E6=9C=AA=E6=8C=89=E7=85=A7=E5=88=97=E8=A1=A8=E9=A1=BA?= =?UTF-8?q?=E5=BA=8F=E8=8E=B7=E5=8F=96=E9=BB=98=E8=AE=A4=E6=9D=83=E9=99=90?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1050600 --user=郭雨琦 https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001050600 --- .../metersphere/dashboard/service/DashboardService.java | 8 +++++--- .../project/service/PermissionCheckService.java | 3 +++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/backend/services/dashboard/src/main/java/io/metersphere/dashboard/service/DashboardService.java b/backend/services/dashboard/src/main/java/io/metersphere/dashboard/service/DashboardService.java index 2a8ba6e4f8..75a4b12008 100644 --- a/backend/services/dashboard/src/main/java/io/metersphere/dashboard/service/DashboardService.java +++ b/backend/services/dashboard/src/main/java/io/metersphere/dashboard/service/DashboardService.java @@ -497,9 +497,11 @@ public class DashboardService { setPlanId(layoutDTO); if (StringUtils.isBlank(layoutDTO.getPlanId())) { TestPlan latestPlanByProjectIds = extTestPlanMapper.getLatestPlanByProjectIds(hasReadProjectIds); - layoutDTO.setPlanId(latestPlanByProjectIds.getId()); - layoutDTO.setGroupId(latestPlanByProjectIds.getGroupId()); - layoutDTO.setProjectIds(List.of(latestPlanByProjectIds.getProjectId())); + if (latestPlanByProjectIds!=null) { + layoutDTO.setPlanId(latestPlanByProjectIds.getId()); + layoutDTO.setGroupId(latestPlanByProjectIds.getGroupId()); + layoutDTO.setProjectIds(List.of(latestPlanByProjectIds.getProjectId())); + } } } } else if (StringUtils.equalsIgnoreCase(layoutDTO.getKey(), DashboardUserLayoutKeys.BUG_COUNT.toString()) diff --git a/backend/services/project-management/src/main/java/io/metersphere/project/service/PermissionCheckService.java b/backend/services/project-management/src/main/java/io/metersphere/project/service/PermissionCheckService.java index c7a57d19e8..2b93dd1f67 100644 --- a/backend/services/project-management/src/main/java/io/metersphere/project/service/PermissionCheckService.java +++ b/backend/services/project-management/src/main/java/io/metersphere/project/service/PermissionCheckService.java @@ -116,6 +116,9 @@ public class PermissionCheckService { for (String projectId : projectIds) { List userRolePermissions = projectPermissionMap.get(projectId); + if (CollectionUtils.isEmpty(userRolePermissions)) { + continue; + } for (UserRolePermission userRolePermission : userRolePermissions) { if (permissions.contains(userRolePermission.getPermissionId())) { permissionProjectIdMap.computeIfAbsent(userRolePermission.getPermissionId(), key -> new LinkedHashSet<>()).add(projectId);