From 8cf01882d3bc1fc0b51688b4cad6c23a990262ae Mon Sep 17 00:00:00 2001 From: guoyuqi Date: Sat, 27 Jan 2024 16:41:31 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E7=94=A8=E4=BE=8B=E7=AE=A1=E7=90=86):?= =?UTF-8?q?=E7=94=A8=E4=BE=8B=E8=AF=84=E5=AE=A1=E7=9A=84num=E7=8B=AC?= =?UTF-8?q?=E7=AB=8B=E7=94=9F=E6=88=90=EF=BC=8C=E4=BF=AE=E6=94=B9=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E7=AC=AC=E4=B8=89=E6=96=B9=E7=9A=84=E9=9C=80=E6=B1=82?= =?UTF-8?q?=E7=9A=84=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sdk/constants/ApplicationNumScope.java | 3 ++- .../FunctionalCaseDemandController.java | 4 ++-- .../FunctionalThirdDemandPageRequest.java | 21 ++----------------- .../request/QueryDemandListRequest.java | 6 ++++++ .../functional/service/CaseReviewService.java | 2 +- .../service/FunctionalCaseDemandService.java | 6 +++--- .../FunctionalCaseDemandControllerTests.java | 3 ++- 7 files changed, 18 insertions(+), 27 deletions(-) diff --git a/backend/framework/sdk/src/main/java/io/metersphere/sdk/constants/ApplicationNumScope.java b/backend/framework/sdk/src/main/java/io/metersphere/sdk/constants/ApplicationNumScope.java index fb2205c54a..a8957ef4d5 100644 --- a/backend/framework/sdk/src/main/java/io/metersphere/sdk/constants/ApplicationNumScope.java +++ b/backend/framework/sdk/src/main/java/io/metersphere/sdk/constants/ApplicationNumScope.java @@ -20,5 +20,6 @@ public enum ApplicationNumScope { BUG_MANAGEMENT, - CASE_MANAGEMENT + CASE_MANAGEMENT, + REVIEW_CASE_MANAGEMENT } diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/controller/FunctionalCaseDemandController.java b/backend/services/case-management/src/main/java/io/metersphere/functional/controller/FunctionalCaseDemandController.java index 20ecb5f190..6f7b6df725 100644 --- a/backend/services/case-management/src/main/java/io/metersphere/functional/controller/FunctionalCaseDemandController.java +++ b/backend/services/case-management/src/main/java/io/metersphere/functional/controller/FunctionalCaseDemandController.java @@ -38,7 +38,7 @@ public class FunctionalCaseDemandController { @PostMapping("/page") @Operation(summary = "用例管理-功能用例-关联需求-获取已关联的需求列表") - @RequiresPermissions(value = {PermissionConstants.FUNCTIONAL_CASE_READ,PermissionConstants.FUNCTIONAL_CASE_READ_ADD, PermissionConstants.FUNCTIONAL_CASE_READ_UPDATE, PermissionConstants.FUNCTIONAL_CASE_READ_DELETE}, logical = Logical.OR) + @RequiresPermissions(value = {PermissionConstants.FUNCTIONAL_CASE_READ, PermissionConstants.FUNCTIONAL_CASE_READ_ADD, PermissionConstants.FUNCTIONAL_CASE_READ_UPDATE, PermissionConstants.FUNCTIONAL_CASE_READ_DELETE}, logical = Logical.OR) public Pager> listFunctionalCaseDemands(@Validated @RequestBody QueryDemandListRequest request) { Page page = PageHelper.startPage(request.getCurrent(), request.getPageSize(), true); return PageUtils.setPageInfo(page, functionalCaseDemandService.listFunctionalCaseDemands(request)); @@ -74,7 +74,7 @@ public class FunctionalCaseDemandController { } @PostMapping("/third/list/page") - @Operation(summary = "用例管理-功能用例-关联需求-批量关联需求") + @Operation(summary = "用例管理-功能用例-关联需求-获取三方需求列表") @RequiresPermissions(value = {PermissionConstants.FUNCTIONAL_CASE_READ_ADD, PermissionConstants.FUNCTIONAL_CASE_READ_UPDATE, PermissionConstants.FUNCTIONAL_CASE_READ_DELETE}, logical = Logical.OR) public PluginPager pageDemand(@RequestBody @Validated FunctionalThirdDemandPageRequest request) { return functionalCaseDemandService.pageDemand(request); diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/request/FunctionalThirdDemandPageRequest.java b/backend/services/case-management/src/main/java/io/metersphere/functional/request/FunctionalThirdDemandPageRequest.java index f572a695dd..a55aa7558c 100644 --- a/backend/services/case-management/src/main/java/io/metersphere/functional/request/FunctionalThirdDemandPageRequest.java +++ b/backend/services/case-management/src/main/java/io/metersphere/functional/request/FunctionalThirdDemandPageRequest.java @@ -1,33 +1,16 @@ package io.metersphere.functional.request; +import io.metersphere.system.dto.sdk.BasePageRequest; import io.swagger.v3.oas.annotations.media.Schema; -import jakarta.validation.constraints.Max; -import jakarta.validation.constraints.Min; import jakarta.validation.constraints.NotBlank; import lombok.Data; -import java.util.Map; - @Data -public class FunctionalThirdDemandPageRequest { +public class FunctionalThirdDemandPageRequest extends BasePageRequest { @Schema(description = "ms系统当前的项目id", requiredMode = Schema.RequiredMode.REQUIRED) @NotBlank(message = "{functional_third_demand_page_request.project_id.not_blank}") private String projectId; - @Schema(description = "需求分页查询关键字") - private String query; - - @Schema(description = "列表筛选条件") - private Map filter; - - @Schema(description = "开始页码", requiredMode = Schema.RequiredMode.REQUIRED) - @Min(value = 1, message = "当前页码必须大于0") - private int startPage; - - @Schema(description = "每页条数", requiredMode = Schema.RequiredMode.REQUIRED) - @Min(value = 5, message = "每页显示条数必须不小于5") - @Max(value = 500, message = "每页显示条数不能大于500") - private int pageSize; } diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/request/QueryDemandListRequest.java b/backend/services/case-management/src/main/java/io/metersphere/functional/request/QueryDemandListRequest.java index 4ab5aedf64..8c5f30432b 100644 --- a/backend/services/case-management/src/main/java/io/metersphere/functional/request/QueryDemandListRequest.java +++ b/backend/services/case-management/src/main/java/io/metersphere/functional/request/QueryDemandListRequest.java @@ -2,6 +2,7 @@ package io.metersphere.functional.request; import io.metersphere.system.dto.sdk.BasePageRequest; import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; import lombok.Getter; import lombok.Setter; @@ -9,5 +10,10 @@ import lombok.Setter; @Setter public class QueryDemandListRequest extends BasePageRequest { @Schema(description = "功能用例id") + @NotBlank(message = "{demand_request.case_id.not_blank}") private String caseId; + + @Schema(description = "当前项目id") + @NotBlank(message = "{demand_request.project_id.not_blank}") + private String projectId; } diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/service/CaseReviewService.java b/backend/services/case-management/src/main/java/io/metersphere/functional/service/CaseReviewService.java index ad7596fc81..f497d1da17 100644 --- a/backend/services/case-management/src/main/java/io/metersphere/functional/service/CaseReviewService.java +++ b/backend/services/case-management/src/main/java/io/metersphere/functional/service/CaseReviewService.java @@ -405,7 +405,7 @@ public class CaseReviewService { * @return num */ public long getNextNum(String projectId) { - return NumGenerator.nextNum(projectId, ApplicationNumScope.CASE_MANAGEMENT); + return NumGenerator.nextNum(projectId, ApplicationNumScope.REVIEW_CASE_MANAGEMENT); } /** diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/service/FunctionalCaseDemandService.java b/backend/services/case-management/src/main/java/io/metersphere/functional/service/FunctionalCaseDemandService.java index 49c43d68b3..eeae69dc28 100644 --- a/backend/services/case-management/src/main/java/io/metersphere/functional/service/FunctionalCaseDemandService.java +++ b/backend/services/case-management/src/main/java/io/metersphere/functional/service/FunctionalCaseDemandService.java @@ -217,9 +217,9 @@ public class FunctionalCaseDemandService { public PluginPager pageDemand(FunctionalThirdDemandPageRequest request) { DemandPageRequest demandPageRequest = new DemandPageRequest(); - demandPageRequest.setQuery(request.getQuery()); - demandPageRequest.setFilter(request.getFilter()); - demandPageRequest.setStartPage(request.getStartPage()); + demandPageRequest.setQuery(request.getKeyword()); + //demandPageRequest.setFilter(request.getFilter()); + demandPageRequest.setStartPage(request.getCurrent()); demandPageRequest.setPageSize(request.getPageSize()); demandPageRequest.setProjectConfig(projectApplicationService.getProjectDemandThirdPartConfig(request.getProjectId())); Platform platform = projectApplicationService.getPlatform(request.getProjectId(), false); diff --git a/backend/services/case-management/src/test/java/io/metersphere/functional/controller/FunctionalCaseDemandControllerTests.java b/backend/services/case-management/src/test/java/io/metersphere/functional/controller/FunctionalCaseDemandControllerTests.java index b5352cadb1..7ccc390986 100644 --- a/backend/services/case-management/src/test/java/io/metersphere/functional/controller/FunctionalCaseDemandControllerTests.java +++ b/backend/services/case-management/src/test/java/io/metersphere/functional/controller/FunctionalCaseDemandControllerTests.java @@ -303,6 +303,7 @@ public class FunctionalCaseDemandControllerTests extends BaseTest { @NotNull private static QueryDemandListRequest getQueryDemandListRequest(String caseId) { QueryDemandListRequest queryDemandListRequest = new QueryDemandListRequest(); + queryDemandListRequest.setProjectId("project-case-demand-test"); queryDemandListRequest.setCurrent(1); queryDemandListRequest.setPageSize(5); queryDemandListRequest.setCaseId(caseId); @@ -481,7 +482,7 @@ public class FunctionalCaseDemandControllerTests extends BaseTest { FunctionalThirdDemandPageRequest functionalThirdDemandPageRequest = new FunctionalThirdDemandPageRequest(); functionalThirdDemandPageRequest.setProjectId("gyq_project-case-demand-test"); functionalThirdDemandPageRequest.setPageSize(10); - functionalThirdDemandPageRequest.setStartPage(1); + functionalThirdDemandPageRequest.setCurrent(1); MvcResult mvcResultDemand= this.requestPostWithOkAndReturn(URL_DEMAND_PAGE_DEMAND, functionalThirdDemandPageRequest); PluginPager tableData = JSON.parseObject(JSON.toJSONString( JSON.parseObject(mvcResultDemand.getResponse().getContentAsString(StandardCharsets.UTF_8), ResultHolder.class).getData()),