From d8069af7da81d0f094edfb42ceca4294b51aaadd Mon Sep 17 00:00:00 2001 From: song-cc-rock Date: Thu, 12 Sep 2024 11:41:25 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E6=B5=8B=E8=AF=95=E8=AE=A1=E5=88=92):=20?= =?UTF-8?q?=E6=8A=A5=E5=91=8A=E7=94=A8=E4=BE=8B=E8=AF=A6=E6=83=85=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=E7=82=B9=E6=9F=A5=E8=AF=A2=E8=A1=A5=E5=85=85=E5=88=86?= =?UTF-8?q?=E4=BA=AB=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../plan/controller/TestPlanReportController.java | 8 ++++++++ .../controller/TestPlanReportShareController.java | 14 ++++++++++++++ .../plan/service/TestPlanReportService.java | 2 +- 3 files changed, 23 insertions(+), 1 deletion(-) 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 b38cd6c9de..f1cb0d0d44 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 @@ -90,6 +90,14 @@ public class TestPlanReportController { testPlanReportService.batchSetReportDelete(request, SessionUtils.getUserId()); } + @PostMapping("/batch-param") + @Operation(summary = "测试计划-报告-获取批量参数") + @RequiresPermissions(PermissionConstants.TEST_PLAN_REPORT_READ) + @CheckOwner(resourceId = "#request.getProjectId()", resourceType = "project") + public List getBatchParam(@Validated @RequestBody TestPlanReportBatchRequest request) { + return testPlanReportService.getBatchIds(request); + } + @PostMapping("/manual-gen") @Operation(summary = "测试计划-详情-手动生成报告") @RequiresPermissions(PermissionConstants.TEST_PLAN_READ_EXECUTE) diff --git a/backend/services/test-plan/src/main/java/io/metersphere/plan/controller/TestPlanReportShareController.java b/backend/services/test-plan/src/main/java/io/metersphere/plan/controller/TestPlanReportShareController.java index c17c7fb8bf..66c0095ff2 100644 --- a/backend/services/test-plan/src/main/java/io/metersphere/plan/controller/TestPlanReportShareController.java +++ b/backend/services/test-plan/src/main/java/io/metersphere/plan/controller/TestPlanReportShareController.java @@ -16,6 +16,7 @@ import io.metersphere.plan.dto.TestPlanShareInfo; import io.metersphere.plan.dto.request.TestPlanReportShareRequest; import io.metersphere.plan.dto.request.TestPlanShareReportDetailRequest; import io.metersphere.plan.dto.response.TestPlanCaseExecHistoryResponse; +import io.metersphere.plan.dto.response.TestPlanReportDetailCollectionResponse; import io.metersphere.plan.dto.response.TestPlanReportDetailResponse; import io.metersphere.plan.dto.response.TestPlanShareResponse; import io.metersphere.plan.service.TestPlanReportService; @@ -27,6 +28,8 @@ import io.metersphere.system.utils.PageUtils; import io.metersphere.system.utils.Pager; import io.metersphere.system.utils.SessionUtils; import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.annotation.Resource; import org.apache.commons.lang3.StringUtils; @@ -181,4 +184,15 @@ public class TestPlanReportShareController { testPlanReportShareService.validateExpired(shareInfo); return testPlanReportService.getFunctionalExecuteResult(reportId); } + + @PostMapping("/detail/{type}/collection/page") + @Operation(summary = "测试计划-报告-详情-测试集分页查询(不同用例类型)") + @Parameter(name = "type", description = "用例类型", schema = @Schema(requiredMode = Schema.RequiredMode.REQUIRED), example = "functional, api, scenario") + public Pager> collectionPage(@PathVariable String type, @Validated @RequestBody TestPlanShareReportDetailRequest request) { + ShareInfo shareInfo = testPlanReportShareService.checkResource(request.getShareId()); + testPlanReportShareService.validateExpired(shareInfo); + Page page = PageHelper.startPage(request.getCurrent(), request.getPageSize(), + StringUtils.isNotBlank(request.getSortString()) ? request.getSortString() : "tpc.pos desc"); + return PageUtils.setPageInfo(page, testPlanReportService.listReportCollection(request, type)); + } } diff --git a/backend/services/test-plan/src/main/java/io/metersphere/plan/service/TestPlanReportService.java b/backend/services/test-plan/src/main/java/io/metersphere/plan/service/TestPlanReportService.java index 0fad7b342d..1cad84e7fa 100644 --- a/backend/services/test-plan/src/main/java/io/metersphere/plan/service/TestPlanReportService.java +++ b/backend/services/test-plan/src/main/java/io/metersphere/plan/service/TestPlanReportService.java @@ -951,7 +951,7 @@ public class TestPlanReportService { * @param request 请求参数 * @return ID集合 */ - private List getBatchIds(TestPlanReportBatchRequest request) { + public List getBatchIds(TestPlanReportBatchRequest request) { if (request.isSelectAll()) { List batchIds = extTestPlanReportMapper.getReportBatchIdsByParam(request); if (CollectionUtils.isNotEmpty(request.getExcludeIds())) {