diff --git a/backend/framework/sdk/src/main/resources/i18n/api.properties b/backend/framework/sdk/src/main/resources/i18n/api.properties index 98e7ceb131..e38276f201 100644 --- a/backend/framework/sdk/src/main/resources/i18n/api.properties +++ b/backend/framework/sdk/src/main/resources/i18n/api.properties @@ -443,7 +443,7 @@ report.status.fake_error=误报 api_definition.status.ongoing=进行中 api_definition.status.completed=已完成 api_definition.status.abandoned=已废弃 -api_definition.status.continuous=连调中 +api_definition.status.continuous=联调中 api_test_case.clear.api_change=忽略本次变更差异 api_test_case.ignore.api_change=忽略全部变更差异 diff --git a/backend/framework/sdk/src/main/resources/i18n/api_zh_CN.properties b/backend/framework/sdk/src/main/resources/i18n/api_zh_CN.properties index 149442e4a1..887c6e2a22 100644 --- a/backend/framework/sdk/src/main/resources/i18n/api_zh_CN.properties +++ b/backend/framework/sdk/src/main/resources/i18n/api_zh_CN.properties @@ -417,7 +417,7 @@ report.status.fake_error=误报 api_definition.status.ongoing=进行中 api_definition.status.completed=已完成 api_definition.status.abandoned=已废弃 -api_definition.status.continuous=连调中 +api_definition.status.continuous=联调中 api_test_case.clear.api_change=忽略本次变更差异 api_test_case.ignore.api_change=忽略全部变更差异 diff --git a/backend/services/bug-management/src/main/java/io/metersphere/bug/mapper/ExtBugMapper.java b/backend/services/bug-management/src/main/java/io/metersphere/bug/mapper/ExtBugMapper.java index e545a1a725..f921cbebf4 100644 --- a/backend/services/bug-management/src/main/java/io/metersphere/bug/mapper/ExtBugMapper.java +++ b/backend/services/bug-management/src/main/java/io/metersphere/bug/mapper/ExtBugMapper.java @@ -136,5 +136,5 @@ public interface ExtBugMapper { */ List projectUserBugStatusCount(@Param("projectId") String projectId, @Param("startTime") Long startTime, @Param("endTime") Long endTime, @Param("userIds") List userIds, @Param("platforms") Set platforms); - ListgetSimpleList(@Param("projectId") String projectId, @Param("startTime") Long startTime, @Param("endTime") Long endTime,@Param("handleUser") String handleUser,@Param("createUser") String createUser, @Param("platforms") Set platforms, @Param("currentUser") String currentUser); + ListgetSimpleList(@Param("projectId") String projectId, @Param("startTime") Long startTime, @Param("endTime") Long endTime,@Param("handleUsers") Set handleUsers,@Param("createUser") String createUser, @Param("platforms") Set platforms); } diff --git a/backend/services/bug-management/src/main/java/io/metersphere/bug/mapper/ExtBugMapper.xml b/backend/services/bug-management/src/main/java/io/metersphere/bug/mapper/ExtBugMapper.xml index 595745ed5d..aa9f41b9c9 100644 --- a/backend/services/bug-management/src/main/java/io/metersphere/bug/mapper/ExtBugMapper.xml +++ b/backend/services/bug-management/src/main/java/io/metersphere/bug/mapper/ExtBugMapper.xml @@ -457,16 +457,11 @@ AND bug.create_time BETWEEN #{startTime} AND #{endTime} - - AND ( - FALSE - - OR bug.handle_user = #{handleUser} - - - OR bug.handle_user = #{currentUser} - - ) + + AND bug.handle_user IN + + #{handleUser} + AND bug.create_user = #{createUser} 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 a56911e186..9c652e1c09 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 @@ -776,8 +776,14 @@ public class DashboardService { Long toEndTime = request.getToEndTime(); List headerHandlerOption = getHandlerOption(request.getHandleUsers(), projectId); //获取每个人每个状态有多少数据(已按照用户id排序) - List headerStatusOption = bugStatusService.getHeaderStatusOption(projectId); - Set platforms = getPlatforms(projectId); + String platformName = projectApplicationService.getPlatformName(projectId); + List headerStatusOption = bugStatusService.getAllLocalStatusOptions(projectId); + if (!StringUtils.equals(platformName, BugPlatform.LOCAL.getName())) { + List thirdStatusOptions = bugStatusService.getHeaderStatusOption(projectId); + headerStatusOption.addAll(thirdStatusOptions); + } + headerStatusOption = headerStatusOption.stream().distinct().toList(); + Set platforms = getPlatforms(platformName); List handleUserIds = headerHandlerOption.stream().sorted(Comparator.comparing(SelectOption::getValue)).map(SelectOption::getValue).collect(Collectors.toList()); List projectUserStatusCountDTOS = extBugMapper.projectUserBugStatusCount(projectId, toStartTime, toEndTime, handleUserIds, platforms); Map statusMap = headerStatusOption.stream().collect(Collectors.toMap(SelectOption::getValue, t -> t)); @@ -882,24 +888,32 @@ public class DashboardService { * @return 处理人id 与 名称的集合 */ private List getHandlerOption(List handleUsers, String projectId) { - List headerHandlerOption; + String platformName = projectApplicationService.getPlatformName(projectId); + List headerHandlerOption = bugCommonService.getLocalHandlerOption(projectId); + List thirdHandlerOption; if (CollectionUtils.isEmpty(handleUsers)) { - headerHandlerOption = bugCommonService.getHeaderHandlerOption(projectId); + if (!StringUtils.equals(platformName, BugPlatform.LOCAL.getName())) { + thirdHandlerOption = bugCommonService.getHeaderHandlerOption(projectId); + if (CollectionUtils.isNotEmpty(thirdHandlerOption)) { + headerHandlerOption.addAll(thirdHandlerOption); + } + } } else { - List headerHandlerOptionList = bugCommonService.getHeaderHandlerOption(projectId); - headerHandlerOption = headerHandlerOptionList.stream().filter(t -> handleUsers.contains(t.getValue())).toList(); + if (!StringUtils.equals(platformName, BugPlatform.LOCAL.getName())) { + List headerHandlerOptionList = bugCommonService.getHeaderHandlerOption(projectId); + headerHandlerOption.addAll(headerHandlerOptionList); + } + headerHandlerOption = headerHandlerOption.stream().filter(t -> handleUsers.contains(t.getValue())).toList(); } - return headerHandlerOption; + return headerHandlerOption.stream().distinct().toList(); } /** * 根据项目id获取当前对接平台,与本地进行组装 * - * @param projectId 项目ID * @return 本地与对接平台集合 */ - private Set getPlatforms(String projectId) { - String platformName = projectApplicationService.getPlatformName(projectId); + private Set getPlatforms(String platformName) { Set platforms = new HashSet<>(); platforms.add(BugPlatform.LOCAL.getName()); if (!StringUtils.equalsIgnoreCase(platformName, BugPlatform.LOCAL.getName())) { @@ -1152,7 +1166,7 @@ public class DashboardService { if (CollectionUtils.isNotEmpty(simpleAllApiCaseList)) { simpleAllApiCaseSize = simpleAllApiCaseList.size(); } - List unExecList = simpleAllApiCaseList.stream().filter(t -> StringUtils.equalsIgnoreCase(t.getLastReportStatus(), ExecStatus.PENDING.toString())).toList(); + List unExecList = simpleAllApiCaseList.stream().filter(t -> StringUtils.equalsIgnoreCase(t.getLastReportStatus(), StringUtils.EMPTY)).toList(); int unExecSize = CollectionUtils.isNotEmpty(unExecList) ? unExecList.size() : 0; List successList = simpleAllApiCaseList.stream().filter(t -> StringUtils.equalsIgnoreCase(t.getLastReportStatus(), ResultStatus.SUCCESS.name())).toList(); @@ -1282,19 +1296,30 @@ public class DashboardService { statisticsDTO.setErrorCode(NO_PROJECT_PERMISSION.getCode()); return statisticsDTO; } + SethandleUsers = new HashSet<>(); String localHandleUser = hasHandleUser ? userId : null; + handleUsers.add(localHandleUser); String handleUser = hasHandleUser ? handleUserId : null; + handleUsers.add(handleUser); String createUser = hasCreateUser ? userId : null; - Set platforms = getPlatforms(projectId); - List allSimpleList = extBugMapper.getSimpleList(projectId, null, null, handleUser, createUser, platforms, localHandleUser); - List localLastStepStatus = getBugEndStatus(projectId); + String platformName = projectApplicationService.getPlatformName(projectId); + Set platforms = getPlatforms(platformName); + List allSimpleList = extBugMapper.getSimpleList(projectId, null, null, handleUsers, createUser, platforms); + List localLastStepStatus = getBugEndStatus(projectId, platformName); List statusList = allSimpleList.stream().filter(t -> !localLastStepStatus.contains(t.getStatus())).toList(); int statusSize = CollectionUtils.isEmpty(statusList) ? 0 : statusList.size(); int totalSize = CollectionUtils.isEmpty(allSimpleList) ? 0 : allSimpleList.size(); List nameCountDTOS = buildBugRetentionRateList(totalSize, statusSize); Map> statusStatisticsMap = new HashMap<>(); statusStatisticsMap.put("retentionRate", nameCountDTOS); - List headerStatusOption = bugStatusService.getHeaderStatusOption(projectId); + List headerStatusOption = bugStatusService.getAllLocalStatusOptions(projectId); + if (!StringUtils.equals(platformName, BugPlatform.LOCAL.getName())) { + List thirdStatusOptions = bugStatusService.getHeaderStatusOption(projectId); + if (CollectionUtils.isNotEmpty(thirdStatusOptions)) { + headerStatusOption.addAll(thirdStatusOptions); + } + } + headerStatusOption = headerStatusOption.stream().distinct().toList(); Map> bugMap = allSimpleList.stream().collect(Collectors.groupingBy(Bug::getStatus)); List bugPercentList = bulidBugPercentList(headerStatusOption, bugMap, totalSize); statisticsDTO.setStatusStatisticsMap(statusStatisticsMap); @@ -1303,9 +1328,8 @@ public class DashboardService { } @NotNull - private List getBugEndStatus(String projectId) { + private List getBugEndStatus(String projectId, String platformName) { List localLastStepStatus = bugCommonService.getLocalLastStepStatus(projectId); - String platformName = projectApplicationService.getPlatformName(projectId); if (StringUtils.equalsIgnoreCase(platformName, BugPlatform.LOCAL.getName())) { return localLastStepStatus; } @@ -1379,11 +1403,19 @@ public class DashboardService { statisticsDTO.setErrorCode(NO_PROJECT_PERMISSION.getCode()); return statisticsDTO; } - Set platforms = getPlatforms(projectId); + String platformName = projectApplicationService.getPlatformName(projectId); + Set platforms = getPlatforms(platformName); List planBugList = extTestPlanMapper.getPlanBugList(projectId, TestPlanConstants.TEST_PLAN_TYPE_PLAN, new ArrayList<>(platforms), null); - List localLastStepStatus = getBugEndStatus(projectId); + List localLastStepStatus = getBugEndStatus(projectId, platformName); List legacyBugList = planBugList.stream().filter(t -> !localLastStepStatus.contains(t.getText())).toList(); - List headerStatusOption = bugStatusService.getHeaderStatusOption(projectId); + List headerStatusOption = bugStatusService.getAllLocalStatusOptions(projectId); + if (!StringUtils.equals(platformName, BugPlatform.LOCAL.getName())) { + List thirdStatusOptions = bugStatusService.getHeaderStatusOption(projectId); + if (CollectionUtils.isNotEmpty(thirdStatusOptions)) { + headerStatusOption.addAll(thirdStatusOptions); + } + } + headerStatusOption = headerStatusOption.stream().distinct().toList(); int statusSize = CollectionUtils.isEmpty(legacyBugList) ? 0 : legacyBugList.size(); int totalSize = CollectionUtils.isEmpty(planBugList) ? 0 : planBugList.size(); List nameCountDTOS = buildBugRetentionRateList(totalSize, statusSize); diff --git a/backend/services/test-plan/src/main/java/io/metersphere/plan/mapper/ExtTestPlanMapper.xml b/backend/services/test-plan/src/main/java/io/metersphere/plan/mapper/ExtTestPlanMapper.xml index 0b4d6be536..00dea5d1b4 100644 --- a/backend/services/test-plan/src/main/java/io/metersphere/plan/mapper/ExtTestPlanMapper.xml +++ b/backend/services/test-plan/src/main/java/io/metersphere/plan/mapper/ExtTestPlanMapper.xml @@ -913,6 +913,7 @@ left join bug_relation_case on test_plan.id = bug_relation_case.test_plan_id left join bug on bug_relation_case.bug_id = bug.id where test_plan.status = 'NOT_ARCHIVED' + and bug.deleted = false and test_plan.type= #{type}