From c1b6e40d6b77ba0b6fc1e7ee24ed8bdab64cf2bc Mon Sep 17 00:00:00 2001 From: shiziyuan9527 Date: Thu, 27 May 2021 18:40:40 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=94=A8=E6=88=B7=E4=B8=8B=E6=8B=89?= =?UTF-8?q?=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ApiTestEnvironmentController.java | 8 ++-- .../controller/UserController.java | 9 +++- .../io/metersphere/service/UserService.java | 44 +++++++++++++++++++ .../automation/scenario/AddBasisScenario.vue | 4 +- .../automation/scenario/ApiScenarioList.vue | 4 +- .../automation/scenario/EditApiScenario.vue | 4 +- .../automation/scenario/api/AddBasisApi.vue | 2 +- .../scenario/api/RelevanceApiList.vue | 3 +- .../api/definition/components/ApiConfig.vue | 4 +- .../components/basis/AddBasisApi.vue | 4 +- .../components/complete/BasisApi.vue | 3 +- .../complete/EditCompleteHTTPApi.vue | 3 +- .../components/complete/TCPBasicApi.vue | 3 +- .../definition/components/list/ApiList.vue | 4 +- .../performance/test/PerformanceTestList.vue | 2 +- .../settings/project/ProjectList.vue | 2 +- .../settings/workspace/MsProject.vue | 2 +- .../template/CustomFiledComponent.vue | 4 +- .../track/case/components/TestCaseCreate.vue | 4 +- .../track/case/components/TestCaseEdit.vue | 3 +- .../track/case/components/TestCaseList.vue | 3 +- .../track/plan/components/TestPlanEdit.vue | 4 +- .../plan/view/comonents/ExecutorEdit.vue | 3 +- .../comonents/api/TestPlanApiCaseList.vue | 4 +- .../functional/FunctionalTestCaseList.vue | 4 +- .../review/components/TestCaseReviewEdit.vue | 4 +- frontend/src/business/components/xpack | 2 +- 27 files changed, 98 insertions(+), 42 deletions(-) diff --git a/backend/src/main/java/io/metersphere/api/controller/ApiTestEnvironmentController.java b/backend/src/main/java/io/metersphere/api/controller/ApiTestEnvironmentController.java index 998b43078d..e7e45a28e0 100644 --- a/backend/src/main/java/io/metersphere/api/controller/ApiTestEnvironmentController.java +++ b/backend/src/main/java/io/metersphere/api/controller/ApiTestEnvironmentController.java @@ -49,10 +49,10 @@ public class ApiTestEnvironmentController { */ @PostMapping("/list/{goPage}/{pageSize}") public Pager> listByCondition(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody EnvironmentRequest environmentRequest) { - List projectIds = environmentRequest.getProjectIds(); - for (String projectId : projectIds) { - checkPermissionService.checkProjectOwner(projectId); - } +// List projectIds = environmentRequest.getProjectIds(); +// for (String projectId : projectIds) { +// checkPermissionService.checkProjectOwner(projectId); +// } Page page = PageHelper.startPage(goPage, pageSize, true); return PageUtils.setPageInfo(page, apiTestEnvironmentService.listByConditions(environmentRequest)); } diff --git a/backend/src/main/java/io/metersphere/controller/UserController.java b/backend/src/main/java/io/metersphere/controller/UserController.java index 3a7c24bd7d..0727925cc5 100644 --- a/backend/src/main/java/io/metersphere/controller/UserController.java +++ b/backend/src/main/java/io/metersphere/controller/UserController.java @@ -278,11 +278,11 @@ public class UserController { } /** - * 组织成员列表不分页 + * 组织下所有相关人员 */ @PostMapping("/org/member/list/all") public List getOrgMemberList(@RequestBody QueryOrgMemberRequest request) { - return userService.getOrgMemberList(request); + return userService.getOrgAllMember(request); } @GetMapping("/besideorg/list/{orgId}") @@ -314,6 +314,11 @@ public class UserController { return userService.getTestManagerAndTestUserList(request); } + @PostMapping("/project/member/tester/list") + public List getProjectMember(@RequestBody QueryMemberRequest request) { + return userService.getProjectMember(request); + } + @GetMapping("/search/{condition}") public List searchUser(@PathVariable String condition) { return userService.searchUser(condition); diff --git a/backend/src/main/java/io/metersphere/service/UserService.java b/backend/src/main/java/io/metersphere/service/UserService.java index 294055eb60..5f20235ab6 100644 --- a/backend/src/main/java/io/metersphere/service/UserService.java +++ b/backend/src/main/java/io/metersphere/service/UserService.java @@ -1307,4 +1307,48 @@ public class UserService { userGroupMapper.deleteByExample(userGroupExample); } + + public List getProjectMember(QueryMemberRequest request) { + String projectId = request.getProjectId(); + if (StringUtils.isBlank(projectId)) { + return new ArrayList<>(); + } + return extUserGroupMapper.getProjectMemberList(request); + } + + public List getOrgAllMember(QueryOrgMemberRequest request) { + String orgId = request.getOrganizationId(); + if (StringUtils.isBlank(orgId)) { + return new ArrayList<>(); + } + List sourceIds = new ArrayList<>(); + sourceIds.add(orgId); + + WorkspaceExample workspaceExample = new WorkspaceExample(); + workspaceExample.createCriteria().andOrganizationIdEqualTo(orgId); + List workspaces = workspaceMapper.selectByExample(workspaceExample); + if (CollectionUtils.isNotEmpty(workspaces)) { + List wsIds = workspaces.stream().map(Workspace::getId).collect(Collectors.toList()); + sourceIds.addAll(wsIds); + ProjectExample projectExample = new ProjectExample(); + projectExample.createCriteria().andWorkspaceIdIn(wsIds); + List projectList = projectMapper.selectByExample(projectExample); + if (CollectionUtils.isNotEmpty(projectList)) { + List proIds = projectList.stream().map(Project::getId).collect(Collectors.toList()); + sourceIds.addAll(proIds); + } + } + + UserGroupExample userGroupExample = new UserGroupExample(); + userGroupExample.createCriteria().andSourceIdIn(sourceIds); + List userGroups = userGroupMapper.selectByExample(userGroupExample); + List userIds = userGroups.stream().map(UserGroup::getUserId).distinct().collect(Collectors.toList()); + if (CollectionUtils.isEmpty(userIds)) { + return new ArrayList<>(); + } + + UserExample userExample = new UserExample(); + userExample.createCriteria().andIdIn(userIds); + return userMapper.selectByExample(userExample); + } } diff --git a/frontend/src/business/components/api/automation/scenario/AddBasisScenario.vue b/frontend/src/business/components/api/automation/scenario/AddBasisScenario.vue index dcb33e50db..764576df17 100644 --- a/frontend/src/business/components/api/automation/scenario/AddBasisScenario.vue +++ b/frontend/src/business/components/api/automation/scenario/AddBasisScenario.vue @@ -58,7 +58,7 @@