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,11 +497,13 @@ 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);
if (latestPlanByProjectIds!=null) {
layoutDTO.setPlanId(latestPlanByProjectIds.getId()); layoutDTO.setPlanId(latestPlanByProjectIds.getId());
layoutDTO.setGroupId(latestPlanByProjectIds.getGroupId()); layoutDTO.setGroupId(latestPlanByProjectIds.getGroupId());
layoutDTO.setProjectIds(List.of(latestPlanByProjectIds.getProjectId())); 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())
|| StringUtils.equalsIgnoreCase(layoutDTO.getKey(), DashboardUserLayoutKeys.CREATE_BUG_BY_ME.toString()) || StringUtils.equalsIgnoreCase(layoutDTO.getKey(), DashboardUserLayoutKeys.CREATE_BUG_BY_ME.toString())
|| StringUtils.equalsIgnoreCase(layoutDTO.getKey(), DashboardUserLayoutKeys.HANDLE_BUG_BY_ME.toString()) || StringUtils.equalsIgnoreCase(layoutDTO.getKey(), DashboardUserLayoutKeys.HANDLE_BUG_BY_ME.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);