From ccc10bacc20968a61eb7fb76f31164d02c9e01a7 Mon Sep 17 00:00:00 2001 From: song-cc-rock Date: Tue, 19 Nov 2024 18:44:45 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E6=B5=8B=E8=AF=95=E8=AE=A1=E5=88=92):?= =?UTF-8?q?=20=E4=BC=98=E5=8C=96=E4=BB=BB=E5=8A=A1=E8=AE=A1=E5=88=92?= =?UTF-8?q?=E6=89=A7=E8=A1=8C=E5=8E=86=E5=8F=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/TestPlanReportController.java | 10 +- .../plan/dto/TestPlanExecuteHisDTO.java | 4 + .../response/TestPlanTaskReportResponse.java | 8 ++ .../plan/mapper/ExtTestPlanMapper.xml | 2 +- .../plan/service/TestPlanReportService.java | 100 ++++++++++++++---- .../plan/service/TestPlanService.java | 5 +- 6 files changed, 104 insertions(+), 25 deletions(-) diff --git a/backend/services/test-plan/src/main/java/io/metersphere/plan/controller/TestPlanReportController.java b/backend/services/test-plan/src/main/java/io/metersphere/plan/controller/TestPlanReportController.java index 0dca27ef5e..3b419883f8 100644 --- a/backend/services/test-plan/src/main/java/io/metersphere/plan/controller/TestPlanReportController.java +++ b/backend/services/test-plan/src/main/java/io/metersphere/plan/controller/TestPlanReportController.java @@ -127,13 +127,21 @@ public class TestPlanReportController { } @GetMapping("/get-task/{taskId}") - @Operation(summary = "测试计划|组-任务-执行结果") + @Operation(summary = "测试计划|组-执行历史-执行结果") @RequiresPermissions(value = {PermissionConstants.TEST_PLAN_REPORT_READ, PermissionConstants.TEST_PLAN_READ_EXECUTE}, logical = Logical.OR) @CheckOwner(resourceId = "#taskId", resourceType = "exec_task") public TestPlanTaskReportResponse getTaskDetail(@PathVariable String taskId) { return testPlanReportService.getTaskDetail(taskId); } + @GetMapping("/get-result/{taskId}") + @Operation(summary = "测试计划|组-任务-执行结果") + @RequiresPermissions(value = {PermissionConstants.TEST_PLAN_REPORT_READ, PermissionConstants.TEST_PLAN_READ_EXECUTE}, logical = Logical.OR) + @CheckOwner(resourceId = "#reportId", resourceType = "test_plan_report") + public TestPlanReportDetailResponse getTaskResult(@PathVariable String taskId) { + return testPlanReportService.getTaskResult(taskId); + } + @GetMapping("/get-layout/{reportId}") @Operation(summary = "测试计划-报告-组件布局") @RequiresPermissions(value = {PermissionConstants.TEST_PLAN_REPORT_READ, PermissionConstants.TEST_PLAN_READ_EXECUTE}, logical = Logical.OR) diff --git a/backend/services/test-plan/src/main/java/io/metersphere/plan/dto/TestPlanExecuteHisDTO.java b/backend/services/test-plan/src/main/java/io/metersphere/plan/dto/TestPlanExecuteHisDTO.java index d743000414..cf35ecd61e 100644 --- a/backend/services/test-plan/src/main/java/io/metersphere/plan/dto/TestPlanExecuteHisDTO.java +++ b/backend/services/test-plan/src/main/java/io/metersphere/plan/dto/TestPlanExecuteHisDTO.java @@ -24,4 +24,8 @@ public class TestPlanExecuteHisDTO { private Long endTime; @Schema(description = "报告是否删除") private Boolean deleted; + @Schema(description = "报告ID") + private String reportId; + @Schema(description = "执行结果是否删除") + private Boolean resultDeleted; } diff --git a/backend/services/test-plan/src/main/java/io/metersphere/plan/dto/response/TestPlanTaskReportResponse.java b/backend/services/test-plan/src/main/java/io/metersphere/plan/dto/response/TestPlanTaskReportResponse.java index 238bb31fe4..a76f2755f6 100644 --- a/backend/services/test-plan/src/main/java/io/metersphere/plan/dto/response/TestPlanTaskReportResponse.java +++ b/backend/services/test-plan/src/main/java/io/metersphere/plan/dto/response/TestPlanTaskReportResponse.java @@ -6,6 +6,7 @@ import io.metersphere.system.serializer.CustomRateSerializer; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; +import java.io.Serial; import java.io.Serializable; import java.util.List; @@ -15,6 +16,7 @@ import java.util.List; @Data public class TestPlanTaskReportResponse implements Serializable { + @Serial private static final long serialVersionUID = 1L; @Schema(description = "报告ID") @@ -40,10 +42,16 @@ public class TestPlanTaskReportResponse implements Serializable { @Schema(description = "执行完成率(实时)") @JsonSerialize(using = CustomRateSerializer.class) private Double executeRate; + @Schema(description = "接口明细总数") + private Integer apiCaseTotal; + @Schema(description = "场景明细总数") + private Integer apiScenarioTotal; @Data public static class ChildPlan { private String id; private String name; + private Integer apiCaseTotal; + private Integer apiScenarioTotal; } } 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 a165dfd44f..33515b7e75 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 @@ -659,7 +659,7 @@