From 0f3348c015b92c40028e8ffd8bedc518b88a05aa Mon Sep 17 00:00:00 2001 From: Jianguo-Genius Date: Thu, 19 Dec 2024 10:34:33 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E6=B5=8B=E8=AF=95=E8=AE=A1=E5=88=92):=20?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=E8=AE=A1=E5=88=92=E8=B7=B3=E8=BD=AC=E6=97=B6?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=BD=92=E6=A1=A3=E7=9A=84=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/response/TestPlanCoverageDTO.java | 23 +++++++++++++++---- .../service/TestPlanManagementService.java | 14 +++++++---- 2 files changed, 28 insertions(+), 9 deletions(-) diff --git a/backend/services/test-plan/src/main/java/io/metersphere/plan/dto/response/TestPlanCoverageDTO.java b/backend/services/test-plan/src/main/java/io/metersphere/plan/dto/response/TestPlanCoverageDTO.java index d52385909c..e8ac358c7d 100644 --- a/backend/services/test-plan/src/main/java/io/metersphere/plan/dto/response/TestPlanCoverageDTO.java +++ b/backend/services/test-plan/src/main/java/io/metersphere/plan/dto/response/TestPlanCoverageDTO.java @@ -14,10 +14,14 @@ public class TestPlanCoverageDTO { /** * 通过 + * 归档通过 * 未通过 + * 归档未通过 */ private int passed = 0; + private int passed_archived = 0; private int notPassed = 0; + private int notPassed_archived = 0; /** * 已完成 @@ -39,52 +43,61 @@ public class TestPlanCoverageDTO { public void notStartedAutoIncrement(boolean isArchived) { this.unExecute++; - this.notPassed++; + if (isArchived) { this.archived++; + this.notPassed_archived++; } else { this.prepared++; + this.notPassed++; } } public void passAndFinishedAutoIncrement(boolean isArchived) { this.executed++; - this.passed++; if (isArchived) { this.archived++; + this.passed_archived++; } else { this.finished++; + this.passed++; } } public void unSuccessAutoIncrement(boolean isArchived) { this.executed++; - this.notPassed++; + if (isArchived) { this.archived++; + this.notPassed_archived++; } else { this.finished++; + this.notPassed++; } } public void passAndNotFinishedAutoIncrement(boolean isArchived) { this.executed++; - this.passed++; + if (isArchived) { this.archived++; + this.passed_archived++; } else { this.running++; + this.passed++; } } public void testPlanRunningAutoIncrement(boolean isArchived) { this.executed++; - this.notPassed++; + if (isArchived) { this.archived++; + this.notPassed_archived++; } else { this.running++; + this.notPassed++; } } } diff --git a/backend/services/test-plan/src/main/java/io/metersphere/plan/service/TestPlanManagementService.java b/backend/services/test-plan/src/main/java/io/metersphere/plan/service/TestPlanManagementService.java index 73f8235818..1690ab2a0f 100644 --- a/backend/services/test-plan/src/main/java/io/metersphere/plan/service/TestPlanManagementService.java +++ b/backend/services/test-plan/src/main/java/io/metersphere/plan/service/TestPlanManagementService.java @@ -359,6 +359,16 @@ public class TestPlanManagementService { List statusSelectParam = null; List passedSelectParam = null; + if (request.getFilter() != null && request.getFilter().containsKey("passed")) { + passedSelectParam = request.getFilter().get("passed"); + } else if (request.getFilter() != null && request.getFilter().containsKey("archivedPassed")) { + passedSelectParam = request.getFilter().get("archivedPassed"); + + request.getFilter().put("status", new ArrayList<>() {{ + this.add(TestPlanConstants.TEST_PLAN_STATUS_ARCHIVED); + }}); + } + if (request.getFilter() == null || !request.getFilter().containsKey("status")) { if (request.getFilter() == null) { request.setFilter(new HashMap<>() {{ @@ -372,10 +382,6 @@ public class TestPlanManagementService { request.getFilter().put("status", defaultStatusList); } - if (request.getFilter() != null && request.getFilter().containsKey("passed")) { - passedSelectParam = request.getFilter().get("passed"); - } - boolean selectArchived = CollectionUtils.isNotEmpty(statusSelectParam) && statusSelectParam.contains(TestPlanConstants.TEST_PLAN_STATUS_ARCHIVED); boolean selectStatus = !selectArchived && CollectionUtils.isNotEmpty(statusSelectParam) && CollectionUtils.size(statusSelectParam) < 3; boolean selectPassed = CollectionUtils.isNotEmpty(passedSelectParam) && CollectionUtils.size(passedSelectParam) == 1;