From 762ffb08dab46e3961db82b3848a22ca33ce75ad Mon Sep 17 00:00:00 2001 From: WangXu10 Date: Thu, 9 May 2024 13:53:48 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E6=B5=8B=E8=AF=95=E8=AE=A1=E5=88=92):?= =?UTF-8?q?=20=E5=8E=BB=E6=8E=89=E4=B9=8B=E5=89=8D=E6=B2=A1=E7=94=A8?= =?UTF-8?q?=E7=9A=84=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../plan/controller/TestPlanController.java | 10 -------- .../dto/response/TestPlanCountResponse.java | 22 ------------------ .../plan/service/TestPlanService.java | 23 ++++--------------- .../plan/controller/TestPlanTests.java | 6 ----- 4 files changed, 5 insertions(+), 56 deletions(-) delete mode 100644 backend/services/test-plan/src/main/java/io/metersphere/plan/dto/response/TestPlanCountResponse.java diff --git a/backend/services/test-plan/src/main/java/io/metersphere/plan/controller/TestPlanController.java b/backend/services/test-plan/src/main/java/io/metersphere/plan/controller/TestPlanController.java index 9779effc2a..2387e78fb5 100644 --- a/backend/services/test-plan/src/main/java/io/metersphere/plan/controller/TestPlanController.java +++ b/backend/services/test-plan/src/main/java/io/metersphere/plan/controller/TestPlanController.java @@ -3,7 +3,6 @@ package io.metersphere.plan.controller; import io.metersphere.plan.constants.TestPlanResourceConfig; import io.metersphere.plan.domain.TestPlan; import io.metersphere.plan.dto.request.*; -import io.metersphere.plan.dto.response.TestPlanCountResponse; import io.metersphere.plan.dto.response.TestPlanDetailResponse; import io.metersphere.plan.dto.response.TestPlanResponse; import io.metersphere.plan.service.TestPlanLogService; @@ -47,15 +46,6 @@ public class TestPlanController { return testPlanManagementService.page(request); } - @GetMapping("/getCount/{id}") - @Operation(summary = "测试计划-获取统计数据") - @RequiresPermissions(PermissionConstants.TEST_PLAN_READ) - @CheckOwner(resourceId = "#id", resourceType = "test_plan") - public TestPlanCountResponse getCount(@PathVariable String id) { - testPlanManagementService.checkModuleIsOpen(id, TestPlanResourceConfig.CHECK_TYPE_TEST_PLAN, Collections.singletonList(TestPlanResourceConfig.CONFIG_TEST_PLAN)); - return testPlanService.getCount(id); - } - @PostMapping("/module/count") @Operation(summary = "测试计划-模块统计") diff --git a/backend/services/test-plan/src/main/java/io/metersphere/plan/dto/response/TestPlanCountResponse.java b/backend/services/test-plan/src/main/java/io/metersphere/plan/dto/response/TestPlanCountResponse.java deleted file mode 100644 index d0091c9326..0000000000 --- a/backend/services/test-plan/src/main/java/io/metersphere/plan/dto/response/TestPlanCountResponse.java +++ /dev/null @@ -1,22 +0,0 @@ -package io.metersphere.plan.dto.response; - -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; - -@Data -public class TestPlanCountResponse { - @Schema(description = "测试计划ID") - private String id; - @Schema(description = "通过率") - private String passRate; - @Schema(description = "功能用例数") - private long functionalCaseCount = -1; - @Schema(description = "接口用例数") - private long apiCaseCount = -1; - @Schema(description = "接口场景数") - private long apiScenarioCount = -1; - @Schema(description = "Bug数量") - private long bugCount = -1; - @Schema(description = "测试进度") - private String testProgress; -} diff --git a/backend/services/test-plan/src/main/java/io/metersphere/plan/service/TestPlanService.java b/backend/services/test-plan/src/main/java/io/metersphere/plan/service/TestPlanService.java index f10b9bb52d..23f7af0f63 100644 --- a/backend/services/test-plan/src/main/java/io/metersphere/plan/service/TestPlanService.java +++ b/backend/services/test-plan/src/main/java/io/metersphere/plan/service/TestPlanService.java @@ -3,7 +3,6 @@ package io.metersphere.plan.service; import io.metersphere.plan.domain.*; import io.metersphere.plan.dto.TestPlanResourceAssociationParam; import io.metersphere.plan.dto.request.*; -import io.metersphere.plan.dto.response.TestPlanCountResponse; import io.metersphere.plan.dto.response.TestPlanDetailResponse; import io.metersphere.plan.mapper.*; import io.metersphere.sdk.constants.ApplicationNumScope; @@ -270,30 +269,18 @@ public class TestPlanService { TestPlanFollowerExample testPlanFollowerExample = new TestPlanFollowerExample(); testPlanFollowerExample.createCriteria().andTestPlanIdIn(testPlanIds); testPlanFollowerMapper.deleteByExample(testPlanFollowerExample); + + TestPlanAllocationExample allocationExample = new TestPlanAllocationExample(); + allocationExample.createCriteria().andTestPlanIdIn(testPlanIds); + testPlanAllocationMapper.deleteByExample(allocationExample); /* todo - 删除计划定时任务 执行相关配置 + 删除计划定时任务 */ } - public TestPlanCountResponse getCount(String id) { - TestPlanCountResponse response = new TestPlanCountResponse(); - response.setId(id); - /* - todo 统计:测试进度、通过率、用例数、Bug数量(这些比较慢的查询,是否需要另开接口查询) - */ - - response.setFunctionalCaseCount(0); - response.setApiCaseCount(0); - response.setApiScenarioCount(0); - response.setPassRate("3.14%"); - response.setTestProgress("15.92%"); - return response; - } - - /** * 更新测试计划 * diff --git a/backend/services/test-plan/src/test/java/io/metersphere/plan/controller/TestPlanTests.java b/backend/services/test-plan/src/test/java/io/metersphere/plan/controller/TestPlanTests.java index 8f76068c31..e58653b396 100644 --- a/backend/services/test-plan/src/test/java/io/metersphere/plan/controller/TestPlanTests.java +++ b/backend/services/test-plan/src/test/java/io/metersphere/plan/controller/TestPlanTests.java @@ -8,7 +8,6 @@ import io.metersphere.plan.domain.*; import io.metersphere.plan.dto.request.*; import io.metersphere.plan.dto.response.TestPlanAssociationResponse; import io.metersphere.plan.dto.response.TestPlanResourceSortResponse; -import io.metersphere.plan.dto.response.TestPlanResponse; import io.metersphere.plan.mapper.TestPlanMapper; import io.metersphere.plan.service.TestPlanManagementService; import io.metersphere.plan.service.TestPlanModuleService; @@ -726,11 +725,6 @@ public class TestPlanTests extends BaseTest { Assertions.assertTrue(JSON.parseArray(JSON.toJSONString(result.getList())).size() <= testPlanTableRequest.getPageSize()); Assertions.assertEquals(result.getTotal(), 1010); - //查询详情 - List testPlanResponseList = JSON.parseArray(JSON.toJSONString(result.getList()), TestPlanResponse.class); - for (TestPlanResponse response : testPlanResponseList) { - this.requestGetWithOk(String.format(URL_GET_TEST_PLAN_COUNT, response.getId())); - } //指定模块ID查询 (查询count时,不会因为选择了模块而更改了总量 testPlanTableRequest.setModuleIds(Arrays.asList(a1Node.getId(), a1a1Node.getId(), a1b1Node.getId()));