From 47eba6f6a90ed8a806c56d3300785348cbc25359 Mon Sep 17 00:00:00 2001 From: song-cc-rock Date: Wed, 24 Jul 2024 18:16:46 +0800 Subject: [PATCH] =?UTF-8?q?fix(=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=E6=98=8E=E7=BB=86=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E8=B7=A8=E9=A1=B9=E7=9B=AE=E7=94=A8=E4=BE=8B=E6=89=80?= =?UTF-8?q?=E5=B1=9E=E6=A8=A1=E5=9D=97=E5=B1=95=E7=A4=BA=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1044294 --user=宋昌昌 【测试计划】测试计划中关联了跨项目的接口用例-执行该计划-报告中的接口明细-所属模块列表信息获取错误 https://www.tapd.cn/55049933/s/1553888 --- .../controller/BugRelateCaseController.java | 8 +- .../system/utils/ServiceUtils.java | 4 + .../ExtTestPlanReportApiCaseMapper.java | 4 +- .../mapper/ExtTestPlanReportApiCaseMapper.xml | 7 +- .../ExtTestPlanReportApiScenarioMapper.java | 4 +- .../ExtTestPlanReportApiScenarioMapper.xml | 7 +- ...ExtTestPlanReportFunctionalCaseMapper.java | 4 +- .../ExtTestPlanReportFunctionalCaseMapper.xml | 7 +- .../plan/service/TestPlanReportService.java | 80 +++++++++---------- .../plan/utils/ModuleTreeUtils.java | 61 -------------- 10 files changed, 67 insertions(+), 119 deletions(-) delete mode 100644 backend/services/test-plan/src/main/java/io/metersphere/plan/utils/ModuleTreeUtils.java diff --git a/backend/services/bug-management/src/main/java/io/metersphere/bug/controller/BugRelateCaseController.java b/backend/services/bug-management/src/main/java/io/metersphere/bug/controller/BugRelateCaseController.java index a44d59e252..4d2102a59e 100644 --- a/backend/services/bug-management/src/main/java/io/metersphere/bug/controller/BugRelateCaseController.java +++ b/backend/services/bug-management/src/main/java/io/metersphere/bug/controller/BugRelateCaseController.java @@ -43,7 +43,7 @@ public class BugRelateCaseController { private BugRelateCaseCommonService bugRelateCaseCommonService; @PostMapping("/un-relate/page") - @Operation(description = "缺陷管理-关联用例-未关联用例-列表分页") + @Operation(summary = "缺陷管理-关联用例-未关联用例-列表分页") @RequiresPermissions(PermissionConstants.PROJECT_BUG_READ) public Pager> unRelatedPage(@Validated @RequestBody TestCasePageProviderRequest request) { bugRelateCaseCommonService.checkCaseTypeParamIllegal(request.getSourceType()); @@ -77,7 +77,7 @@ public class BugRelateCaseController { } @PostMapping("/page") - @Operation(description = "缺陷管理-关联用例-列表分页查询") + @Operation(summary = "缺陷管理-关联用例-列表分页查询") @RequiresPermissions(PermissionConstants.PROJECT_BUG_READ) public Pager> page(@Validated @RequestBody BugRelatedCasePageRequest request) { Page page = PageHelper.startPage(request.getCurrent(), request.getPageSize()); @@ -85,7 +85,7 @@ public class BugRelateCaseController { } @GetMapping("/un-relate/{id}") - @Operation(description = "缺陷管理-关联用例-取消关联用例") + @Operation(summary = "缺陷管理-关联用例-取消关联用例") @RequiresPermissions(PermissionConstants.PROJECT_BUG_UPDATE) @Parameter(name = "id", description = "ID", schema = @Schema(requiredMode = Schema.RequiredMode.REQUIRED)) @Log(type = OperationLogType.DISASSOCIATE, expression = "#msClass.getRelateLog(#id)", msClass = BugRelateCaseLogService.class) @@ -94,7 +94,7 @@ public class BugRelateCaseController { } @GetMapping("/check-permission/{projectId}/{caseType}") - @Operation(description = "缺陷管理-关联用例-查看用例权限校验") + @Operation(summary = "缺陷管理-关联用例-查看用例权限校验") @Parameters({ @Parameter(name = "projectId", description = "项目ID", schema = @Schema(requiredMode = Schema.RequiredMode.REQUIRED)), @Parameter(name = "caseType", description = "关联用例类型(FUNCTIONAL, API, SCENARIO)", schema = @Schema(requiredMode = Schema.RequiredMode.REQUIRED)) diff --git a/backend/services/system-setting/src/main/java/io/metersphere/system/utils/ServiceUtils.java b/backend/services/system-setting/src/main/java/io/metersphere/system/utils/ServiceUtils.java index efa55e15f6..7176b52e6e 100644 --- a/backend/services/system-setting/src/main/java/io/metersphere/system/utils/ServiceUtils.java +++ b/backend/services/system-setting/src/main/java/io/metersphere/system/utils/ServiceUtils.java @@ -8,6 +8,7 @@ import io.metersphere.system.dto.sdk.request.PosRequest; import jakarta.validation.ConstraintViolation; import jakarta.validation.Validator; import org.apache.commons.collections.CollectionUtils; +import org.apache.commons.lang3.StringUtils; import java.lang.reflect.Method; import java.util.ArrayList; @@ -120,6 +121,9 @@ public class ServiceUtils { } public static String compressName(String name, int maxSize) { + if (StringUtils.isBlank(name)) { + return StringUtils.EMPTY; + } String newName = name; // 限制名称长度 (数据库里最大的长度是255,这里判断超过250时截取到200附近) if (newName.length() > maxSize) { diff --git a/backend/services/test-plan/src/main/java/io/metersphere/plan/mapper/ExtTestPlanReportApiCaseMapper.java b/backend/services/test-plan/src/main/java/io/metersphere/plan/mapper/ExtTestPlanReportApiCaseMapper.java index 35a292afa9..f1a529e9ad 100644 --- a/backend/services/test-plan/src/main/java/io/metersphere/plan/mapper/ExtTestPlanReportApiCaseMapper.java +++ b/backend/services/test-plan/src/main/java/io/metersphere/plan/mapper/ExtTestPlanReportApiCaseMapper.java @@ -27,10 +27,10 @@ public interface ExtTestPlanReportApiCaseMapper { /** * 获取项目下接口用例所属模块集合 - * @param projectId 计划ID + * @param ids 模块ID集合 * @return 模块集合 */ - List getPlanExecuteCaseModules(@Param("id") String projectId); + List getPlanExecuteCaseModules(@Param("ids") List ids); /** * 分页查询报告关联的用例 diff --git a/backend/services/test-plan/src/main/java/io/metersphere/plan/mapper/ExtTestPlanReportApiCaseMapper.xml b/backend/services/test-plan/src/main/java/io/metersphere/plan/mapper/ExtTestPlanReportApiCaseMapper.xml index 0091bf055e..1bea6486d8 100644 --- a/backend/services/test-plan/src/main/java/io/metersphere/plan/mapper/ExtTestPlanReportApiCaseMapper.xml +++ b/backend/services/test-plan/src/main/java/io/metersphere/plan/mapper/ExtTestPlanReportApiCaseMapper.xml @@ -20,8 +20,11 @@