From d99bde8ba9bf34c7478bb193bfe3f6771d70a0a9 Mon Sep 17 00:00:00 2001 From: AgAngle <1323481023@qq.com> Date: Mon, 12 Aug 2024 17:50:02 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95):?= =?UTF-8?q?=20=E8=8E=B7=E5=8F=96=E9=A1=B9=E7=9B=AE=E6=A8=A1=E6=9D=BF?= =?UTF-8?q?=E6=98=AF=E5=90=A6=E5=90=AF=E7=94=A8=E6=8E=A5=E5=8F=A3=EF=BC=8C?= =?UTF-8?q?=E5=8E=BB=E9=99=A4=E6=97=A0=E7=94=A8=E7=9A=84=E6=A8=A1=E7=89=88?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1044851 --user=陈建星 【系统设置】组织-模版的接口:/organization/template/enable/config/100001?_t=1723022622529返回信息错误 https://www.tapd.cn/55049933/s/1561263 --- .../io/metersphere/project/service/ProjectTemplateService.java | 2 +- .../project/controller/ProjectTemplateControllerTests.java | 2 +- .../metersphere/system/service/OrganizationTemplateService.java | 2 +- .../system/controller/OrganizationTemplateControllerTests.java | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/backend/services/project-management/src/main/java/io/metersphere/project/service/ProjectTemplateService.java b/backend/services/project-management/src/main/java/io/metersphere/project/service/ProjectTemplateService.java index 11a470e804..b2deccb0a0 100644 --- a/backend/services/project-management/src/main/java/io/metersphere/project/service/ProjectTemplateService.java +++ b/backend/services/project-management/src/main/java/io/metersphere/project/service/ProjectTemplateService.java @@ -400,7 +400,7 @@ public class ProjectTemplateService extends BaseTemplateService { ProjectService.checkResourceExist(projectId); ProjectDTO project = projectService.getProjectById(projectId); HashMap templateEnableConfig = new HashMap<>(); - Arrays.stream(TemplateScene.values()) + List.of(TemplateScene.FUNCTIONAL, TemplateScene.BUG) .forEach(scene -> templateEnableConfig.put(scene.name(), !isOrganizationTemplateEnable(project.getOrganizationId(), scene.name()))); return templateEnableConfig; diff --git a/backend/services/project-management/src/test/java/io/metersphere/project/controller/ProjectTemplateControllerTests.java b/backend/services/project-management/src/test/java/io/metersphere/project/controller/ProjectTemplateControllerTests.java index 817b7639b9..20bfd0171d 100644 --- a/backend/services/project-management/src/test/java/io/metersphere/project/controller/ProjectTemplateControllerTests.java +++ b/backend/services/project-management/src/test/java/io/metersphere/project/controller/ProjectTemplateControllerTests.java @@ -493,7 +493,7 @@ public class ProjectTemplateControllerTests extends BaseTest { // @@请求成功 MvcResult mvcResult = this.requestGetWithOkAndReturn(ENABLE_CONFIG, DEFAULT_PROJECT_ID); Map resultData = getResultData(mvcResult, Map.class); - Assertions.assertEquals(resultData.size(), TemplateScene.values().length); + Assertions.assertEquals(resultData.size(), 2); Assertions.assertFalse((Boolean) resultData.get(TemplateScene.FUNCTIONAL.name())); changeOrgTemplateEnable(false); mvcResult = this.requestGetWithOkAndReturn(ENABLE_CONFIG, DEFAULT_PROJECT_ID); diff --git a/backend/services/system-setting/src/main/java/io/metersphere/system/service/OrganizationTemplateService.java b/backend/services/system-setting/src/main/java/io/metersphere/system/service/OrganizationTemplateService.java index 190fc1a464..bdd1b551fb 100644 --- a/backend/services/system-setting/src/main/java/io/metersphere/system/service/OrganizationTemplateService.java +++ b/backend/services/system-setting/src/main/java/io/metersphere/system/service/OrganizationTemplateService.java @@ -218,7 +218,7 @@ public class OrganizationTemplateService extends BaseTemplateService { public Map getOrganizationTemplateEnableConfig(String organizationId) { OrganizationService.checkResourceExist(organizationId); HashMap templateEnableConfig = new HashMap<>(); - Arrays.stream(TemplateScene.values()) + List.of(TemplateScene.FUNCTIONAL, TemplateScene.BUG) .forEach(scene -> templateEnableConfig.put(scene.name(), isOrganizationTemplateEnable(organizationId, scene.name()))); return templateEnableConfig; diff --git a/backend/services/system-setting/src/test/java/io/metersphere/system/controller/OrganizationTemplateControllerTests.java b/backend/services/system-setting/src/test/java/io/metersphere/system/controller/OrganizationTemplateControllerTests.java index 07955785b7..49fabc9f8d 100644 --- a/backend/services/system-setting/src/test/java/io/metersphere/system/controller/OrganizationTemplateControllerTests.java +++ b/backend/services/system-setting/src/test/java/io/metersphere/system/controller/OrganizationTemplateControllerTests.java @@ -521,7 +521,7 @@ public class OrganizationTemplateControllerTests extends BaseTest { // @@请求成功 MvcResult mvcResult = this.requestGetWithOkAndReturn(ENABLE_CONFIG, DEFAULT_ORGANIZATION_ID); Map resultData = getResultData(mvcResult, Map.class); - Assertions.assertEquals(resultData.size(), TemplateScene.values().length); + Assertions.assertEquals(resultData.size(), 2); Assertions.assertTrue((Boolean) resultData.get(TemplateScene.FUNCTIONAL.name())); changeOrgTemplateEnable(false); mvcResult = this.requestGetWithOkAndReturn(ENABLE_CONFIG, DEFAULT_ORGANIZATION_ID);