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 98c947ec4d..841e4326a1 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 @@ -56,6 +56,7 @@ import io.metersphere.sdk.util.Translator; import io.metersphere.system.domain.UserLayout; import io.metersphere.system.domain.UserLayoutExample; import io.metersphere.system.dto.ProtocolDTO; +import io.metersphere.system.dto.sdk.OptionDTO; import io.metersphere.system.dto.user.ProjectUserMemberDTO; import io.metersphere.system.mapper.ExtExecTaskItemMapper; import io.metersphere.system.mapper.UserLayoutMapper; @@ -956,14 +957,14 @@ public class DashboardService { @NotNull private List getStatusPercentList(List statisticListByProjectId) { List statusPercentList = new ArrayList<>(); - Map statusNameMap = buildStatusNameMap(); + ListstatusNameList = buildStatusNameMap(); int totalCount = CollectionUtils.isEmpty(statisticListByProjectId) ? 0 : statisticListByProjectId.size(); Map> reviewStatusMap = statisticListByProjectId.stream().collect(Collectors.groupingBy(FunctionalCaseStatisticDTO::getReviewStatus)); - statusNameMap.forEach((k, v) -> { + statusNameList.forEach(t->{ StatusPercentDTO statusPercentDTO = new StatusPercentDTO(); - List functionalCaseStatisticDTOS = reviewStatusMap.get(k); + List functionalCaseStatisticDTOS = reviewStatusMap.get(t.getId()); int count = CollectionUtils.isEmpty(functionalCaseStatisticDTOS) ? 0 : functionalCaseStatisticDTOS.size(); - statusPercentDTO.setStatus(v); + statusPercentDTO.setStatus(t.getName()); statusPercentDTO.setCount(count); if (totalCount > 0) { BigDecimal divide = BigDecimal.valueOf(count).divide(BigDecimal.valueOf(totalCount), 2, RoundingMode.HALF_UP); @@ -997,14 +998,14 @@ public class DashboardService { return coverList; } - private static Map buildStatusNameMap() { - Map statusNameMap = new HashMap<>(); - statusNameMap.put(FunctionalCaseReviewStatus.UN_REVIEWED.toString(), Translator.get("case.review.status.un_reviewed")); - statusNameMap.put(FunctionalCaseReviewStatus.UNDER_REVIEWED.toString(), Translator.get("case.review.status.under_reviewed")); - statusNameMap.put(FunctionalCaseReviewStatus.PASS.toString(), Translator.get("case.review.status.pass")); - statusNameMap.put(FunctionalCaseReviewStatus.UN_PASS.toString(), Translator.get("case.review.status.un_pass")); - statusNameMap.put(FunctionalCaseReviewStatus.RE_REVIEWED.toString(), Translator.get("case.review.status.re_reviewed")); - return statusNameMap; + private static List buildStatusNameMap() { + ListoptionDTOList = new ArrayList<>(); + optionDTOList.add(new OptionDTO(FunctionalCaseReviewStatus.UN_REVIEWED.toString(), Translator.get("case.review.status.un_reviewed"))); + optionDTOList.add(new OptionDTO(FunctionalCaseReviewStatus.UNDER_REVIEWED.toString(), Translator.get("case.review.status.under_reviewed"))); + optionDTOList.add(new OptionDTO(FunctionalCaseReviewStatus.PASS.toString(), Translator.get("case.review.status.pass"))); + optionDTOList.add(new OptionDTO(FunctionalCaseReviewStatus.UN_PASS.toString(), Translator.get("case.review.status.un_pass"))); + optionDTOList.add(new OptionDTO(FunctionalCaseReviewStatus.RE_REVIEWED.toString(), Translator.get("case.review.status.re_reviewed"))); + return optionDTOList; } public Pager> getFunctionalCasePage(DashboardFrontPageRequest request) {