From d1f635f6b796ec9e51feaf8beec1929be78c40a9 Mon Sep 17 00:00:00 2001 From: guoyuqi Date: Tue, 26 Nov 2024 10:25:12 +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=E8=AE=A1=E5=88=92=E9=81=97=E7=95=99=E7=BC=BA=E9=99=B7?= =?UTF-8?q?=E5=8D=A1=E7=89=87=E6=98=BE=E7=A4=BA=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dashboard/service/DashboardService.java | 22 +++++++++++++------ 1 file changed, 15 insertions(+), 7 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 e79000abaf..9053d1f9ca 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 @@ -1320,7 +1320,7 @@ public class DashboardService { 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); + List nameCountDTOS = buildBugRetentionRateList(totalSize, statusSize, false); Map> statusStatisticsMap = new HashMap<>(); statusStatisticsMap.put("retentionRate", nameCountDTOS); List headerStatusOption = getHeaderStatusOption(projectId, platformName, new ArrayList<>()); @@ -1350,7 +1350,7 @@ public class DashboardService { } - private static List buildBugRetentionRateList(int totalSize, int statusSize) { + private static List buildBugRetentionRateList(int totalSize, int statusSize, boolean isPlan) { List retentionRates = new ArrayList<>(); NameCountDTO retentionRate = new NameCountDTO(); retentionRate.setName(Translator.get("bug_management.retentionRate")); @@ -1361,10 +1361,18 @@ public class DashboardService { retentionRate.setCount(getTurnCount(divide)); } retentionRates.add(retentionRate); - NameCountDTO retentionDTO = getNameCountDTO(statusSize, Translator.get("bug_management.retentionCount")); - retentionRates.add(retentionDTO); - NameCountDTO total = getNameCountDTO(totalSize, Translator.get("bug_management.totalCount")); - retentionRates.add(total); + if (isPlan) { + NameCountDTO retentionDTO = getNameCountDTO(statusSize, Translator.get("bug_management.retentionCount")); + retentionRates.add(retentionDTO); + NameCountDTO total = getNameCountDTO(totalSize, Translator.get("bug_management.totalCount")); + retentionRates.add(total); + } else { + NameCountDTO total = getNameCountDTO(totalSize, Translator.get("bug_management.totalCount")); + retentionRates.add(total); + NameCountDTO retentionDTO = getNameCountDTO(statusSize, Translator.get("bug_management.retentionCount")); + retentionRates.add(retentionDTO); + } + return retentionRates; } @@ -1415,7 +1423,7 @@ public class DashboardService { List headerStatusOption = getHeaderStatusOption(projectId, platformName, localLastStepStatus); int statusSize = CollectionUtils.isEmpty(legacyBugList) ? 0 : legacyBugList.size(); int totalSize = CollectionUtils.isEmpty(planBugList) ? 0 : planBugList.size(); - List nameCountDTOS = buildBugRetentionRateList(totalSize, statusSize); + List nameCountDTOS = buildBugRetentionRateList(totalSize, statusSize, true); Map> statusStatisticsMap = new HashMap<>(); statusStatisticsMap.put("retentionRate", nameCountDTOS); Map> bugMap = legacyBugList.stream().collect(Collectors.groupingBy(SelectOption::getText));