fix(工作台): 修复未按照列表顺序获取默认权限项目问题

--bug=1050600 --user=郭雨琦 https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001050600
This commit is contained in:
guoyuqi 2024-12-20 16:59:03 +08:00 committed by Craftsman
parent 1fe3f4566c
commit 94dc028725
2 changed files with 8 additions and 3 deletions

View File

@ -497,9 +497,11 @@ public class DashboardService {
setPlanId(layoutDTO); setPlanId(layoutDTO);
if (StringUtils.isBlank(layoutDTO.getPlanId())) { if (StringUtils.isBlank(layoutDTO.getPlanId())) {
TestPlan latestPlanByProjectIds = extTestPlanMapper.getLatestPlanByProjectIds(hasReadProjectIds); TestPlan latestPlanByProjectIds = extTestPlanMapper.getLatestPlanByProjectIds(hasReadProjectIds);
layoutDTO.setPlanId(latestPlanByProjectIds.getId()); if (latestPlanByProjectIds!=null) {
layoutDTO.setGroupId(latestPlanByProjectIds.getGroupId()); layoutDTO.setPlanId(latestPlanByProjectIds.getId());
layoutDTO.setProjectIds(List.of(latestPlanByProjectIds.getProjectId())); layoutDTO.setGroupId(latestPlanByProjectIds.getGroupId());
layoutDTO.setProjectIds(List.of(latestPlanByProjectIds.getProjectId()));
}
} }
} }
} else if (StringUtils.equalsIgnoreCase(layoutDTO.getKey(), DashboardUserLayoutKeys.BUG_COUNT.toString()) } else if (StringUtils.equalsIgnoreCase(layoutDTO.getKey(), DashboardUserLayoutKeys.BUG_COUNT.toString())

View File

@ -116,6 +116,9 @@ public class PermissionCheckService {
for (String projectId : projectIds) { for (String projectId : projectIds) {
List<UserRolePermission> userRolePermissions = projectPermissionMap.get(projectId); List<UserRolePermission> userRolePermissions = projectPermissionMap.get(projectId);
if (CollectionUtils.isEmpty(userRolePermissions)) {
continue;
}
for (UserRolePermission userRolePermission : userRolePermissions) { for (UserRolePermission userRolePermission : userRolePermissions) {
if (permissions.contains(userRolePermission.getPermissionId())) { if (permissions.contains(userRolePermission.getPermissionId())) {
permissionProjectIdMap.computeIfAbsent(userRolePermission.getPermissionId(), key -> new LinkedHashSet<>()).add(projectId); permissionProjectIdMap.computeIfAbsent(userRolePermission.getPermissionId(), key -> new LinkedHashSet<>()).add(projectId);