feat(测试计划): 报告用例详情测试点查询补充分享接口

This commit is contained in:
song-cc-rock 2024-09-12 11:41:25 +08:00 committed by Craftsman
parent 2323194f28
commit d8069af7da
3 changed files with 23 additions and 1 deletions

View File

@ -90,6 +90,14 @@ public class TestPlanReportController {
testPlanReportService.batchSetReportDelete(request, SessionUtils.getUserId()); testPlanReportService.batchSetReportDelete(request, SessionUtils.getUserId());
} }
@PostMapping("/batch-param")
@Operation(summary = "测试计划-报告-获取批量参数")
@RequiresPermissions(PermissionConstants.TEST_PLAN_REPORT_READ)
@CheckOwner(resourceId = "#request.getProjectId()", resourceType = "project")
public List<String> getBatchParam(@Validated @RequestBody TestPlanReportBatchRequest request) {
return testPlanReportService.getBatchIds(request);
}
@PostMapping("/manual-gen") @PostMapping("/manual-gen")
@Operation(summary = "测试计划-详情-手动生成报告") @Operation(summary = "测试计划-详情-手动生成报告")
@RequiresPermissions(PermissionConstants.TEST_PLAN_READ_EXECUTE) @RequiresPermissions(PermissionConstants.TEST_PLAN_READ_EXECUTE)

View File

@ -16,6 +16,7 @@ import io.metersphere.plan.dto.TestPlanShareInfo;
import io.metersphere.plan.dto.request.TestPlanReportShareRequest; import io.metersphere.plan.dto.request.TestPlanReportShareRequest;
import io.metersphere.plan.dto.request.TestPlanShareReportDetailRequest; import io.metersphere.plan.dto.request.TestPlanShareReportDetailRequest;
import io.metersphere.plan.dto.response.TestPlanCaseExecHistoryResponse; 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.TestPlanReportDetailResponse;
import io.metersphere.plan.dto.response.TestPlanShareResponse; import io.metersphere.plan.dto.response.TestPlanShareResponse;
import io.metersphere.plan.service.TestPlanReportService; 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.Pager;
import io.metersphere.system.utils.SessionUtils; import io.metersphere.system.utils.SessionUtils;
import io.swagger.v3.oas.annotations.Operation; 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 io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource; import jakarta.annotation.Resource;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
@ -181,4 +184,15 @@ public class TestPlanReportShareController {
testPlanReportShareService.validateExpired(shareInfo); testPlanReportShareService.validateExpired(shareInfo);
return testPlanReportService.getFunctionalExecuteResult(reportId); 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<List<TestPlanReportDetailCollectionResponse>> collectionPage(@PathVariable String type, @Validated @RequestBody TestPlanShareReportDetailRequest request) {
ShareInfo shareInfo = testPlanReportShareService.checkResource(request.getShareId());
testPlanReportShareService.validateExpired(shareInfo);
Page<Object> page = PageHelper.startPage(request.getCurrent(), request.getPageSize(),
StringUtils.isNotBlank(request.getSortString()) ? request.getSortString() : "tpc.pos desc");
return PageUtils.setPageInfo(page, testPlanReportService.listReportCollection(request, type));
}
} }

View File

@ -951,7 +951,7 @@ public class TestPlanReportService {
* @param request 请求参数 * @param request 请求参数
* @return ID集合 * @return ID集合
*/ */
private List<String> getBatchIds(TestPlanReportBatchRequest request) { public List<String> getBatchIds(TestPlanReportBatchRequest request) {
if (request.isSelectAll()) { if (request.isSelectAll()) {
List<String> batchIds = extTestPlanReportMapper.getReportBatchIdsByParam(request); List<String> batchIds = extTestPlanReportMapper.getReportBatchIdsByParam(request);
if (CollectionUtils.isNotEmpty(request.getExcludeIds())) { if (CollectionUtils.isNotEmpty(request.getExcludeIds())) {