From 826059025797f43bd6138adca3dcd684f2ce5f0c Mon Sep 17 00:00:00 2001 From: metersphere-bot <78466014+metersphere-bot@users.noreply.github.com> Date: Thu, 21 Oct 2021 11:20:57 +0800 Subject: [PATCH 1/3] =?UTF-8?q?fix:=20=E5=A4=84=E7=90=86=E5=BC=95=E7=94=A8?= =?UTF-8?q?=E9=97=AE=E9=A2=98=20(#6886)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: 删除组织这一级 Co-authored-by: shiziyuan9527 Co-authored-by: Captain.B --- .../api/controller/APIReportController.java | 3 - .../api/controller/ApiDatabaseController.java | 8 +- .../api/controller/ApiModuleController.java | 3 - .../api/controller/ApiMonitorController.java | 3 - .../ApiScenarioModuleController.java | 3 - .../ApiTestEnvironmentController.java | 3 - .../api/service/ApiScenarioReportService.java | 17 +- .../api/service/EsbImportService.java | 4 - .../api/service/TestResultService.java | 17 +- .../metersphere/base/domain/MessageTask.java | 7 +- .../base/domain/MessageTaskExample.java | 140 ++-- .../metersphere/base/domain/Organization.java | 22 - .../base/domain/OrganizationExample.java | 600 ------------------ .../io/metersphere/base/domain/Quota.java | 2 - .../metersphere/base/domain/QuotaExample.java | 70 -- .../java/io/metersphere/base/domain/Role.java | 22 - .../metersphere/base/domain/RoleExample.java | 600 ------------------ .../base/domain/ServiceIntegration.java | 4 +- .../domain/ServiceIntegrationExample.java | 140 ++-- .../java/io/metersphere/base/domain/User.java | 2 - .../metersphere/base/domain/UserExample.java | 70 -- .../io/metersphere/base/domain/UserRole.java | 22 - .../base/domain/UserRoleExample.java | 600 ------------------ .../io/metersphere/base/domain/Workspace.java | 2 - .../base/domain/WorkspaceExample.java | 70 -- .../base/mapper/MessageTaskMapper.java | 3 +- .../base/mapper/MessageTaskMapper.xml | 84 +-- .../base/mapper/OrganizationMapper.java | 30 - .../base/mapper/OrganizationMapper.xml | 228 ------- .../metersphere/base/mapper/QuotaMapper.xml | 27 +- .../metersphere/base/mapper/RoleMapper.java | 30 - .../io/metersphere/base/mapper/RoleMapper.xml | 228 ------- .../base/mapper/ServiceIntegrationMapper.xml | 46 +- .../io/metersphere/base/mapper/UserMapper.xml | 29 +- .../base/mapper/UserRoleMapper.java | 30 - .../base/mapper/UserRoleMapper.xml | 228 ------- .../base/mapper/WorkspaceMapper.xml | 31 +- .../base/mapper/ext/ExtGroupMapper.xml | 4 +- .../mapper/ext/ExtOrganizationMapper.java | 15 - .../base/mapper/ext/ExtOrganizationMapper.xml | 134 ---- .../base/mapper/ext/ExtProjectMapper.java | 7 +- .../base/mapper/ext/ExtProjectMapper.xml | 18 +- .../base/mapper/ext/ExtRoleMapper.java | 11 - .../base/mapper/ext/ExtRoleMapper.xml | 9 - .../base/mapper/ext/ExtUserGroupMapper.java | 10 +- .../base/mapper/ext/ExtUserGroupMapper.xml | 60 +- .../base/mapper/ext/ExtUserMapper.xml | 5 +- .../base/mapper/ext/ExtUserRoleMapper.java | 34 - .../base/mapper/ext/ExtUserRoleMapper.xml | 129 ---- .../base/mapper/ext/ExtWorkspaceMapper.java | 10 +- .../base/mapper/ext/ExtWorkspaceMapper.xml | 142 ++++- .../constants/PermissionConstants.java | 26 +- .../commons/constants/RoleConstants.java | 10 - .../commons/utils/SessionUtils.java | 11 - .../controller/CustomFieldController.java | 3 - .../controller/GroupController.java | 26 +- .../controller/IssueTemplateController.java | 3 - .../controller/JarConfigController.java | 3 - .../controller/OrganizationController.java | 76 --- .../controller/ProjectController.java | 4 + .../controller/ResourceController.java | 3 - .../controller/RoleController.java | 32 - .../ServiceIntegrationController.java | 10 +- .../controller/SystemParameterController.java | 35 + .../TestCaseTemplateController.java | 3 - .../TestResourcePoolController.java | 3 - .../controller/UserController.java | 134 +--- .../controller/UserKeysController.java | 3 - .../controller/UserRoleController.java | 38 -- .../controller/WorkspaceController.java | 19 +- .../controller/request/BaseQueryRequest.java | 2 - .../request/IntegrationRequest.java | 2 +- .../controller/request/WorkspaceRequest.java | 1 - .../organization/AddOrgMemberRequest.java | 1 - .../organization/QueryOrgMemberRequest.java | 11 - .../resourcepool/UserBatchProcessRequest.java | 2 +- .../io/metersphere/dto/CascaderParse.java | 108 ---- .../dto/OrganizationMemberDTO.java | 24 - .../io/metersphere/dto/RelatedSource.java | 1 - .../metersphere/dto/SystemStatisticData.java | 10 + .../main/java/io/metersphere/dto/UserDTO.java | 5 - .../java/io/metersphere/dto/UserRoleDTO.java | 19 - .../io/metersphere/dto/UserRoleHelpDTO.java | 16 - .../java/io/metersphere/dto/WorkspaceDTO.java | 3 - ...onResource.java => WorkspaceResource.java} | 4 +- .../excel/domain/UserExcelData.java | 8 - .../excel/domain/UserExcelDataCn.java | 20 - .../excel/domain/UserExcelDataTw.java | 20 - .../excel/domain/UserExcelDataUs.java | 20 - .../excel/listener/UserDataListener.java | 53 +- .../controller/OperatingLogController.java | 4 - .../notice/controller/NoticeController.java | 4 +- .../notice/domain/MessageDetail.java | 1 - .../notice/sender/AbstractNoticeSender.java | 16 +- .../notice/service/NoticeSendService.java | 6 +- .../notice/service/NoticeService.java | 40 +- .../notice/PerformanceNoticeEvent.java | 17 +- .../service/JmeterFileService.java | 3 - .../metersphere/security/realm/LdapRealm.java | 15 +- .../security/realm/LocalRealm.java | 6 - .../io/metersphere/service/GroupService.java | 128 ++-- .../service/IntegrationService.java | 18 +- .../service/OrganizationService.java | 281 -------- .../metersphere/service/ProjectService.java | 117 ++-- .../io/metersphere/service/RoleService.java | 28 - .../service/SystemParameterService.java | 11 + .../metersphere/service/UserGroupService.java | 45 ++ .../metersphere/service/UserRoleService.java | 85 --- .../io/metersphere/service/UserService.java | 339 +--------- .../metersphere/service/WorkspaceService.java | 146 ++--- .../track/controller/IssuesController.java | 6 +- .../controller/TestCaseNodeController.java | 3 - .../TestCaseReportTemplateController.java | 3 - .../TestCaseReviewScenarioCaseController.java | 5 - .../track/issue/AbstractIssuePlatform.java | 46 +- .../metersphere/track/issue/JiraPlatform.java | 2 +- .../metersphere/track/issue/TapdPlatform.java | 2 +- .../track/issue/ZentaoPlatform.java | 4 +- .../testcase/AuthUserIssueRequest.java | 2 +- .../request/testcase/IssuesUpdateRequest.java | 2 +- .../track/service/DemandService.java | 18 +- .../track/service/IssuesService.java | 33 +- .../track/service/TestPlanReportService.java | 8 +- backend/src/main/java/io/metersphere/xpack | 2 +- .../db/migration/V97__v1.14_release.sql | 321 +++++++++- .../src/main/resources/generatorConfig.xml | 4 +- .../resources/i18n/messages_en_US.properties | 4 +- .../resources/i18n/messages_zh_CN.properties | 4 +- .../resources/i18n/messages_zh_TW.properties | 4 +- .../resources/mail/ApiFailedNotification.html | 7 +- .../mail/ApiSuccessfulNotification.html | 6 +- .../mail/TestPlanFailedNotification.html | 2 +- .../mail/TestPlanSuccessfulNotification.html | 2 +- backend/src/main/resources/permission.json | 195 +++--- .../automation/scenario/ApiScenarioList.vue | 2 +- .../automation/scenario/EditApiScenario.vue | 2 +- .../common/Jsr233ProcessorContent.vue | 6 +- .../automation/schedule/ScheduleMaintain.vue | 8 +- .../schedule/ScheduleNotification.vue | 169 ++--- .../components/case/ApiCaseList.vue | 2 +- .../components/import/ApiSchedule.vue | 26 +- .../import/SwaggerTaskNotification.vue | 78 +-- .../components/list/ApiCaseSimpleList.vue | 2 +- .../mock/Components/MockApiScriptEditor.vue | 4 +- .../mock/Components/MockScriptNavMenu.vue | 8 +- .../components/api/head/ApiHeaderMenus.vue | 3 +- .../api/test/components/jar/JarConfig.vue | 12 +- .../api/test/components/jar/JarConfigFrom.vue | 42 +- .../api/test/components/jar/JarConfigList.vue | 189 ++++-- .../common/components/MsScheduleEdit.vue | 30 +- .../components/common/head/CreateTest.vue | 32 - .../components/common/head/HeaderOrgWs.vue | 134 ++-- .../components/common/head/HeaderTopMenus.vue | 5 + .../components/common/head/LanguageSwitch.vue | 3 +- .../components/common/head/ProjectSwitch.vue | 2 +- .../components/common/head/RecentList.vue | 2 - .../components/common/head/SearchList.vue | 1 + .../components/common/router/router.js | 2 + .../head/PerformanceHeaderMenus.vue | 11 +- .../components/project/ProjectSetting.vue | 35 + .../project/head/ProjectHeaderMenus.vue | 76 +++ .../components/project/home/ProjectHome.vue | 231 +++++++ .../project => project/menu}/EditMember.vue | 16 +- .../menu}/EnvironmentImport.vue | 0 .../menu}/EnvironmentList.vue | 190 +++--- .../business/components/project/menu/Log.vue | 288 +++++++++ .../components/project/menu/Member.vue | 220 +++++++ .../project => project/menu}/ProjectList.vue | 191 +----- .../project/menu/file/FileManage.vue | 46 ++ .../project/menu/file/ResourceManage.vue | 227 +++++++ .../menu}/function/ApiFuncRelevance.vue | 0 .../project/menu/function/CustomFunction.vue | 172 +++++ .../menu}/function/CustomFunctionRelate.vue | 0 .../menu}/function/EditFunction.vue | 12 +- .../menu}/function/FunctionParams.vue | 0 .../menu}/function/FunctionRun.vue | 0 .../menu}/function/ScriptNavMenu.vue | 8 +- .../menu}/function/custom-function.js | 0 .../menu}/function/script-menu.js | 0 .../src/business/components/project/router.js | 48 ++ .../business/components/settings/Setting.vue | 42 +- .../components/settings/SettingHome.vue | 84 +++ .../components/settings/SettingMenu.vue | 31 - .../components/settings/common/AddMember.vue | 5 +- .../settings/operatinglog/OperatingLog.vue | 12 +- .../settings/operatinglog/config.js | 10 +- .../settings/organization/MessageSettings.vue | 31 - .../organization/OrganizationMember.vue | 360 ----------- .../organization/OrganizationWorkspace.vue | 496 --------------- .../settings/personal/PersonSetting.vue | 37 +- .../components/settings/project/Member.vue | 205 ------ .../project/function/CustomFunction.vue | 164 ----- .../business/components/settings/router.js | 79 +-- .../components/settings/system/EditUser.vue | 30 +- .../settings/system/Organization.vue | 476 -------------- .../settings/system/SystemWorkspace.vue | 35 +- .../components/settings/system/User.vue | 5 - .../system/components/ProjectCascader.vue | 21 +- .../settings/system/group/EditPermission.vue | 12 +- .../settings/system/group/EditUserGroup.vue | 26 +- .../settings/system/group/GroupMember.vue | 8 +- .../BugManagement.vue | 8 +- .../settings/workspace/MessageSettings.vue | 29 + .../settings/workspace/MsProject.vue | 34 +- .../ServiceIntegration.vue | 0 .../TaskNotification.vue | 39 +- .../settings/workspace/WorkspaceMember.vue | 560 ++++++++-------- .../settings/workspace/WsEnvironmentList.vue | 2 +- .../components/AzureDevopsSetting.vue | 37 +- .../components/BugManageBtn.vue | 0 .../components/JiraSetting.vue | 32 +- .../components/ScheduleTaskNotification.vue | 105 ++- .../components/TapdSetting.vue | 28 +- .../components/ZentaoSetting.vue | 30 +- .../api/ApiAutomationNotification.vue | 100 ++- .../api/ApiDefinitionNotification.vue} | 305 +++++---- .../components/api/ApiHomeNotification.vue | 63 +- .../components/api/ApiReportNotification.vue | 78 ++- .../jenkins/JenkinsNotification.vue | 73 +-- .../PerformanceReportNotification.vue | 71 ++- .../PerformanceTestNotification.vue} | 116 ++-- .../track/DefectTaskNotification.vue | 70 +- .../components/track/TestCaseNotification.vue | 91 ++- .../track/TestPlanTaskNotification.vue | 88 ++- .../track/TestReviewNotification.vue | 83 ++- .../track/TrackHomeNotification.vue | 61 +- .../track/TrackReportNotification.vue | 66 +- .../business/components/task/TaskCenter.vue | 27 +- .../track/issue/IssueEditDetail.vue | 30 +- .../plan/components/ScheduleMaintain.vue | 14 +- .../track/plan/components/TestPlanList.vue | 2 +- .../comonents/api/TestPlanApiCaseList.vue | 2 +- .../comonents/api/TestPlanApiScenarioList.vue | 2 +- frontend/src/business/components/xpack | 2 +- frontend/src/business/main.js | 4 +- frontend/src/business/permission.js | 7 +- frontend/src/common/js/ajax.js | 5 +- frontend/src/common/js/constants.js | 1 - frontend/src/common/js/table-constants.js | 1 - frontend/src/common/js/utils.js | 80 --- frontend/src/i18n/en-US.js | 25 +- frontend/src/i18n/zh-CN.js | 25 +- frontend/src/i18n/zh-TW.js | 25 +- frontend/src/network/organization.js | 4 +- git | 0 package-lock.json | 3 - yarn.lock | 4 - 247 files changed, 4635 insertions(+), 9284 deletions(-) delete mode 100644 backend/src/main/java/io/metersphere/base/domain/Organization.java delete mode 100644 backend/src/main/java/io/metersphere/base/domain/OrganizationExample.java delete mode 100644 backend/src/main/java/io/metersphere/base/domain/Role.java delete mode 100644 backend/src/main/java/io/metersphere/base/domain/RoleExample.java delete mode 100644 backend/src/main/java/io/metersphere/base/domain/UserRole.java delete mode 100644 backend/src/main/java/io/metersphere/base/domain/UserRoleExample.java delete mode 100644 backend/src/main/java/io/metersphere/base/mapper/OrganizationMapper.java delete mode 100644 backend/src/main/java/io/metersphere/base/mapper/OrganizationMapper.xml delete mode 100644 backend/src/main/java/io/metersphere/base/mapper/RoleMapper.java delete mode 100644 backend/src/main/java/io/metersphere/base/mapper/RoleMapper.xml delete mode 100644 backend/src/main/java/io/metersphere/base/mapper/UserRoleMapper.java delete mode 100644 backend/src/main/java/io/metersphere/base/mapper/UserRoleMapper.xml delete mode 100644 backend/src/main/java/io/metersphere/base/mapper/ext/ExtOrganizationMapper.java delete mode 100644 backend/src/main/java/io/metersphere/base/mapper/ext/ExtOrganizationMapper.xml delete mode 100644 backend/src/main/java/io/metersphere/base/mapper/ext/ExtRoleMapper.java delete mode 100644 backend/src/main/java/io/metersphere/base/mapper/ext/ExtRoleMapper.xml delete mode 100644 backend/src/main/java/io/metersphere/base/mapper/ext/ExtUserRoleMapper.java delete mode 100644 backend/src/main/java/io/metersphere/base/mapper/ext/ExtUserRoleMapper.xml delete mode 100644 backend/src/main/java/io/metersphere/commons/constants/RoleConstants.java delete mode 100644 backend/src/main/java/io/metersphere/controller/OrganizationController.java delete mode 100644 backend/src/main/java/io/metersphere/controller/RoleController.java delete mode 100644 backend/src/main/java/io/metersphere/controller/UserRoleController.java delete mode 100644 backend/src/main/java/io/metersphere/controller/request/organization/QueryOrgMemberRequest.java delete mode 100644 backend/src/main/java/io/metersphere/dto/CascaderParse.java delete mode 100644 backend/src/main/java/io/metersphere/dto/OrganizationMemberDTO.java create mode 100644 backend/src/main/java/io/metersphere/dto/SystemStatisticData.java delete mode 100644 backend/src/main/java/io/metersphere/dto/UserRoleDTO.java delete mode 100644 backend/src/main/java/io/metersphere/dto/UserRoleHelpDTO.java rename backend/src/main/java/io/metersphere/dto/{OrganizationResource.java => WorkspaceResource.java} (67%) delete mode 100644 backend/src/main/java/io/metersphere/service/OrganizationService.java delete mode 100644 backend/src/main/java/io/metersphere/service/RoleService.java create mode 100644 backend/src/main/java/io/metersphere/service/UserGroupService.java delete mode 100644 backend/src/main/java/io/metersphere/service/UserRoleService.java delete mode 100644 frontend/src/business/components/common/head/CreateTest.vue create mode 100644 frontend/src/business/components/project/ProjectSetting.vue create mode 100644 frontend/src/business/components/project/head/ProjectHeaderMenus.vue create mode 100644 frontend/src/business/components/project/home/ProjectHome.vue rename frontend/src/business/components/{settings/project => project/menu}/EditMember.vue (81%) rename frontend/src/business/components/{settings/project => project/menu}/EnvironmentImport.vue (100%) rename frontend/src/business/components/{settings/project => project/menu}/EnvironmentList.vue (67%) create mode 100644 frontend/src/business/components/project/menu/Log.vue create mode 100644 frontend/src/business/components/project/menu/Member.vue rename frontend/src/business/components/{settings/project => project/menu}/ProjectList.vue (58%) create mode 100644 frontend/src/business/components/project/menu/file/FileManage.vue create mode 100644 frontend/src/business/components/project/menu/file/ResourceManage.vue rename frontend/src/business/components/{settings/project => project/menu}/function/ApiFuncRelevance.vue (100%) create mode 100644 frontend/src/business/components/project/menu/function/CustomFunction.vue rename frontend/src/business/components/{settings/project => project/menu}/function/CustomFunctionRelate.vue (100%) rename frontend/src/business/components/{settings/project => project/menu}/function/EditFunction.vue (94%) rename frontend/src/business/components/{settings/project => project/menu}/function/FunctionParams.vue (100%) rename frontend/src/business/components/{settings/project => project/menu}/function/FunctionRun.vue (100%) rename frontend/src/business/components/{settings/project => project/menu}/function/ScriptNavMenu.vue (94%) rename frontend/src/business/components/{settings/project => project/menu}/function/custom-function.js (100%) rename frontend/src/business/components/{settings/project => project/menu}/function/script-menu.js (100%) create mode 100644 frontend/src/business/components/project/router.js create mode 100644 frontend/src/business/components/settings/SettingHome.vue delete mode 100644 frontend/src/business/components/settings/organization/MessageSettings.vue delete mode 100644 frontend/src/business/components/settings/organization/OrganizationMember.vue delete mode 100644 frontend/src/business/components/settings/organization/OrganizationWorkspace.vue delete mode 100644 frontend/src/business/components/settings/project/Member.vue delete mode 100644 frontend/src/business/components/settings/project/function/CustomFunction.vue delete mode 100644 frontend/src/business/components/settings/system/Organization.vue rename frontend/src/business/components/settings/{organization => workspace}/BugManagement.vue (86%) create mode 100644 frontend/src/business/components/settings/workspace/MessageSettings.vue rename frontend/src/business/components/settings/{organization => workspace}/ServiceIntegration.vue (100%) rename frontend/src/business/components/settings/{organization => workspace}/TaskNotification.vue (84%) rename frontend/src/business/components/settings/{organization => workspace}/components/AzureDevopsSetting.vue (88%) rename frontend/src/business/components/settings/{organization => workspace}/components/BugManageBtn.vue (100%) rename frontend/src/business/components/settings/{organization => workspace}/components/JiraSetting.vue (90%) rename frontend/src/business/components/settings/{organization => workspace}/components/ScheduleTaskNotification.vue (74%) rename frontend/src/business/components/settings/{organization => workspace}/components/TapdSetting.vue (89%) rename frontend/src/business/components/settings/{organization => workspace}/components/ZentaoSetting.vue (91%) rename frontend/src/business/components/settings/{organization => workspace}/components/api/ApiAutomationNotification.vue (81%) rename frontend/src/business/components/settings/{organization/components/performance/PerformanceTestNotification.vue => workspace/components/api/ApiDefinitionNotification.vue} (50%) rename frontend/src/business/components/settings/{organization => workspace}/components/api/ApiHomeNotification.vue (88%) rename frontend/src/business/components/settings/{organization => workspace}/components/api/ApiReportNotification.vue (86%) rename frontend/src/business/components/settings/{organization => workspace}/components/jenkins/JenkinsNotification.vue (78%) rename frontend/src/business/components/settings/{organization => workspace}/components/performance/PerformanceReportNotification.vue (87%) rename frontend/src/business/components/settings/{organization/components/api/ApiDefinitionNotification.vue => workspace/components/performance/PerformanceTestNotification.vue} (79%) rename frontend/src/business/components/settings/{organization => workspace}/components/track/DefectTaskNotification.vue (88%) rename frontend/src/business/components/settings/{organization => workspace}/components/track/TestCaseNotification.vue (84%) rename frontend/src/business/components/settings/{organization => workspace}/components/track/TestPlanTaskNotification.vue (84%) rename frontend/src/business/components/settings/{organization => workspace}/components/track/TestReviewNotification.vue (85%) rename frontend/src/business/components/settings/{organization => workspace}/components/track/TrackHomeNotification.vue (88%) rename frontend/src/business/components/settings/{organization => workspace}/components/track/TrackReportNotification.vue (88%) delete mode 100644 git delete mode 100644 package-lock.json delete mode 100644 yarn.lock diff --git a/backend/src/main/java/io/metersphere/api/controller/APIReportController.java b/backend/src/main/java/io/metersphere/api/controller/APIReportController.java index b72904a68b..f58eb96792 100644 --- a/backend/src/main/java/io/metersphere/api/controller/APIReportController.java +++ b/backend/src/main/java/io/metersphere/api/controller/APIReportController.java @@ -6,14 +6,11 @@ import io.metersphere.api.dto.APIReportResult; import io.metersphere.api.dto.DeleteAPIReportRequest; import io.metersphere.api.dto.QueryAPIReportRequest; import io.metersphere.api.service.APIReportService; -import io.metersphere.commons.constants.RoleConstants; import io.metersphere.commons.utils.PageUtils; import io.metersphere.commons.utils.Pager; import io.metersphere.commons.utils.SessionUtils; import io.metersphere.dto.DashboardTestDTO; import io.metersphere.service.CheckPermissionService; -import org.apache.shiro.authz.annotation.Logical; -import org.apache.shiro.authz.annotation.RequiresRoles; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; diff --git a/backend/src/main/java/io/metersphere/api/controller/ApiDatabaseController.java b/backend/src/main/java/io/metersphere/api/controller/ApiDatabaseController.java index 0dcf0a65d9..6d3a715d56 100644 --- a/backend/src/main/java/io/metersphere/api/controller/ApiDatabaseController.java +++ b/backend/src/main/java/io/metersphere/api/controller/ApiDatabaseController.java @@ -2,10 +2,10 @@ package io.metersphere.api.controller; import io.metersphere.api.dto.scenario.DatabaseConfig; import io.metersphere.api.service.APIDatabaseService; -import io.metersphere.commons.constants.RoleConstants; -import org.apache.shiro.authz.annotation.Logical; -import org.apache.shiro.authz.annotation.RequiresRoles; -import org.springframework.web.bind.annotation.*; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; diff --git a/backend/src/main/java/io/metersphere/api/controller/ApiModuleController.java b/backend/src/main/java/io/metersphere/api/controller/ApiModuleController.java index e3e7deb4c5..3c6a5cf0b5 100644 --- a/backend/src/main/java/io/metersphere/api/controller/ApiModuleController.java +++ b/backend/src/main/java/io/metersphere/api/controller/ApiModuleController.java @@ -5,13 +5,10 @@ import io.metersphere.api.dto.definition.DragModuleRequest; import io.metersphere.api.service.ApiModuleService; import io.metersphere.base.domain.ApiModule; import io.metersphere.commons.constants.OperLogConstants; -import io.metersphere.commons.constants.RoleConstants; import io.metersphere.commons.utils.ApiDefinitionDefaultApiTypeUtil; import io.metersphere.commons.utils.SessionUtils; import io.metersphere.log.annotation.MsAuditLog; import io.metersphere.service.CheckPermissionService; -import org.apache.shiro.authz.annotation.Logical; -import org.apache.shiro.authz.annotation.RequiresRoles; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; diff --git a/backend/src/main/java/io/metersphere/api/controller/ApiMonitorController.java b/backend/src/main/java/io/metersphere/api/controller/ApiMonitorController.java index 601a68e34b..7ca84984c6 100644 --- a/backend/src/main/java/io/metersphere/api/controller/ApiMonitorController.java +++ b/backend/src/main/java/io/metersphere/api/controller/ApiMonitorController.java @@ -5,9 +5,6 @@ import io.metersphere.api.dto.ApiMonitorSearch; import io.metersphere.api.dto.ApiResponseCodeMonitor; import io.metersphere.api.dto.ApiResponseTimeMonitor; import io.metersphere.api.service.APIMonitorService; -import io.metersphere.commons.constants.RoleConstants; -import org.apache.shiro.authz.annotation.Logical; -import org.apache.shiro.authz.annotation.RequiresRoles; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; diff --git a/backend/src/main/java/io/metersphere/api/controller/ApiScenarioModuleController.java b/backend/src/main/java/io/metersphere/api/controller/ApiScenarioModuleController.java index e198342034..df467483a2 100644 --- a/backend/src/main/java/io/metersphere/api/controller/ApiScenarioModuleController.java +++ b/backend/src/main/java/io/metersphere/api/controller/ApiScenarioModuleController.java @@ -5,11 +5,8 @@ import io.metersphere.api.dto.automation.DragApiScenarioModuleRequest; import io.metersphere.api.service.ApiScenarioModuleService; import io.metersphere.base.domain.ApiScenarioModule; import io.metersphere.commons.constants.OperLogConstants; -import io.metersphere.commons.constants.RoleConstants; import io.metersphere.log.annotation.MsAuditLog; import io.metersphere.service.CheckPermissionService; -import org.apache.shiro.authz.annotation.Logical; -import org.apache.shiro.authz.annotation.RequiresRoles; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; 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 7acf0f4084..6c27bc4ec7 100644 --- a/backend/src/main/java/io/metersphere/api/controller/ApiTestEnvironmentController.java +++ b/backend/src/main/java/io/metersphere/api/controller/ApiTestEnvironmentController.java @@ -8,14 +8,11 @@ import io.metersphere.api.service.ApiTestEnvironmentService; import io.metersphere.api.service.CommandService; import io.metersphere.base.domain.ApiTestEnvironmentWithBLOBs; import io.metersphere.commons.constants.OperLogConstants; -import io.metersphere.commons.constants.RoleConstants; import io.metersphere.commons.utils.PageUtils; import io.metersphere.commons.utils.Pager; import io.metersphere.controller.request.EnvironmentRequest; import io.metersphere.log.annotation.MsAuditLog; import io.metersphere.service.CheckPermissionService; -import org.apache.shiro.authz.annotation.Logical; -import org.apache.shiro.authz.annotation.RequiresRoles; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; diff --git a/backend/src/main/java/io/metersphere/api/service/ApiScenarioReportService.java b/backend/src/main/java/io/metersphere/api/service/ApiScenarioReportService.java index 7d0d7177f2..11bfd9d106 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiScenarioReportService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiScenarioReportService.java @@ -20,16 +20,15 @@ import io.metersphere.api.jmeter.ReportCounter; import io.metersphere.api.jmeter.ScenarioResult; import io.metersphere.api.jmeter.TestResult; import io.metersphere.base.domain.*; -import io.metersphere.base.mapper.ApiScenarioMapper; -import io.metersphere.base.mapper.ApiScenarioReportDetailMapper; -import io.metersphere.base.mapper.ApiScenarioReportMapper; -import io.metersphere.base.mapper.TestPlanApiScenarioMapper; +import io.metersphere.base.mapper.*; import io.metersphere.base.mapper.ext.ExtApiScenarioReportDetailMapper; import io.metersphere.base.mapper.ext.ExtApiScenarioReportMapper; -import io.metersphere.base.mapper.ext.ExtProjectMapper; import io.metersphere.commons.constants.*; import io.metersphere.commons.exception.MSException; -import io.metersphere.commons.utils.*; +import io.metersphere.commons.utils.DateUtils; +import io.metersphere.commons.utils.LogUtil; +import io.metersphere.commons.utils.ServiceUtils; +import io.metersphere.commons.utils.SessionUtils; import io.metersphere.dto.ApiReportCountDTO; import io.metersphere.dto.NodeDTO; import io.metersphere.dto.UserDTO; @@ -84,7 +83,7 @@ public class ApiScenarioReportService { @Resource private UserService userService; @Resource - private ExtProjectMapper extProjectMapper; + private ProjectMapper projectMapper; public ApiScenarioReport complete(TestResult result, String runMode) { // 更新场景 @@ -648,8 +647,8 @@ public class ApiScenarioReportService { .event(event) .build(); - Organization organization = extProjectMapper.getOrganizationByProjectId(scenario.getProjectId()); - noticeSendService.send(organization, NoticeConstants.TaskType.API_AUTOMATION_TASK, noticeModel); + Project project = projectMapper.selectByPrimaryKey(scenario.getProjectId()); + noticeSendService.send(project, NoticeConstants.TaskType.API_AUTOMATION_TASK, noticeModel); } public String update(APIScenarioReportResult test) { diff --git a/backend/src/main/java/io/metersphere/api/service/EsbImportService.java b/backend/src/main/java/io/metersphere/api/service/EsbImportService.java index 7c8b0ee971..8ef110c14b 100644 --- a/backend/src/main/java/io/metersphere/api/service/EsbImportService.java +++ b/backend/src/main/java/io/metersphere/api/service/EsbImportService.java @@ -54,18 +54,14 @@ public class EsbImportService { } data.setUserIsAdmin(Translator.get("options_no")); data.setUserIsTester(Translator.get("options_no")); - data.setUserIsOrgMember(Translator.get("options_no")); data.setUserIsViewer(Translator.get("options_no")); data.setUserIsTestManager(Translator.get("options_no")); - data.setUserIsOrgAdmin(Translator.get("options_yes")); - data.setOrgAdminOrganization(workspace); list.add(data); } list.add(new UserExcelData()); UserExcelData explain = new UserExcelData(); explain.setName(Translator.get("do_not_modify_header_order")); - explain.setOrgAdminOrganization("多个工作空间请换行展示"); list.add(explain); return list; } diff --git a/backend/src/main/java/io/metersphere/api/service/TestResultService.java b/backend/src/main/java/io/metersphere/api/service/TestResultService.java index 6b85572fc1..da9992790c 100644 --- a/backend/src/main/java/io/metersphere/api/service/TestResultService.java +++ b/backend/src/main/java/io/metersphere/api/service/TestResultService.java @@ -153,7 +153,7 @@ public class TestResultService { if (reportTask != null) { if (StringUtils.equals(ReportTriggerMode.API.name(), reportTask.getTriggerMode()) || StringUtils.equals(ReportTriggerMode.SCHEDULE.name(), reportTask.getTriggerMode())) { - sendTask(reportTask, reportUrl, testResult); + sendTask(reportTask, testResult); } } } catch (Exception e) { @@ -194,7 +194,7 @@ public class TestResultService { } } - private void sendTask(ApiTestReportVariable report, String reportUrl, TestResult testResult) { + private void sendTask(ApiTestReportVariable report, TestResult testResult) { if (report == null) { return; } @@ -203,21 +203,17 @@ public class TestResultService { assert systemParameterService != null; assert noticeSendService != null; BaseSystemConfigDTO baseSystemConfigDTO = systemParameterService.getBaseInfo(); - String url = baseSystemConfigDTO.getUrl() + "/#/api/report/view/" + report.getId(); - String url2 = baseSystemConfigDTO.getUrl() + "/#/api/automation/report/view/" + report.getId(); + String reportUrl = baseSystemConfigDTO.getUrl() + "/#/api/automation/report/view/" + report.getId(); - String successContext = ""; - String failedContext = ""; String subject = ""; String event = ""; + String successContext = "${operator}执行接口测成功: ${name}" + ", 报告: ${reportUrl}"; + String failedContext = "${operator}执行接口测试失败: ${name}" + ", 报告: ${reportUrl}"; + if (StringUtils.equals(ReportTriggerMode.API.name(), report.getTriggerMode())) { - successContext = "接口测试 API任务通知:jenkins所执行的" + report.getName() + "'执行成功" + "\n" + "执行环境:" + report.getExecutionEnvironment() + "\n" + "[接口定义暂无报告链接]" + "\n" + "请点击下面链接进入测试报告页面" + "\n" + "(旧版)接口测试路径" + url + "\n" + "(新版)接口测试路径" + url2; - failedContext = "接口测试 API任务通知:jenkins所执行的" + report.getName() + "'执行失败" + "\n" + "执行环境:" + report.getExecutionEnvironment() + "\n" + "[接口定义暂无报告链接]" + "\n" + "请点击下面链接进入测试报告页面" + "\n" + "(旧版)接口测试路径" + url + "\n" + "(新版)接口测试路径" + url2; subject = Translator.get("task_notification_jenkins"); } if (StringUtils.equals(ReportTriggerMode.SCHEDULE.name(), report.getTriggerMode())) { - successContext = "接口测试定时任务通知:定时任务所执行的" + report.getName() + "'执行成功" + "\n" + "执行环境:" + report.getExecutionEnvironment() + "\n" + "[接口定义暂无报告链接]" + "\n" + "请点击下面链接进入测试报告页面" + "\n" + "(旧版)接口测试路径" + url + "\n" + "(新版)接口测试路径" + url2; - failedContext = "接口测试定时任务通知:定时任务所执行的" + report.getName() + "'执行失败" + "\n" + "执行环境:" + report.getExecutionEnvironment() + "\n" + "[接口定义暂无报告链接]" + "\n" + "请点击下面链接进入测试报告页面" + "\n" + "(旧版)接口测试路径" + url + "\n" + "(新版)接口测试路径" + url2; subject = Translator.get("task_notification"); } if (StringUtils.equals("Success", report.getStatus())) { @@ -235,6 +231,7 @@ public class TestResultService { Map paramMap = new HashMap<>(); paramMap.put("type", "api"); paramMap.put("url", baseSystemConfigDTO.getUrl()); + paramMap.put("reportUrl", reportUrl); paramMap.put("operator", report.getExecutor()); paramMap.putAll(new BeanMap(report)); NoticeModel noticeModel = NoticeModel.builder() diff --git a/backend/src/main/java/io/metersphere/base/domain/MessageTask.java b/backend/src/main/java/io/metersphere/base/domain/MessageTask.java index 03866ff546..8e3953f7ec 100644 --- a/backend/src/main/java/io/metersphere/base/domain/MessageTask.java +++ b/backend/src/main/java/io/metersphere/base/domain/MessageTask.java @@ -1,8 +1,7 @@ package io.metersphere.base.domain; -import lombok.Data; - import java.io.Serializable; +import lombok.Data; @Data public class MessageTask implements Serializable { @@ -22,12 +21,12 @@ public class MessageTask implements Serializable { private Boolean isSet; - private String organizationId; - private String testId; private Long createTime; + private String workspaceId; + private String template; private static final long serialVersionUID = 1L; diff --git a/backend/src/main/java/io/metersphere/base/domain/MessageTaskExample.java b/backend/src/main/java/io/metersphere/base/domain/MessageTaskExample.java index fa4f63c284..8e2761b7f2 100644 --- a/backend/src/main/java/io/metersphere/base/domain/MessageTaskExample.java +++ b/backend/src/main/java/io/metersphere/base/domain/MessageTaskExample.java @@ -654,76 +654,6 @@ public class MessageTaskExample { return (Criteria) this; } - public Criteria andOrganizationIdIsNull() { - addCriterion("organization_id is null"); - return (Criteria) this; - } - - public Criteria andOrganizationIdIsNotNull() { - addCriterion("organization_id is not null"); - return (Criteria) this; - } - - public Criteria andOrganizationIdEqualTo(String value) { - addCriterion("organization_id =", value, "organizationId"); - return (Criteria) this; - } - - public Criteria andOrganizationIdNotEqualTo(String value) { - addCriterion("organization_id <>", value, "organizationId"); - return (Criteria) this; - } - - public Criteria andOrganizationIdGreaterThan(String value) { - addCriterion("organization_id >", value, "organizationId"); - return (Criteria) this; - } - - public Criteria andOrganizationIdGreaterThanOrEqualTo(String value) { - addCriterion("organization_id >=", value, "organizationId"); - return (Criteria) this; - } - - public Criteria andOrganizationIdLessThan(String value) { - addCriterion("organization_id <", value, "organizationId"); - return (Criteria) this; - } - - public Criteria andOrganizationIdLessThanOrEqualTo(String value) { - addCriterion("organization_id <=", value, "organizationId"); - return (Criteria) this; - } - - public Criteria andOrganizationIdLike(String value) { - addCriterion("organization_id like", value, "organizationId"); - return (Criteria) this; - } - - public Criteria andOrganizationIdNotLike(String value) { - addCriterion("organization_id not like", value, "organizationId"); - return (Criteria) this; - } - - public Criteria andOrganizationIdIn(List values) { - addCriterion("organization_id in", values, "organizationId"); - return (Criteria) this; - } - - public Criteria andOrganizationIdNotIn(List values) { - addCriterion("organization_id not in", values, "organizationId"); - return (Criteria) this; - } - - public Criteria andOrganizationIdBetween(String value1, String value2) { - addCriterion("organization_id between", value1, value2, "organizationId"); - return (Criteria) this; - } - - public Criteria andOrganizationIdNotBetween(String value1, String value2) { - addCriterion("organization_id not between", value1, value2, "organizationId"); - return (Criteria) this; - } - public Criteria andTestIdIsNull() { addCriterion("test_id is null"); return (Criteria) this; @@ -853,6 +783,76 @@ public class MessageTaskExample { addCriterion("create_time not between", value1, value2, "createTime"); return (Criteria) this; } + + public Criteria andWorkspaceIdIsNull() { + addCriterion("workspace_id is null"); + return (Criteria) this; + } + + public Criteria andWorkspaceIdIsNotNull() { + addCriterion("workspace_id is not null"); + return (Criteria) this; + } + + public Criteria andWorkspaceIdEqualTo(String value) { + addCriterion("workspace_id =", value, "workspaceId"); + return (Criteria) this; + } + + public Criteria andWorkspaceIdNotEqualTo(String value) { + addCriterion("workspace_id <>", value, "workspaceId"); + return (Criteria) this; + } + + public Criteria andWorkspaceIdGreaterThan(String value) { + addCriterion("workspace_id >", value, "workspaceId"); + return (Criteria) this; + } + + public Criteria andWorkspaceIdGreaterThanOrEqualTo(String value) { + addCriterion("workspace_id >=", value, "workspaceId"); + return (Criteria) this; + } + + public Criteria andWorkspaceIdLessThan(String value) { + addCriterion("workspace_id <", value, "workspaceId"); + return (Criteria) this; + } + + public Criteria andWorkspaceIdLessThanOrEqualTo(String value) { + addCriterion("workspace_id <=", value, "workspaceId"); + return (Criteria) this; + } + + public Criteria andWorkspaceIdLike(String value) { + addCriterion("workspace_id like", value, "workspaceId"); + return (Criteria) this; + } + + public Criteria andWorkspaceIdNotLike(String value) { + addCriterion("workspace_id not like", value, "workspaceId"); + return (Criteria) this; + } + + public Criteria andWorkspaceIdIn(List values) { + addCriterion("workspace_id in", values, "workspaceId"); + return (Criteria) this; + } + + public Criteria andWorkspaceIdNotIn(List values) { + addCriterion("workspace_id not in", values, "workspaceId"); + return (Criteria) this; + } + + public Criteria andWorkspaceIdBetween(String value1, String value2) { + addCriterion("workspace_id between", value1, value2, "workspaceId"); + return (Criteria) this; + } + + public Criteria andWorkspaceIdNotBetween(String value1, String value2) { + addCriterion("workspace_id not between", value1, value2, "workspaceId"); + return (Criteria) this; + } } public static class Criteria extends GeneratedCriteria { diff --git a/backend/src/main/java/io/metersphere/base/domain/Organization.java b/backend/src/main/java/io/metersphere/base/domain/Organization.java deleted file mode 100644 index 72aeaf092b..0000000000 --- a/backend/src/main/java/io/metersphere/base/domain/Organization.java +++ /dev/null @@ -1,22 +0,0 @@ -package io.metersphere.base.domain; - -import lombok.Data; - -import java.io.Serializable; - -@Data -public class Organization implements Serializable { - private String id; - - private String name; - - private String description; - - private Long createTime; - - private Long updateTime; - - private String createUser; - - private static final long serialVersionUID = 1L; -} \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/base/domain/OrganizationExample.java b/backend/src/main/java/io/metersphere/base/domain/OrganizationExample.java deleted file mode 100644 index 82d48c9760..0000000000 --- a/backend/src/main/java/io/metersphere/base/domain/OrganizationExample.java +++ /dev/null @@ -1,600 +0,0 @@ -package io.metersphere.base.domain; - -import java.util.ArrayList; -import java.util.List; - -public class OrganizationExample { - protected String orderByClause; - - protected boolean distinct; - - protected List oredCriteria; - - public OrganizationExample() { - oredCriteria = new ArrayList(); - } - - public void setOrderByClause(String orderByClause) { - this.orderByClause = orderByClause; - } - - public String getOrderByClause() { - return orderByClause; - } - - public void setDistinct(boolean distinct) { - this.distinct = distinct; - } - - public boolean isDistinct() { - return distinct; - } - - public List getOredCriteria() { - return oredCriteria; - } - - public void or(Criteria criteria) { - oredCriteria.add(criteria); - } - - public Criteria or() { - Criteria criteria = createCriteriaInternal(); - oredCriteria.add(criteria); - return criteria; - } - - public Criteria createCriteria() { - Criteria criteria = createCriteriaInternal(); - if (oredCriteria.size() == 0) { - oredCriteria.add(criteria); - } - return criteria; - } - - protected Criteria createCriteriaInternal() { - Criteria criteria = new Criteria(); - return criteria; - } - - public void clear() { - oredCriteria.clear(); - orderByClause = null; - distinct = false; - } - - protected abstract static class GeneratedCriteria { - protected List criteria; - - protected GeneratedCriteria() { - super(); - criteria = new ArrayList(); - } - - public boolean isValid() { - return criteria.size() > 0; - } - - public List getAllCriteria() { - return criteria; - } - - public List getCriteria() { - return criteria; - } - - protected void addCriterion(String condition) { - if (condition == null) { - throw new RuntimeException("Value for condition cannot be null"); - } - criteria.add(new Criterion(condition)); - } - - protected void addCriterion(String condition, Object value, String property) { - if (value == null) { - throw new RuntimeException("Value for " + property + " cannot be null"); - } - criteria.add(new Criterion(condition, value)); - } - - protected void addCriterion(String condition, Object value1, Object value2, String property) { - if (value1 == null || value2 == null) { - throw new RuntimeException("Between values for " + property + " cannot be null"); - } - criteria.add(new Criterion(condition, value1, value2)); - } - - public Criteria andIdIsNull() { - addCriterion("id is null"); - return (Criteria) this; - } - - public Criteria andIdIsNotNull() { - addCriterion("id is not null"); - return (Criteria) this; - } - - public Criteria andIdEqualTo(String value) { - addCriterion("id =", value, "id"); - return (Criteria) this; - } - - public Criteria andIdNotEqualTo(String value) { - addCriterion("id <>", value, "id"); - return (Criteria) this; - } - - public Criteria andIdGreaterThan(String value) { - addCriterion("id >", value, "id"); - return (Criteria) this; - } - - public Criteria andIdGreaterThanOrEqualTo(String value) { - addCriterion("id >=", value, "id"); - return (Criteria) this; - } - - public Criteria andIdLessThan(String value) { - addCriterion("id <", value, "id"); - return (Criteria) this; - } - - public Criteria andIdLessThanOrEqualTo(String value) { - addCriterion("id <=", value, "id"); - return (Criteria) this; - } - - public Criteria andIdLike(String value) { - addCriterion("id like", value, "id"); - return (Criteria) this; - } - - public Criteria andIdNotLike(String value) { - addCriterion("id not like", value, "id"); - return (Criteria) this; - } - - public Criteria andIdIn(List values) { - addCriterion("id in", values, "id"); - return (Criteria) this; - } - - public Criteria andIdNotIn(List values) { - addCriterion("id not in", values, "id"); - return (Criteria) this; - } - - public Criteria andIdBetween(String value1, String value2) { - addCriterion("id between", value1, value2, "id"); - return (Criteria) this; - } - - public Criteria andIdNotBetween(String value1, String value2) { - addCriterion("id not between", value1, value2, "id"); - return (Criteria) this; - } - - public Criteria andNameIsNull() { - addCriterion("`name` is null"); - return (Criteria) this; - } - - public Criteria andNameIsNotNull() { - addCriterion("`name` is not null"); - return (Criteria) this; - } - - public Criteria andNameEqualTo(String value) { - addCriterion("`name` =", value, "name"); - return (Criteria) this; - } - - public Criteria andNameNotEqualTo(String value) { - addCriterion("`name` <>", value, "name"); - return (Criteria) this; - } - - public Criteria andNameGreaterThan(String value) { - addCriterion("`name` >", value, "name"); - return (Criteria) this; - } - - public Criteria andNameGreaterThanOrEqualTo(String value) { - addCriterion("`name` >=", value, "name"); - return (Criteria) this; - } - - public Criteria andNameLessThan(String value) { - addCriterion("`name` <", value, "name"); - return (Criteria) this; - } - - public Criteria andNameLessThanOrEqualTo(String value) { - addCriterion("`name` <=", value, "name"); - return (Criteria) this; - } - - public Criteria andNameLike(String value) { - addCriterion("`name` like", value, "name"); - return (Criteria) this; - } - - public Criteria andNameNotLike(String value) { - addCriterion("`name` not like", value, "name"); - return (Criteria) this; - } - - public Criteria andNameIn(List values) { - addCriterion("`name` in", values, "name"); - return (Criteria) this; - } - - public Criteria andNameNotIn(List values) { - addCriterion("`name` not in", values, "name"); - return (Criteria) this; - } - - public Criteria andNameBetween(String value1, String value2) { - addCriterion("`name` between", value1, value2, "name"); - return (Criteria) this; - } - - public Criteria andNameNotBetween(String value1, String value2) { - addCriterion("`name` not between", value1, value2, "name"); - return (Criteria) this; - } - - public Criteria andDescriptionIsNull() { - addCriterion("description is null"); - return (Criteria) this; - } - - public Criteria andDescriptionIsNotNull() { - addCriterion("description is not null"); - return (Criteria) this; - } - - public Criteria andDescriptionEqualTo(String value) { - addCriterion("description =", value, "description"); - return (Criteria) this; - } - - public Criteria andDescriptionNotEqualTo(String value) { - addCriterion("description <>", value, "description"); - return (Criteria) this; - } - - public Criteria andDescriptionGreaterThan(String value) { - addCriterion("description >", value, "description"); - return (Criteria) this; - } - - public Criteria andDescriptionGreaterThanOrEqualTo(String value) { - addCriterion("description >=", value, "description"); - return (Criteria) this; - } - - public Criteria andDescriptionLessThan(String value) { - addCriterion("description <", value, "description"); - return (Criteria) this; - } - - public Criteria andDescriptionLessThanOrEqualTo(String value) { - addCriterion("description <=", value, "description"); - return (Criteria) this; - } - - public Criteria andDescriptionLike(String value) { - addCriterion("description like", value, "description"); - return (Criteria) this; - } - - public Criteria andDescriptionNotLike(String value) { - addCriterion("description not like", value, "description"); - return (Criteria) this; - } - - public Criteria andDescriptionIn(List values) { - addCriterion("description in", values, "description"); - return (Criteria) this; - } - - public Criteria andDescriptionNotIn(List values) { - addCriterion("description not in", values, "description"); - return (Criteria) this; - } - - public Criteria andDescriptionBetween(String value1, String value2) { - addCriterion("description between", value1, value2, "description"); - return (Criteria) this; - } - - public Criteria andDescriptionNotBetween(String value1, String value2) { - addCriterion("description not between", value1, value2, "description"); - return (Criteria) this; - } - - public Criteria andCreateTimeIsNull() { - addCriterion("create_time is null"); - return (Criteria) this; - } - - public Criteria andCreateTimeIsNotNull() { - addCriterion("create_time is not null"); - return (Criteria) this; - } - - public Criteria andCreateTimeEqualTo(Long value) { - addCriterion("create_time =", value, "createTime"); - return (Criteria) this; - } - - public Criteria andCreateTimeNotEqualTo(Long value) { - addCriterion("create_time <>", value, "createTime"); - return (Criteria) this; - } - - public Criteria andCreateTimeGreaterThan(Long value) { - addCriterion("create_time >", value, "createTime"); - return (Criteria) this; - } - - public Criteria andCreateTimeGreaterThanOrEqualTo(Long value) { - addCriterion("create_time >=", value, "createTime"); - return (Criteria) this; - } - - public Criteria andCreateTimeLessThan(Long value) { - addCriterion("create_time <", value, "createTime"); - return (Criteria) this; - } - - public Criteria andCreateTimeLessThanOrEqualTo(Long value) { - addCriterion("create_time <=", value, "createTime"); - return (Criteria) this; - } - - public Criteria andCreateTimeIn(List values) { - addCriterion("create_time in", values, "createTime"); - return (Criteria) this; - } - - public Criteria andCreateTimeNotIn(List values) { - addCriterion("create_time not in", values, "createTime"); - return (Criteria) this; - } - - public Criteria andCreateTimeBetween(Long value1, Long value2) { - addCriterion("create_time between", value1, value2, "createTime"); - return (Criteria) this; - } - - public Criteria andCreateTimeNotBetween(Long value1, Long value2) { - addCriterion("create_time not between", value1, value2, "createTime"); - return (Criteria) this; - } - - public Criteria andUpdateTimeIsNull() { - addCriterion("update_time is null"); - return (Criteria) this; - } - - public Criteria andUpdateTimeIsNotNull() { - addCriterion("update_time is not null"); - return (Criteria) this; - } - - public Criteria andUpdateTimeEqualTo(Long value) { - addCriterion("update_time =", value, "updateTime"); - return (Criteria) this; - } - - public Criteria andUpdateTimeNotEqualTo(Long value) { - addCriterion("update_time <>", value, "updateTime"); - return (Criteria) this; - } - - public Criteria andUpdateTimeGreaterThan(Long value) { - addCriterion("update_time >", value, "updateTime"); - return (Criteria) this; - } - - public Criteria andUpdateTimeGreaterThanOrEqualTo(Long value) { - addCriterion("update_time >=", value, "updateTime"); - return (Criteria) this; - } - - public Criteria andUpdateTimeLessThan(Long value) { - addCriterion("update_time <", value, "updateTime"); - return (Criteria) this; - } - - public Criteria andUpdateTimeLessThanOrEqualTo(Long value) { - addCriterion("update_time <=", value, "updateTime"); - return (Criteria) this; - } - - public Criteria andUpdateTimeIn(List values) { - addCriterion("update_time in", values, "updateTime"); - return (Criteria) this; - } - - public Criteria andUpdateTimeNotIn(List values) { - addCriterion("update_time not in", values, "updateTime"); - return (Criteria) this; - } - - public Criteria andUpdateTimeBetween(Long value1, Long value2) { - addCriterion("update_time between", value1, value2, "updateTime"); - return (Criteria) this; - } - - public Criteria andUpdateTimeNotBetween(Long value1, Long value2) { - addCriterion("update_time not between", value1, value2, "updateTime"); - return (Criteria) this; - } - - public Criteria andCreateUserIsNull() { - addCriterion("create_user is null"); - return (Criteria) this; - } - - public Criteria andCreateUserIsNotNull() { - addCriterion("create_user is not null"); - return (Criteria) this; - } - - public Criteria andCreateUserEqualTo(String value) { - addCriterion("create_user =", value, "createUser"); - return (Criteria) this; - } - - public Criteria andCreateUserNotEqualTo(String value) { - addCriterion("create_user <>", value, "createUser"); - return (Criteria) this; - } - - public Criteria andCreateUserGreaterThan(String value) { - addCriterion("create_user >", value, "createUser"); - return (Criteria) this; - } - - public Criteria andCreateUserGreaterThanOrEqualTo(String value) { - addCriterion("create_user >=", value, "createUser"); - return (Criteria) this; - } - - public Criteria andCreateUserLessThan(String value) { - addCriterion("create_user <", value, "createUser"); - return (Criteria) this; - } - - public Criteria andCreateUserLessThanOrEqualTo(String value) { - addCriterion("create_user <=", value, "createUser"); - return (Criteria) this; - } - - public Criteria andCreateUserLike(String value) { - addCriterion("create_user like", value, "createUser"); - return (Criteria) this; - } - - public Criteria andCreateUserNotLike(String value) { - addCriterion("create_user not like", value, "createUser"); - return (Criteria) this; - } - - public Criteria andCreateUserIn(List values) { - addCriterion("create_user in", values, "createUser"); - return (Criteria) this; - } - - public Criteria andCreateUserNotIn(List values) { - addCriterion("create_user not in", values, "createUser"); - return (Criteria) this; - } - - public Criteria andCreateUserBetween(String value1, String value2) { - addCriterion("create_user between", value1, value2, "createUser"); - return (Criteria) this; - } - - public Criteria andCreateUserNotBetween(String value1, String value2) { - addCriterion("create_user not between", value1, value2, "createUser"); - return (Criteria) this; - } - } - - public static class Criteria extends GeneratedCriteria { - - protected Criteria() { - super(); - } - } - - public static class Criterion { - private String condition; - - private Object value; - - private Object secondValue; - - private boolean noValue; - - private boolean singleValue; - - private boolean betweenValue; - - private boolean listValue; - - private String typeHandler; - - public String getCondition() { - return condition; - } - - public Object getValue() { - return value; - } - - public Object getSecondValue() { - return secondValue; - } - - public boolean isNoValue() { - return noValue; - } - - public boolean isSingleValue() { - return singleValue; - } - - public boolean isBetweenValue() { - return betweenValue; - } - - public boolean isListValue() { - return listValue; - } - - public String getTypeHandler() { - return typeHandler; - } - - protected Criterion(String condition) { - super(); - this.condition = condition; - this.typeHandler = null; - this.noValue = true; - } - - protected Criterion(String condition, Object value, String typeHandler) { - super(); - this.condition = condition; - this.value = value; - this.typeHandler = typeHandler; - if (value instanceof List) { - this.listValue = true; - } else { - this.singleValue = true; - } - } - - protected Criterion(String condition, Object value) { - this(condition, value, null); - } - - protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { - super(); - this.condition = condition; - this.value = value; - this.secondValue = secondValue; - this.typeHandler = typeHandler; - this.betweenValue = true; - } - - protected Criterion(String condition, Object value, Object secondValue) { - this(condition, value, secondValue, null); - } - } -} \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/base/domain/Quota.java b/backend/src/main/java/io/metersphere/base/domain/Quota.java index 578d59f8ca..0bc5f56b67 100644 --- a/backend/src/main/java/io/metersphere/base/domain/Quota.java +++ b/backend/src/main/java/io/metersphere/base/domain/Quota.java @@ -17,8 +17,6 @@ public class Quota implements Serializable { private String resourcePool; - private String organizationId; - private String workspaceId; private Boolean useDefault; diff --git a/backend/src/main/java/io/metersphere/base/domain/QuotaExample.java b/backend/src/main/java/io/metersphere/base/domain/QuotaExample.java index c9f47fdc7c..1611150bd0 100644 --- a/backend/src/main/java/io/metersphere/base/domain/QuotaExample.java +++ b/backend/src/main/java/io/metersphere/base/domain/QuotaExample.java @@ -484,76 +484,6 @@ public class QuotaExample { return (Criteria) this; } - public Criteria andOrganizationIdIsNull() { - addCriterion("organization_id is null"); - return (Criteria) this; - } - - public Criteria andOrganizationIdIsNotNull() { - addCriterion("organization_id is not null"); - return (Criteria) this; - } - - public Criteria andOrganizationIdEqualTo(String value) { - addCriterion("organization_id =", value, "organizationId"); - return (Criteria) this; - } - - public Criteria andOrganizationIdNotEqualTo(String value) { - addCriterion("organization_id <>", value, "organizationId"); - return (Criteria) this; - } - - public Criteria andOrganizationIdGreaterThan(String value) { - addCriterion("organization_id >", value, "organizationId"); - return (Criteria) this; - } - - public Criteria andOrganizationIdGreaterThanOrEqualTo(String value) { - addCriterion("organization_id >=", value, "organizationId"); - return (Criteria) this; - } - - public Criteria andOrganizationIdLessThan(String value) { - addCriterion("organization_id <", value, "organizationId"); - return (Criteria) this; - } - - public Criteria andOrganizationIdLessThanOrEqualTo(String value) { - addCriterion("organization_id <=", value, "organizationId"); - return (Criteria) this; - } - - public Criteria andOrganizationIdLike(String value) { - addCriterion("organization_id like", value, "organizationId"); - return (Criteria) this; - } - - public Criteria andOrganizationIdNotLike(String value) { - addCriterion("organization_id not like", value, "organizationId"); - return (Criteria) this; - } - - public Criteria andOrganizationIdIn(List values) { - addCriterion("organization_id in", values, "organizationId"); - return (Criteria) this; - } - - public Criteria andOrganizationIdNotIn(List values) { - addCriterion("organization_id not in", values, "organizationId"); - return (Criteria) this; - } - - public Criteria andOrganizationIdBetween(String value1, String value2) { - addCriterion("organization_id between", value1, value2, "organizationId"); - return (Criteria) this; - } - - public Criteria andOrganizationIdNotBetween(String value1, String value2) { - addCriterion("organization_id not between", value1, value2, "organizationId"); - return (Criteria) this; - } - public Criteria andWorkspaceIdIsNull() { addCriterion("workspace_id is null"); return (Criteria) this; diff --git a/backend/src/main/java/io/metersphere/base/domain/Role.java b/backend/src/main/java/io/metersphere/base/domain/Role.java deleted file mode 100644 index b2ecae0b96..0000000000 --- a/backend/src/main/java/io/metersphere/base/domain/Role.java +++ /dev/null @@ -1,22 +0,0 @@ -package io.metersphere.base.domain; - -import lombok.Data; - -import java.io.Serializable; - -@Data -public class Role implements Serializable { - private String id; - - private String name; - - private String description; - - private String type; - - private Long createTime; - - private Long updateTime; - - private static final long serialVersionUID = 1L; -} \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/base/domain/RoleExample.java b/backend/src/main/java/io/metersphere/base/domain/RoleExample.java deleted file mode 100644 index f7fb4e9cdc..0000000000 --- a/backend/src/main/java/io/metersphere/base/domain/RoleExample.java +++ /dev/null @@ -1,600 +0,0 @@ -package io.metersphere.base.domain; - -import java.util.ArrayList; -import java.util.List; - -public class RoleExample { - protected String orderByClause; - - protected boolean distinct; - - protected List oredCriteria; - - public RoleExample() { - oredCriteria = new ArrayList(); - } - - public void setOrderByClause(String orderByClause) { - this.orderByClause = orderByClause; - } - - public String getOrderByClause() { - return orderByClause; - } - - public void setDistinct(boolean distinct) { - this.distinct = distinct; - } - - public boolean isDistinct() { - return distinct; - } - - public List getOredCriteria() { - return oredCriteria; - } - - public void or(Criteria criteria) { - oredCriteria.add(criteria); - } - - public Criteria or() { - Criteria criteria = createCriteriaInternal(); - oredCriteria.add(criteria); - return criteria; - } - - public Criteria createCriteria() { - Criteria criteria = createCriteriaInternal(); - if (oredCriteria.size() == 0) { - oredCriteria.add(criteria); - } - return criteria; - } - - protected Criteria createCriteriaInternal() { - Criteria criteria = new Criteria(); - return criteria; - } - - public void clear() { - oredCriteria.clear(); - orderByClause = null; - distinct = false; - } - - protected abstract static class GeneratedCriteria { - protected List criteria; - - protected GeneratedCriteria() { - super(); - criteria = new ArrayList(); - } - - public boolean isValid() { - return criteria.size() > 0; - } - - public List getAllCriteria() { - return criteria; - } - - public List getCriteria() { - return criteria; - } - - protected void addCriterion(String condition) { - if (condition == null) { - throw new RuntimeException("Value for condition cannot be null"); - } - criteria.add(new Criterion(condition)); - } - - protected void addCriterion(String condition, Object value, String property) { - if (value == null) { - throw new RuntimeException("Value for " + property + " cannot be null"); - } - criteria.add(new Criterion(condition, value)); - } - - protected void addCriterion(String condition, Object value1, Object value2, String property) { - if (value1 == null || value2 == null) { - throw new RuntimeException("Between values for " + property + " cannot be null"); - } - criteria.add(new Criterion(condition, value1, value2)); - } - - public Criteria andIdIsNull() { - addCriterion("id is null"); - return (Criteria) this; - } - - public Criteria andIdIsNotNull() { - addCriterion("id is not null"); - return (Criteria) this; - } - - public Criteria andIdEqualTo(String value) { - addCriterion("id =", value, "id"); - return (Criteria) this; - } - - public Criteria andIdNotEqualTo(String value) { - addCriterion("id <>", value, "id"); - return (Criteria) this; - } - - public Criteria andIdGreaterThan(String value) { - addCriterion("id >", value, "id"); - return (Criteria) this; - } - - public Criteria andIdGreaterThanOrEqualTo(String value) { - addCriterion("id >=", value, "id"); - return (Criteria) this; - } - - public Criteria andIdLessThan(String value) { - addCriterion("id <", value, "id"); - return (Criteria) this; - } - - public Criteria andIdLessThanOrEqualTo(String value) { - addCriterion("id <=", value, "id"); - return (Criteria) this; - } - - public Criteria andIdLike(String value) { - addCriterion("id like", value, "id"); - return (Criteria) this; - } - - public Criteria andIdNotLike(String value) { - addCriterion("id not like", value, "id"); - return (Criteria) this; - } - - public Criteria andIdIn(List values) { - addCriterion("id in", values, "id"); - return (Criteria) this; - } - - public Criteria andIdNotIn(List values) { - addCriterion("id not in", values, "id"); - return (Criteria) this; - } - - public Criteria andIdBetween(String value1, String value2) { - addCriterion("id between", value1, value2, "id"); - return (Criteria) this; - } - - public Criteria andIdNotBetween(String value1, String value2) { - addCriterion("id not between", value1, value2, "id"); - return (Criteria) this; - } - - public Criteria andNameIsNull() { - addCriterion("name is null"); - return (Criteria) this; - } - - public Criteria andNameIsNotNull() { - addCriterion("name is not null"); - return (Criteria) this; - } - - public Criteria andNameEqualTo(String value) { - addCriterion("name =", value, "name"); - return (Criteria) this; - } - - public Criteria andNameNotEqualTo(String value) { - addCriterion("name <>", value, "name"); - return (Criteria) this; - } - - public Criteria andNameGreaterThan(String value) { - addCriterion("name >", value, "name"); - return (Criteria) this; - } - - public Criteria andNameGreaterThanOrEqualTo(String value) { - addCriterion("name >=", value, "name"); - return (Criteria) this; - } - - public Criteria andNameLessThan(String value) { - addCriterion("name <", value, "name"); - return (Criteria) this; - } - - public Criteria andNameLessThanOrEqualTo(String value) { - addCriterion("name <=", value, "name"); - return (Criteria) this; - } - - public Criteria andNameLike(String value) { - addCriterion("name like", value, "name"); - return (Criteria) this; - } - - public Criteria andNameNotLike(String value) { - addCriterion("name not like", value, "name"); - return (Criteria) this; - } - - public Criteria andNameIn(List values) { - addCriterion("name in", values, "name"); - return (Criteria) this; - } - - public Criteria andNameNotIn(List values) { - addCriterion("name not in", values, "name"); - return (Criteria) this; - } - - public Criteria andNameBetween(String value1, String value2) { - addCriterion("name between", value1, value2, "name"); - return (Criteria) this; - } - - public Criteria andNameNotBetween(String value1, String value2) { - addCriterion("name not between", value1, value2, "name"); - return (Criteria) this; - } - - public Criteria andDescriptionIsNull() { - addCriterion("description is null"); - return (Criteria) this; - } - - public Criteria andDescriptionIsNotNull() { - addCriterion("description is not null"); - return (Criteria) this; - } - - public Criteria andDescriptionEqualTo(String value) { - addCriterion("description =", value, "description"); - return (Criteria) this; - } - - public Criteria andDescriptionNotEqualTo(String value) { - addCriterion("description <>", value, "description"); - return (Criteria) this; - } - - public Criteria andDescriptionGreaterThan(String value) { - addCriterion("description >", value, "description"); - return (Criteria) this; - } - - public Criteria andDescriptionGreaterThanOrEqualTo(String value) { - addCriterion("description >=", value, "description"); - return (Criteria) this; - } - - public Criteria andDescriptionLessThan(String value) { - addCriterion("description <", value, "description"); - return (Criteria) this; - } - - public Criteria andDescriptionLessThanOrEqualTo(String value) { - addCriterion("description <=", value, "description"); - return (Criteria) this; - } - - public Criteria andDescriptionLike(String value) { - addCriterion("description like", value, "description"); - return (Criteria) this; - } - - public Criteria andDescriptionNotLike(String value) { - addCriterion("description not like", value, "description"); - return (Criteria) this; - } - - public Criteria andDescriptionIn(List values) { - addCriterion("description in", values, "description"); - return (Criteria) this; - } - - public Criteria andDescriptionNotIn(List values) { - addCriterion("description not in", values, "description"); - return (Criteria) this; - } - - public Criteria andDescriptionBetween(String value1, String value2) { - addCriterion("description between", value1, value2, "description"); - return (Criteria) this; - } - - public Criteria andDescriptionNotBetween(String value1, String value2) { - addCriterion("description not between", value1, value2, "description"); - return (Criteria) this; - } - - public Criteria andTypeIsNull() { - addCriterion("type is null"); - return (Criteria) this; - } - - public Criteria andTypeIsNotNull() { - addCriterion("type is not null"); - return (Criteria) this; - } - - public Criteria andTypeEqualTo(String value) { - addCriterion("type =", value, "type"); - return (Criteria) this; - } - - public Criteria andTypeNotEqualTo(String value) { - addCriterion("type <>", value, "type"); - return (Criteria) this; - } - - public Criteria andTypeGreaterThan(String value) { - addCriterion("type >", value, "type"); - return (Criteria) this; - } - - public Criteria andTypeGreaterThanOrEqualTo(String value) { - addCriterion("type >=", value, "type"); - return (Criteria) this; - } - - public Criteria andTypeLessThan(String value) { - addCriterion("type <", value, "type"); - return (Criteria) this; - } - - public Criteria andTypeLessThanOrEqualTo(String value) { - addCriterion("type <=", value, "type"); - return (Criteria) this; - } - - public Criteria andTypeLike(String value) { - addCriterion("type like", value, "type"); - return (Criteria) this; - } - - public Criteria andTypeNotLike(String value) { - addCriterion("type not like", value, "type"); - return (Criteria) this; - } - - public Criteria andTypeIn(List values) { - addCriterion("type in", values, "type"); - return (Criteria) this; - } - - public Criteria andTypeNotIn(List values) { - addCriterion("type not in", values, "type"); - return (Criteria) this; - } - - public Criteria andTypeBetween(String value1, String value2) { - addCriterion("type between", value1, value2, "type"); - return (Criteria) this; - } - - public Criteria andTypeNotBetween(String value1, String value2) { - addCriterion("type not between", value1, value2, "type"); - return (Criteria) this; - } - - public Criteria andCreateTimeIsNull() { - addCriterion("create_time is null"); - return (Criteria) this; - } - - public Criteria andCreateTimeIsNotNull() { - addCriterion("create_time is not null"); - return (Criteria) this; - } - - public Criteria andCreateTimeEqualTo(Long value) { - addCriterion("create_time =", value, "createTime"); - return (Criteria) this; - } - - public Criteria andCreateTimeNotEqualTo(Long value) { - addCriterion("create_time <>", value, "createTime"); - return (Criteria) this; - } - - public Criteria andCreateTimeGreaterThan(Long value) { - addCriterion("create_time >", value, "createTime"); - return (Criteria) this; - } - - public Criteria andCreateTimeGreaterThanOrEqualTo(Long value) { - addCriterion("create_time >=", value, "createTime"); - return (Criteria) this; - } - - public Criteria andCreateTimeLessThan(Long value) { - addCriterion("create_time <", value, "createTime"); - return (Criteria) this; - } - - public Criteria andCreateTimeLessThanOrEqualTo(Long value) { - addCriterion("create_time <=", value, "createTime"); - return (Criteria) this; - } - - public Criteria andCreateTimeIn(List values) { - addCriterion("create_time in", values, "createTime"); - return (Criteria) this; - } - - public Criteria andCreateTimeNotIn(List values) { - addCriterion("create_time not in", values, "createTime"); - return (Criteria) this; - } - - public Criteria andCreateTimeBetween(Long value1, Long value2) { - addCriterion("create_time between", value1, value2, "createTime"); - return (Criteria) this; - } - - public Criteria andCreateTimeNotBetween(Long value1, Long value2) { - addCriterion("create_time not between", value1, value2, "createTime"); - return (Criteria) this; - } - - public Criteria andUpdateTimeIsNull() { - addCriterion("update_time is null"); - return (Criteria) this; - } - - public Criteria andUpdateTimeIsNotNull() { - addCriterion("update_time is not null"); - return (Criteria) this; - } - - public Criteria andUpdateTimeEqualTo(Long value) { - addCriterion("update_time =", value, "updateTime"); - return (Criteria) this; - } - - public Criteria andUpdateTimeNotEqualTo(Long value) { - addCriterion("update_time <>", value, "updateTime"); - return (Criteria) this; - } - - public Criteria andUpdateTimeGreaterThan(Long value) { - addCriterion("update_time >", value, "updateTime"); - return (Criteria) this; - } - - public Criteria andUpdateTimeGreaterThanOrEqualTo(Long value) { - addCriterion("update_time >=", value, "updateTime"); - return (Criteria) this; - } - - public Criteria andUpdateTimeLessThan(Long value) { - addCriterion("update_time <", value, "updateTime"); - return (Criteria) this; - } - - public Criteria andUpdateTimeLessThanOrEqualTo(Long value) { - addCriterion("update_time <=", value, "updateTime"); - return (Criteria) this; - } - - public Criteria andUpdateTimeIn(List values) { - addCriterion("update_time in", values, "updateTime"); - return (Criteria) this; - } - - public Criteria andUpdateTimeNotIn(List values) { - addCriterion("update_time not in", values, "updateTime"); - return (Criteria) this; - } - - public Criteria andUpdateTimeBetween(Long value1, Long value2) { - addCriterion("update_time between", value1, value2, "updateTime"); - return (Criteria) this; - } - - public Criteria andUpdateTimeNotBetween(Long value1, Long value2) { - addCriterion("update_time not between", value1, value2, "updateTime"); - return (Criteria) this; - } - } - - public static class Criteria extends GeneratedCriteria { - - protected Criteria() { - super(); - } - } - - public static class Criterion { - private String condition; - - private Object value; - - private Object secondValue; - - private boolean noValue; - - private boolean singleValue; - - private boolean betweenValue; - - private boolean listValue; - - private String typeHandler; - - public String getCondition() { - return condition; - } - - public Object getValue() { - return value; - } - - public Object getSecondValue() { - return secondValue; - } - - public boolean isNoValue() { - return noValue; - } - - public boolean isSingleValue() { - return singleValue; - } - - public boolean isBetweenValue() { - return betweenValue; - } - - public boolean isListValue() { - return listValue; - } - - public String getTypeHandler() { - return typeHandler; - } - - protected Criterion(String condition) { - super(); - this.condition = condition; - this.typeHandler = null; - this.noValue = true; - } - - protected Criterion(String condition, Object value, String typeHandler) { - super(); - this.condition = condition; - this.value = value; - this.typeHandler = typeHandler; - if (value instanceof List) { - this.listValue = true; - } else { - this.singleValue = true; - } - } - - protected Criterion(String condition, Object value) { - this(condition, value, null); - } - - protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { - super(); - this.condition = condition; - this.value = value; - this.secondValue = secondValue; - this.typeHandler = typeHandler; - this.betweenValue = true; - } - - protected Criterion(String condition, Object value, Object secondValue) { - this(condition, value, secondValue, null); - } - } -} \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/base/domain/ServiceIntegration.java b/backend/src/main/java/io/metersphere/base/domain/ServiceIntegration.java index 8b4888386b..0ac266739f 100644 --- a/backend/src/main/java/io/metersphere/base/domain/ServiceIntegration.java +++ b/backend/src/main/java/io/metersphere/base/domain/ServiceIntegration.java @@ -7,10 +7,10 @@ import lombok.Data; public class ServiceIntegration implements Serializable { private String id; - private String organizationId; - private String platform; + private String workspaceId; + private String configuration; private static final long serialVersionUID = 1L; diff --git a/backend/src/main/java/io/metersphere/base/domain/ServiceIntegrationExample.java b/backend/src/main/java/io/metersphere/base/domain/ServiceIntegrationExample.java index bae7990cf8..b8f86f35fe 100644 --- a/backend/src/main/java/io/metersphere/base/domain/ServiceIntegrationExample.java +++ b/backend/src/main/java/io/metersphere/base/domain/ServiceIntegrationExample.java @@ -174,76 +174,6 @@ public class ServiceIntegrationExample { return (Criteria) this; } - public Criteria andOrganizationIdIsNull() { - addCriterion("organization_id is null"); - return (Criteria) this; - } - - public Criteria andOrganizationIdIsNotNull() { - addCriterion("organization_id is not null"); - return (Criteria) this; - } - - public Criteria andOrganizationIdEqualTo(String value) { - addCriterion("organization_id =", value, "organizationId"); - return (Criteria) this; - } - - public Criteria andOrganizationIdNotEqualTo(String value) { - addCriterion("organization_id <>", value, "organizationId"); - return (Criteria) this; - } - - public Criteria andOrganizationIdGreaterThan(String value) { - addCriterion("organization_id >", value, "organizationId"); - return (Criteria) this; - } - - public Criteria andOrganizationIdGreaterThanOrEqualTo(String value) { - addCriterion("organization_id >=", value, "organizationId"); - return (Criteria) this; - } - - public Criteria andOrganizationIdLessThan(String value) { - addCriterion("organization_id <", value, "organizationId"); - return (Criteria) this; - } - - public Criteria andOrganizationIdLessThanOrEqualTo(String value) { - addCriterion("organization_id <=", value, "organizationId"); - return (Criteria) this; - } - - public Criteria andOrganizationIdLike(String value) { - addCriterion("organization_id like", value, "organizationId"); - return (Criteria) this; - } - - public Criteria andOrganizationIdNotLike(String value) { - addCriterion("organization_id not like", value, "organizationId"); - return (Criteria) this; - } - - public Criteria andOrganizationIdIn(List values) { - addCriterion("organization_id in", values, "organizationId"); - return (Criteria) this; - } - - public Criteria andOrganizationIdNotIn(List values) { - addCriterion("organization_id not in", values, "organizationId"); - return (Criteria) this; - } - - public Criteria andOrganizationIdBetween(String value1, String value2) { - addCriterion("organization_id between", value1, value2, "organizationId"); - return (Criteria) this; - } - - public Criteria andOrganizationIdNotBetween(String value1, String value2) { - addCriterion("organization_id not between", value1, value2, "organizationId"); - return (Criteria) this; - } - public Criteria andPlatformIsNull() { addCriterion("platform is null"); return (Criteria) this; @@ -313,6 +243,76 @@ public class ServiceIntegrationExample { addCriterion("platform not between", value1, value2, "platform"); return (Criteria) this; } + + public Criteria andWorkspaceIdIsNull() { + addCriterion("workspace_id is null"); + return (Criteria) this; + } + + public Criteria andWorkspaceIdIsNotNull() { + addCriterion("workspace_id is not null"); + return (Criteria) this; + } + + public Criteria andWorkspaceIdEqualTo(String value) { + addCriterion("workspace_id =", value, "workspaceId"); + return (Criteria) this; + } + + public Criteria andWorkspaceIdNotEqualTo(String value) { + addCriterion("workspace_id <>", value, "workspaceId"); + return (Criteria) this; + } + + public Criteria andWorkspaceIdGreaterThan(String value) { + addCriterion("workspace_id >", value, "workspaceId"); + return (Criteria) this; + } + + public Criteria andWorkspaceIdGreaterThanOrEqualTo(String value) { + addCriterion("workspace_id >=", value, "workspaceId"); + return (Criteria) this; + } + + public Criteria andWorkspaceIdLessThan(String value) { + addCriterion("workspace_id <", value, "workspaceId"); + return (Criteria) this; + } + + public Criteria andWorkspaceIdLessThanOrEqualTo(String value) { + addCriterion("workspace_id <=", value, "workspaceId"); + return (Criteria) this; + } + + public Criteria andWorkspaceIdLike(String value) { + addCriterion("workspace_id like", value, "workspaceId"); + return (Criteria) this; + } + + public Criteria andWorkspaceIdNotLike(String value) { + addCriterion("workspace_id not like", value, "workspaceId"); + return (Criteria) this; + } + + public Criteria andWorkspaceIdIn(List values) { + addCriterion("workspace_id in", values, "workspaceId"); + return (Criteria) this; + } + + public Criteria andWorkspaceIdNotIn(List values) { + addCriterion("workspace_id not in", values, "workspaceId"); + return (Criteria) this; + } + + public Criteria andWorkspaceIdBetween(String value1, String value2) { + addCriterion("workspace_id between", value1, value2, "workspaceId"); + return (Criteria) this; + } + + public Criteria andWorkspaceIdNotBetween(String value1, String value2) { + addCriterion("workspace_id not between", value1, value2, "workspaceId"); + return (Criteria) this; + } } public static class Criteria extends GeneratedCriteria { diff --git a/backend/src/main/java/io/metersphere/base/domain/User.java b/backend/src/main/java/io/metersphere/base/domain/User.java index 5f737458c9..a94d3fcd74 100644 --- a/backend/src/main/java/io/metersphere/base/domain/User.java +++ b/backend/src/main/java/io/metersphere/base/domain/User.java @@ -23,8 +23,6 @@ public class User implements Serializable { private String lastWorkspaceId; - private String lastOrganizationId; - private String phone; private String source; diff --git a/backend/src/main/java/io/metersphere/base/domain/UserExample.java b/backend/src/main/java/io/metersphere/base/domain/UserExample.java index 041d091bf9..06ce767c50 100644 --- a/backend/src/main/java/io/metersphere/base/domain/UserExample.java +++ b/backend/src/main/java/io/metersphere/base/domain/UserExample.java @@ -714,76 +714,6 @@ public class UserExample { return (Criteria) this; } - public Criteria andLastOrganizationIdIsNull() { - addCriterion("last_organization_id is null"); - return (Criteria) this; - } - - public Criteria andLastOrganizationIdIsNotNull() { - addCriterion("last_organization_id is not null"); - return (Criteria) this; - } - - public Criteria andLastOrganizationIdEqualTo(String value) { - addCriterion("last_organization_id =", value, "lastOrganizationId"); - return (Criteria) this; - } - - public Criteria andLastOrganizationIdNotEqualTo(String value) { - addCriterion("last_organization_id <>", value, "lastOrganizationId"); - return (Criteria) this; - } - - public Criteria andLastOrganizationIdGreaterThan(String value) { - addCriterion("last_organization_id >", value, "lastOrganizationId"); - return (Criteria) this; - } - - public Criteria andLastOrganizationIdGreaterThanOrEqualTo(String value) { - addCriterion("last_organization_id >=", value, "lastOrganizationId"); - return (Criteria) this; - } - - public Criteria andLastOrganizationIdLessThan(String value) { - addCriterion("last_organization_id <", value, "lastOrganizationId"); - return (Criteria) this; - } - - public Criteria andLastOrganizationIdLessThanOrEqualTo(String value) { - addCriterion("last_organization_id <=", value, "lastOrganizationId"); - return (Criteria) this; - } - - public Criteria andLastOrganizationIdLike(String value) { - addCriterion("last_organization_id like", value, "lastOrganizationId"); - return (Criteria) this; - } - - public Criteria andLastOrganizationIdNotLike(String value) { - addCriterion("last_organization_id not like", value, "lastOrganizationId"); - return (Criteria) this; - } - - public Criteria andLastOrganizationIdIn(List values) { - addCriterion("last_organization_id in", values, "lastOrganizationId"); - return (Criteria) this; - } - - public Criteria andLastOrganizationIdNotIn(List values) { - addCriterion("last_organization_id not in", values, "lastOrganizationId"); - return (Criteria) this; - } - - public Criteria andLastOrganizationIdBetween(String value1, String value2) { - addCriterion("last_organization_id between", value1, value2, "lastOrganizationId"); - return (Criteria) this; - } - - public Criteria andLastOrganizationIdNotBetween(String value1, String value2) { - addCriterion("last_organization_id not between", value1, value2, "lastOrganizationId"); - return (Criteria) this; - } - public Criteria andPhoneIsNull() { addCriterion("phone is null"); return (Criteria) this; diff --git a/backend/src/main/java/io/metersphere/base/domain/UserRole.java b/backend/src/main/java/io/metersphere/base/domain/UserRole.java deleted file mode 100644 index 9b13531750..0000000000 --- a/backend/src/main/java/io/metersphere/base/domain/UserRole.java +++ /dev/null @@ -1,22 +0,0 @@ -package io.metersphere.base.domain; - -import lombok.Data; - -import java.io.Serializable; - -@Data -public class UserRole implements Serializable { - private String id; - - private String userId; - - private String roleId; - - private String sourceId; - - private Long createTime; - - private Long updateTime; - - private static final long serialVersionUID = 1L; -} \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/base/domain/UserRoleExample.java b/backend/src/main/java/io/metersphere/base/domain/UserRoleExample.java deleted file mode 100644 index 00f0ffb78b..0000000000 --- a/backend/src/main/java/io/metersphere/base/domain/UserRoleExample.java +++ /dev/null @@ -1,600 +0,0 @@ -package io.metersphere.base.domain; - -import java.util.ArrayList; -import java.util.List; - -public class UserRoleExample { - protected String orderByClause; - - protected boolean distinct; - - protected List oredCriteria; - - public UserRoleExample() { - oredCriteria = new ArrayList(); - } - - public void setOrderByClause(String orderByClause) { - this.orderByClause = orderByClause; - } - - public String getOrderByClause() { - return orderByClause; - } - - public void setDistinct(boolean distinct) { - this.distinct = distinct; - } - - public boolean isDistinct() { - return distinct; - } - - public List getOredCriteria() { - return oredCriteria; - } - - public void or(Criteria criteria) { - oredCriteria.add(criteria); - } - - public Criteria or() { - Criteria criteria = createCriteriaInternal(); - oredCriteria.add(criteria); - return criteria; - } - - public Criteria createCriteria() { - Criteria criteria = createCriteriaInternal(); - if (oredCriteria.size() == 0) { - oredCriteria.add(criteria); - } - return criteria; - } - - protected Criteria createCriteriaInternal() { - Criteria criteria = new Criteria(); - return criteria; - } - - public void clear() { - oredCriteria.clear(); - orderByClause = null; - distinct = false; - } - - protected abstract static class GeneratedCriteria { - protected List criteria; - - protected GeneratedCriteria() { - super(); - criteria = new ArrayList(); - } - - public boolean isValid() { - return criteria.size() > 0; - } - - public List getAllCriteria() { - return criteria; - } - - public List getCriteria() { - return criteria; - } - - protected void addCriterion(String condition) { - if (condition == null) { - throw new RuntimeException("Value for condition cannot be null"); - } - criteria.add(new Criterion(condition)); - } - - protected void addCriterion(String condition, Object value, String property) { - if (value == null) { - throw new RuntimeException("Value for " + property + " cannot be null"); - } - criteria.add(new Criterion(condition, value)); - } - - protected void addCriterion(String condition, Object value1, Object value2, String property) { - if (value1 == null || value2 == null) { - throw new RuntimeException("Between values for " + property + " cannot be null"); - } - criteria.add(new Criterion(condition, value1, value2)); - } - - public Criteria andIdIsNull() { - addCriterion("id is null"); - return (Criteria) this; - } - - public Criteria andIdIsNotNull() { - addCriterion("id is not null"); - return (Criteria) this; - } - - public Criteria andIdEqualTo(String value) { - addCriterion("id =", value, "id"); - return (Criteria) this; - } - - public Criteria andIdNotEqualTo(String value) { - addCriterion("id <>", value, "id"); - return (Criteria) this; - } - - public Criteria andIdGreaterThan(String value) { - addCriterion("id >", value, "id"); - return (Criteria) this; - } - - public Criteria andIdGreaterThanOrEqualTo(String value) { - addCriterion("id >=", value, "id"); - return (Criteria) this; - } - - public Criteria andIdLessThan(String value) { - addCriterion("id <", value, "id"); - return (Criteria) this; - } - - public Criteria andIdLessThanOrEqualTo(String value) { - addCriterion("id <=", value, "id"); - return (Criteria) this; - } - - public Criteria andIdLike(String value) { - addCriterion("id like", value, "id"); - return (Criteria) this; - } - - public Criteria andIdNotLike(String value) { - addCriterion("id not like", value, "id"); - return (Criteria) this; - } - - public Criteria andIdIn(List values) { - addCriterion("id in", values, "id"); - return (Criteria) this; - } - - public Criteria andIdNotIn(List values) { - addCriterion("id not in", values, "id"); - return (Criteria) this; - } - - public Criteria andIdBetween(String value1, String value2) { - addCriterion("id between", value1, value2, "id"); - return (Criteria) this; - } - - public Criteria andIdNotBetween(String value1, String value2) { - addCriterion("id not between", value1, value2, "id"); - return (Criteria) this; - } - - public Criteria andUserIdIsNull() { - addCriterion("user_id is null"); - return (Criteria) this; - } - - public Criteria andUserIdIsNotNull() { - addCriterion("user_id is not null"); - return (Criteria) this; - } - - public Criteria andUserIdEqualTo(String value) { - addCriterion("user_id =", value, "userId"); - return (Criteria) this; - } - - public Criteria andUserIdNotEqualTo(String value) { - addCriterion("user_id <>", value, "userId"); - return (Criteria) this; - } - - public Criteria andUserIdGreaterThan(String value) { - addCriterion("user_id >", value, "userId"); - return (Criteria) this; - } - - public Criteria andUserIdGreaterThanOrEqualTo(String value) { - addCriterion("user_id >=", value, "userId"); - return (Criteria) this; - } - - public Criteria andUserIdLessThan(String value) { - addCriterion("user_id <", value, "userId"); - return (Criteria) this; - } - - public Criteria andUserIdLessThanOrEqualTo(String value) { - addCriterion("user_id <=", value, "userId"); - return (Criteria) this; - } - - public Criteria andUserIdLike(String value) { - addCriterion("user_id like", value, "userId"); - return (Criteria) this; - } - - public Criteria andUserIdNotLike(String value) { - addCriterion("user_id not like", value, "userId"); - return (Criteria) this; - } - - public Criteria andUserIdIn(List values) { - addCriterion("user_id in", values, "userId"); - return (Criteria) this; - } - - public Criteria andUserIdNotIn(List values) { - addCriterion("user_id not in", values, "userId"); - return (Criteria) this; - } - - public Criteria andUserIdBetween(String value1, String value2) { - addCriterion("user_id between", value1, value2, "userId"); - return (Criteria) this; - } - - public Criteria andUserIdNotBetween(String value1, String value2) { - addCriterion("user_id not between", value1, value2, "userId"); - return (Criteria) this; - } - - public Criteria andRoleIdIsNull() { - addCriterion("role_id is null"); - return (Criteria) this; - } - - public Criteria andRoleIdIsNotNull() { - addCriterion("role_id is not null"); - return (Criteria) this; - } - - public Criteria andRoleIdEqualTo(String value) { - addCriterion("role_id =", value, "roleId"); - return (Criteria) this; - } - - public Criteria andRoleIdNotEqualTo(String value) { - addCriterion("role_id <>", value, "roleId"); - return (Criteria) this; - } - - public Criteria andRoleIdGreaterThan(String value) { - addCriterion("role_id >", value, "roleId"); - return (Criteria) this; - } - - public Criteria andRoleIdGreaterThanOrEqualTo(String value) { - addCriterion("role_id >=", value, "roleId"); - return (Criteria) this; - } - - public Criteria andRoleIdLessThan(String value) { - addCriterion("role_id <", value, "roleId"); - return (Criteria) this; - } - - public Criteria andRoleIdLessThanOrEqualTo(String value) { - addCriterion("role_id <=", value, "roleId"); - return (Criteria) this; - } - - public Criteria andRoleIdLike(String value) { - addCriterion("role_id like", value, "roleId"); - return (Criteria) this; - } - - public Criteria andRoleIdNotLike(String value) { - addCriterion("role_id not like", value, "roleId"); - return (Criteria) this; - } - - public Criteria andRoleIdIn(List values) { - addCriterion("role_id in", values, "roleId"); - return (Criteria) this; - } - - public Criteria andRoleIdNotIn(List values) { - addCriterion("role_id not in", values, "roleId"); - return (Criteria) this; - } - - public Criteria andRoleIdBetween(String value1, String value2) { - addCriterion("role_id between", value1, value2, "roleId"); - return (Criteria) this; - } - - public Criteria andRoleIdNotBetween(String value1, String value2) { - addCriterion("role_id not between", value1, value2, "roleId"); - return (Criteria) this; - } - - public Criteria andSourceIdIsNull() { - addCriterion("source_id is null"); - return (Criteria) this; - } - - public Criteria andSourceIdIsNotNull() { - addCriterion("source_id is not null"); - return (Criteria) this; - } - - public Criteria andSourceIdEqualTo(String value) { - addCriterion("source_id =", value, "sourceId"); - return (Criteria) this; - } - - public Criteria andSourceIdNotEqualTo(String value) { - addCriterion("source_id <>", value, "sourceId"); - return (Criteria) this; - } - - public Criteria andSourceIdGreaterThan(String value) { - addCriterion("source_id >", value, "sourceId"); - return (Criteria) this; - } - - public Criteria andSourceIdGreaterThanOrEqualTo(String value) { - addCriterion("source_id >=", value, "sourceId"); - return (Criteria) this; - } - - public Criteria andSourceIdLessThan(String value) { - addCriterion("source_id <", value, "sourceId"); - return (Criteria) this; - } - - public Criteria andSourceIdLessThanOrEqualTo(String value) { - addCriterion("source_id <=", value, "sourceId"); - return (Criteria) this; - } - - public Criteria andSourceIdLike(String value) { - addCriterion("source_id like", value, "sourceId"); - return (Criteria) this; - } - - public Criteria andSourceIdNotLike(String value) { - addCriterion("source_id not like", value, "sourceId"); - return (Criteria) this; - } - - public Criteria andSourceIdIn(List values) { - addCriterion("source_id in", values, "sourceId"); - return (Criteria) this; - } - - public Criteria andSourceIdNotIn(List values) { - addCriterion("source_id not in", values, "sourceId"); - return (Criteria) this; - } - - public Criteria andSourceIdBetween(String value1, String value2) { - addCriterion("source_id between", value1, value2, "sourceId"); - return (Criteria) this; - } - - public Criteria andSourceIdNotBetween(String value1, String value2) { - addCriterion("source_id not between", value1, value2, "sourceId"); - return (Criteria) this; - } - - public Criteria andCreateTimeIsNull() { - addCriterion("create_time is null"); - return (Criteria) this; - } - - public Criteria andCreateTimeIsNotNull() { - addCriterion("create_time is not null"); - return (Criteria) this; - } - - public Criteria andCreateTimeEqualTo(Long value) { - addCriterion("create_time =", value, "createTime"); - return (Criteria) this; - } - - public Criteria andCreateTimeNotEqualTo(Long value) { - addCriterion("create_time <>", value, "createTime"); - return (Criteria) this; - } - - public Criteria andCreateTimeGreaterThan(Long value) { - addCriterion("create_time >", value, "createTime"); - return (Criteria) this; - } - - public Criteria andCreateTimeGreaterThanOrEqualTo(Long value) { - addCriterion("create_time >=", value, "createTime"); - return (Criteria) this; - } - - public Criteria andCreateTimeLessThan(Long value) { - addCriterion("create_time <", value, "createTime"); - return (Criteria) this; - } - - public Criteria andCreateTimeLessThanOrEqualTo(Long value) { - addCriterion("create_time <=", value, "createTime"); - return (Criteria) this; - } - - public Criteria andCreateTimeIn(List values) { - addCriterion("create_time in", values, "createTime"); - return (Criteria) this; - } - - public Criteria andCreateTimeNotIn(List values) { - addCriterion("create_time not in", values, "createTime"); - return (Criteria) this; - } - - public Criteria andCreateTimeBetween(Long value1, Long value2) { - addCriterion("create_time between", value1, value2, "createTime"); - return (Criteria) this; - } - - public Criteria andCreateTimeNotBetween(Long value1, Long value2) { - addCriterion("create_time not between", value1, value2, "createTime"); - return (Criteria) this; - } - - public Criteria andUpdateTimeIsNull() { - addCriterion("update_time is null"); - return (Criteria) this; - } - - public Criteria andUpdateTimeIsNotNull() { - addCriterion("update_time is not null"); - return (Criteria) this; - } - - public Criteria andUpdateTimeEqualTo(Long value) { - addCriterion("update_time =", value, "updateTime"); - return (Criteria) this; - } - - public Criteria andUpdateTimeNotEqualTo(Long value) { - addCriterion("update_time <>", value, "updateTime"); - return (Criteria) this; - } - - public Criteria andUpdateTimeGreaterThan(Long value) { - addCriterion("update_time >", value, "updateTime"); - return (Criteria) this; - } - - public Criteria andUpdateTimeGreaterThanOrEqualTo(Long value) { - addCriterion("update_time >=", value, "updateTime"); - return (Criteria) this; - } - - public Criteria andUpdateTimeLessThan(Long value) { - addCriterion("update_time <", value, "updateTime"); - return (Criteria) this; - } - - public Criteria andUpdateTimeLessThanOrEqualTo(Long value) { - addCriterion("update_time <=", value, "updateTime"); - return (Criteria) this; - } - - public Criteria andUpdateTimeIn(List values) { - addCriterion("update_time in", values, "updateTime"); - return (Criteria) this; - } - - public Criteria andUpdateTimeNotIn(List values) { - addCriterion("update_time not in", values, "updateTime"); - return (Criteria) this; - } - - public Criteria andUpdateTimeBetween(Long value1, Long value2) { - addCriterion("update_time between", value1, value2, "updateTime"); - return (Criteria) this; - } - - public Criteria andUpdateTimeNotBetween(Long value1, Long value2) { - addCriterion("update_time not between", value1, value2, "updateTime"); - return (Criteria) this; - } - } - - public static class Criteria extends GeneratedCriteria { - - protected Criteria() { - super(); - } - } - - public static class Criterion { - private String condition; - - private Object value; - - private Object secondValue; - - private boolean noValue; - - private boolean singleValue; - - private boolean betweenValue; - - private boolean listValue; - - private String typeHandler; - - public String getCondition() { - return condition; - } - - public Object getValue() { - return value; - } - - public Object getSecondValue() { - return secondValue; - } - - public boolean isNoValue() { - return noValue; - } - - public boolean isSingleValue() { - return singleValue; - } - - public boolean isBetweenValue() { - return betweenValue; - } - - public boolean isListValue() { - return listValue; - } - - public String getTypeHandler() { - return typeHandler; - } - - protected Criterion(String condition) { - super(); - this.condition = condition; - this.typeHandler = null; - this.noValue = true; - } - - protected Criterion(String condition, Object value, String typeHandler) { - super(); - this.condition = condition; - this.value = value; - this.typeHandler = typeHandler; - if (value instanceof List) { - this.listValue = true; - } else { - this.singleValue = true; - } - } - - protected Criterion(String condition, Object value) { - this(condition, value, null); - } - - protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { - super(); - this.condition = condition; - this.value = value; - this.secondValue = secondValue; - this.typeHandler = typeHandler; - this.betweenValue = true; - } - - protected Criterion(String condition, Object value, Object secondValue) { - this(condition, value, secondValue, null); - } - } -} \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/base/domain/Workspace.java b/backend/src/main/java/io/metersphere/base/domain/Workspace.java index 4cf43b3425..d45b8b06c0 100644 --- a/backend/src/main/java/io/metersphere/base/domain/Workspace.java +++ b/backend/src/main/java/io/metersphere/base/domain/Workspace.java @@ -7,8 +7,6 @@ import lombok.Data; public class Workspace implements Serializable { private String id; - private String organizationId; - private String name; private String description; diff --git a/backend/src/main/java/io/metersphere/base/domain/WorkspaceExample.java b/backend/src/main/java/io/metersphere/base/domain/WorkspaceExample.java index a368d19008..579b841382 100644 --- a/backend/src/main/java/io/metersphere/base/domain/WorkspaceExample.java +++ b/backend/src/main/java/io/metersphere/base/domain/WorkspaceExample.java @@ -174,76 +174,6 @@ public class WorkspaceExample { return (Criteria) this; } - public Criteria andOrganizationIdIsNull() { - addCriterion("organization_id is null"); - return (Criteria) this; - } - - public Criteria andOrganizationIdIsNotNull() { - addCriterion("organization_id is not null"); - return (Criteria) this; - } - - public Criteria andOrganizationIdEqualTo(String value) { - addCriterion("organization_id =", value, "organizationId"); - return (Criteria) this; - } - - public Criteria andOrganizationIdNotEqualTo(String value) { - addCriterion("organization_id <>", value, "organizationId"); - return (Criteria) this; - } - - public Criteria andOrganizationIdGreaterThan(String value) { - addCriterion("organization_id >", value, "organizationId"); - return (Criteria) this; - } - - public Criteria andOrganizationIdGreaterThanOrEqualTo(String value) { - addCriterion("organization_id >=", value, "organizationId"); - return (Criteria) this; - } - - public Criteria andOrganizationIdLessThan(String value) { - addCriterion("organization_id <", value, "organizationId"); - return (Criteria) this; - } - - public Criteria andOrganizationIdLessThanOrEqualTo(String value) { - addCriterion("organization_id <=", value, "organizationId"); - return (Criteria) this; - } - - public Criteria andOrganizationIdLike(String value) { - addCriterion("organization_id like", value, "organizationId"); - return (Criteria) this; - } - - public Criteria andOrganizationIdNotLike(String value) { - addCriterion("organization_id not like", value, "organizationId"); - return (Criteria) this; - } - - public Criteria andOrganizationIdIn(List values) { - addCriterion("organization_id in", values, "organizationId"); - return (Criteria) this; - } - - public Criteria andOrganizationIdNotIn(List values) { - addCriterion("organization_id not in", values, "organizationId"); - return (Criteria) this; - } - - public Criteria andOrganizationIdBetween(String value1, String value2) { - addCriterion("organization_id between", value1, value2, "organizationId"); - return (Criteria) this; - } - - public Criteria andOrganizationIdNotBetween(String value1, String value2) { - addCriterion("organization_id not between", value1, value2, "organizationId"); - return (Criteria) this; - } - public Criteria andNameIsNull() { addCriterion("`name` is null"); return (Criteria) this; diff --git a/backend/src/main/java/io/metersphere/base/mapper/MessageTaskMapper.java b/backend/src/main/java/io/metersphere/base/mapper/MessageTaskMapper.java index 1220f9d2da..368fd3f34b 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/MessageTaskMapper.java +++ b/backend/src/main/java/io/metersphere/base/mapper/MessageTaskMapper.java @@ -2,9 +2,8 @@ package io.metersphere.base.mapper; import io.metersphere.base.domain.MessageTask; import io.metersphere.base.domain.MessageTaskExample; -import org.apache.ibatis.annotations.Param; - import java.util.List; +import org.apache.ibatis.annotations.Param; public interface MessageTaskMapper { long countByExample(MessageTaskExample example); diff --git a/backend/src/main/java/io/metersphere/base/mapper/MessageTaskMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/MessageTaskMapper.xml index 64d5f3312e..4eeed4b7dc 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/MessageTaskMapper.xml +++ b/backend/src/main/java/io/metersphere/base/mapper/MessageTaskMapper.xml @@ -10,9 +10,9 @@ - + @@ -28,13 +28,13 @@ and ${criterion.condition} - AND ${criterion.condition} #{criterion.value} + and ${criterion.condition} #{criterion.value} - AND ${criterion.condition} #{criterion.value} AND #{criterion.secondValue} + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} - AND ${criterion.condition} + and ${criterion.condition} #{listItem} @@ -76,26 +76,26 @@ - id, `type`, event, user_id, task_type, webhook, identification, is_set, organization_id, - test_id, create_time + id, `type`, event, user_id, task_type, webhook, identification, is_set, test_id, + create_time, workspace_id `template` - select - - distinct - - - from organization - - - - - order by ${orderByClause} - - - - - delete from organization - where id = #{id,jdbcType=VARCHAR} - - - delete from organization - - - - - - insert into organization (id, `name`, description, - create_time, update_time, create_user - ) - values (#{id,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR}, - #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT}, #{createUser,jdbcType=VARCHAR} - ) - - - insert into organization - - - id, - - - `name`, - - - description, - - - create_time, - - - update_time, - - - create_user, - - - - - #{id,jdbcType=VARCHAR}, - - - #{name,jdbcType=VARCHAR}, - - - #{description,jdbcType=VARCHAR}, - - - #{createTime,jdbcType=BIGINT}, - - - #{updateTime,jdbcType=BIGINT}, - - - #{createUser,jdbcType=VARCHAR}, - - - - - - update organization - - - id = #{record.id,jdbcType=VARCHAR}, - - - `name` = #{record.name,jdbcType=VARCHAR}, - - - description = #{record.description,jdbcType=VARCHAR}, - - - create_time = #{record.createTime,jdbcType=BIGINT}, - - - update_time = #{record.updateTime,jdbcType=BIGINT}, - - - create_user = #{record.createUser,jdbcType=VARCHAR}, - - - - - - - - update organization - set id = #{record.id,jdbcType=VARCHAR}, - `name` = #{record.name,jdbcType=VARCHAR}, - description = #{record.description,jdbcType=VARCHAR}, - create_time = #{record.createTime,jdbcType=BIGINT}, - update_time = #{record.updateTime,jdbcType=BIGINT}, - create_user = #{record.createUser,jdbcType=VARCHAR} - - - - - - update organization - - - `name` = #{name,jdbcType=VARCHAR}, - - - description = #{description,jdbcType=VARCHAR}, - - - create_time = #{createTime,jdbcType=BIGINT}, - - - update_time = #{updateTime,jdbcType=BIGINT}, - - - create_user = #{createUser,jdbcType=VARCHAR}, - - - where id = #{id,jdbcType=VARCHAR} - - - update organization - set `name` = #{name,jdbcType=VARCHAR}, - description = #{description,jdbcType=VARCHAR}, - create_time = #{createTime,jdbcType=BIGINT}, - update_time = #{updateTime,jdbcType=BIGINT}, - create_user = #{createUser,jdbcType=VARCHAR} - where id = #{id,jdbcType=VARCHAR} - - \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/base/mapper/QuotaMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/QuotaMapper.xml index 72ab941079..5a26192f44 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/QuotaMapper.xml +++ b/backend/src/main/java/io/metersphere/base/mapper/QuotaMapper.xml @@ -8,7 +8,6 @@ - @@ -72,8 +71,8 @@ - id, api, performance, max_threads, duration, resource_pool, organization_id, workspace_id, - use_default, update_time + id, api, performance, max_threads, duration, resource_pool, workspace_id, use_default, + update_time - select - - distinct - - - from role - - - - - order by ${orderByClause} - - - - - delete from role - where id = #{id,jdbcType=VARCHAR} - - - delete from role - - - - - - insert into role (id, name, description, - type, create_time, update_time - ) - values (#{id,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR}, - #{type,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT} - ) - - - insert into role - - - id, - - - name, - - - description, - - - type, - - - create_time, - - - update_time, - - - - - #{id,jdbcType=VARCHAR}, - - - #{name,jdbcType=VARCHAR}, - - - #{description,jdbcType=VARCHAR}, - - - #{type,jdbcType=VARCHAR}, - - - #{createTime,jdbcType=BIGINT}, - - - #{updateTime,jdbcType=BIGINT}, - - - - - - update role - - - id = #{record.id,jdbcType=VARCHAR}, - - - name = #{record.name,jdbcType=VARCHAR}, - - - description = #{record.description,jdbcType=VARCHAR}, - - - type = #{record.type,jdbcType=VARCHAR}, - - - create_time = #{record.createTime,jdbcType=BIGINT}, - - - update_time = #{record.updateTime,jdbcType=BIGINT}, - - - - - - - - update role - set id = #{record.id,jdbcType=VARCHAR}, - name = #{record.name,jdbcType=VARCHAR}, - description = #{record.description,jdbcType=VARCHAR}, - type = #{record.type,jdbcType=VARCHAR}, - create_time = #{record.createTime,jdbcType=BIGINT}, - update_time = #{record.updateTime,jdbcType=BIGINT} - - - - - - update role - - - name = #{name,jdbcType=VARCHAR}, - - - description = #{description,jdbcType=VARCHAR}, - - - type = #{type,jdbcType=VARCHAR}, - - - create_time = #{createTime,jdbcType=BIGINT}, - - - update_time = #{updateTime,jdbcType=BIGINT}, - - - where id = #{id,jdbcType=VARCHAR} - - - update role - set name = #{name,jdbcType=VARCHAR}, - description = #{description,jdbcType=VARCHAR}, - type = #{type,jdbcType=VARCHAR}, - create_time = #{createTime,jdbcType=BIGINT}, - update_time = #{updateTime,jdbcType=BIGINT} - where id = #{id,jdbcType=VARCHAR} - - \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/base/mapper/ServiceIntegrationMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/ServiceIntegrationMapper.xml index 8a85844582..77e4f5bf79 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ServiceIntegrationMapper.xml +++ b/backend/src/main/java/io/metersphere/base/mapper/ServiceIntegrationMapper.xml @@ -3,8 +3,8 @@ - + @@ -68,7 +68,7 @@ - id, organization_id, platform + id, platform, workspace_id configuration @@ -122,9 +122,9 @@ - insert into service_integration (id, organization_id, platform, + insert into service_integration (id, platform, workspace_id, configuration) - values (#{id,jdbcType=VARCHAR}, #{organizationId,jdbcType=VARCHAR}, #{platform,jdbcType=VARCHAR}, + values (#{id,jdbcType=VARCHAR}, #{platform,jdbcType=VARCHAR}, #{workspaceId,jdbcType=VARCHAR}, #{configuration,jdbcType=LONGVARCHAR}) @@ -133,12 +133,12 @@ id, - - organization_id, - platform, + + workspace_id, + configuration, @@ -147,12 +147,12 @@ #{id,jdbcType=VARCHAR}, - - #{organizationId,jdbcType=VARCHAR}, - #{platform,jdbcType=VARCHAR}, + + #{workspaceId,jdbcType=VARCHAR}, + #{configuration,jdbcType=LONGVARCHAR}, @@ -170,12 +170,12 @@ id = #{record.id,jdbcType=VARCHAR}, - - organization_id = #{record.organizationId,jdbcType=VARCHAR}, - platform = #{record.platform,jdbcType=VARCHAR}, + + workspace_id = #{record.workspaceId,jdbcType=VARCHAR}, + configuration = #{record.configuration,jdbcType=LONGVARCHAR}, @@ -187,8 +187,8 @@ update service_integration set id = #{record.id,jdbcType=VARCHAR}, - organization_id = #{record.organizationId,jdbcType=VARCHAR}, platform = #{record.platform,jdbcType=VARCHAR}, + workspace_id = #{record.workspaceId,jdbcType=VARCHAR}, configuration = #{record.configuration,jdbcType=LONGVARCHAR} @@ -197,8 +197,8 @@ update service_integration set id = #{record.id,jdbcType=VARCHAR}, - organization_id = #{record.organizationId,jdbcType=VARCHAR}, - platform = #{record.platform,jdbcType=VARCHAR} + platform = #{record.platform,jdbcType=VARCHAR}, + workspace_id = #{record.workspaceId,jdbcType=VARCHAR} @@ -206,12 +206,12 @@ update service_integration - - organization_id = #{organizationId,jdbcType=VARCHAR}, - platform = #{platform,jdbcType=VARCHAR}, + + workspace_id = #{workspaceId,jdbcType=VARCHAR}, + configuration = #{configuration,jdbcType=LONGVARCHAR}, @@ -220,15 +220,15 @@ update service_integration - set organization_id = #{organizationId,jdbcType=VARCHAR}, - platform = #{platform,jdbcType=VARCHAR}, + set platform = #{platform,jdbcType=VARCHAR}, + workspace_id = #{workspaceId,jdbcType=VARCHAR}, configuration = #{configuration,jdbcType=LONGVARCHAR} where id = #{id,jdbcType=VARCHAR} update service_integration - set organization_id = #{organizationId,jdbcType=VARCHAR}, - platform = #{platform,jdbcType=VARCHAR} + set platform = #{platform,jdbcType=VARCHAR}, + workspace_id = #{workspaceId,jdbcType=VARCHAR} where id = #{id,jdbcType=VARCHAR} \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/base/mapper/UserMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/UserMapper.xml index 448ca4dd36..77f36664f7 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/UserMapper.xml +++ b/backend/src/main/java/io/metersphere/base/mapper/UserMapper.xml @@ -11,7 +11,6 @@ - @@ -80,7 +79,7 @@ id, `name`, email, `password`, `status`, create_time, update_time, `language`, last_workspace_id, - last_organization_id, phone, `source`, last_project_id, create_user + phone, `source`, last_project_id, create_user platform_info @@ -137,15 +136,13 @@ insert into user (id, `name`, email, `password`, `status`, create_time, update_time, `language`, last_workspace_id, - last_organization_id, phone, `source`, - last_project_id, create_user, platform_info - ) + phone, `source`, last_project_id, + create_user, platform_info) values (#{id,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{email,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT}, #{language,jdbcType=VARCHAR}, #{lastWorkspaceId,jdbcType=VARCHAR}, - #{lastOrganizationId,jdbcType=VARCHAR}, #{phone,jdbcType=VARCHAR}, #{source,jdbcType=VARCHAR}, - #{lastProjectId,jdbcType=VARCHAR}, #{createUser,jdbcType=VARCHAR}, #{platformInfo,jdbcType=LONGVARCHAR} - ) + #{phone,jdbcType=VARCHAR}, #{source,jdbcType=VARCHAR}, #{lastProjectId,jdbcType=VARCHAR}, + #{createUser,jdbcType=VARCHAR}, #{platformInfo,jdbcType=LONGVARCHAR}) insert into user @@ -177,9 +174,6 @@ last_workspace_id, - - last_organization_id, - phone, @@ -224,9 +218,6 @@ #{lastWorkspaceId,jdbcType=VARCHAR}, - - #{lastOrganizationId,jdbcType=VARCHAR}, - #{phone,jdbcType=VARCHAR}, @@ -280,9 +271,6 @@ last_workspace_id = #{record.lastWorkspaceId,jdbcType=VARCHAR}, - - last_organization_id = #{record.lastOrganizationId,jdbcType=VARCHAR}, - phone = #{record.phone,jdbcType=VARCHAR}, @@ -314,7 +302,6 @@ update_time = #{record.updateTime,jdbcType=BIGINT}, `language` = #{record.language,jdbcType=VARCHAR}, last_workspace_id = #{record.lastWorkspaceId,jdbcType=VARCHAR}, - last_organization_id = #{record.lastOrganizationId,jdbcType=VARCHAR}, phone = #{record.phone,jdbcType=VARCHAR}, `source` = #{record.source,jdbcType=VARCHAR}, last_project_id = #{record.lastProjectId,jdbcType=VARCHAR}, @@ -335,7 +322,6 @@ update_time = #{record.updateTime,jdbcType=BIGINT}, `language` = #{record.language,jdbcType=VARCHAR}, last_workspace_id = #{record.lastWorkspaceId,jdbcType=VARCHAR}, - last_organization_id = #{record.lastOrganizationId,jdbcType=VARCHAR}, phone = #{record.phone,jdbcType=VARCHAR}, `source` = #{record.source,jdbcType=VARCHAR}, last_project_id = #{record.lastProjectId,jdbcType=VARCHAR}, @@ -371,9 +357,6 @@ last_workspace_id = #{lastWorkspaceId,jdbcType=VARCHAR}, - - last_organization_id = #{lastOrganizationId,jdbcType=VARCHAR}, - phone = #{phone,jdbcType=VARCHAR}, @@ -402,7 +385,6 @@ update_time = #{updateTime,jdbcType=BIGINT}, `language` = #{language,jdbcType=VARCHAR}, last_workspace_id = #{lastWorkspaceId,jdbcType=VARCHAR}, - last_organization_id = #{lastOrganizationId,jdbcType=VARCHAR}, phone = #{phone,jdbcType=VARCHAR}, `source` = #{source,jdbcType=VARCHAR}, last_project_id = #{lastProjectId,jdbcType=VARCHAR}, @@ -420,7 +402,6 @@ update_time = #{updateTime,jdbcType=BIGINT}, `language` = #{language,jdbcType=VARCHAR}, last_workspace_id = #{lastWorkspaceId,jdbcType=VARCHAR}, - last_organization_id = #{lastOrganizationId,jdbcType=VARCHAR}, phone = #{phone,jdbcType=VARCHAR}, `source` = #{source,jdbcType=VARCHAR}, last_project_id = #{lastProjectId,jdbcType=VARCHAR}, diff --git a/backend/src/main/java/io/metersphere/base/mapper/UserRoleMapper.java b/backend/src/main/java/io/metersphere/base/mapper/UserRoleMapper.java deleted file mode 100644 index c312097d0b..0000000000 --- a/backend/src/main/java/io/metersphere/base/mapper/UserRoleMapper.java +++ /dev/null @@ -1,30 +0,0 @@ -package io.metersphere.base.mapper; - -import io.metersphere.base.domain.UserRole; -import io.metersphere.base.domain.UserRoleExample; -import java.util.List; -import org.apache.ibatis.annotations.Param; - -public interface UserRoleMapper { - long countByExample(UserRoleExample example); - - int deleteByExample(UserRoleExample example); - - int deleteByPrimaryKey(String id); - - int insert(UserRole record); - - int insertSelective(UserRole record); - - List selectByExample(UserRoleExample example); - - UserRole selectByPrimaryKey(String id); - - int updateByExampleSelective(@Param("record") UserRole record, @Param("example") UserRoleExample example); - - int updateByExample(@Param("record") UserRole record, @Param("example") UserRoleExample example); - - int updateByPrimaryKeySelective(UserRole record); - - int updateByPrimaryKey(UserRole record); -} \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/base/mapper/UserRoleMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/UserRoleMapper.xml deleted file mode 100644 index 10369dff04..0000000000 --- a/backend/src/main/java/io/metersphere/base/mapper/UserRoleMapper.xml +++ /dev/null @@ -1,228 +0,0 @@ - - - - - - - - - - - - - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value} - - - and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} - - - and ${criterion.condition} - - #{listItem} - - - - - - - - - - - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value} - - - and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} - - - and ${criterion.condition} - - #{listItem} - - - - - - - - - - - id, user_id, role_id, source_id, create_time, update_time - - - - - delete from user_role - where id = #{id,jdbcType=VARCHAR} - - - delete from user_role - - - - - - insert into user_role (id, user_id, role_id, - source_id, create_time, update_time - ) - values (#{id,jdbcType=VARCHAR}, #{userId,jdbcType=VARCHAR}, #{roleId,jdbcType=VARCHAR}, - #{sourceId,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT} - ) - - - insert into user_role - - - id, - - - user_id, - - - role_id, - - - source_id, - - - create_time, - - - update_time, - - - - - #{id,jdbcType=VARCHAR}, - - - #{userId,jdbcType=VARCHAR}, - - - #{roleId,jdbcType=VARCHAR}, - - - #{sourceId,jdbcType=VARCHAR}, - - - #{createTime,jdbcType=BIGINT}, - - - #{updateTime,jdbcType=BIGINT}, - - - - - - update user_role - - - id = #{record.id,jdbcType=VARCHAR}, - - - user_id = #{record.userId,jdbcType=VARCHAR}, - - - role_id = #{record.roleId,jdbcType=VARCHAR}, - - - source_id = #{record.sourceId,jdbcType=VARCHAR}, - - - create_time = #{record.createTime,jdbcType=BIGINT}, - - - update_time = #{record.updateTime,jdbcType=BIGINT}, - - - - - - - - update user_role - set id = #{record.id,jdbcType=VARCHAR}, - user_id = #{record.userId,jdbcType=VARCHAR}, - role_id = #{record.roleId,jdbcType=VARCHAR}, - source_id = #{record.sourceId,jdbcType=VARCHAR}, - create_time = #{record.createTime,jdbcType=BIGINT}, - update_time = #{record.updateTime,jdbcType=BIGINT} - - - - - - update user_role - - - user_id = #{userId,jdbcType=VARCHAR}, - - - role_id = #{roleId,jdbcType=VARCHAR}, - - - source_id = #{sourceId,jdbcType=VARCHAR}, - - - create_time = #{createTime,jdbcType=BIGINT}, - - - update_time = #{updateTime,jdbcType=BIGINT}, - - - where id = #{id,jdbcType=VARCHAR} - - - update user_role - set user_id = #{userId,jdbcType=VARCHAR}, - role_id = #{roleId,jdbcType=VARCHAR}, - source_id = #{sourceId,jdbcType=VARCHAR}, - create_time = #{createTime,jdbcType=BIGINT}, - update_time = #{updateTime,jdbcType=BIGINT} - where id = #{id,jdbcType=VARCHAR} - - \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/base/mapper/WorkspaceMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/WorkspaceMapper.xml index d99a762312..33e7de947d 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/WorkspaceMapper.xml +++ b/backend/src/main/java/io/metersphere/base/mapper/WorkspaceMapper.xml @@ -3,7 +3,6 @@ - @@ -69,7 +68,7 @@ - id, organization_id, `name`, description, create_time, update_time, create_user + id, `name`, description, create_time, update_time, create_user - SELECT COUNT(id) - FROM user_group ug - WHERE ug.user_id = #{userId} - AND ug.source_id = #{sourceId} - AND ug.group_id = #{groupId} - - - - - - - INSERT INTO message_task (id, type, event, user_id, task_type, webhook, identification, is_set, organization_id, - test_id, create_time, template) - VALUES (UUID(), 'IN_SITE', 'DELETE', 'CREATOR', 'PERFORMANCE_TEST_TASK', '', - 'ce692111-166b-491a-ae69-f047c31de971', 0, - #{orgId}, NULL, 1629686472659, NULL), - (UUID(), 'IN_SITE', 'COMPLETE', 'CREATOR', 'REVIEW_TASK', - '', - '72836b2d-4c2f-4185-95aa-1894c6f0d1c3', 0, #{orgId}, NULL, 1629697096803, - NULL), - (UUID(), 'IN_SITE', 'CLOSE_SCHEDULE', 'CREATOR', 'TRACK_HOME_TASK', '', - 'ceb0aeb5-f194-4183-a995-3607a769c61d', - 0, #{orgId}, NULL, 1629705930753, NULL), - (UUID(), 'IN_SITE', 'DELETE', 'CREATOR', 'API_AUTOMATION_TASK', '', - 'e2865464-0da3-42bc-a041-7d21bd70d339', 0, - #{orgId}, NULL, 1629446356866, NULL), - (UUID(), 'IN_SITE', 'UPDATE', 'FOLLOW_PEOPLE', 'PERFORMANCE_TEST_TASK', '', - '79d7dcdc-68a2-47a2-9ef5-21fdf9bde65c', 0, #{orgId}, NULL, 1629446379928, - NULL), - (UUID(), 'IN_SITE', 'CLOSE_SCHEDULE', 'CREATOR', 'API_HOME_TASK', '', - 'dbe5dfcd-927f-4065-93cf-22f33d9570ac', 0, - #{orgId}, NULL, 1629446330438, NULL), - (UUID(), 'IN_SITE', 'UPDATE', 'FOLLOW_PEOPLE', 'TRACK_TEST_CASE_TASK', '', - '3a632784-c73b-4f5f-824c-bdf4fccf6f4d', 0, #{orgId}, NULL, 1629705939795, - NULL), - (UUID(), 'IN_SITE', 'CASE_UPDATE', 'FOLLOW_PEOPLE', 'API_DEFINITION_TASK', '', - 'a6a3979a-bd80-414c-a253-06f0364c434f', 0, #{orgId}, NULL, 1629446346104, - NULL), - (UUID(), 'IN_SITE', 'UPDATE', 'FOLLOW_PEOPLE', 'API_AUTOMATION_TASK', '', - '019de091-1a19-4b30-bd5e-23b83bc820fb', - 0, #{orgId}, NULL, 1629618010742, NULL), - (UUID(), 'IN_SITE', 'CASE_UPDATE', 'CREATOR', 'API_DEFINITION_TASK', '', - 'a6a3979a-bd80-414c-a253-06f0364c434f', - 0, #{orgId}, NULL, 1629446346104, NULL), - (UUID(), 'IN_SITE', 'DELETE', 'CREATOR', 'DEFECT_TASK', '', '66568b56-4f9e-4bf6-8621-7402403368b9', 0, - #{orgId}, NULL, 1629446306675, NULL), - (UUID(), 'IN_SITE', 'DELETE', 'FOLLOW_PEOPLE', 'PERFORMANCE_TEST_TASK', '', - 'ce692111-166b-491a-ae69-f047c31de971', 0, #{orgId}, NULL, 1629686472659, - NULL), - (UUID(), 'IN_SITE', 'UPDATE', 'CREATOR', 'DEFECT_TASK', '', '3a913f72-7cee-4e36-ae1d-0443c7cb5f97', 0, - #{orgId}, NULL, 1629699608062, NULL), - (UUID(), 'IN_SITE', 'UPDATE', 'FOLLOW_PEOPLE', 'API_DEFINITION_TASK', '', - '7ca324cd-7113-412b-8714-5cbe1bffa535', - 0, #{orgId}, NULL, 1629706088088, NULL), - (UUID(), 'IN_SITE', 'CASE_DELETE', 'CREATOR', 'API_DEFINITION_TASK', '', - 'aeb9d21a-855c-44d3-a715-dfb1bba8ad6c', - 0, #{orgId}, NULL, 1629446334332, NULL), - (UUID(), 'IN_SITE', 'DELETE', 'CREATOR', 'API_REPORT_TASK', '', '4d3309f3-7ab2-492e-b9c9-1127c3e005d1', - 0, - #{orgId}, NULL, 1629446364391, NULL), - (UUID(), 'IN_SITE', 'COMMENT', 'CREATOR', 'TRACK_TEST_CASE_TASK', '', - '2e8db54f-2d39-42a6-9832-43bb3384e7d5', 0, - #{orgId}, NULL, 1629446247833, NULL), - (UUID(), 'IN_SITE', 'DELETE', 'CREATOR', 'API_DEFINITION_TASK', '', - '90f2be5d-0a71-44f0-a750-f16bf39d690b', 0, - #{orgId}, NULL, 1629446338557, NULL), - (UUID(), 'IN_SITE', 'DELETE', 'CREATOR', 'PERFORMANCE_REPORT_TASK', '', - '4c1bfa4a-b02b-4e8e-bc09-b13613723a11', - 0, #{orgId}, NULL, 1629446384995, NULL), - (UUID(), 'IN_SITE', 'UPDATE', 'CREATOR', 'API_AUTOMATION_TASK', '', - '019de091-1a19-4b30-bd5e-23b83bc820fb', 0, - #{orgId}, NULL, 1629618010742, NULL), - (UUID(), 'IN_SITE', 'COMPLETE', 'CREATOR', 'TEST_PLAN_TASK', '', '86b42beb-a86f-4ff3-a73c-d25112c2f104', - 0, - #{orgId}, NULL, 1629446286106, NULL), - (UUID(), 'IN_SITE', 'UPDATE', 'CREATOR', 'PERFORMANCE_TEST_TASK', '', - '79d7dcdc-68a2-47a2-9ef5-21fdf9bde65c', 0, - #{orgId}, NULL, 1629446379928, NULL), - (UUID(), 'IN_SITE', 'UPDATE', 'CREATOR', 'TRACK_TEST_CASE_TASK', '', - '3a632784-c73b-4f5f-824c-bdf4fccf6f4d', 0, - #{orgId}, NULL, 1629705939795, NULL), - (UUID(), 'IN_SITE', 'UPDATE', 'CREATOR', 'API_DEFINITION_TASK', '', - '7ca324cd-7113-412b-8714-5cbe1bffa535', 0, - #{orgId}, NULL, 1629706088088, NULL), - (UUID(), 'IN_SITE', 'DELETE', 'CREATOR', 'TEST_PLAN_TASK', '', '04ea4fbd-a392-4f80-a61c-51d31a302cac', 0, - #{orgId}, NULL, 1629446289522, NULL), - (UUID(), 'IN_SITE', 'UPDATE', 'CREATOR', 'REVIEW_TASK', '', 'db515209-f864-46d3-a2e5-63db6d1339c3', 0, - #{orgId}, NULL, 1629446276516, NULL), - (UUID(), 'IN_SITE', 'DELETE', 'CREATOR', 'TRACK_REPORT_TASK', '', 'ea2fee85-8a44-413a-a128-16bfa01ada0d', - 0, - #{orgId}, NULL, 1629283758941, NULL), - (UUID(), 'IN_SITE', 'DELETE', 'CREATOR', 'REVIEW_TASK', '', 'f9b1f60b-6dee-48af-8217-0428b27dcbab', 0, - #{orgId}, NULL, 1629446272477, NULL), - (UUID(), 'IN_SITE', 'DELETE', 'CREATOR', 'TRACK_TEST_CASE_TASK', '', - '7c26254e-85e9-4269-be13-a2ffcfe0b9f5', 0, - #{orgId}, NULL, 1629446251939, NULL), - (UUID(), 'IN_SITE', 'DELETE', 'FOLLOW_PEOPLE', 'TRACK_TEST_CASE_TASK', '', - '7c26254e-85e9-4269-be13-a2ffcfe0b9f5', 0, #{orgId}, NULL, 1629446251939, - NULL), - (UUID(), 'IN_SITE', 'EXECUTE_SUCCESSFUL', 'CREATOR', 'API_DEFINITION_TASK', '', - '7efddbdb-2b6c-4425-96a4-0bc2aa9e2cd2', 0, #{orgId}, NULL, 1629775183917, - NULL), - (UUID(), 'IN_SITE', 'EXECUTE_FAILED', 'CREATOR', 'API_DEFINITION_TASK', '', - 'e508035c-1318-40ea-9457-0bbe9865f4ce', 0, #{orgId}, NULL, 1629775194857, - NULL), - (UUID(), 'IN_SITE', 'EXECUTE_COMPLETED', 'CREATOR', 'PERFORMANCE_TEST_TASK', '', - 'e3db90c6-fb49-4e89-bc25-1d14b5ce94d0', 0, #{orgId}, NULL, 1629790602744, - NULL), - (UUID(), 'IN_SITE', 'EXECUTE_FAILED', 'CREATOR', 'API_AUTOMATION_TASK', '', - 'c25930e8-b617-45f7-af5e-cc94adc14192', 0, #{orgId}, NULL, 1629780485724, - NULL), - (UUID(), 'IN_SITE', 'EXECUTE_SUCCESSFUL', 'CREATOR', 'API_AUTOMATION_TASK', '', - '9f91e5e5-1744-4160-bfc6-3851bfd59e05', 0, #{orgId}, NULL, 1629780475764, - NULL), - (UUID(), 'IN_SITE', 'UPDATE', 'PROCESSOR', 'DEFECT_TASK', '', - '6cad944e-db8d-4786-9ef3-7d6370940325', 0, #{orgId}, NULL, 1629791388405, - NULL), - (UUID(), 'IN_SITE', 'CREATE', 'PROCESSOR', 'DEFECT_TASK', '', - '4a890e41-e755-44fc-b734-d6a0ca25a65c', 0, #{orgId}, NULL, 1629790487682, - NULL) - - \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtProjectMapper.java b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtProjectMapper.java index 6d860be9ea..e086ce7058 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtProjectMapper.java +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtProjectMapper.java @@ -1,6 +1,5 @@ package io.metersphere.base.mapper.ext; -import io.metersphere.base.domain.Organization; import io.metersphere.base.domain.Project; import io.metersphere.controller.request.ProjectRequest; import io.metersphere.dto.ProjectDTO; @@ -16,7 +15,7 @@ public interface ExtProjectMapper { List getProjectIdByWorkspaceId(String workspaceId); - int removeIssuePlatform(@Param("platform") String platform, @Param("orgId") String orgId); + int removeIssuePlatform(@Param("platform") String platform, @Param("workspaceId") String workspaceId); List getUserProject(@Param("proRequest") ProjectRequest request); @@ -29,9 +28,9 @@ public interface ExtProjectMapper { @MapKey("id") Map queryNameByIds(@Param("ids") List ids); - Organization getOrganizationByProjectId(@Param("projectId") String projectId); - List selectTcpPorts(); Project selectProjectByResourceId(@Param("resourceId") String resourceId); + + long getProjectMemberSize(@Param("projectId") String projectId); } diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtProjectMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtProjectMapper.xml index aa7b9b6f10..e9b27ff1f4 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtProjectMapper.xml +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtProjectMapper.xml @@ -172,20 +172,9 @@ WHERE project.id IN (SELECT id FROM (SELECT id FROM project - WHERE workspace_id IN - (SELECT workspace.id - FROM workspace - WHERE organization_id = #{orgId})) AS a) + WHERE workspace_id = #{workspaceId}) AS a) - - + + diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtRoleMapper.java b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtRoleMapper.java deleted file mode 100644 index 63e27d3233..0000000000 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtRoleMapper.java +++ /dev/null @@ -1,11 +0,0 @@ -package io.metersphere.base.mapper.ext; - -import io.metersphere.base.domain.Role; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - -public interface ExtRoleMapper { - - List getRoleList(@Param("sign") String sign); -} diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtRoleMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtRoleMapper.xml deleted file mode 100644 index 554dc2a138..0000000000 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtRoleMapper.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtUserGroupMapper.java b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtUserGroupMapper.java index 7f89a0c2b3..21787420ad 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtUserGroupMapper.java +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtUserGroupMapper.java @@ -4,10 +4,8 @@ import io.metersphere.base.domain.Group; import io.metersphere.base.domain.User; import io.metersphere.controller.request.group.EditGroupRequest; import io.metersphere.controller.request.member.QueryMemberRequest; -import io.metersphere.controller.request.organization.QueryOrgMemberRequest; import io.metersphere.dto.RelatedSource; import io.metersphere.dto.UserGroupDTO; -import io.metersphere.dto.UserGroupHelpDTO; import org.apache.ibatis.annotations.Param; import java.util.List; @@ -16,16 +14,10 @@ public interface ExtUserGroupMapper { List getUserGroup(@Param("userId") String userId); - List getOrganizationMemberGroups(@Param("orgId") String orgId, @Param("userId") String userId); - - List getOrgMemberList(@Param("orgMember") QueryOrgMemberRequest request); - List getWorkspaceMemberGroups(@Param("workspaceId") String workspaceId, @Param("userId") String userId); List getMemberList(@Param("member") QueryMemberRequest request); - List getUserRoleHelpList(@Param("userId") String userId); - List getProjectMemberList(@Param("request") QueryMemberRequest request); List getProjectMemberGroups(@Param("projectId") String projectId,@Param("userId") String userId); @@ -33,4 +25,6 @@ public interface ExtUserGroupMapper { List getRelatedSource(@Param("userId") String userId); List getGroupUser(@Param("request")EditGroupRequest request); + + int checkSourceRole(@Param("sourceId") String sourceId, @Param("userId") String userId, @Param("groupId") String groupId); } diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtUserGroupMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtUserGroupMapper.xml index 9b06e20088..149be6f23c 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtUserGroupMapper.xml +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtUserGroupMapper.xml @@ -8,27 +8,7 @@ from user_group ug join `group` g on ug.group_id = g.id where ug.user_id = #{userId} - - + - + + + \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtUserMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtUserMapper.xml index 027b9c6668..ffc4e27dcb 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtUserMapper.xml +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtUserMapper.xml @@ -12,7 +12,6 @@ - @@ -39,7 +38,7 @@ - SELECT - user_role.role_id AS roleId, - role.`name` AS roleName, - user_role.source_id AS sourceId, - - IF(workspace.id IS NULL,IF(organization.id IS NULL,'',organization.`name`),workspace.name) AS sourceName, - - IF(workspace.id IS NULL,NULL,workspace.organization_id) AS parentId - - FROM user_role LEFT JOIN role ON role.id = user_role.role_id - - LEFT JOIN workspace ON workspace.id = user_role.source_id - - LEFT JOIN organization ON organization.id = user_role.source_id - - WHERE user_role.user_id = #{userId} - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtWorkspaceMapper.java b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtWorkspaceMapper.java index 8f60844e2b..90f38b5321 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtWorkspaceMapper.java +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtWorkspaceMapper.java @@ -8,13 +8,7 @@ import java.util.List; public interface ExtWorkspaceMapper { - List getWorkspaceWithOrg(@Param("request") WorkspaceRequest request); + List getWorkspaces(@Param("request") WorkspaceRequest request); - List getWorkspaceIdsByOrgId(@Param("orgId") String orgId); - - List getWorkspaceIdsOrgId(@Param("orgId") String orgId); - - String getOrganizationIdById(String resourceID); - - List findIdAndNameByOrganizationId(@Param("organizationId") String organizationId); + void setDefaultMessageTask(@Param("workspaceId") String workspaceId); } diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtWorkspaceMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtWorkspaceMapper.xml index e184cac3dd..9a7d8d3e0b 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtWorkspaceMapper.xml +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtWorkspaceMapper.xml @@ -2,9 +2,9 @@ - + select w.id, w.name, w.description + from workspace w AND w.name LIKE #{request.name,jdbcType=VARCHAR} @@ -13,29 +13,115 @@ order by w.update_time desc - - - - - - - + + INSERT INTO message_task (id, type, event, user_id, task_type, webhook, identification, is_set, workspace_id, + test_id, create_time, template) + VALUES (UUID(), 'IN_SITE', 'DELETE', 'CREATOR', 'PERFORMANCE_TEST_TASK', '', + 'ce692111-166b-491a-ae69-f047c31de971', 0, + #{workspaceId}, NULL, 1629686472659, NULL), + (UUID(), 'IN_SITE', 'COMPLETE', 'CREATOR', 'REVIEW_TASK', + '', + '72836b2d-4c2f-4185-95aa-1894c6f0d1c3', 0, #{workspaceId}, NULL, 1629697096803, + NULL), + (UUID(), 'IN_SITE', 'CLOSE_SCHEDULE', 'CREATOR', 'TRACK_HOME_TASK', '', + 'ceb0aeb5-f194-4183-a995-3607a769c61d', + 0, #{workspaceId}, NULL, 1629705930753, NULL), + (UUID(), 'IN_SITE', 'DELETE', 'CREATOR', 'API_AUTOMATION_TASK', '', + 'e2865464-0da3-42bc-a041-7d21bd70d339', 0, + #{workspaceId}, NULL, 1629446356866, NULL), + (UUID(), 'IN_SITE', 'UPDATE', 'FOLLOW_PEOPLE', 'PERFORMANCE_TEST_TASK', '', + '79d7dcdc-68a2-47a2-9ef5-21fdf9bde65c', 0, #{workspaceId}, NULL, 1629446379928, + NULL), + (UUID(), 'IN_SITE', 'CLOSE_SCHEDULE', 'CREATOR', 'API_HOME_TASK', '', + 'dbe5dfcd-927f-4065-93cf-22f33d9570ac', 0, + #{workspaceId}, NULL, 1629446330438, NULL), + (UUID(), 'IN_SITE', 'UPDATE', 'FOLLOW_PEOPLE', 'TRACK_TEST_CASE_TASK', '', + '3a632784-c73b-4f5f-824c-bdf4fccf6f4d', 0, #{workspaceId}, NULL, 1629705939795, + NULL), + (UUID(), 'IN_SITE', 'CASE_UPDATE', 'FOLLOW_PEOPLE', 'API_DEFINITION_TASK', '', + 'a6a3979a-bd80-414c-a253-06f0364c434f', 0, #{workspaceId}, NULL, 1629446346104, + NULL), + (UUID(), 'IN_SITE', 'UPDATE', 'FOLLOW_PEOPLE', 'API_AUTOMATION_TASK', '', + '019de091-1a19-4b30-bd5e-23b83bc820fb', + 0, #{workspaceId}, NULL, 1629618010742, NULL), + (UUID(), 'IN_SITE', 'CASE_UPDATE', 'CREATOR', 'API_DEFINITION_TASK', '', + 'a6a3979a-bd80-414c-a253-06f0364c434f', + 0, #{workspaceId}, NULL, 1629446346104, NULL), + (UUID(), 'IN_SITE', 'DELETE', 'CREATOR', 'DEFECT_TASK', '', '66568b56-4f9e-4bf6-8621-7402403368b9', 0, + #{workspaceId}, NULL, 1629446306675, NULL), + (UUID(), 'IN_SITE', 'DELETE', 'FOLLOW_PEOPLE', 'PERFORMANCE_TEST_TASK', '', + 'ce692111-166b-491a-ae69-f047c31de971', 0, #{workspaceId}, NULL, 1629686472659, + NULL), + (UUID(), 'IN_SITE', 'UPDATE', 'CREATOR', 'DEFECT_TASK', '', '3a913f72-7cee-4e36-ae1d-0443c7cb5f97', 0, + #{workspaceId}, NULL, 1629699608062, NULL), + (UUID(), 'IN_SITE', 'UPDATE', 'FOLLOW_PEOPLE', 'API_DEFINITION_TASK', '', + '7ca324cd-7113-412b-8714-5cbe1bffa535', + 0, #{workspaceId}, NULL, 1629706088088, NULL), + (UUID(), 'IN_SITE', 'CASE_DELETE', 'CREATOR', 'API_DEFINITION_TASK', '', + 'aeb9d21a-855c-44d3-a715-dfb1bba8ad6c', + 0, #{workspaceId}, NULL, 1629446334332, NULL), + (UUID(), 'IN_SITE', 'DELETE', 'CREATOR', 'API_REPORT_TASK', '', '4d3309f3-7ab2-492e-b9c9-1127c3e005d1', + 0, + #{workspaceId}, NULL, 1629446364391, NULL), + (UUID(), 'IN_SITE', 'COMMENT', 'CREATOR', 'TRACK_TEST_CASE_TASK', '', + '2e8db54f-2d39-42a6-9832-43bb3384e7d5', 0, + #{workspaceId}, NULL, 1629446247833, NULL), + (UUID(), 'IN_SITE', 'DELETE', 'CREATOR', 'API_DEFINITION_TASK', '', + '90f2be5d-0a71-44f0-a750-f16bf39d690b', 0, + #{workspaceId}, NULL, 1629446338557, NULL), + (UUID(), 'IN_SITE', 'DELETE', 'CREATOR', 'PERFORMANCE_REPORT_TASK', '', + '4c1bfa4a-b02b-4e8e-bc09-b13613723a11', + 0, #{workspaceId}, NULL, 1629446384995, NULL), + (UUID(), 'IN_SITE', 'UPDATE', 'CREATOR', 'API_AUTOMATION_TASK', '', + '019de091-1a19-4b30-bd5e-23b83bc820fb', 0, + #{workspaceId}, NULL, 1629618010742, NULL), + (UUID(), 'IN_SITE', 'COMPLETE', 'CREATOR', 'TEST_PLAN_TASK', '', '86b42beb-a86f-4ff3-a73c-d25112c2f104', + 0, + #{workspaceId}, NULL, 1629446286106, NULL), + (UUID(), 'IN_SITE', 'UPDATE', 'CREATOR', 'PERFORMANCE_TEST_TASK', '', + '79d7dcdc-68a2-47a2-9ef5-21fdf9bde65c', 0, + #{workspaceId}, NULL, 1629446379928, NULL), + (UUID(), 'IN_SITE', 'UPDATE', 'CREATOR', 'TRACK_TEST_CASE_TASK', '', + '3a632784-c73b-4f5f-824c-bdf4fccf6f4d', 0, + #{workspaceId}, NULL, 1629705939795, NULL), + (UUID(), 'IN_SITE', 'UPDATE', 'CREATOR', 'API_DEFINITION_TASK', '', + '7ca324cd-7113-412b-8714-5cbe1bffa535', 0, + #{workspaceId}, NULL, 1629706088088, NULL), + (UUID(), 'IN_SITE', 'DELETE', 'CREATOR', 'TEST_PLAN_TASK', '', '04ea4fbd-a392-4f80-a61c-51d31a302cac', 0, + #{workspaceId}, NULL, 1629446289522, NULL), + (UUID(), 'IN_SITE', 'UPDATE', 'CREATOR', 'REVIEW_TASK', '', 'db515209-f864-46d3-a2e5-63db6d1339c3', 0, + #{workspaceId}, NULL, 1629446276516, NULL), + (UUID(), 'IN_SITE', 'DELETE', 'CREATOR', 'TRACK_REPORT_TASK', '', 'ea2fee85-8a44-413a-a128-16bfa01ada0d', + 0, + #{workspaceId}, NULL, 1629283758941, NULL), + (UUID(), 'IN_SITE', 'DELETE', 'CREATOR', 'REVIEW_TASK', '', 'f9b1f60b-6dee-48af-8217-0428b27dcbab', 0, + #{workspaceId}, NULL, 1629446272477, NULL), + (UUID(), 'IN_SITE', 'DELETE', 'CREATOR', 'TRACK_TEST_CASE_TASK', '', + '7c26254e-85e9-4269-be13-a2ffcfe0b9f5', 0, + #{workspaceId}, NULL, 1629446251939, NULL), + (UUID(), 'IN_SITE', 'DELETE', 'FOLLOW_PEOPLE', 'TRACK_TEST_CASE_TASK', '', + '7c26254e-85e9-4269-be13-a2ffcfe0b9f5', 0, #{workspaceId}, NULL, 1629446251939, + NULL), + (UUID(), 'IN_SITE', 'EXECUTE_SUCCESSFUL', 'CREATOR', 'API_DEFINITION_TASK', '', + '7efddbdb-2b6c-4425-96a4-0bc2aa9e2cd2', 0, #{workspaceId}, NULL, 1629775183917, + NULL), + (UUID(), 'IN_SITE', 'EXECUTE_FAILED', 'CREATOR', 'API_DEFINITION_TASK', '', + 'e508035c-1318-40ea-9457-0bbe9865f4ce', 0, #{workspaceId}, NULL, 1629775194857, + NULL), + (UUID(), 'IN_SITE', 'EXECUTE_COMPLETED', 'CREATOR', 'PERFORMANCE_TEST_TASK', '', + 'e3db90c6-fb49-4e89-bc25-1d14b5ce94d0', 0, #{workspaceId}, NULL, 1629790602744, + NULL), + (UUID(), 'IN_SITE', 'EXECUTE_FAILED', 'CREATOR', 'API_AUTOMATION_TASK', '', + 'c25930e8-b617-45f7-af5e-cc94adc14192', 0, #{workspaceId}, NULL, 1629780485724, + NULL), + (UUID(), 'IN_SITE', 'EXECUTE_SUCCESSFUL', 'CREATOR', 'API_AUTOMATION_TASK', '', + '9f91e5e5-1744-4160-bfc6-3851bfd59e05', 0, #{workspaceId}, NULL, 1629780475764, + NULL), + (UUID(), 'IN_SITE', 'UPDATE', 'PROCESSOR', 'DEFECT_TASK', '', + '6cad944e-db8d-4786-9ef3-7d6370940325', 0, #{workspaceId}, NULL, 1629791388405, + NULL), + (UUID(), 'IN_SITE', 'CREATE', 'PROCESSOR', 'DEFECT_TASK', '', + '4a890e41-e755-44fc-b734-d6a0ca25a65c', 0, #{workspaceId}, NULL, 1629790487682, + NULL) + \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/commons/constants/PermissionConstants.java b/backend/src/main/java/io/metersphere/commons/constants/PermissionConstants.java index d3bf1e4036..477e320dff 100644 --- a/backend/src/main/java/io/metersphere/commons/constants/PermissionConstants.java +++ b/backend/src/main/java/io/metersphere/commons/constants/PermissionConstants.java @@ -38,27 +38,11 @@ public class PermissionConstants { public static final String SYSTEM_AUTH_READ = "SYSTEM_AUTH:READ"; public static final String SYSTEM_AUTH_READ_EDIT = "SYSTEM_AUTH:READ+EDIT"; - - public static final String ORGANIZATION_USER_READ = "ORGANIZATION_USER:READ"; - public static final String ORGANIZATION_USER_READ_CREATE = "ORGANIZATION_USER:READ+CREATE"; - public static final String ORGANIZATION_USER_READ_EDIT = "ORGANIZATION_USER:READ+EDIT"; - public static final String ORGANIZATION_USER_READ_DELETE = "ORGANIZATION_USER:READ+DELETE"; - - public static final String ORGANIZATION_WORKSPACE_READ = "ORGANIZATION_WORKSPACE:READ"; - public static final String ORGANIZATION_WORKSPACE_READ_CREATE = "ORGANIZATION_WORKSPACE:READ+CREATE"; - public static final String ORGANIZATION_WORKSPACE_READ_EDIT = "ORGANIZATION_WORKSPACE:READ+EDIT"; - public static final String ORGANIZATION_WORKSPACE_READ_DELETE = "ORGANIZATION_WORKSPACE:READ+DELETE"; - - public static final String ORGANIZATION_GROUP_READ = "ORGANIZATION_GROUP:READ"; - public static final String ORGANIZATION_GROUP_READ_CREATE = "ORGANIZATION_GROUP:READ+CREATE"; - public static final String ORGANIZATION_GROUP_READ_EDIT = "ORGANIZATION_GROUP:READ+EDIT"; - public static final String ORGANIZATION_GROUP_READ_SETTING_PERMISSION = "ORGANIZATION_GROUP:READ+SETTING_PERMISSION"; - public static final String ORGANIZATION_GROUP_READ_DELETE = "ORGANIZATION_GROUP:READ+DELETE"; - - public static final String ORGANIZATION_SERVICE_READ = "ORGANIZATION_SERVICE:READ"; - public static final String ORGANIZATION_SERVICE_READ_EDIT = "ORGANIZATION_SERVICE:READ+EDIT"; - public static final String ORGANIZATION_MESSAGE_READ = "ORGANIZATION_MESSAGE:READ"; - public static final String ORGANIZATION_MESSAGE_READ_EDIT = "ORGANIZATION_MESSAGE:READ+EDIT"; + + public static final String WORKSPACE_SERVICE_READ = "WORKSPACE_SERVICE:READ"; + public static final String WORKSPACE_SERVICE_READ_EDIT = "WORKSPACE_SERVICE:READ+EDIT"; + public static final String WORKSPACE_MESSAGE_READ = "WORKSPACE_MESSAGE:READ"; + public static final String WORKSPACE_MESSAGE_READ_EDIT = "WORKSPACE_MESSAGE:READ+EDIT"; public static final String WORKSPACE_USER_READ = "WORKSPACE_USER:READ"; diff --git a/backend/src/main/java/io/metersphere/commons/constants/RoleConstants.java b/backend/src/main/java/io/metersphere/commons/constants/RoleConstants.java deleted file mode 100644 index adb585b0d0..0000000000 --- a/backend/src/main/java/io/metersphere/commons/constants/RoleConstants.java +++ /dev/null @@ -1,10 +0,0 @@ -package io.metersphere.commons.constants; - -public class RoleConstants { - public final static String ADMIN = "admin"; - public final static String ORG_ADMIN = "org_admin"; - public final static String ORG_MEMBER = "org_member"; - public final static String TEST_VIEWER = "test_viewer"; - public final static String TEST_MANAGER = "test_manager"; - public final static String TEST_USER = "test_user"; -} diff --git a/backend/src/main/java/io/metersphere/commons/utils/SessionUtils.java b/backend/src/main/java/io/metersphere/commons/utils/SessionUtils.java index 037ad56679..bd2e4a56b5 100644 --- a/backend/src/main/java/io/metersphere/commons/utils/SessionUtils.java +++ b/backend/src/main/java/io/metersphere/commons/utils/SessionUtils.java @@ -78,17 +78,6 @@ public class SessionUtils { return getUser().getLastWorkspaceId(); } - public static String getCurrentOrganizationId() { - try { - HttpServletRequest request = ((ServletRequestAttributes) (RequestContextHolder.currentRequestAttributes())).getRequest(); - if (request.getHeader("ORGANIZATION_ID") != null) { - return request.getHeader("ORGANIZATION_ID"); - } - } catch (Exception e) { - } - return getUser().getLastOrganizationId(); - } - public static String getCurrentProjectId() { try { HttpServletRequest request = ((ServletRequestAttributes) (RequestContextHolder.currentRequestAttributes())).getRequest(); diff --git a/backend/src/main/java/io/metersphere/controller/CustomFieldController.java b/backend/src/main/java/io/metersphere/controller/CustomFieldController.java index 7f2250ed8c..82a3850305 100644 --- a/backend/src/main/java/io/metersphere/controller/CustomFieldController.java +++ b/backend/src/main/java/io/metersphere/controller/CustomFieldController.java @@ -4,14 +4,11 @@ import com.github.pagehelper.Page; import com.github.pagehelper.PageHelper; import io.metersphere.base.domain.CustomField; import io.metersphere.commons.constants.OperLogConstants; -import io.metersphere.commons.constants.RoleConstants; import io.metersphere.commons.utils.PageUtils; import io.metersphere.commons.utils.Pager; import io.metersphere.controller.request.QueryCustomFieldRequest; import io.metersphere.log.annotation.MsAuditLog; import io.metersphere.service.CustomFieldService; -import org.apache.shiro.authz.annotation.Logical; -import org.apache.shiro.authz.annotation.RequiresRoles; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; diff --git a/backend/src/main/java/io/metersphere/controller/GroupController.java b/backend/src/main/java/io/metersphere/controller/GroupController.java index 670ebb49f1..c608bfcf88 100644 --- a/backend/src/main/java/io/metersphere/controller/GroupController.java +++ b/backend/src/main/java/io/metersphere/controller/GroupController.java @@ -3,8 +3,8 @@ package io.metersphere.controller; import com.github.pagehelper.Page; import com.github.pagehelper.PageHelper; import io.metersphere.base.domain.Group; -import io.metersphere.base.domain.Organization; import io.metersphere.base.domain.User; +import io.metersphere.base.domain.Workspace; import io.metersphere.commons.constants.OperLogConstants; import io.metersphere.commons.constants.PermissionConstants; import io.metersphere.commons.utils.PageUtils; @@ -19,6 +19,7 @@ import io.metersphere.service.GroupService; import org.apache.shiro.authz.annotation.Logical; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.web.bind.annotation.*; + import javax.annotation.Resource; import java.util.List; import java.util.Map; @@ -33,7 +34,7 @@ public class GroupController { private GroupService groupService; @PostMapping("/get/{goPage}/{pageSize}") - @RequiresPermissions(value= {PermissionConstants.SYSTEM_GROUP_READ, PermissionConstants.ORGANIZATION_GROUP_READ}, logical = Logical.OR) + @RequiresPermissions(value= {PermissionConstants.SYSTEM_GROUP_READ}, logical = Logical.OR) public Pager> getGroupList(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody EditGroupRequest request) { request.setGoPage(goPage); request.setPageSize(pageSize); @@ -46,13 +47,13 @@ public class GroupController { } @PostMapping("/get") - @RequiresPermissions(value={PermissionConstants.SYSTEM_GROUP_READ, PermissionConstants.ORGANIZATION_GROUP_READ}, logical = Logical.OR) + @RequiresPermissions(value={PermissionConstants.SYSTEM_GROUP_READ}, logical = Logical.OR) public List getGroupByType(@RequestBody EditGroupRequest request) { return groupService.getGroupByType(request); } @PostMapping("/add") - @RequiresPermissions(value={PermissionConstants.SYSTEM_GROUP_READ_CREATE, PermissionConstants.ORGANIZATION_GROUP_READ_CREATE}, logical = Logical.OR) + @RequiresPermissions(value={PermissionConstants.SYSTEM_GROUP_READ_CREATE}, logical = Logical.OR) @MsAuditLog(module = "group_permission", type = OperLogConstants.CREATE, content = "#msClass.getLogDetails(#request.id)", msClass = GroupService.class) public Group addGroup(@RequestBody EditGroupRequest request) { request.setId(UUID.randomUUID().toString()); @@ -60,14 +61,14 @@ public class GroupController { } @PostMapping("/edit") - @RequiresPermissions(value={PermissionConstants.SYSTEM_GROUP_READ_EDIT, PermissionConstants.ORGANIZATION_GROUP_READ_EDIT}, logical = Logical.OR) + @RequiresPermissions(value={PermissionConstants.SYSTEM_GROUP_READ_EDIT}, logical = Logical.OR) @MsAuditLog(module = "group_permission", type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails(#request.id)", content = "#msClass.getLogDetails(#request.id)", msClass = GroupService.class) public void editGroup(@RequestBody EditGroupRequest request) { groupService.editGroup(request); } @GetMapping("/delete/{id}") - @RequiresPermissions(value={PermissionConstants.SYSTEM_GROUP_READ_DELETE, PermissionConstants.ORGANIZATION_GROUP_READ_DELETE}, logical = Logical.OR) + @RequiresPermissions(value={PermissionConstants.SYSTEM_GROUP_READ_DELETE}, logical = Logical.OR) @MsAuditLog(module = "group_permission", type = OperLogConstants.DELETE, beforeEvent = "#msClass.getLogDetails(#id)", msClass = GroupService.class) public void deleteGroup(@PathVariable String id) { groupService.deleteGroup(id); @@ -79,7 +80,7 @@ public class GroupController { } @PostMapping("/permission/edit") - @RequiresPermissions(value={PermissionConstants.SYSTEM_GROUP_READ_SETTING_PERMISSION, PermissionConstants.ORGANIZATION_GROUP_READ_SETTING_PERMISSION}, logical = Logical.OR) + @RequiresPermissions(value={PermissionConstants.SYSTEM_GROUP_READ_SETTING_PERMISSION}, logical = Logical.OR) public void editGroupPermission(@RequestBody EditGroupRequest editGroupRequest) { groupService.editGroupPermission(editGroupRequest); } @@ -94,11 +95,6 @@ public class GroupController { return groupService.getGroupsByType(request); } - @GetMapping("/list/org/{orgId}/{userId}") - public List getOrganizationMemberGroups(@PathVariable String orgId, @PathVariable String userId) { - return groupService.getOrganizationMemberGroups(orgId, userId); - } - @GetMapping("/list/ws/{workspaceId}/{userId}") public List getWorkspaceMemberGroups(@PathVariable String workspaceId, @PathVariable String userId) { return groupService.getWorkspaceMemberGroups(workspaceId, userId); @@ -109,9 +105,9 @@ public class GroupController { return groupService.getProjectMemberGroups(projectId, userId); } - @GetMapping("/org/{userId}") - public List getOrganization(@PathVariable String userId) { - return groupService.getOrganization(userId); + @GetMapping("/ws/{userId}") + public List getWorkspace(@PathVariable String userId) { + return groupService.getWorkspace(userId); } @GetMapping("/{type}/{id}") diff --git a/backend/src/main/java/io/metersphere/controller/IssueTemplateController.java b/backend/src/main/java/io/metersphere/controller/IssueTemplateController.java index bacb2ba9e1..5e170dedb8 100644 --- a/backend/src/main/java/io/metersphere/controller/IssueTemplateController.java +++ b/backend/src/main/java/io/metersphere/controller/IssueTemplateController.java @@ -4,7 +4,6 @@ import com.github.pagehelper.Page; import com.github.pagehelper.PageHelper; import io.metersphere.base.domain.IssueTemplate; import io.metersphere.commons.constants.OperLogConstants; -import io.metersphere.commons.constants.RoleConstants; import io.metersphere.commons.utils.PageUtils; import io.metersphere.commons.utils.Pager; import io.metersphere.controller.request.BaseQueryRequest; @@ -12,8 +11,6 @@ import io.metersphere.controller.request.UpdateIssueTemplateRequest; import io.metersphere.dto.IssueTemplateDao; import io.metersphere.log.annotation.MsAuditLog; import io.metersphere.service.IssueTemplateService; -import org.apache.shiro.authz.annotation.Logical; -import org.apache.shiro.authz.annotation.RequiresRoles; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; diff --git a/backend/src/main/java/io/metersphere/controller/JarConfigController.java b/backend/src/main/java/io/metersphere/controller/JarConfigController.java index a89126f3a2..f19c01b240 100644 --- a/backend/src/main/java/io/metersphere/controller/JarConfigController.java +++ b/backend/src/main/java/io/metersphere/controller/JarConfigController.java @@ -4,13 +4,10 @@ import com.github.pagehelper.Page; import com.github.pagehelper.PageHelper; import io.metersphere.base.domain.JarConfig; import io.metersphere.commons.constants.OperLogConstants; -import io.metersphere.commons.constants.RoleConstants; import io.metersphere.commons.utils.PageUtils; import io.metersphere.commons.utils.Pager; import io.metersphere.log.annotation.MsAuditLog; import io.metersphere.service.JarConfigService; -import org.apache.shiro.authz.annotation.Logical; -import org.apache.shiro.authz.annotation.RequiresRoles; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; diff --git a/backend/src/main/java/io/metersphere/controller/OrganizationController.java b/backend/src/main/java/io/metersphere/controller/OrganizationController.java deleted file mode 100644 index eb83ff296d..0000000000 --- a/backend/src/main/java/io/metersphere/controller/OrganizationController.java +++ /dev/null @@ -1,76 +0,0 @@ -package io.metersphere.controller; - -import com.github.pagehelper.Page; -import com.github.pagehelper.PageHelper; -import io.metersphere.base.domain.Organization; -import io.metersphere.commons.constants.OperLogConstants; -import io.metersphere.commons.utils.PageUtils; -import io.metersphere.commons.utils.Pager; -import io.metersphere.controller.request.OrganizationRequest; -import io.metersphere.dto.OrganizationMemberDTO; -import io.metersphere.dto.OrganizationResource; -import io.metersphere.log.annotation.MsAuditLog; -import io.metersphere.service.OrganizationService; -import io.metersphere.service.UserService; -import org.springframework.web.bind.annotation.*; - -import javax.annotation.Resource; -import java.util.List; -import java.util.UUID; - -@RequestMapping("organization") -@RestController -public class OrganizationController { - - @Resource - private OrganizationService organizationService; - @Resource - private UserService userService; - - @PostMapping("/add") - @MsAuditLog(module = "system_organization", type = OperLogConstants.CREATE, content = "#msClass.getLogDetails(#organization.id)", msClass = OrganizationService.class) - public Organization addOrganization(@RequestBody Organization organization) { - organization.setId(UUID.randomUUID().toString()); - return organizationService.addOrganization(organization); - } - - @GetMapping("/list") - public List getOrganizationList() { - return organizationService.getOrganizationList(new OrganizationRequest()); - } - - @PostMapping("/list/{goPage}/{pageSize}") - public Pager> getOrganizationList(@RequestBody OrganizationRequest request, @PathVariable int goPage, @PathVariable int pageSize) { - Page page = PageHelper.startPage(goPage, pageSize, true); - return PageUtils.setPageInfo(page, organizationService.getOrganizationList(request)); - } - - @GetMapping("/delete/{organizationId}") - @MsAuditLog(module = "system_organization", type = OperLogConstants.DELETE, beforeEvent = "#msClass.getLogDetails(#organizationId)", msClass = OrganizationService.class) - public void deleteOrganization(@PathVariable(value = "organizationId") String organizationId) { - userService.refreshSessionUser("organization", organizationId); - organizationService.deleteOrganization(organizationId); - } - - @PostMapping("/update") - @MsAuditLog(module = "system_organization", type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails(#organization.id)", content = "#msClass.getLogDetails(#organization.id)", msClass = OrganizationService.class) - public void updateOrganization(@RequestBody Organization organization) { - organizationService.updateOrganization(organization); - } - - @GetMapping("/list/userorg/{userId}") - public List getOrganizationListByUserId(@PathVariable String userId) { - return organizationService.getOrganizationListByUserId(userId); - } - - @PostMapping("/member/update") - @MsAuditLog(module = "organization_member", type = OperLogConstants.UPDATE,beforeEvent = "#msClass.getLogDetails(#memberDTO)", content = "#msClass.getLogDetails(#memberDTO)", msClass = OrganizationService.class) - public void updateOrgMember(@RequestBody OrganizationMemberDTO memberDTO) { - organizationService.updateOrgMember(memberDTO); - } - - @GetMapping("/list/resource/{groupId}/{type}") - public OrganizationResource listResource(@PathVariable String groupId, @PathVariable String type) { - return organizationService.listResource(groupId, type); - } -} diff --git a/backend/src/main/java/io/metersphere/controller/ProjectController.java b/backend/src/main/java/io/metersphere/controller/ProjectController.java index 7ce693e2ba..3235f6e876 100644 --- a/backend/src/main/java/io/metersphere/controller/ProjectController.java +++ b/backend/src/main/java/io/metersphere/controller/ProjectController.java @@ -68,6 +68,10 @@ public class ProjectController { public Project getProject(@PathVariable String id) { return projectService.getProjectById(id); } + @GetMapping("/member/size/{id}") + public long getProjectMemberSize(@PathVariable String id) { + return projectService.getProjectMemberSize(id); + } @PostMapping("/add") @MsAuditLog(module = "project_project_manager", type = OperLogConstants.CREATE, content = "#msClass.getLogDetails(#project.id)", msClass = ProjectService.class) diff --git a/backend/src/main/java/io/metersphere/controller/ResourceController.java b/backend/src/main/java/io/metersphere/controller/ResourceController.java index 750c2c4713..f00e1de30b 100644 --- a/backend/src/main/java/io/metersphere/controller/ResourceController.java +++ b/backend/src/main/java/io/metersphere/controller/ResourceController.java @@ -1,10 +1,7 @@ package io.metersphere.controller; -import io.metersphere.commons.constants.RoleConstants; import io.metersphere.controller.request.MdUploadRequest; import io.metersphere.service.ResourceService; -import org.apache.shiro.authz.annotation.Logical; -import org.apache.shiro.authz.annotation.RequiresRoles; import org.springframework.core.io.FileSystemResource; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; diff --git a/backend/src/main/java/io/metersphere/controller/RoleController.java b/backend/src/main/java/io/metersphere/controller/RoleController.java deleted file mode 100644 index 137918bfe4..0000000000 --- a/backend/src/main/java/io/metersphere/controller/RoleController.java +++ /dev/null @@ -1,32 +0,0 @@ -package io.metersphere.controller; - -import io.metersphere.base.domain.Role; -import io.metersphere.commons.constants.RoleConstants; -import io.metersphere.service.RoleService; -import org.apache.shiro.authz.annotation.RequiresRoles; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -import javax.annotation.Resource; -import java.util.List; - -@RequestMapping("role") -@RestController -public class RoleController { - - @Resource - private RoleService roleService; - - @GetMapping("/list/{sign}") - public List getRoleList(@PathVariable String sign) { - return roleService.getRoleList(sign); - } - - @GetMapping("/all") - public List getAllRole() { - return roleService.getAllRole(); - } - -} diff --git a/backend/src/main/java/io/metersphere/controller/ServiceIntegrationController.java b/backend/src/main/java/io/metersphere/controller/ServiceIntegrationController.java index 2d24912940..14e9ca3828 100644 --- a/backend/src/main/java/io/metersphere/controller/ServiceIntegrationController.java +++ b/backend/src/main/java/io/metersphere/controller/ServiceIntegrationController.java @@ -18,7 +18,7 @@ public class ServiceIntegrationController { private IntegrationService integrationService; @PostMapping("/save") - @MsAuditLog(module = "organization_service_integration", type = OperLogConstants.CREATE, content = "#msClass.getLogDetails(#service.id)", msClass = IntegrationService.class) + @MsAuditLog(module = "workspace_service_integration", type = OperLogConstants.CREATE, content = "#msClass.getLogDetails(#service.id)", msClass = IntegrationService.class) public ServiceIntegration save(@RequestBody ServiceIntegration service) { return integrationService.save(service); } @@ -29,14 +29,14 @@ public class ServiceIntegrationController { } @PostMapping("/delete") - @MsAuditLog(module = "organization_service_integration", type = OperLogConstants.DELETE, beforeEvent = "#msClass.getLogDetails(#request.id)", msClass = IntegrationService.class) + @MsAuditLog(module = "workspace_service_integration", type = OperLogConstants.DELETE, beforeEvent = "#msClass.getLogDetails(#request.id)", msClass = IntegrationService.class) public void delete(@RequestBody IntegrationRequest request) { integrationService.delete(request); } - @GetMapping("/all/{orgId}") - public List getAll(@PathVariable String orgId) { - return integrationService.getAll(orgId); + @GetMapping("/all/{workspaceId}") + public List getAll(@PathVariable String workspaceId) { + return integrationService.getAll(workspaceId); } } diff --git a/backend/src/main/java/io/metersphere/controller/SystemParameterController.java b/backend/src/main/java/io/metersphere/controller/SystemParameterController.java index 8773b4259d..5846549872 100644 --- a/backend/src/main/java/io/metersphere/controller/SystemParameterController.java +++ b/backend/src/main/java/io/metersphere/controller/SystemParameterController.java @@ -7,10 +7,14 @@ import io.metersphere.commons.constants.OperLogConstants; import io.metersphere.commons.constants.ParamConstants; import io.metersphere.controller.request.HeaderRequest; import io.metersphere.dto.BaseSystemConfigDTO; +import io.metersphere.dto.SystemStatisticData; import io.metersphere.ldap.domain.LdapInfo; import io.metersphere.log.annotation.MsAuditLog; import io.metersphere.notice.domain.MailInfo; +import io.metersphere.service.ProjectService; import io.metersphere.service.SystemParameterService; +import io.metersphere.service.UserService; +import io.metersphere.service.WorkspaceService; import org.springframework.core.env.Environment; import org.springframework.web.bind.annotation.*; @@ -25,6 +29,12 @@ public class SystemParameterController { private SystemParameterService SystemParameterService; @Resource private Environment env; + @Resource + private UserService userService; + @Resource + private WorkspaceService workspaceService; + @Resource + private ProjectService projectService; @PostMapping("/edit/email") @MsAuditLog(module = "system_parameter_setting", type = OperLogConstants.UPDATE, title = "邮件设置", beforeEvent = "#msClass.getMailLogDetails()", content = "#msClass.getMailLogDetails()", msClass = SystemParameterService.class) @@ -99,4 +109,29 @@ public class SystemParameterController { public UserHeader getHeaderInfo(@RequestBody HeaderRequest headerRequest) { return SystemParameterService.queryUserHeader(headerRequest); } + + @GetMapping("/statistics/data") + public SystemStatisticData getStatisticsData() { + SystemStatisticData systemStatisticData = new SystemStatisticData(); + long userSize = userService.getUserSize(); + long workspaceSize = workspaceService.getWorkspaceSize(); + long projectSize = projectService.getProjectSize(); + systemStatisticData.setUserSize(userSize); + systemStatisticData.setWorkspaceSize(workspaceSize); + systemStatisticData.setProjectSize(projectSize); + return systemStatisticData; + } + + @GetMapping("/get/info/{key}") + public SystemParameter getInfo(@PathVariable String key) { + return SystemParameterService.getInfo(key); + } + + @PostMapping("/edit/info") + public SystemParameter editInfo(@RequestBody SystemParameter systemParameter) { + SystemParameterService.editInfo(systemParameter); + return systemParameter; + } + + } diff --git a/backend/src/main/java/io/metersphere/controller/TestCaseTemplateController.java b/backend/src/main/java/io/metersphere/controller/TestCaseTemplateController.java index b3109fb8f5..698668890a 100644 --- a/backend/src/main/java/io/metersphere/controller/TestCaseTemplateController.java +++ b/backend/src/main/java/io/metersphere/controller/TestCaseTemplateController.java @@ -5,7 +5,6 @@ import com.github.pagehelper.PageHelper; import io.metersphere.base.domain.TestCaseTemplate; import io.metersphere.base.domain.TestCaseTemplateWithBLOBs; import io.metersphere.commons.constants.OperLogConstants; -import io.metersphere.commons.constants.RoleConstants; import io.metersphere.commons.utils.PageUtils; import io.metersphere.commons.utils.Pager; import io.metersphere.controller.request.BaseQueryRequest; @@ -13,8 +12,6 @@ import io.metersphere.controller.request.UpdateCaseFieldTemplateRequest; import io.metersphere.dto.TestCaseTemplateDao; import io.metersphere.log.annotation.MsAuditLog; import io.metersphere.service.TestCaseTemplateService; -import org.apache.shiro.authz.annotation.Logical; -import org.apache.shiro.authz.annotation.RequiresRoles; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; diff --git a/backend/src/main/java/io/metersphere/controller/TestResourcePoolController.java b/backend/src/main/java/io/metersphere/controller/TestResourcePoolController.java index 193f575389..4892f5ddd5 100644 --- a/backend/src/main/java/io/metersphere/controller/TestResourcePoolController.java +++ b/backend/src/main/java/io/metersphere/controller/TestResourcePoolController.java @@ -3,7 +3,6 @@ package io.metersphere.controller; import com.github.pagehelper.Page; import com.github.pagehelper.PageHelper; import io.metersphere.commons.constants.OperLogConstants; -import io.metersphere.commons.constants.RoleConstants; import io.metersphere.commons.utils.PageUtils; import io.metersphere.commons.utils.Pager; import io.metersphere.consul.CacheNode; @@ -12,8 +11,6 @@ import io.metersphere.dto.TestResourcePoolDTO; import io.metersphere.dto.UpdatePoolDTO; import io.metersphere.log.annotation.MsAuditLog; import io.metersphere.service.TestResourcePoolService; -import org.apache.shiro.authz.annotation.Logical; -import org.apache.shiro.authz.annotation.RequiresRoles; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; diff --git a/backend/src/main/java/io/metersphere/controller/UserController.java b/backend/src/main/java/io/metersphere/controller/UserController.java index bb4810cfb6..e856e0569c 100644 --- a/backend/src/main/java/io/metersphere/controller/UserController.java +++ b/backend/src/main/java/io/metersphere/controller/UserController.java @@ -12,27 +12,19 @@ import io.metersphere.controller.request.member.AddMemberRequest; import io.metersphere.controller.request.member.EditPassWordRequest; import io.metersphere.controller.request.member.QueryMemberRequest; import io.metersphere.controller.request.member.UserRequest; -import io.metersphere.controller.request.organization.AddOrgMemberRequest; -import io.metersphere.controller.request.organization.QueryOrgMemberRequest; import io.metersphere.controller.request.resourcepool.UserBatchProcessRequest; import io.metersphere.dto.*; import io.metersphere.excel.domain.ExcelResponse; import io.metersphere.i18n.Translator; import io.metersphere.log.annotation.MsAuditLog; -import io.metersphere.service.OrganizationService; import io.metersphere.service.UserService; -import io.metersphere.service.WorkspaceService; import org.apache.commons.lang3.StringUtils; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; - import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import java.util.ArrayList; import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; @RequestMapping("user") @RestController @@ -40,10 +32,6 @@ public class UserController { @Resource private UserService userService; - @Resource - private OrganizationService organizationService; - @Resource - private WorkspaceService workspaceService; @PostMapping("/special/add") @MsAuditLog(module = "system_user", type = OperLogConstants.CREATE, content = "#msClass.getLogDetails(#user)", msClass = UserService.class) @@ -57,11 +45,6 @@ public class UserController { return PageUtils.setPageInfo(page, userService.getUserListWithRequest(request)); } - @GetMapping("/special/user/role/{userId}") - public UserRoleDTO getUserRole(@PathVariable("userId") String userId) { - return userService.getUserRole(userId); - } - @GetMapping("/special/user/group/{userId}") public UserGroupPermissionDTO getUserGroup(@PathVariable("userId") String userId) { return userService.getUserGroup(userId); @@ -110,29 +93,6 @@ public class UserController { userService.deleteMember(workspaceId, userId); } - @PostMapping("/special/org/member/add") - @MsAuditLog(module = "organization_member", type = OperLogConstants.CREATE, content = "#msClass.getLogDetails(#request.userIds,#request.organizationId)", msClass = UserService.class) - public void addOrganizationMemberByAdmin(@RequestBody AddOrgMemberRequest request) { - userService.addOrganizationMember(request); - } - - @GetMapping("/special/org/member/delete/{organizationId}/{userId}") - @MsAuditLog(module = "organization_member", type = OperLogConstants.DELETE, beforeEvent = "#msClass.getLogDetails(#userId)", msClass = UserService.class) - public void delOrganizationMemberByAdmin(@PathVariable String organizationId, @PathVariable String userId) { - userService.delOrganizationMember(organizationId, userId); - } - - @PostMapping("/special/org/member/list/{goPage}/{pageSize}") - public Pager> getOrgMemberListByAdmin(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody QueryOrgMemberRequest request) { - Page page = PageHelper.startPage(goPage, pageSize, true); - return PageUtils.setPageInfo(page, userService.getOrgMemberList(request)); - } - - @PostMapping("/special/org/member/list/all") - public List getOrgMemberListByAdmin(@RequestBody QueryOrgMemberRequest request) { - return userService.getOrgMemberList(request); - } - @GetMapping("/list") public List getUserList() { return userService.getUserList(); @@ -242,50 +202,13 @@ public class UserController { userService.deleteProjectMember(projectId, userId); } - /** - * 添加组织成员 - */ - @PostMapping("/org/member/add") - @MsAuditLog(module = "organization_member", type = OperLogConstants.CREATE, title = "'添加组织成员-'+#request.userIds") - public void addOrganizationMember(@RequestBody AddOrgMemberRequest request) { - organizationService.checkOrgOwner(request.getOrganizationId()); - userService.addOrganizationMember(request); - } /** - * 删除组织成员 + * ws 下所有相关人员 */ - @GetMapping("/org/member/delete/{organizationId}/{userId}") - @MsAuditLog(module = "organization_member", type = OperLogConstants.DELETE, title = "删除组织成员") - public void delOrganizationMember(@PathVariable String organizationId, @PathVariable String userId) { - organizationService.checkOrgOwner(organizationId); - String currentUserId = SessionUtils.getUser().getId(); - if (StringUtils.equals(userId, currentUserId)) { - MSException.throwException(Translator.get("cannot_remove_current")); - } - userService.delOrganizationMember(organizationId, userId); - } - - /** - * 查询组织成员列表 - */ - @PostMapping("/org/member/list/{goPage}/{pageSize}") - public Pager> getOrgMemberList(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody QueryOrgMemberRequest request) { - Page page = PageHelper.startPage(goPage, pageSize, true); - return PageUtils.setPageInfo(page, userService.getOrgMemberList(request)); - } - - /** - * 组织下所有相关人员 - */ - @PostMapping("/org/member/list/all") - public List getOrgMemberList(@RequestBody QueryOrgMemberRequest request) { - return userService.getOrgAllMember(request); - } - - @GetMapping("/besideorg/list/{orgId}") - public List getBesideOrgMemberList(@PathVariable String orgId) { - return userService.getBesideOrgMemberList(orgId); + @GetMapping("/ws/member/list/{workspaceId}") + public List getWsMemberList(@PathVariable String workspaceId) { + return userService.getWsAllMember(workspaceId); } /* @@ -304,14 +227,6 @@ public class UserController { return userService.updateUserPassword(request); } - /** - * 获取工作空间成员用户 不分页 - */ - @PostMapping("/ws/member/tester/list") - public List getTestManagerAndTestUserList(@RequestBody QueryMemberRequest request) { - return userService.getTestManagerAndTestUserList(request); - } - @PostMapping("/project/member/tester/list") public List getProjectMember(@RequestBody QueryMemberRequest request) { return userService.getProjectMember(request); @@ -340,45 +255,4 @@ public class UserController { userService.batchProcessUserInfo(request); return returnString; } - - @GetMapping("/getWorkspaceDataStruct/{organizationId}") - public List getWorkspaceDataStruct(@PathVariable String organizationId) { - List organizationList = organizationService.findIdAndNameByOrganizationId(organizationId); - List workspaceDTOList = workspaceService.findIdAndNameByOrganizationId(organizationId); - if (!workspaceDTOList.isEmpty()) { - Map> orgIdWorkspaceMap = workspaceDTOList.stream().collect(Collectors.groupingBy(WorkspaceDTO::getOrganizationId)); - List returnList = CascaderParse.parseWorkspaceDataStruct(organizationList, orgIdWorkspaceMap); - return returnList; - } else { - return new ArrayList<>(); - } - } - - @GetMapping("/getUserRoleDataStruct/{organizationId}") - public List getUserRoleDataStruct(@PathVariable String organizationId) { - List organizationList = organizationService.findIdAndNameByOrganizationId(organizationId); - List workspaceDTOList = workspaceService.findIdAndNameByOrganizationId(organizationId); - if (!workspaceDTOList.isEmpty()) { - Map> orgIdWorkspaceMap = workspaceDTOList.stream().collect(Collectors.groupingBy(WorkspaceDTO::getOrganizationId)); - List returnList = CascaderParse.parseUserRoleDataStruct(organizationList, orgIdWorkspaceMap, false); - return returnList; - } else { - return new ArrayList<>(); - } - } - - @GetMapping("/getWorkspaceUserRoleDataStruct/{organizationId}") - public List getWorkspaceUserRoleDataStruct(@PathVariable String organizationId) { - List organizationList = organizationService.findIdAndNameByOrganizationId(organizationId); - List workspaceDTOList = workspaceService.findIdAndNameByOrganizationId(organizationId); - if (!workspaceDTOList.isEmpty()) { - Map> orgIdWorkspaceMap = workspaceDTOList.stream().collect(Collectors.groupingBy(WorkspaceDTO::getOrganizationId)); - List returnList = CascaderParse.parseUserRoleDataStruct(organizationList, orgIdWorkspaceMap, true); - return returnList; - } else { - return new ArrayList<>(); - } - } - - } diff --git a/backend/src/main/java/io/metersphere/controller/UserKeysController.java b/backend/src/main/java/io/metersphere/controller/UserKeysController.java index 34e9df168d..0cb8dc662c 100644 --- a/backend/src/main/java/io/metersphere/controller/UserKeysController.java +++ b/backend/src/main/java/io/metersphere/controller/UserKeysController.java @@ -2,13 +2,10 @@ package io.metersphere.controller; import io.metersphere.base.domain.UserKey; import io.metersphere.commons.constants.OperLogConstants; -import io.metersphere.commons.constants.RoleConstants; import io.metersphere.commons.utils.SessionUtils; import io.metersphere.log.annotation.MsAuditLog; import io.metersphere.security.ApiKeyHandler; import io.metersphere.service.UserKeyService; -import org.apache.shiro.authz.annotation.Logical; -import org.apache.shiro.authz.annotation.RequiresRoles; import org.apache.shiro.web.util.WebUtils; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; diff --git a/backend/src/main/java/io/metersphere/controller/UserRoleController.java b/backend/src/main/java/io/metersphere/controller/UserRoleController.java deleted file mode 100644 index de0767bc51..0000000000 --- a/backend/src/main/java/io/metersphere/controller/UserRoleController.java +++ /dev/null @@ -1,38 +0,0 @@ -package io.metersphere.controller; - -import io.metersphere.base.domain.Role; -import io.metersphere.commons.constants.RoleConstants; -import io.metersphere.service.UserRoleService; -import org.apache.shiro.authz.annotation.Logical; -import org.apache.shiro.authz.annotation.RequiresRoles; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -import javax.annotation.Resource; -import java.util.List; -import java.util.Map; - -@RequestMapping("userrole") -@RestController -public class UserRoleController { - - @Resource - private UserRoleService userRoleService; - - @GetMapping("/list/org/{orgId}/{userId}") - public List getOrganizationMemberRoles(@PathVariable String orgId, @PathVariable String userId) { - return userRoleService.getOrganizationMemberRoles(orgId, userId); - } - - @GetMapping("/list/ws/{workspaceId}/{userId}") - public List getWorkspaceMemberRoles(@PathVariable String workspaceId, @PathVariable String userId) { - return userRoleService.getWorkspaceMemberRoles(workspaceId, userId); - } - - @GetMapping("/all/{userId}") - public List> getUserRole(@PathVariable("userId") String userId) { - return userRoleService.getUserRole(userId); - } -} diff --git a/backend/src/main/java/io/metersphere/controller/WorkspaceController.java b/backend/src/main/java/io/metersphere/controller/WorkspaceController.java index 8963b3a113..6bbec83f91 100644 --- a/backend/src/main/java/io/metersphere/controller/WorkspaceController.java +++ b/backend/src/main/java/io/metersphere/controller/WorkspaceController.java @@ -6,12 +6,11 @@ import io.metersphere.base.domain.Workspace; import io.metersphere.commons.constants.OperLogConstants; import io.metersphere.commons.utils.PageUtils; import io.metersphere.commons.utils.Pager; -import io.metersphere.commons.utils.SessionUtils; import io.metersphere.controller.request.WorkspaceRequest; import io.metersphere.dto.WorkspaceDTO; import io.metersphere.dto.WorkspaceMemberDTO; +import io.metersphere.dto.WorkspaceResource; import io.metersphere.log.annotation.MsAuditLog; -import io.metersphere.service.OrganizationService; import io.metersphere.service.UserService; import io.metersphere.service.WorkspaceService; import org.springframework.web.bind.annotation.*; @@ -25,14 +24,11 @@ public class WorkspaceController { @Resource private WorkspaceService workspaceService; @Resource - private OrganizationService organizationService; - @Resource private UserService userService; @PostMapping("add") @MsAuditLog(module = "system_workspace", type = OperLogConstants.CREATE, content = "#msClass.getLogDetails(#workspace.id)", msClass = WorkspaceService.class) public Workspace addWorkspace(@RequestBody Workspace workspace) { - organizationService.checkOrgOwner(workspace.getOrganizationId()); return workspaceService.saveWorkspace(workspace); } @@ -92,21 +88,14 @@ public class WorkspaceController { return workspaceService.getWorkspaceListByUserId(userId); } - @GetMapping("/list/orgworkspace/{userId}/{orgId}") - public List getWorkspaceListByOrgId(@PathVariable String userId, @PathVariable String orgId) { - return workspaceService.getWorkspaceListByOrgIdAndUserId(userId, orgId); - } - @PostMapping("/member/update") @MsAuditLog(module = "workspace_member", type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails(#memberDTO)", content = "#msClass.getLogDetails(#memberDTO)", msClass = WorkspaceService.class) public void updateOrgMember(@RequestBody WorkspaceMemberDTO memberDTO) { workspaceService.updateWorkspaceMember(memberDTO); } - @GetMapping("/list/{orgId}") - public List getWorkspaceByOrgId(@PathVariable String orgId) { - WorkspaceRequest request = new WorkspaceRequest(); - request.setOrganizationId(orgId); - return workspaceService.getWorkspaceList(request); + @GetMapping("/list/resource/{groupId}/{type}") + public WorkspaceResource listResource(@PathVariable String groupId, @PathVariable String type) { + return workspaceService.listResource(groupId, type); } } diff --git a/backend/src/main/java/io/metersphere/controller/request/BaseQueryRequest.java b/backend/src/main/java/io/metersphere/controller/request/BaseQueryRequest.java index c1ad76012e..1b958489c1 100644 --- a/backend/src/main/java/io/metersphere/controller/request/BaseQueryRequest.java +++ b/backend/src/main/java/io/metersphere/controller/request/BaseQueryRequest.java @@ -16,8 +16,6 @@ public class BaseQueryRequest { private String workspaceId; - private String organizationId; - private List ids; private List moduleIds; diff --git a/backend/src/main/java/io/metersphere/controller/request/IntegrationRequest.java b/backend/src/main/java/io/metersphere/controller/request/IntegrationRequest.java index 3c9229611f..0ac18d5521 100644 --- a/backend/src/main/java/io/metersphere/controller/request/IntegrationRequest.java +++ b/backend/src/main/java/io/metersphere/controller/request/IntegrationRequest.java @@ -7,5 +7,5 @@ import lombok.Setter; @Setter public class IntegrationRequest { private String platform; - private String orgId; + private String workspaceId; } diff --git a/backend/src/main/java/io/metersphere/controller/request/WorkspaceRequest.java b/backend/src/main/java/io/metersphere/controller/request/WorkspaceRequest.java index ce51de92c2..d7c595ee6b 100644 --- a/backend/src/main/java/io/metersphere/controller/request/WorkspaceRequest.java +++ b/backend/src/main/java/io/metersphere/controller/request/WorkspaceRequest.java @@ -6,6 +6,5 @@ import lombok.Setter; @Getter @Setter public class WorkspaceRequest { - private String organizationId; private String name; } diff --git a/backend/src/main/java/io/metersphere/controller/request/organization/AddOrgMemberRequest.java b/backend/src/main/java/io/metersphere/controller/request/organization/AddOrgMemberRequest.java index 3db3075436..d9f7d8eaf1 100644 --- a/backend/src/main/java/io/metersphere/controller/request/organization/AddOrgMemberRequest.java +++ b/backend/src/main/java/io/metersphere/controller/request/organization/AddOrgMemberRequest.java @@ -9,7 +9,6 @@ import java.util.List; @Setter public class AddOrgMemberRequest { - private String organizationId; private List userIds; private List roleIds; private List groupIds; diff --git a/backend/src/main/java/io/metersphere/controller/request/organization/QueryOrgMemberRequest.java b/backend/src/main/java/io/metersphere/controller/request/organization/QueryOrgMemberRequest.java deleted file mode 100644 index 684cdae270..0000000000 --- a/backend/src/main/java/io/metersphere/controller/request/organization/QueryOrgMemberRequest.java +++ /dev/null @@ -1,11 +0,0 @@ -package io.metersphere.controller.request.organization; - -import lombok.Getter; -import lombok.Setter; - -@Getter -@Setter -public class QueryOrgMemberRequest { - private String name; - private String organizationId; -} diff --git a/backend/src/main/java/io/metersphere/controller/request/resourcepool/UserBatchProcessRequest.java b/backend/src/main/java/io/metersphere/controller/request/resourcepool/UserBatchProcessRequest.java index 1b69ab71d1..73223334ab 100644 --- a/backend/src/main/java/io/metersphere/controller/request/resourcepool/UserBatchProcessRequest.java +++ b/backend/src/main/java/io/metersphere/controller/request/resourcepool/UserBatchProcessRequest.java @@ -19,7 +19,7 @@ public class UserBatchProcessRequest { String projectId; String batchType; List batchProcessValue; - String organizationId; + String workspaceId; UserRequest condition; } diff --git a/backend/src/main/java/io/metersphere/dto/CascaderParse.java b/backend/src/main/java/io/metersphere/dto/CascaderParse.java deleted file mode 100644 index b95b15d0a0..0000000000 --- a/backend/src/main/java/io/metersphere/dto/CascaderParse.java +++ /dev/null @@ -1,108 +0,0 @@ -package io.metersphere.dto; - -import bsh.StringUtil; -import io.metersphere.commons.constants.RoleConstants; -import io.metersphere.i18n.Translator; -import org.apache.commons.lang3.StringUtils; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -/** - * @author song.tianyang - * @Date 2021/3/4 2:47 下午 - * @Description - */ -public class CascaderParse { - public static List parseUserRoleDataStruct(List organizationList, Map> orgIdWorkspaceMap,boolean hideOrgRole) { - List returnList = new ArrayList<>(); - for (OrganizationMemberDTO orgDTO : organizationList) { - String orgId = orgDTO.getId(); - List workspaceDTOList = orgIdWorkspaceMap.get(orgId); - CascaderDTO orgCascader = generateCascaderDTO(orgDTO.getId(), orgDTO.getName(), null); - if (workspaceDTOList != null) { - List children = new ArrayList<>(); - for (WorkspaceDTO workspace : workspaceDTOList) { - String parentCascaderType = "workspace"; - if(hideOrgRole){ - parentCascaderType = "hideOrg"; - } - List cascaderDTOList = getUserRoleCascaderDTO(parentCascaderType, workspace.getId()); - CascaderDTO workspaceCascader = generateCascaderDTO(workspace.getId(), workspace.getName(), cascaderDTOList); - children.add(workspaceCascader); - } - orgCascader.setChildren(children); - } else { - List cascaderDTOList = getUserRoleCascaderDTO("org", orgDTO.getId()); - orgCascader.setChildren(cascaderDTOList); - } - returnList.add(orgCascader); - } - return returnList; - } - - private static List getUserRoleCascaderDTO(String parentCascaderType, String parentID) { - String idPrefix = ""; - String idSuffix = "<->" + parentCascaderType; - if (!StringUtils.isEmpty(parentID)) { - idPrefix = parentID + "<->"; - } - CascaderDTO orgAdminCascasder = generateCascaderDTO(idPrefix + RoleConstants.ORG_ADMIN + idSuffix, Translator.get("org_admin"), null); - CascaderDTO orgMemberCascasder = generateCascaderDTO(idPrefix + RoleConstants.ORG_MEMBER + idSuffix, Translator.get("org_member"), null); - CascaderDTO testManagerCascasder = generateCascaderDTO(idPrefix + RoleConstants.TEST_MANAGER + idSuffix, Translator.get("test_manager"), null); - CascaderDTO testerCascasder = generateCascaderDTO(idPrefix + RoleConstants.TEST_USER + idSuffix, Translator.get("tester"), null); - CascaderDTO readOnlyUserCascasder = generateCascaderDTO(idPrefix + RoleConstants.TEST_VIEWER + idSuffix, Translator.get("read_only_user"), null); - - //默认都要添加这两种类型 - List returnList = new ArrayList<>(); - - switch (parentCascaderType) { - case "workspace": - returnList.add(orgAdminCascasder); - returnList.add(orgMemberCascasder); - returnList.add(testManagerCascasder); - returnList.add(testerCascasder); - returnList.add(readOnlyUserCascasder); - break; - case "org": - returnList.add(orgAdminCascasder); - returnList.add(orgMemberCascasder); - break; - case "hideOrg": - returnList.add(testManagerCascasder); - returnList.add(testerCascasder); - returnList.add(readOnlyUserCascasder); - break; - } - return returnList; - } - - public static List parseWorkspaceDataStruct(List organizationList, Map> orgIdWorkspaceMap) { - List returnList = new ArrayList<>(); - for (OrganizationMemberDTO orgDTO : organizationList) { - String orgId = orgDTO.getId(); - List workspaceDTOList = orgIdWorkspaceMap.get(orgId); - if (workspaceDTOList != null) { - List children = new ArrayList<>(); - for (WorkspaceDTO workspace : workspaceDTOList) { - CascaderDTO workspaceCascader = generateCascaderDTO(workspace.getId(), workspace.getName(), null); - children.add(workspaceCascader); - } - CascaderDTO orgCascader = generateCascaderDTO(orgDTO.getId(), orgDTO.getName(), children); - returnList.add(orgCascader); - } - } - return returnList; - } - - private static CascaderDTO generateCascaderDTO(String value, String lable, List children) { - CascaderDTO cascaderDTO = new CascaderDTO(); - cascaderDTO.setLabel(lable); - cascaderDTO.setValue(value); - if (children != null && !children.isEmpty()) { - cascaderDTO.setChildren(children); - } - return cascaderDTO; - } -} diff --git a/backend/src/main/java/io/metersphere/dto/OrganizationMemberDTO.java b/backend/src/main/java/io/metersphere/dto/OrganizationMemberDTO.java deleted file mode 100644 index d2ac32468a..0000000000 --- a/backend/src/main/java/io/metersphere/dto/OrganizationMemberDTO.java +++ /dev/null @@ -1,24 +0,0 @@ -package io.metersphere.dto; - -import lombok.Getter; -import lombok.Setter; - -import java.util.ArrayList; -import java.util.List; - -@Getter -@Setter -public class OrganizationMemberDTO { - private String id; - private String name; - private String email; - private String phone; - private String status; - private Long createTime; - private Long updateTime; - private String language; - private String organizationId; - private List roleIds = new ArrayList<>(); - private List groupIds = new ArrayList<>(); - -} diff --git a/backend/src/main/java/io/metersphere/dto/RelatedSource.java b/backend/src/main/java/io/metersphere/dto/RelatedSource.java index 3ca884488f..aa23631991 100644 --- a/backend/src/main/java/io/metersphere/dto/RelatedSource.java +++ b/backend/src/main/java/io/metersphere/dto/RelatedSource.java @@ -4,7 +4,6 @@ import lombok.Data; @Data public class RelatedSource { - private String organizationId; private String workspaceId; private String projectId; } diff --git a/backend/src/main/java/io/metersphere/dto/SystemStatisticData.java b/backend/src/main/java/io/metersphere/dto/SystemStatisticData.java new file mode 100644 index 0000000000..a7cb35f156 --- /dev/null +++ b/backend/src/main/java/io/metersphere/dto/SystemStatisticData.java @@ -0,0 +1,10 @@ +package io.metersphere.dto; + +import lombok.Data; + +@Data +public class SystemStatisticData { + private long userSize = 0; + private long workspaceSize = 0; + private long projectSize = 0; +} diff --git a/backend/src/main/java/io/metersphere/dto/UserDTO.java b/backend/src/main/java/io/metersphere/dto/UserDTO.java index 771aaf2eec..da830fb7d1 100644 --- a/backend/src/main/java/io/metersphere/dto/UserDTO.java +++ b/backend/src/main/java/io/metersphere/dto/UserDTO.java @@ -10,11 +10,6 @@ import java.util.List; @Getter @Setter public class UserDTO extends User { - - private List roles = new ArrayList<>(); - - private List userRoles = new ArrayList<>(); - private List userGroups = new ArrayList<>(); private List groups = new ArrayList<>(); private List groupPermissions = new ArrayList<>(); diff --git a/backend/src/main/java/io/metersphere/dto/UserRoleDTO.java b/backend/src/main/java/io/metersphere/dto/UserRoleDTO.java deleted file mode 100644 index 58808a7fa3..0000000000 --- a/backend/src/main/java/io/metersphere/dto/UserRoleDTO.java +++ /dev/null @@ -1,19 +0,0 @@ -package io.metersphere.dto; - -import io.metersphere.base.domain.Role; -import io.metersphere.base.domain.UserRole; -import lombok.Getter; -import lombok.Setter; - -import java.util.List; - -@Getter -@Setter -public class UserRoleDTO { - - private String userId; - private List roles; - private List userRoles; - private static final long serialVersionUID = 1L; - -} diff --git a/backend/src/main/java/io/metersphere/dto/UserRoleHelpDTO.java b/backend/src/main/java/io/metersphere/dto/UserRoleHelpDTO.java deleted file mode 100644 index 9d86f4f38f..0000000000 --- a/backend/src/main/java/io/metersphere/dto/UserRoleHelpDTO.java +++ /dev/null @@ -1,16 +0,0 @@ -package io.metersphere.dto; - -import lombok.Getter; -import lombok.Setter; - -@Getter -@Setter -public class UserRoleHelpDTO { - - private String roleId; - private String roleName; - private String sourceId; - private String sourceName; - private String parentId; - -} diff --git a/backend/src/main/java/io/metersphere/dto/WorkspaceDTO.java b/backend/src/main/java/io/metersphere/dto/WorkspaceDTO.java index e895a71b66..e32d95dc98 100644 --- a/backend/src/main/java/io/metersphere/dto/WorkspaceDTO.java +++ b/backend/src/main/java/io/metersphere/dto/WorkspaceDTO.java @@ -9,8 +9,5 @@ public class WorkspaceDTO { private String id; private String name; - private String organizationId; private String description; - private String organizationName; - } diff --git a/backend/src/main/java/io/metersphere/dto/OrganizationResource.java b/backend/src/main/java/io/metersphere/dto/WorkspaceResource.java similarity index 67% rename from backend/src/main/java/io/metersphere/dto/OrganizationResource.java rename to backend/src/main/java/io/metersphere/dto/WorkspaceResource.java index b1d20f0856..f9df05fe89 100644 --- a/backend/src/main/java/io/metersphere/dto/OrganizationResource.java +++ b/backend/src/main/java/io/metersphere/dto/WorkspaceResource.java @@ -1,6 +1,5 @@ package io.metersphere.dto; -import io.metersphere.base.domain.Organization; import io.metersphere.base.domain.Project; import io.metersphere.base.domain.Workspace; import lombok.Data; @@ -9,8 +8,7 @@ import java.util.ArrayList; import java.util.List; @Data -public class OrganizationResource { - private List organizations = new ArrayList<>(); +public class WorkspaceResource { private List workspaces = new ArrayList<>(); private List projects = new ArrayList<>(); } diff --git a/backend/src/main/java/io/metersphere/excel/domain/UserExcelData.java b/backend/src/main/java/io/metersphere/excel/domain/UserExcelData.java index 61f301853d..937be85ec3 100644 --- a/backend/src/main/java/io/metersphere/excel/domain/UserExcelData.java +++ b/backend/src/main/java/io/metersphere/excel/domain/UserExcelData.java @@ -21,14 +21,6 @@ public class UserExcelData { @ExcelIgnore private String userIsAdmin; @ExcelIgnore - private String userIsOrgAdmin; - @ExcelIgnore - private String orgAdminOrganization; - @ExcelIgnore - private String userIsOrgMember; - @ExcelIgnore - private String orgMemberOrganization; - @ExcelIgnore private String userIsTestManager; @ExcelIgnore private String testManagerWorkspace; diff --git a/backend/src/main/java/io/metersphere/excel/domain/UserExcelDataCn.java b/backend/src/main/java/io/metersphere/excel/domain/UserExcelDataCn.java index abf6ad57e5..a396b42d9c 100644 --- a/backend/src/main/java/io/metersphere/excel/domain/UserExcelDataCn.java +++ b/backend/src/main/java/io/metersphere/excel/domain/UserExcelDataCn.java @@ -47,26 +47,6 @@ public class UserExcelDataCn extends UserExcelData { @ExcelProperty("是否是系统管理员(是/否)") private String userIsAdmin; - @NotBlank(message = "{cannot_be_null}") - @ColumnWidth(30) - @ExcelProperty("是否是组织管理员(是/否)") - private String userIsOrgAdmin; - - @Length(max = 100) - @ColumnWidth(30) - @ExcelProperty("组织管理员组织名称") - private String orgAdminOrganization; - - @NotBlank(message = "{cannot_be_null}") - @ExcelProperty("是否是组织成员(是/否)") - @ColumnWidth(30) - private String userIsOrgMember; - - @Length(max = 100) - @ColumnWidth(30) - @ExcelProperty("组织成员组织名称") - private String orgMemberOrganization; - @NotBlank(message = "{cannot_be_null}") @ExcelProperty("是否是工作空间管理员(是/否)") @ColumnWidth(30) diff --git a/backend/src/main/java/io/metersphere/excel/domain/UserExcelDataTw.java b/backend/src/main/java/io/metersphere/excel/domain/UserExcelDataTw.java index be6621ceae..5a4dc4c804 100644 --- a/backend/src/main/java/io/metersphere/excel/domain/UserExcelDataTw.java +++ b/backend/src/main/java/io/metersphere/excel/domain/UserExcelDataTw.java @@ -47,26 +47,6 @@ public class UserExcelDataTw extends TestCaseExcelData { @ExcelProperty("是否是系統管理員(是/否)") private String userIsAdmin; - @NotBlank(message = "{cannot_be_null}") - @ColumnWidth(30) - @ExcelProperty("是否是組織管理員(是/否)") - private String userIsOrgAdmin; - - @Length(max = 100) - @ColumnWidth(30) - @ExcelProperty("組織管理員組織名稱") - private String orgAdminOrganization; - - @NotBlank(message = "{cannot_be_null}") - @ColumnWidth(30) - @ExcelProperty("是否是組織成員(是/否)") - private String userIsOrgMember; - - @Length(max = 100) - @ColumnWidth(30) - @ExcelProperty("組織成員組織名稱") - private String orgMemberOrganization; - @NotBlank(message = "{cannot_be_null}") @ColumnWidth(30) @ExcelProperty("是否是工作空間管理員(是/否)") diff --git a/backend/src/main/java/io/metersphere/excel/domain/UserExcelDataUs.java b/backend/src/main/java/io/metersphere/excel/domain/UserExcelDataUs.java index f11e329d0e..7cd75a84ad 100644 --- a/backend/src/main/java/io/metersphere/excel/domain/UserExcelDataUs.java +++ b/backend/src/main/java/io/metersphere/excel/domain/UserExcelDataUs.java @@ -48,26 +48,6 @@ public class UserExcelDataUs extends UserExcelData { @ExcelProperty("User is administrator(Yes/No)") private String userIsAdmin; - @NotBlank(message = "{cannot_be_null}") - @ColumnWidth(30) - @ExcelProperty("User is organization manager(Yes/No)") - private String userIsOrgAdmin; - - @Length(max = 100) - @ColumnWidth(30) - @ExcelProperty("Manager in witch organization") - private String orgAdminOrganization; - - @NotBlank(message = "{cannot_be_null}") - @ColumnWidth(30) - @ExcelProperty("User is organization member(Yes/No)") - private String userIsOrgMember; - - @Length(max = 100) - @ColumnWidth(30) - @ExcelProperty("Member in witch organization") - private String orgMemberOrganization; - @NotBlank(message = "{cannot_be_null}") @ColumnWidth(30) @ExcelProperty("User is test manager(Yes/No)") diff --git a/backend/src/main/java/io/metersphere/excel/listener/UserDataListener.java b/backend/src/main/java/io/metersphere/excel/listener/UserDataListener.java index b8e98b0ce3..6ceecd70cc 100644 --- a/backend/src/main/java/io/metersphere/excel/listener/UserDataListener.java +++ b/backend/src/main/java/io/metersphere/excel/listener/UserDataListener.java @@ -1,6 +1,5 @@ package io.metersphere.excel.listener; -import io.metersphere.commons.constants.RoleConstants; import io.metersphere.commons.constants.UserGroupConstants; import io.metersphere.commons.exception.MSException; import io.metersphere.commons.utils.CommonBeanFactory; @@ -19,8 +18,6 @@ public class UserDataListener extends EasyExcelListener { //key:workspace.name value:id Map workspaceNameMap; - //key:Organization.name value:id - Map orgNameMap; /** * key:project.name value.id */ @@ -47,10 +44,9 @@ public class UserDataListener extends EasyExcelListener { return this.names; } - public UserDataListener(Class clazz, Map workspaceNameMap, Map orgNameMap, Map projectNameMap) { + public UserDataListener(Class clazz, Map workspaceNameMap, Map projectNameMap) { this.clazz = clazz; this.workspaceNameMap = workspaceNameMap; - this.orgNameMap = orgNameMap; this.projectNameMap = projectNameMap; this.userService = (UserService) CommonBeanFactory.getBean("userService"); savedUserId = userService.selectAllId(); @@ -60,16 +56,6 @@ public class UserDataListener extends EasyExcelListener { public String validate(UserExcelData data, String errMsg) { StringBuilder stringBuilder = new StringBuilder(errMsg); - //判断组织管理员组织(系统) - String orgManagerOrgCheck = this.checkOrganization(data.getUserIsOrgAdmin(), data.getOrgAdminOrganization()); - if (orgManagerOrgCheck != null) { - stringBuilder.append(orgManagerOrgCheck); - } - //判断组织成员组织(系统) - String orgMemberOrgCheck = this.checkOrganization(data.getUserIsOrgMember(), data.getOrgMemberOrganization()); - if (orgMemberOrgCheck != null) { - stringBuilder.append(orgMemberOrgCheck); - } //判断测试经理工作空间(系统) String testManagerWorkspaceCheck = this.checkWorkSpace(data.getUserIsTestManager(), data.getTestManagerWorkspace()); if (testManagerWorkspaceCheck != null) { @@ -155,31 +141,6 @@ public class UserDataListener extends EasyExcelListener { return result; } - /** - * 检查组织 - * - * @param userRoleInExcel excel表里的用户权限填写信息 - * @param organizationInfoInExcel excel表中用户组织填写信息 - * @return 报错信息 - */ - private String checkOrganization(String userRoleInExcel, String organizationInfoInExcel) { - String result = null; - if (StringUtils.equalsIgnoreCase(Translator.get("options_yes"), userRoleInExcel)) { - String[] organizationArr = organizationInfoInExcel.split("\n"); - for (String organization : - organizationArr) { - if (!orgNameMap.containsKey(organization)) { - if (result == null) { - result = new String(Translator.get("user_import_organization_not_fond") + ":" + organization + "; "); - } else { - result += Translator.get("user_import_organization_not_fond") + ":" + organization + "; "; - } - } - } - } - return result; - } - /** * 检查项目 * @param userGroupInExcel excel表中用户组填写信息 @@ -243,18 +204,6 @@ public class UserDataListener extends EasyExcelListener { Map adminRoleMap = this.genGroupMap(UserGroupConstants.ADMIN, adminIdList); groupMapList.add(adminRoleMap); } - //判断组织管理员 - List orgManagerOrdIdList = this.getIdByExcelInfoAndIdDic(data.getUserIsOrgAdmin(), data.getOrgAdminOrganization(), orgNameMap); - if (!orgManagerOrdIdList.isEmpty()) { - Map orgAdminRoleMap = this.genGroupMap(UserGroupConstants.ORG_ADMIN, orgManagerOrdIdList); - groupMapList.add(orgAdminRoleMap); - } - //判断组织成员 - List orgMemberOrdIdList = this.getIdByExcelInfoAndIdDic(data.getUserIsOrgMember(), data.getOrgMemberOrganization(), orgNameMap); - if (!orgMemberOrdIdList.isEmpty()) { - Map orgMemberRoleMap = this.genGroupMap(UserGroupConstants.ORG_MEMBER, orgMemberOrdIdList); - groupMapList.add(orgMemberRoleMap); - } //判断测试经理 List testManagerWorkspaceIdList = this.getIdByExcelInfoAndIdDic(data.getUserIsTestManager(), data.getTestManagerWorkspace(), workspaceNameMap); if (!testManagerWorkspaceIdList.isEmpty()) { diff --git a/backend/src/main/java/io/metersphere/log/controller/OperatingLogController.java b/backend/src/main/java/io/metersphere/log/controller/OperatingLogController.java index 8035af5918..7375f759a3 100644 --- a/backend/src/main/java/io/metersphere/log/controller/OperatingLogController.java +++ b/backend/src/main/java/io/metersphere/log/controller/OperatingLogController.java @@ -2,15 +2,11 @@ package io.metersphere.log.controller; import com.github.pagehelper.Page; import com.github.pagehelper.PageHelper; -import io.metersphere.commons.constants.RoleConstants; import io.metersphere.commons.utils.PageUtils; import io.metersphere.commons.utils.Pager; -import io.metersphere.commons.utils.SessionUtils; import io.metersphere.log.service.OperatingLogService; import io.metersphere.log.vo.OperatingLogDTO; import io.metersphere.log.vo.OperatingLogRequest; -import org.apache.shiro.authz.annotation.Logical; -import org.apache.shiro.authz.annotation.RequiresRoles; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; diff --git a/backend/src/main/java/io/metersphere/notice/controller/NoticeController.java b/backend/src/main/java/io/metersphere/notice/controller/NoticeController.java index f23a35cc98..0ff3c75116 100644 --- a/backend/src/main/java/io/metersphere/notice/controller/NoticeController.java +++ b/backend/src/main/java/io/metersphere/notice/controller/NoticeController.java @@ -16,7 +16,7 @@ public class NoticeController { private NoticeService noticeService; @PostMapping("save/message/task") - @MsAuditLog(module = "organization_message_settings", type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails(#messageDetail.id)", content = "#msClass.getLogDetails(#messageDetail.id)", msClass = NoticeService.class) + @MsAuditLog(module = "workspace_message_settings", type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails(#messageDetail.id)", content = "#msClass.getLogDetails(#messageDetail.id)", msClass = NoticeService.class) public void saveMessage(@RequestBody MessageDetail messageDetail) { noticeService.saveMessageTask(messageDetail); } @@ -32,7 +32,7 @@ public class NoticeController { } @GetMapping("/delete/message/{identification}") - @MsAuditLog(module = "organization_message_settings", type = OperLogConstants.DELETE, beforeEvent = "#msClass.getLogDetails(#identification)", msClass = NoticeService.class) + @MsAuditLog(module = "workspace_message_settings", type = OperLogConstants.DELETE, beforeEvent = "#msClass.getLogDetails(#identification)", msClass = NoticeService.class) public int deleteMessage(@PathVariable String identification) { return noticeService.delMessage(identification); } diff --git a/backend/src/main/java/io/metersphere/notice/domain/MessageDetail.java b/backend/src/main/java/io/metersphere/notice/domain/MessageDetail.java index d3c4e63c1d..beec1d3866 100644 --- a/backend/src/main/java/io/metersphere/notice/domain/MessageDetail.java +++ b/backend/src/main/java/io/metersphere/notice/domain/MessageDetail.java @@ -14,7 +14,6 @@ public class MessageDetail { private String webhook; private String type; private String identification; - private String organizationId; private Boolean isSet; private String testId; private Long createTime; diff --git a/backend/src/main/java/io/metersphere/notice/sender/AbstractNoticeSender.java b/backend/src/main/java/io/metersphere/notice/sender/AbstractNoticeSender.java index 6757ee6bc3..8efb8c7771 100644 --- a/backend/src/main/java/io/metersphere/notice/sender/AbstractNoticeSender.java +++ b/backend/src/main/java/io/metersphere/notice/sender/AbstractNoticeSender.java @@ -15,6 +15,7 @@ import org.apache.commons.collections4.MapUtils; import org.apache.commons.io.IOUtils; import org.apache.commons.lang3.RegExUtils; import org.apache.commons.lang3.StringUtils; +import org.apache.commons.lang3.time.DateFormatUtils; import javax.annotation.Resource; import java.io.IOException; @@ -100,7 +101,8 @@ public abstract class AbstractNoticeSender implements NoticeSender { if (MapUtils.isNotEmpty(context)) { for (String k : context.keySet()) { if (context.get(k) != null) { - template = RegExUtils.replaceAll(template, "\\$\\{" + k + "}", context.get(k).toString()); + String value = handleTime(k, context); + template = RegExUtils.replaceAll(template, "\\$\\{" + k + "}", value); } else { template = RegExUtils.replaceAll(template, "\\$\\{" + k + "}", ""); } @@ -109,6 +111,18 @@ public abstract class AbstractNoticeSender implements NoticeSender { return template; } + private String handleTime(String k, Map context) { + String value = context.get(k).toString(); + if (StringUtils.endsWithIgnoreCase(k, "Time")) { + try { + long time = Long.parseLong(value); + value = DateFormatUtils.format(time, "yyyy-MM-dd HH:mm:ss"); + } catch (Exception ignore) { + } + } + return value; + } + protected List getUserDetails(List userIds) { return userService.queryTypeByIds(userIds); } diff --git a/backend/src/main/java/io/metersphere/notice/service/NoticeSendService.java b/backend/src/main/java/io/metersphere/notice/service/NoticeSendService.java index 1ba187de94..4416bd42f3 100644 --- a/backend/src/main/java/io/metersphere/notice/service/NoticeSendService.java +++ b/backend/src/main/java/io/metersphere/notice/service/NoticeSendService.java @@ -1,7 +1,7 @@ package io.metersphere.notice.service; import com.alibaba.nacos.client.utils.StringUtils; -import io.metersphere.base.domain.Organization; +import io.metersphere.base.domain.Project; import io.metersphere.commons.constants.NoticeConstants; import io.metersphere.commons.utils.LogUtil; import io.metersphere.notice.domain.MessageDetail; @@ -113,7 +113,7 @@ public class NoticeSendService { /** * 后台触发的发送,没有session */ - public void send(Organization organization, String taskType, NoticeModel noticeModel) { + public void send(Project project, String taskType, NoticeModel noticeModel) { try { List messageDetails; // switch (taskType) { @@ -127,7 +127,7 @@ public class NoticeSendService { // default: // break; // } - messageDetails = noticeService.searchMessageByTypeAndOrganizationId(taskType, organization.getId()); + messageDetails = noticeService.searchMessageByTypeAndWorkspaceId(taskType, project.getWorkspaceId()); // 异步发送通知 messageDetails.stream() diff --git a/backend/src/main/java/io/metersphere/notice/service/NoticeService.java b/backend/src/main/java/io/metersphere/notice/service/NoticeService.java index 231e0fd2ad..b339095485 100644 --- a/backend/src/main/java/io/metersphere/notice/service/NoticeService.java +++ b/backend/src/main/java/io/metersphere/notice/service/NoticeService.java @@ -3,9 +3,9 @@ package io.metersphere.notice.service; import com.alibaba.fastjson.JSON; import io.metersphere.base.domain.MessageTask; import io.metersphere.base.domain.MessageTaskExample; -import io.metersphere.base.domain.Organization; +import io.metersphere.base.domain.Project; import io.metersphere.base.mapper.MessageTaskMapper; -import io.metersphere.base.mapper.ext.ExtProjectMapper; +import io.metersphere.base.mapper.ProjectMapper; import io.metersphere.commons.exception.MSException; import io.metersphere.commons.utils.LogUtil; import io.metersphere.commons.utils.SessionUtils; @@ -31,7 +31,7 @@ public class NoticeService { @Resource private MessageTaskMapper messageTaskMapper; @Resource - private ExtProjectMapper extProjectMapper; + private ProjectMapper projectMapper; public void saveMessageTask(MessageDetail messageDetail) { MessageTaskExample example = new MessageTaskExample(); @@ -40,14 +40,14 @@ public class NoticeService { if (messageTaskLists.size() > 0) { delMessage(messageDetail.getIdentification()); } - String orgId = SessionUtils.getCurrentOrganizationId(); + String workspaceId = SessionUtils.getCurrentWorkspaceId(); long time = System.currentTimeMillis(); String identification = messageDetail.getIdentification(); if (StringUtils.isBlank(identification)) { identification = UUID.randomUUID().toString(); } for (String userId : messageDetail.getUserIds()) { - checkUserIdExist(userId, messageDetail, orgId); + checkUserIdExist(userId, messageDetail, workspaceId); MessageTask messageTask = new MessageTask(); messageTask.setId(UUID.randomUUID().toString()); messageTask.setEvent(messageDetail.getEvent()); @@ -57,7 +57,7 @@ public class NoticeService { messageTask.setWebhook(messageDetail.getWebhook()); messageTask.setIdentification(identification); messageTask.setIsSet(false); - messageTask.setOrganizationId(orgId); + messageTask.setWorkspaceId(workspaceId); messageTask.setTestId(messageDetail.getTestId()); messageTask.setCreateTime(time); setTemplate(messageDetail, messageTask); @@ -72,7 +72,7 @@ public class NoticeService { } } - private void checkUserIdExist(String userId, MessageDetail list, String orgId) { + private void checkUserIdExist(String userId, MessageDetail list, String workspaceId) { MessageTaskExample example = new MessageTaskExample(); if (StringUtils.isBlank(list.getTestId())) { example.createCriteria() @@ -81,7 +81,7 @@ public class NoticeService { .andTypeEqualTo(list.getType()) .andTaskTypeEqualTo(list.getTaskType()) .andWebhookEqualTo(list.getWebhook()) - .andOrganizationIdEqualTo(orgId); + .andWorkspaceIdEqualTo(workspaceId); } else { example.createCriteria() .andUserIdEqualTo(userId) @@ -90,7 +90,7 @@ public class NoticeService { .andTaskTypeEqualTo(list.getTaskType()) .andWebhookEqualTo(list.getWebhook()) .andTestIdEqualTo(list.getTestId()) - .andOrganizationIdEqualTo(orgId); + .andWorkspaceIdEqualTo(workspaceId); } if (messageTaskMapper.countByExample(example) > 0) { MSException.throwException(Translator.get("message_task_already_exists")); @@ -113,8 +113,8 @@ public class NoticeService { public List searchMessageByType(String type) { try { - String orgId = SessionUtils.getCurrentOrganizationId(); - return getMessageDetails(type, orgId); + String workspaceId = SessionUtils.getCurrentWorkspaceId(); + return getMessageDetails(type, workspaceId); } catch (Exception e) { LogUtil.error(e.getMessage(), e); return new ArrayList<>(); @@ -122,9 +122,9 @@ public class NoticeService { } - public List searchMessageByTypeAndOrganizationId(String type, String organizationId) { + public List searchMessageByTypeAndWorkspaceId(String type, String workspaceId) { try { - return getMessageDetails(type, organizationId); + return getMessageDetails(type, workspaceId); } catch (Exception e) { LogUtil.error(e.getMessage(), e); return new ArrayList<>(); @@ -133,27 +133,27 @@ public class NoticeService { public List searchMessageByTypeBySend(String type, String projectId) { try { - String orgId = ""; + String workspaceId = ""; if (null == SessionUtils.getUser()) { - Organization organization = extProjectMapper.getOrganizationByProjectId(projectId); - orgId = organization.getId(); + Project project = projectMapper.selectByPrimaryKey(projectId); + workspaceId = project.getWorkspaceId(); } else { - orgId = SessionUtils.getCurrentOrganizationId(); + workspaceId = SessionUtils.getCurrentWorkspaceId(); } - return getMessageDetails(type, orgId); + return getMessageDetails(type, workspaceId); } catch (Exception e) { LogUtil.error(e.getMessage(), e); return new ArrayList<>(); } } - private List getMessageDetails(String type, String orgId) { + private List getMessageDetails(String type, String workspaceId) { List messageDetails = new ArrayList<>(); MessageTaskExample example = new MessageTaskExample(); example.createCriteria() .andTaskTypeEqualTo(type) - .andOrganizationIdEqualTo(orgId); + .andWorkspaceIdEqualTo(workspaceId); List messageTaskLists = messageTaskMapper.selectByExampleWithBLOBs(example); Map> messageTaskMap = messageTaskLists.stream() diff --git a/backend/src/main/java/io/metersphere/performance/notice/PerformanceNoticeEvent.java b/backend/src/main/java/io/metersphere/performance/notice/PerformanceNoticeEvent.java index 3ca415a7a4..ecb122c8e0 100644 --- a/backend/src/main/java/io/metersphere/performance/notice/PerformanceNoticeEvent.java +++ b/backend/src/main/java/io/metersphere/performance/notice/PerformanceNoticeEvent.java @@ -1,7 +1,7 @@ package io.metersphere.performance.notice; import io.metersphere.base.domain.LoadTestReport; -import io.metersphere.base.domain.Organization; +import io.metersphere.base.domain.Project; import io.metersphere.commons.constants.NoticeConstants; import io.metersphere.commons.constants.PerformanceTestStatus; import io.metersphere.commons.constants.ReportTriggerMode; @@ -41,19 +41,15 @@ public class PerformanceNoticeEvent implements LoadTestFinishEvent { public void sendNotice(LoadTestReport loadTestReport) { BaseSystemConfigDTO baseSystemConfigDTO = systemParameterService.getBaseInfo(); - String url = baseSystemConfigDTO.getUrl() + "/#/performance/report/view/" + loadTestReport.getId(); - String successContext = ""; - String failedContext = ""; + String reportUrl = baseSystemConfigDTO.getUrl() + "/#/performance/report/view/" + loadTestReport.getId(); String subject = ""; String event = ""; + String successContext = "${operator}执行性能测试成功: ${name}, 报告: ${reportUrl}"; + String failedContext = "${operator}执行性能测试失败: ${name}, 报告: ${reportUrl}"; if (StringUtils.equals(ReportTriggerMode.API.name(), loadTestReport.getTriggerMode())) { - successContext = "性能测试 API任务通知:" + loadTestReport.getName() + "执行成功" + "\n" + "请点击下面链接进入测试报告页面" + "\n" + url; - failedContext = "性能测试 API任务通知:" + loadTestReport.getName() + "执行失败" + "\n" + "请点击下面链接进入测试报告页面" + "\n" + url; subject = Translator.get("task_notification_jenkins"); } if (StringUtils.equals(ReportTriggerMode.SCHEDULE.name(), loadTestReport.getTriggerMode())) { - successContext = "性能测试定时任务通知:" + loadTestReport.getName() + "执行成功" + "\n" + "请点击下面链接进入测试报告页面" + "\n" + url; - failedContext = "性能测试定时任务通知:" + loadTestReport.getName() + "执行失败" + "\n" + "请点击下面链接进入测试报告页面" + "\n" + url; subject = Translator.get("task_notification"); } @@ -71,6 +67,7 @@ public class PerformanceNoticeEvent implements LoadTestFinishEvent { paramMap.put("operator", userDTO.getName()); paramMap.put("type", "performance"); paramMap.put("url", baseSystemConfigDTO.getUrl()); + paramMap.put("reportUrl", reportUrl); paramMap.putAll(new BeanMap(loadTestDTO)); @@ -90,7 +87,7 @@ public class PerformanceNoticeEvent implements LoadTestFinishEvent { .build(); noticeSendService.send(loadTestReport.getTriggerMode(), NoticeConstants.TaskType.PERFORMANCE_TEST_TASK, noticeModel); } else { - Organization organization = projectService.getOrganizationByProjectId(loadTestReport.getProjectId()); + Project project = projectService.getProjectById(loadTestReport.getProjectId()); String context = "${operator}执行性能测试完成: ${name}"; NoticeModel noticeModel2 = NoticeModel.builder() .operator(loadTestReport.getUserId()) @@ -102,7 +99,7 @@ public class PerformanceNoticeEvent implements LoadTestFinishEvent { .event(NoticeConstants.Event.EXECUTE_COMPLETED) .paramMap(paramMap) .build(); - noticeSendService.send(organization, NoticeConstants.TaskType.PERFORMANCE_TEST_TASK, noticeModel2); + noticeSendService.send(project, NoticeConstants.TaskType.PERFORMANCE_TEST_TASK, noticeModel2); } } diff --git a/backend/src/main/java/io/metersphere/performance/service/JmeterFileService.java b/backend/src/main/java/io/metersphere/performance/service/JmeterFileService.java index beb33b7600..95019dfc56 100644 --- a/backend/src/main/java/io/metersphere/performance/service/JmeterFileService.java +++ b/backend/src/main/java/io/metersphere/performance/service/JmeterFileService.java @@ -36,9 +36,6 @@ public class JmeterFileService { } EngineContext context = EngineFactory.createContext(loadTestReport, ratios, reportId, resourceIndex); return zipFilesToByteArray(context); - } catch (MSException e) { - LogUtil.error(e.getMessage(), e); - throw e; } catch (Exception e) { LogUtil.error(e.getMessage(), e); MSException.throwException(e); diff --git a/backend/src/main/java/io/metersphere/security/realm/LdapRealm.java b/backend/src/main/java/io/metersphere/security/realm/LdapRealm.java index 6e923f77c8..a9a4455762 100644 --- a/backend/src/main/java/io/metersphere/security/realm/LdapRealm.java +++ b/backend/src/main/java/io/metersphere/security/realm/LdapRealm.java @@ -1,7 +1,6 @@ package io.metersphere.security.realm; -import io.metersphere.base.domain.Role; import io.metersphere.commons.constants.UserSource; import io.metersphere.commons.user.SessionUser; import io.metersphere.commons.utils.SessionUtils; @@ -11,15 +10,12 @@ import io.metersphere.service.UserService; import org.apache.shiro.SecurityUtils; import org.apache.shiro.authc.*; import org.apache.shiro.authz.AuthorizationInfo; -import org.apache.shiro.authz.SimpleAuthorizationInfo; import org.apache.shiro.subject.PrincipalCollection; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import javax.annotation.Resource; import java.util.Arrays; -import java.util.Set; -import java.util.stream.Collectors; /** @@ -48,16 +44,7 @@ public class LdapRealm extends BaseRealm { @Override protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principals) { String userId = (String) principals.getPrimaryPrincipal(); - return getAuthorizationInfo(userId, userService); - } - - public static AuthorizationInfo getAuthorizationInfo(String userId, UserService userService) { - SimpleAuthorizationInfo authorizationInfo = new SimpleAuthorizationInfo(); - // roles 内容填充 - UserDTO userDTO = userService.getUserDTO(userId); - Set roles = userDTO.getRoles().stream().map(Role::getId).collect(Collectors.toSet()); - authorizationInfo.setRoles(roles); - return authorizationInfo; + return LocalRealm.getAuthorizationInfo(userId, userService); } /** diff --git a/backend/src/main/java/io/metersphere/security/realm/LocalRealm.java b/backend/src/main/java/io/metersphere/security/realm/LocalRealm.java index eb257bdb9a..9a0487823f 100644 --- a/backend/src/main/java/io/metersphere/security/realm/LocalRealm.java +++ b/backend/src/main/java/io/metersphere/security/realm/LocalRealm.java @@ -1,7 +1,6 @@ package io.metersphere.security.realm; -import io.metersphere.base.domain.Role; import io.metersphere.commons.constants.UserSource; import io.metersphere.commons.user.SessionUser; import io.metersphere.commons.utils.SessionUtils; @@ -21,7 +20,6 @@ import org.springframework.beans.factory.annotation.Value; import javax.annotation.Resource; import java.util.Collections; import java.util.Set; -import java.util.stream.Collectors; /** @@ -57,10 +55,6 @@ public class LocalRealm extends BaseRealm { public static AuthorizationInfo getAuthorizationInfo(String userId, UserService userService) { SimpleAuthorizationInfo authorizationInfo = new SimpleAuthorizationInfo(); - // roles 内容填充 - UserDTO userDTO = userService.getUserDTO(userId); - Set roles = userDTO.getRoles().stream().map(Role::getId).collect(Collectors.toSet()); - authorizationInfo.setRoles(roles); Set userPermission = userService.getUserPermission(userId); authorizationInfo.setStringPermissions(userPermission); return authorizationInfo; diff --git a/backend/src/main/java/io/metersphere/service/GroupService.java b/backend/src/main/java/io/metersphere/service/GroupService.java index 453b6fc5c0..1d5eb93900 100644 --- a/backend/src/main/java/io/metersphere/service/GroupService.java +++ b/backend/src/main/java/io/metersphere/service/GroupService.java @@ -11,7 +11,10 @@ import io.metersphere.commons.constants.UserGroupConstants; import io.metersphere.commons.constants.UserGroupType; import io.metersphere.commons.exception.MSException; import io.metersphere.commons.user.SessionUser; -import io.metersphere.commons.utils.*; +import io.metersphere.commons.utils.BeanUtils; +import io.metersphere.commons.utils.PageUtils; +import io.metersphere.commons.utils.Pager; +import io.metersphere.commons.utils.SessionUtils; import io.metersphere.controller.request.GroupRequest; import io.metersphere.controller.request.group.EditGroupRequest; import io.metersphere.controller.request.group.EditGroupUserRequest; @@ -55,9 +58,7 @@ public class GroupService { @Resource private UserGroupMapper userGroupMapper; @Resource - private OrganizationService organizationService; - @Resource - private OrganizationMapper organizationMapper; + private WorkspaceService workspaceService; @Resource private WorkspaceMapper workspaceMapper; @Resource @@ -65,16 +66,14 @@ public class GroupService { private static final String GLOBAL = "global"; - private static final Map> map = new HashMap>(4){{ - put(UserGroupType.SYSTEM, Arrays.asList(UserGroupType.SYSTEM, UserGroupType.ORGANIZATION, UserGroupType.WORKSPACE, UserGroupType.PROJECT)); - put(UserGroupType.ORGANIZATION, Arrays.asList(UserGroupType.ORGANIZATION, UserGroupType.WORKSPACE, UserGroupType.PROJECT)); + private static final Map> map = new HashMap>(4) {{ + put(UserGroupType.SYSTEM, Arrays.asList(UserGroupType.SYSTEM, UserGroupType.WORKSPACE, UserGroupType.PROJECT)); put(UserGroupType.WORKSPACE, Arrays.asList(UserGroupType.WORKSPACE, UserGroupType.PROJECT)); put(UserGroupType.PROJECT, Collections.singletonList(UserGroupType.PROJECT)); }}; - private static final Map typeMap = new HashMap(4){{ + private static final Map typeMap = new HashMap(4) {{ put(UserGroupType.SYSTEM, "系统"); - put(UserGroupType.ORGANIZATION, "组织"); put(UserGroupType.WORKSPACE, "工作空间"); put(UserGroupType.PROJECT, "项目"); }}; @@ -232,17 +231,14 @@ public class GroupService { String type = group.getType(); Map map = new HashMap<>(2); map.put("type", id + "+" + type); - OrganizationResource organizationResource = organizationService.listResource(id, group.getType()); + WorkspaceResource workspaceResource = workspaceService.listResource(id, group.getType()); List collect = userGroups.stream().filter(ugp -> ugp.getGroupId().equals(id)).map(UserGroup::getSourceId).collect(Collectors.toList()); map.put("ids", collect); - if (StringUtils.equals(type, UserGroupType.ORGANIZATION)) { - map.put("organizations", organizationResource.getOrganizations()); - } if (StringUtils.equals(type, UserGroupType.WORKSPACE)) { - map.put("workspaces", organizationResource.getWorkspaces()); + map.put("workspaces", workspaceResource.getWorkspaces()); } if (StringUtils.equals(type, UserGroupType.PROJECT)) { - map.put("projects", organizationResource.getProjects()); + map.put("projects", workspaceResource.getProjects()); } list.add(map); } @@ -259,17 +255,10 @@ public class GroupService { return groupMapper.selectByExample(groupExample); } - public List getOrganizationMemberGroups(String orgId, String userId) { - return extUserGroupMapper.getOrganizationMemberGroups(orgId, userId); - } - public List getWorkspaceMemberGroups(String workspaceId, String userId) { return extUserGroupMapper.getWorkspaceMemberGroups(workspaceId, userId); } - - - private List getResourcePermission(List resource, List permissions, String type, List permissionList) { List dto = new ArrayList<>(); List resources = resource.stream().filter(g -> g.getId().startsWith(type)).collect(Collectors.toList()); @@ -297,10 +286,6 @@ public class GroupService { return getUserGroup(UserGroupType.SYSTEM, request); } - if (groupTypeList.contains(UserGroupType.ORGANIZATION)) { - return getUserGroup(UserGroupType.ORGANIZATION, request); - } - if (groupTypeList.contains(UserGroupType.WORKSPACE)) { return getUserGroup(UserGroupType.WORKSPACE, request); } @@ -314,8 +299,8 @@ public class GroupService { private Pager> getUserGroup(String groupType, EditGroupRequest request) { List types; - String orgId = SessionUtils.getCurrentOrganizationId(); - List scopes = Arrays.asList(GLOBAL, orgId); + String workspaceId = SessionUtils.getCurrentWorkspaceId(); + List scopes = Arrays.asList(GLOBAL, workspaceId); int goPage = request.getGoPage(); int pageSize = request.getPageSize(); Page page = PageHelper.startPage(goPage, pageSize, true); @@ -330,31 +315,6 @@ public class GroupService { return PageUtils.setPageInfo(page, groups); } - public List getOrganization(String userId) { - List list = new ArrayList<>(); - GroupExample groupExample = new GroupExample(); - groupExample.createCriteria().andTypeEqualTo(UserGroupType.ORGANIZATION); - List groups = groupMapper.selectByExample(groupExample); - List groupIds = groups.stream().map(Group::getId).collect(Collectors.toList()); - - if (CollectionUtils.isEmpty(groups)) { - return list; - } - UserGroupExample userGroupExample = new UserGroupExample(); - userGroupExample.createCriteria().andUserIdEqualTo(userId).andGroupIdIn(groupIds); - List userGroups = userGroupMapper.selectByExample(userGroupExample); - List orgIds = userGroups.stream().map(UserGroup::getSourceId).collect(Collectors.toList()); - - if (CollectionUtils.isEmpty(orgIds)) { - return list; - } - - OrganizationExample organizationExample = new OrganizationExample(); - organizationExample.createCriteria().andIdIn(orgIds); - list = organizationMapper.selectByExample(organizationExample); - return list; - } - public List getProjectMemberGroups(String projectId, String userId) { return extUserGroupMapper.getProjectMemberGroups(projectId, userId); } @@ -366,28 +326,13 @@ public class GroupService { public List getResource(String type, String groupId) { List resource = new ArrayList<>(); Group group = groupMapper.selectByPrimaryKey(groupId); - String orgId = group.getScopeId(); - if (!StringUtils.equals(GLOBAL, orgId)) { - Organization organization = organizationMapper.selectByPrimaryKey(orgId); - if (organization == null) { - return resource; - } - } - - if (StringUtils.equals(UserGroupType.ORGANIZATION, type)) { - OrganizationExample organizationExample = new OrganizationExample(); - OrganizationExample.Criteria criteria = organizationExample.createCriteria(); - if (!StringUtils.equals(orgId, GLOBAL)) { - criteria.andIdEqualTo(orgId); - } - return organizationMapper.selectByExample(organizationExample); - } + String workspaceId = group.getScopeId(); if (StringUtils.equals(UserGroupType.WORKSPACE, type)) { WorkspaceExample workspaceExample = new WorkspaceExample(); WorkspaceExample.Criteria criteria = workspaceExample.createCriteria(); - if (!StringUtils.equals(orgId, GLOBAL)) { - criteria.andOrganizationIdEqualTo(orgId); + if (!StringUtils.equals(workspaceId, GLOBAL)) { + criteria.andIdEqualTo(workspaceId); } return workspaceMapper.selectByExample(workspaceExample); } @@ -397,8 +342,8 @@ public class GroupService { ProjectExample.Criteria pc = projectExample.createCriteria(); WorkspaceExample workspaceExample = new WorkspaceExample(); WorkspaceExample.Criteria criteria = workspaceExample.createCriteria(); - if (!StringUtils.equals(orgId, GLOBAL)) { - criteria.andOrganizationIdEqualTo(orgId); + if (!StringUtils.equals(workspaceId, GLOBAL)) { + criteria.andIdEqualTo(workspaceId); List workspaces = workspaceMapper.selectByExample(workspaceExample); List list = workspaces.stream().map(Workspace::getId).collect(Collectors.toList()); pc.andWorkspaceIdIn(list); @@ -433,12 +378,6 @@ public class GroupService { Group group = groupMapper.selectByPrimaryKey(groupId); String type = group.getType(); - if (StringUtils.equals(type, UserGroupType.ORGANIZATION)) { - OrganizationExample organizationExample = new OrganizationExample(); - organizationExample.createCriteria().andIdIn(sources); - return organizationMapper.selectByExample(organizationExample); - } - if (StringUtils.equals(type, UserGroupType.WORKSPACE)) { WorkspaceExample workspaceExample = new WorkspaceExample(); workspaceExample.createCriteria().andIdIn(sources); @@ -540,9 +479,9 @@ public class GroupService { column.setOriginalValue("是"); } else { String scopeId = group.getScopeId(); - Organization organization = organizationMapper.selectByPrimaryKey(scopeId); - if (organization != null) { - column.setOriginalValue("否; 所属组织:" + organization.getName()); + Workspace workspace = workspaceMapper.selectByPrimaryKey(scopeId); + if (workspace != null) { + column.setOriginalValue("否; 所属工作空间:" + workspace.getName()); } else { column.setOriginalValue("否"); } @@ -557,4 +496,29 @@ public class GroupService { } return null; } + + public List getWorkspace(String userId) { + List list = new ArrayList<>(); + GroupExample groupExample = new GroupExample(); + groupExample.createCriteria().andTypeEqualTo(UserGroupType.WORKSPACE); + List groups = groupMapper.selectByExample(groupExample); + List groupIds = groups.stream().map(Group::getId).collect(Collectors.toList()); + + if (CollectionUtils.isEmpty(groups)) { + return list; + } + UserGroupExample userGroupExample = new UserGroupExample(); + userGroupExample.createCriteria().andUserIdEqualTo(userId).andGroupIdIn(groupIds); + List userGroups = userGroupMapper.selectByExample(userGroupExample); + List workspaceIds = userGroups.stream().map(UserGroup::getSourceId).collect(Collectors.toList()); + + if (CollectionUtils.isEmpty(workspaceIds)) { + return list; + } + + WorkspaceExample workspaceExample = new WorkspaceExample(); + workspaceExample.createCriteria().andIdIn(workspaceIds); + list = workspaceMapper.selectByExample(workspaceExample); + return list; + } } diff --git a/backend/src/main/java/io/metersphere/service/IntegrationService.java b/backend/src/main/java/io/metersphere/service/IntegrationService.java index 7fc1a3926d..b2f18ba121 100644 --- a/backend/src/main/java/io/metersphere/service/IntegrationService.java +++ b/backend/src/main/java/io/metersphere/service/IntegrationService.java @@ -32,7 +32,7 @@ public class IntegrationService { public ServiceIntegration save(ServiceIntegration service) { ServiceIntegrationExample example = new ServiceIntegrationExample(); example.createCriteria() - .andOrganizationIdEqualTo(service.getOrganizationId()) + .andWorkspaceIdEqualTo(service.getWorkspaceId()) .andPlatformEqualTo(service.getPlatform()); List list = serviceIntegrationMapper.selectByExample(example); if (!CollectionUtils.isEmpty(list)) { @@ -47,7 +47,7 @@ public class IntegrationService { public ServiceIntegration get(IntegrationRequest request) { String platform = request.getPlatform(); - String orgId = request.getOrgId(); + String workspaceId = request.getWorkspaceId(); ServiceIntegrationExample example = new ServiceIntegrationExample(); ServiceIntegrationExample.Criteria criteria = example.createCriteria(); @@ -55,8 +55,8 @@ public class IntegrationService { criteria.andPlatformEqualTo(platform); } - if (StringUtils.isNotBlank(orgId)) { - criteria.andOrganizationIdEqualTo(orgId); + if (StringUtils.isNotBlank(workspaceId)) { + criteria.andWorkspaceIdEqualTo(workspaceId); } List list = serviceIntegrationMapper.selectByExampleWithBLOBs(example); @@ -65,19 +65,19 @@ public class IntegrationService { public void delete(IntegrationRequest request) { String platform = request.getPlatform(); - String orgId = request.getOrgId(); + String workspaceId = request.getWorkspaceId(); ServiceIntegrationExample example = new ServiceIntegrationExample(); example.createCriteria() - .andOrganizationIdEqualTo(orgId) + .andWorkspaceIdEqualTo(workspaceId) .andPlatformEqualTo(platform); serviceIntegrationMapper.deleteByExample(example); // 删除项目关联的id/key - extProjectMapper.removeIssuePlatform(platform, orgId); + extProjectMapper.removeIssuePlatform(platform, workspaceId); } - public List getAll(String orgId) { + public List getAll(String workspaceId) { ServiceIntegrationExample example = new ServiceIntegrationExample(); - example.createCriteria().andOrganizationIdEqualTo(orgId); + example.createCriteria().andWorkspaceIdEqualTo(workspaceId); List list = serviceIntegrationMapper.selectByExample(example); return CollectionUtils.isEmpty(list) ? new ArrayList<>() : list; } diff --git a/backend/src/main/java/io/metersphere/service/OrganizationService.java b/backend/src/main/java/io/metersphere/service/OrganizationService.java deleted file mode 100644 index cb3e218b30..0000000000 --- a/backend/src/main/java/io/metersphere/service/OrganizationService.java +++ /dev/null @@ -1,281 +0,0 @@ -package io.metersphere.service; - -import com.alibaba.fastjson.JSON; -import io.metersphere.base.domain.*; -import io.metersphere.base.mapper.*; -import io.metersphere.base.mapper.ext.ExtOrganizationMapper; -import io.metersphere.base.mapper.ext.ExtUserGroupMapper; -import io.metersphere.commons.constants.UserGroupConstants; -import io.metersphere.commons.constants.UserGroupType; -import io.metersphere.commons.exception.MSException; -import io.metersphere.commons.user.SessionUser; -import io.metersphere.commons.utils.SessionUtils; -import io.metersphere.controller.request.OrganizationRequest; -import io.metersphere.dto.OrganizationMemberDTO; -import io.metersphere.dto.OrganizationResource; -import io.metersphere.dto.RelatedSource; -import io.metersphere.dto.UserDTO; -import io.metersphere.i18n.Translator; -import io.metersphere.log.utils.ReflexObjectUtil; -import io.metersphere.log.vo.DetailColumn; -import io.metersphere.log.vo.OperatingLogDetails; -import io.metersphere.log.vo.system.SystemReference; -import org.apache.commons.collections.CollectionUtils; -import org.apache.commons.lang3.StringUtils; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import javax.annotation.Resource; -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; -import java.util.stream.Collectors; - -@Service -@Transactional(rollbackFor = Exception.class) -public class OrganizationService { - - @Resource - private OrganizationMapper organizationMapper; - @Resource - private ExtOrganizationMapper extOrganizationMapper; - @Resource - private WorkspaceMapper workspaceMapper; - @Resource - private WorkspaceService workspaceService; - @Resource - private UserService userService; - @Resource - private ProjectMapper projectMapper; - @Resource - private GroupMapper groupMapper; - @Resource - private ExtUserGroupMapper extUserGroupMapper; - @Resource - private UserGroupMapper userGroupMapper; - - public Organization addOrganization(Organization organization) { - checkOrganization(organization); - long currentTimeMillis = System.currentTimeMillis(); - organization.setId(organization.getId()); - organization.setCreateTime(currentTimeMillis); - organization.setUpdateTime(currentTimeMillis); - organization.setCreateUser(SessionUtils.getUserId()); - organizationMapper.insertSelective(organization); - - // 创建组织为当前用户添加用户组 - UserGroup userGroup = new UserGroup(); - userGroup.setId(UUID.randomUUID().toString()); - userGroup.setUserId(SessionUtils.getUserId()); - userGroup.setCreateTime(System.currentTimeMillis()); - userGroup.setUpdateTime(System.currentTimeMillis()); - userGroup.setGroupId(UserGroupConstants.ORG_ADMIN); - userGroup.setSourceId(organization.getId()); - userGroupMapper.insert(userGroup); - - // 设置默认的通知 - extOrganizationMapper.setDefaultMessageTask(organization.getId()); - return organization; - } - - public List getOrganizationList(OrganizationRequest request) { - OrganizationExample example = new OrganizationExample(); - OrganizationExample.Criteria criteria = example.createCriteria(); - if (StringUtils.isNotBlank(request.getName())) { - criteria.andNameLike(StringUtils.wrapIfMissing(request.getName(), "%")); - } - example.setOrderByClause("update_time desc"); - return organizationMapper.selectByExample(example); - } - - private void checkOrganization(Organization organization) { - if (StringUtils.isBlank(organization.getName())) { - MSException.throwException(Translator.get("organization_name_is_null")); - } - - OrganizationExample example = new OrganizationExample(); - OrganizationExample.Criteria criteria = example.createCriteria(); - criteria.andNameEqualTo(organization.getName()); - if (StringUtils.isNotBlank(organization.getId())) { - criteria.andIdNotEqualTo(organization.getId()); - } - - if (organizationMapper.countByExample(example) > 0) { - MSException.throwException(Translator.get("organization_name_already_exists")); - } - - } - - public void deleteOrganization(String organizationId) { - WorkspaceExample example = new WorkspaceExample(); - WorkspaceExample.Criteria criteria = example.createCriteria(); - criteria.andOrganizationIdEqualTo(organizationId); - - // delete workspace - List workspaces = workspaceMapper.selectByExample(example); - List workspaceIdList = workspaces.stream().map(Workspace::getId).collect(Collectors.toList()); - for (String workspaceId : workspaceIdList) { - workspaceService.deleteWorkspace(workspaceId); - } - - // delete user group - UserGroupExample userGroupExample = new UserGroupExample(); - userGroupExample.createCriteria().andSourceIdEqualTo(organizationId); - userGroupMapper.deleteByExample(userGroupExample); - - // delete org - organizationMapper.deleteByPrimaryKey(organizationId); - } - - public void updateOrganization(Organization organization) { - checkOrganization(organization); - organization.setCreateTime(null); - organization.setUpdateTime(System.currentTimeMillis()); - organizationMapper.updateByPrimaryKeySelective(organization); - } - - public List getOrganizationListByUserId(String userId) { - List relatedSource = extUserGroupMapper.getRelatedSource(userId); - List organizationIds = relatedSource - .stream() - .map(RelatedSource::getOrganizationId) - .distinct() - .collect(Collectors.toList()); - if (CollectionUtils.isEmpty(organizationIds)) { - return new ArrayList<>(); - } - OrganizationExample organizationExample = new OrganizationExample(); - organizationExample.createCriteria().andIdIn(organizationIds); - return organizationMapper.selectByExample(organizationExample); - } - - public void updateOrgMember(OrganizationMemberDTO memberDTO) { - String orgId = memberDTO.getOrganizationId(); - String userId = memberDTO.getId(); - List memberGroups = extUserGroupMapper.getOrganizationMemberGroups(orgId, userId); - List groups = memberDTO.getGroupIds(); - List allGroupIds = memberGroups.stream().map(Group::getId).collect(Collectors.toList()); - for (int i = 0; i < groups.size(); i++) { - if (checkSourceRole(orgId, userId, groups.get(i)) == 0) { - UserGroup userGroup = new UserGroup(); - userGroup.setId(UUID.randomUUID().toString()); - userGroup.setUserId(userId); - userGroup.setGroupId(groups.get(i)); - userGroup.setSourceId(orgId); - userGroup.setCreateTime(System.currentTimeMillis()); - userGroup.setUpdateTime(System.currentTimeMillis()); - userGroupMapper.insertSelective(userGroup); - } - } - allGroupIds.removeAll(groups); - if (allGroupIds.size() > 0) { - UserGroupExample userGroupExample = new UserGroupExample(); - userGroupExample.createCriteria().andUserIdEqualTo(userId) - .andSourceIdEqualTo(orgId) - .andGroupIdIn(allGroupIds); - userGroupMapper.deleteByExample(userGroupExample); - } - } - - public Integer checkSourceRole(String orgId, String userId, String groupId) { - return extOrganizationMapper.checkSourceRole(orgId, userId, groupId); - } - - public void checkOrgOwner(String organizationId) { - SessionUser sessionUser = SessionUtils.getUser(); - UserDTO user = userService.getUserDTO(sessionUser.getId()); - List groupIds = user.getGroups() - .stream() - .filter(g -> StringUtils.equals(g.getType(), UserGroupType.ORGANIZATION)) - .map(Group::getId) - .collect(Collectors.toList()); - List collect = user.getUserGroups().stream() - .filter(ur -> groupIds.contains(ur.getGroupId())) - .map(UserGroup::getSourceId) - .collect(Collectors.toList()); - if (!collect.contains(organizationId)) { - MSException.throwException(Translator.get("organization_does_not_belong_to_user")); - } - } - - public List findIdAndNameByOrganizationId(String OrganizationID) { - return extOrganizationMapper.findIdAndNameByOrganizationId(OrganizationID); - } - - public String getLogDetails(String id) { - Organization user = organizationMapper.selectByPrimaryKey(id); - if (user != null) { - List columns = ReflexObjectUtil.getColumns(user, SystemReference.organizationColumns); - OperatingLogDetails details = new OperatingLogDetails(JSON.toJSONString(user.getId()), null, user.getName(), user.getCreateUser(), columns); - return JSON.toJSONString(details); - } - return null; - } - - public OrganizationResource listResource(String groupId, String type) { - Group group = groupMapper.selectByPrimaryKey(groupId); - String orgId = group.getScopeId(); - OrganizationResource resource = new OrganizationResource(); - if (!StringUtils.equals("global", orgId)) { - Organization organization = organizationMapper.selectByPrimaryKey(orgId); - if (organization == null) { - return resource; - } - } - - if (StringUtils.equals(UserGroupType.ORGANIZATION, type)) { - OrganizationExample organizationExample = new OrganizationExample(); - OrganizationExample.Criteria criteria = organizationExample.createCriteria(); - if (!StringUtils.equals(orgId, "global")) { - criteria.andIdEqualTo(orgId); - } - List organizations = organizationMapper.selectByExample(organizationExample); - resource.setOrganizations(organizations); - } - - if (StringUtils.equals(UserGroupType.WORKSPACE, type)) { - WorkspaceExample workspaceExample = new WorkspaceExample(); - WorkspaceExample.Criteria criteria = workspaceExample.createCriteria(); - if (!StringUtils.equals(orgId, "global")) { - criteria.andOrganizationIdEqualTo(orgId); - } - List workspaces = workspaceMapper.selectByExample(workspaceExample); - resource.setWorkspaces(workspaces); - } - - if (StringUtils.equals(UserGroupType.PROJECT, type)) { - ProjectExample projectExample = new ProjectExample(); - ProjectExample.Criteria pc = projectExample.createCriteria(); - WorkspaceExample workspaceExample = new WorkspaceExample(); - WorkspaceExample.Criteria criteria = workspaceExample.createCriteria(); - if (!StringUtils.equals(orgId, "global")) { - criteria.andOrganizationIdEqualTo(orgId); - List workspaces = workspaceMapper.selectByExample(workspaceExample); - List list = workspaces.stream().map(Workspace::getId).collect(Collectors.toList()); - pc.andWorkspaceIdIn(list); - } - List projects = projectMapper.selectByExample(projectExample); - resource.setProjects(projects); - } - - return resource; - } - - public String getLogDetails(OrganizationMemberDTO memberDTO) { - String orgId = memberDTO.getOrganizationId(); - String userId = memberDTO.getId(); - // 已有角色 - List memberGroups = extUserGroupMapper.getOrganizationMemberGroups(orgId, userId); - Organization user = organizationMapper.selectByPrimaryKey(orgId); - if (user != null) { - List names = memberGroups.stream().map(Group::getName).collect(Collectors.toList()); - List ids = memberGroups.stream().map(Group::getId).collect(Collectors.toList()); - List columns = ReflexObjectUtil.getColumns(user, SystemReference.organizationColumns); - DetailColumn column = new DetailColumn("成员角色", "userRoles", String.join(",", names), null); - columns.add(column); - OperatingLogDetails details = new OperatingLogDetails(JSON.toJSONString(ids), null, "用户 " + userId + " 修改角色为:" + String.join(",", names), user.getCreateUser(), columns); - return JSON.toJSONString(details); - } - return null; - } -} diff --git a/backend/src/main/java/io/metersphere/service/ProjectService.java b/backend/src/main/java/io/metersphere/service/ProjectService.java index 459b343dc7..0833fa6896 100644 --- a/backend/src/main/java/io/metersphere/service/ProjectService.java +++ b/backend/src/main/java/io/metersphere/service/ProjectService.java @@ -10,7 +10,6 @@ import io.metersphere.api.service.ApiTestEnvironmentService; import io.metersphere.api.tcp.TCPPool; import io.metersphere.base.domain.*; import io.metersphere.base.mapper.*; -import io.metersphere.base.mapper.ext.ExtOrganizationMapper; import io.metersphere.base.mapper.ext.ExtProjectMapper; import io.metersphere.base.mapper.ext.ExtUserGroupMapper; import io.metersphere.base.mapper.ext.ExtUserMapper; @@ -77,20 +76,18 @@ public class ProjectService { @Resource private ApiTestFileMapper apiTestFileMapper; @Resource - private ApiAutomationService apiAutomationService; - @Resource private PerformanceReportService performanceReportService; @Resource private UserGroupMapper userGroupMapper; @Resource - private ExtOrganizationMapper extOrganizationMapper; - @Resource private ExtUserGroupMapper extUserGroupMapper; @Resource private ExtUserMapper extUserMapper; @Resource private ScheduleService scheduleService; @Resource + private UserMapper userMapper; + @Resource private ApiTestDelService apiTestDelService; @Value("${tcp.mock.port}") private String tcpMockPorts; @@ -200,7 +197,8 @@ public class ProjectService { try { //捕获关闭失败的异常,使其不影响删除 this.closeMockTcp(projectId); - }catch (Exception e){} + } catch (Exception e) { + } // delete project @@ -284,7 +282,7 @@ public class ProjectService { lastTcpNum = oldData.getMockTcpPort().intValue(); } - if(project.getMockTcpPort().intValue() > 0){ + if (project.getMockTcpPort().intValue() > 0) { this.checkMockTcpPort(project.getMockTcpPort().intValue()); } @@ -309,63 +307,64 @@ public class ProjectService { } } - private boolean isMockTcpPortIsInRange(int port){ + private boolean isMockTcpPortIsInRange(int port) { boolean inRange = false; - if(StringUtils.isNotEmpty(this.tcpMockPorts)){ + if (StringUtils.isNotEmpty(this.tcpMockPorts)) { try { - if(this.tcpMockPorts.contains("-")){ - String [] tcpMockPortArr = this.tcpMockPorts.split("-"); + if (this.tcpMockPorts.contains("-")) { + String[] tcpMockPortArr = this.tcpMockPorts.split("-"); int num1 = Integer.parseInt(tcpMockPortArr[0]); int num2 = Integer.parseInt(tcpMockPortArr[1]); int startNum = num1 > num2 ? num2 : num1; int endNum = num1 < num2 ? num2 : num1; - if(port < startNum || port > endNum){ + if (port < startNum || port > endNum) { inRange = false; - }else { + } else { inRange = true; } - }else { + } else { int tcpPortConfigNum = Integer.parseInt(this.tcpMockPorts); - if(port == tcpPortConfigNum){ + if (port == tcpPortConfigNum) { inRange = true; } } - }catch (Exception e){ + } catch (Exception e) { } } return inRange; } + private void checkMockTcpPort(int port) { - if(StringUtils.isNotEmpty(this.tcpMockPorts)){ + if (StringUtils.isNotEmpty(this.tcpMockPorts)) { try { - if(this.tcpMockPorts.contains("-")){ - String [] tcpMockPortArr = this.tcpMockPorts.split("-"); + if (this.tcpMockPorts.contains("-")) { + String[] tcpMockPortArr = this.tcpMockPorts.split("-"); int num1 = Integer.parseInt(tcpMockPortArr[0]); int num2 = Integer.parseInt(tcpMockPortArr[1]); int startNum = num1 > num2 ? num2 : num1; int endNum = num1 < num2 ? num2 : num1; - if(port < startNum || port > endNum){ - MSException.throwException("Tcp port is not in ["+this.tcpMockPorts+"]"); + if (port < startNum || port > endNum) { + MSException.throwException("Tcp port is not in [" + this.tcpMockPorts + "]"); } - }else { + } else { int tcpPortConfigNum = Integer.parseInt(this.tcpMockPorts); - if(port != tcpPortConfigNum){ - MSException.throwException("Tcp port is not equals ["+this.tcpMockPorts+"]"); + if (port != tcpPortConfigNum) { + MSException.throwException("Tcp port is not equals [" + this.tcpMockPorts + "]"); } } - }catch (Exception e){ + } catch (Exception e) { String errorMsg = e.getMessage(); - if(!errorMsg.startsWith("Tcp")){ + if (!errorMsg.startsWith("Tcp")) { MSException.throwException("Tcp port config is error!"); - }else { + } else { MSException.throwException(errorMsg); } } - }else { + } else { MSException.throwException("Tcp port config is error!"); } } @@ -373,7 +372,7 @@ public class ProjectService { private void checkProjectTcpPort(Project project) { //判断端口是否重复 if (project.getMockTcpPort() != null && project.getMockTcpPort().intValue() != 0) { - String projectId = StringUtils.isEmpty(project.getId())?"":project.getId(); + String projectId = StringUtils.isEmpty(project.getId()) ? "" : project.getId(); ProjectExample example = new ProjectExample(); example.createCriteria().andMockTcpPortEqualTo(project.getMockTcpPort()).andIdNotEqualTo(projectId); long countResult = projectMapper.countByExample(example); @@ -412,7 +411,15 @@ public class ProjectService { } public Project getProjectById(String id) { - return projectMapper.selectByPrimaryKey(id); + Project project = projectMapper.selectByPrimaryKey(id); + String createUser = project.getCreateUser(); + if (StringUtils.isNotBlank(createUser)) { + User user = userMapper.selectByPrimaryKey(createUser); + if (user != null) { + project.setCreateUser(user.getName()); + } + } + return project; } public boolean useCustomNum(String projectId) { @@ -572,7 +579,7 @@ public class ProjectService { } public Integer checkSourceRole(String workspaceId, String userId, String roleId) { - return extOrganizationMapper.checkSourceRole(workspaceId, userId, roleId); + return extUserGroupMapper.checkSourceRole(workspaceId, userId, roleId); } public String getSystemIdByProjectId(String projectId) { @@ -652,71 +659,75 @@ public class ProjectService { List opendPortList = new ArrayList<>(); for (Project p : projectList) { boolean isPortInRange = this.isMockTcpPortIsInRange(p.getMockTcpPort()); - if(isPortInRange && !opendPortList.contains(p.getMockTcpPort())){ + if (isPortInRange && !opendPortList.contains(p.getMockTcpPort())) { opendPortList.add(p.getMockTcpPort()); this.openMockTcp(p); - }else { - if(opendPortList.contains(p.getMockTcpPort())){ + } else { + if (opendPortList.contains(p.getMockTcpPort())) { p.setMockTcpPort(0); } p.setIsMockTcpOpen(false); projectMapper.updateByPrimaryKeySelective(p); } } - }catch (Exception e){ + } catch (Exception e) { e.printStackTrace(); } } - public Organization getOrganizationByProjectId(String projectId) { - return extProjectMapper.getOrganizationByProjectId(projectId); - } - public String genTcpMockPort(String id) { int returnPort = 0; Project project = projectMapper.selectByPrimaryKey(id); - if(project != null && project.getMockTcpPort() != null && project.getMockTcpPort().intValue() != 0 ){ - if(this.isMockTcpPortIsInRange(project.getMockTcpPort().intValue())){ + if (project != null && project.getMockTcpPort() != null && project.getMockTcpPort().intValue() != 0) { + if (this.isMockTcpPortIsInRange(project.getMockTcpPort().intValue())) { returnPort = project.getMockTcpPort(); } - }else { - if(StringUtils.isNotEmpty(this.tcpMockPorts)){ + } else { + if (StringUtils.isNotEmpty(this.tcpMockPorts)) { List portInRange = new ArrayList<>(); List tcpPortInDataBase = extProjectMapper.selectTcpPorts(); - for (Integer port :tcpPortInDataBase) { - if(this.isMockTcpPortIsInRange(port)){ + for (Integer port : tcpPortInDataBase) { + if (this.isMockTcpPortIsInRange(port)) { portInRange.add(port); } } try { - if(this.tcpMockPorts.contains("-")){ - String [] tcpMockPortArr = this.tcpMockPorts.split("-"); + if (this.tcpMockPorts.contains("-")) { + String[] tcpMockPortArr = this.tcpMockPorts.split("-"); int num1 = Integer.parseInt(tcpMockPortArr[0]); int num2 = Integer.parseInt(tcpMockPortArr[1]); int startNum = num1 > num2 ? num2 : num1; int endNum = num1 < num2 ? num2 : num1; - for (int i = startNum; i <= endNum ; i++) { - if(!portInRange.contains(i)){ + for (int i = startNum; i <= endNum; i++) { + if (!portInRange.contains(i)) { returnPort = i; break; } } - }else { + } else { int tcpPortConfigNum = Integer.parseInt(this.tcpMockPorts); - if(!portInRange.contains(tcpPortConfigNum)){ + if (!portInRange.contains(tcpPortConfigNum)) { returnPort = tcpPortConfigNum; } } - }catch (Exception e){ + } catch (Exception e) { } } } - if(returnPort == 0 ){ + if (returnPort == 0) { MSException.throwException("无可用TCP端口"); } return String.valueOf(returnPort); } + + public long getProjectSize() { + return projectMapper.countByExample(new ProjectExample()); + } + + public long getProjectMemberSize(String id) { + return extProjectMapper.getProjectMemberSize(id); + } } diff --git a/backend/src/main/java/io/metersphere/service/RoleService.java b/backend/src/main/java/io/metersphere/service/RoleService.java deleted file mode 100644 index c1e4d1565f..0000000000 --- a/backend/src/main/java/io/metersphere/service/RoleService.java +++ /dev/null @@ -1,28 +0,0 @@ -package io.metersphere.service; - -import io.metersphere.base.domain.Role; -import io.metersphere.base.mapper.RoleMapper; -import io.metersphere.base.mapper.ext.ExtRoleMapper; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import javax.annotation.Resource; -import java.util.List; - -@Service -@Transactional(rollbackFor = Exception.class) -public class RoleService { - - @Resource - private ExtRoleMapper extRoleMapper; - @Resource - private RoleMapper roleMapper; - - public List getRoleList(String sign) { - return extRoleMapper.getRoleList(sign); - } - - public List getAllRole() { - return roleMapper.selectByExample(null); - } -} diff --git a/backend/src/main/java/io/metersphere/service/SystemParameterService.java b/backend/src/main/java/io/metersphere/service/SystemParameterService.java index 9d54c75cb7..31fbee07ff 100644 --- a/backend/src/main/java/io/metersphere/service/SystemParameterService.java +++ b/backend/src/main/java/io/metersphere/service/SystemParameterService.java @@ -348,4 +348,15 @@ public class SystemParameterService { public void saveBaseurl(String baseurl) { extSystemParameterMapper.saveBaseurl(baseurl); } + + public SystemParameter getInfo(String key) { + return systemParameterMapper.selectByPrimaryKey(key); + } + + public void editInfo(SystemParameter systemParameter) { + if (StringUtils.isBlank(systemParameter.getParamKey())) { + return; + } + systemParameterMapper.updateByPrimaryKeySelective(systemParameter); + } } diff --git a/backend/src/main/java/io/metersphere/service/UserGroupService.java b/backend/src/main/java/io/metersphere/service/UserGroupService.java new file mode 100644 index 0000000000..7399ee53b0 --- /dev/null +++ b/backend/src/main/java/io/metersphere/service/UserGroupService.java @@ -0,0 +1,45 @@ +package io.metersphere.service; + +import io.metersphere.base.domain.UserGroup; +import io.metersphere.base.domain.UserGroupExample; +import io.metersphere.base.mapper.UserGroupMapper; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +@Service +public class UserGroupService { + @Resource + private UserGroupMapper userGroupMapper; + + public List> getUserGroup(String userId) { + List> list = new ArrayList<>(); + UserGroupExample userRoleExample = new UserGroupExample(); + userRoleExample.createCriteria().andUserIdEqualTo(userId); + List userGroups = userGroupMapper.selectByExample(userRoleExample); + List collect = userGroups.stream() + .map(userRole -> userRole.getGroupId()) + .distinct() + .collect(Collectors.toList()); + for (int i = 0; i < collect.size(); i++) { + Map map = new HashMap<>(2); + map.put("id", collect.get(i)); + map.put("ids", new ArrayList<>()); + for (int j = 0; j < userGroups.size(); j++) { + String role = userGroups.get(j).getGroupId(); + if (StringUtils.equals(role, collect.get(i))) { + List ids = (List) map.get("ids"); + ids.add(userGroups.get(j).getSourceId()); + } + } + list.add(map); + } + return list; + } +} diff --git a/backend/src/main/java/io/metersphere/service/UserRoleService.java b/backend/src/main/java/io/metersphere/service/UserRoleService.java deleted file mode 100644 index 52658eba9a..0000000000 --- a/backend/src/main/java/io/metersphere/service/UserRoleService.java +++ /dev/null @@ -1,85 +0,0 @@ -package io.metersphere.service; - -import io.metersphere.base.domain.*; -import io.metersphere.base.mapper.UserGroupMapper; -import io.metersphere.base.mapper.UserRoleMapper; -import io.metersphere.base.mapper.ext.ExtUserRoleMapper; -import org.apache.commons.lang3.StringUtils; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import javax.annotation.Resource; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; - -@Service -@Transactional(rollbackFor = Exception.class) -public class UserRoleService { - - @Resource - private ExtUserRoleMapper extUserRoleMapper; - @Resource - private UserRoleMapper userRoleMapper; - @Resource - private UserGroupMapper userGroupMapper; - - public List getOrganizationMemberRoles(String orgId, String userId) { - return extUserRoleMapper.getOrganizationMemberRoles(orgId, userId); - } - - public List getWorkspaceMemberRoles(String workspaceId, String userId) { - return extUserRoleMapper.getWorkspaceMemberRoles(workspaceId, userId); - } - - public List> getUserRole(String userId) { - List> list = new ArrayList<>(); - UserRoleExample userRoleExample = new UserRoleExample(); - userRoleExample.createCriteria().andUserIdEqualTo(userId); - List userRoles = userRoleMapper.selectByExample(userRoleExample); - List collect = userRoles.stream() - .map(userRole -> userRole.getRoleId()) - .distinct() - .collect(Collectors.toList()); - for (int i = 0; i < collect.size(); i++) { - Map map = new HashMap<>(2); - map.put("id", collect.get(i)); - map.put("ids", new ArrayList<>()); - for (int j = 0; j < userRoles.size(); j++) { - String role = userRoles.get(j).getRoleId(); - if (StringUtils.equals(role, collect.get(i))) { - List ids = (List) map.get("ids"); - ids.add(userRoles.get(j).getSourceId()); - } - } - list.add(map); - } - return list; - } - public List> getUserGroup(String userId) { - List> list = new ArrayList<>(); - UserGroupExample userRoleExample = new UserGroupExample(); - userRoleExample.createCriteria().andUserIdEqualTo(userId); - List userRoles = userGroupMapper.selectByExample(userRoleExample); - List collect = userRoles.stream() - .map(userRole -> userRole.getGroupId()) - .distinct() - .collect(Collectors.toList()); - for (int i = 0; i < collect.size(); i++) { - Map map = new HashMap<>(2); - map.put("id", collect.get(i)); - map.put("ids", new ArrayList<>()); - for (int j = 0; j < userRoles.size(); j++) { - String role = userRoles.get(j).getGroupId(); - if (StringUtils.equals(role, collect.get(i))) { - List ids = (List) map.get("ids"); - ids.add(userRoles.get(j).getSourceId()); - } - } - list.add(map); - } - return list; - } -} diff --git a/backend/src/main/java/io/metersphere/service/UserService.java b/backend/src/main/java/io/metersphere/service/UserService.java index f5133393c8..25ec762ea7 100644 --- a/backend/src/main/java/io/metersphere/service/UserService.java +++ b/backend/src/main/java/io/metersphere/service/UserService.java @@ -5,7 +5,9 @@ import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import io.metersphere.base.domain.*; import io.metersphere.base.mapper.*; -import io.metersphere.base.mapper.ext.*; +import io.metersphere.base.mapper.ext.ExtProjectMapper; +import io.metersphere.base.mapper.ext.ExtUserGroupMapper; +import io.metersphere.base.mapper.ext.ExtUserMapper; import io.metersphere.commons.constants.*; import io.metersphere.commons.exception.MSException; import io.metersphere.commons.user.SessionUser; @@ -15,14 +17,16 @@ import io.metersphere.commons.utils.LogUtil; import io.metersphere.commons.utils.SessionUtils; import io.metersphere.controller.ResultHolder; import io.metersphere.controller.request.LoginRequest; +import io.metersphere.controller.request.WorkspaceRequest; import io.metersphere.controller.request.member.AddMemberRequest; import io.metersphere.controller.request.member.EditPassWordRequest; import io.metersphere.controller.request.member.QueryMemberRequest; import io.metersphere.controller.request.member.UserRequest; -import io.metersphere.controller.request.organization.AddOrgMemberRequest; -import io.metersphere.controller.request.organization.QueryOrgMemberRequest; import io.metersphere.controller.request.resourcepool.UserBatchProcessRequest; -import io.metersphere.dto.*; +import io.metersphere.dto.GroupResourceDTO; +import io.metersphere.dto.UserDTO; +import io.metersphere.dto.UserGroupPermissionDTO; +import io.metersphere.dto.WorkspaceDTO; import io.metersphere.excel.domain.*; import io.metersphere.excel.listener.EasyExcelListener; import io.metersphere.excel.listener.UserDataListener; @@ -64,14 +68,6 @@ public class UserService { @Resource private UserMapper userMapper; @Resource - private RoleMapper roleMapper; - @Resource - private UserRoleMapper userRoleMapper; - @Resource - private ExtUserRoleMapper extUserRoleMapper; - @Resource - private OrganizationMapper organizationMapper; - @Resource private WorkspaceMapper workspaceMapper; @Resource private ExtUserMapper extUserMapper; @@ -79,8 +75,6 @@ public class UserService { @Resource private WorkspaceService workspaceService; @Resource - private ExtOrganizationMapper extOrganizationMapper; - @Resource private UserGroupMapper userGroupMapper; @Resource private UserGroupPermissionMapper userGroupPermissionMapper; @@ -89,7 +83,7 @@ public class UserService { @Resource private SqlSessionFactory sqlSessionFactory; @Resource - private UserRoleService userRoleService; + private UserGroupService userGroupService; @Resource private ExtUserGroupMapper extUserGroupMapper; @Resource @@ -176,36 +170,6 @@ public class UserService { } - private void insertUserRole(List> roles, String userId) { - for (int i = 0; i < roles.size(); i++) { - Map map = roles.get(i); - String role = (String) map.get("id"); - if (StringUtils.equals(role, RoleConstants.ADMIN)) { - UserRole userRole = new UserRole(); - userRole.setId(UUID.randomUUID().toString()); - userRole.setUserId(userId); - userRole.setUpdateTime(System.currentTimeMillis()); - userRole.setCreateTime(System.currentTimeMillis()); - userRole.setRoleId(role); - // TODO 修改 - userRole.setSourceId("adminSourceId"); - userRoleMapper.insertSelective(userRole); - } else { - List list = (List) map.get("ids"); - for (int j = 0; j < list.size(); j++) { - UserRole userRole1 = new UserRole(); - userRole1.setId(UUID.randomUUID().toString()); - userRole1.setUserId(userId); - userRole1.setRoleId(role); - userRole1.setUpdateTime(System.currentTimeMillis()); - userRole1.setCreateTime(System.currentTimeMillis()); - userRole1.setSourceId(list.get(j)); - userRoleMapper.insertSelective(userRole1); - } - } - } - } - private void checkUserParam(User user) { if (StringUtils.isBlank(user.getId())) { @@ -340,30 +304,6 @@ public class UserService { return getUserDTO(users.get(0).getId()); } - public UserRoleDTO getUserRole(String userId) { - UserRoleDTO userRoleDTO = new UserRoleDTO(); - // - UserRoleExample userRoleExample = new UserRoleExample(); - userRoleExample.createCriteria().andUserIdEqualTo(userId); - List userRoleList = userRoleMapper.selectByExample(userRoleExample); - - if (CollectionUtils.isEmpty(userRoleList)) { - return userRoleDTO; - } - // 设置 user_role - userRoleDTO.setUserRoles(userRoleList); - - List roleIds = userRoleList.stream().map(UserRole::getRoleId).collect(Collectors.toList()); - - RoleExample roleExample = new RoleExample(); - roleExample.createCriteria().andIdIn(roleIds); - - List roleList = roleMapper.selectByExample(roleExample); - userRoleDTO.setRoles(roleList); - - return userRoleDTO; - } - public List getUserList() { UserExample example = new UserExample(); example.setOrderByClause("update_time desc"); @@ -395,8 +335,7 @@ public class UserService { List list = userGroups.stream().map(UserGroup::getSourceId).collect(Collectors.toList()); if (!CollectionUtils.isEmpty(list)) { - if (list.contains(user.getLastWorkspaceId()) || list.contains(user.getLastOrganizationId())) { - user.setLastOrganizationId(null); + if (list.contains(user.getLastWorkspaceId())) { user.setLastWorkspaceId(null); userMapper.updateByPrimaryKeySelective(user); } @@ -445,25 +384,8 @@ public class UserService { UserDTO user = getUserDTO(sessionUser.getId()); User newUser = new User(); - if (StringUtils.equals("organization", sign)) { - user.setLastOrganizationId(sourceId); - List workspaces = workspaceService.getWorkspaceListByOrgIdAndUserId(user.getId(), sourceId); - if (workspaces.size() > 0) { - user.setLastWorkspaceId(workspaces.get(0).getId()); - List projects = getProjectListByWsAndUserId(workspaces.get(0).getId()); - if (projects.size() > 0) { - user.setLastProjectId(projects.get(0).getId()); - } else { - user.setLastProjectId(""); - } - } else { - user.setLastWorkspaceId(""); - user.setLastProjectId(""); - } - } if (StringUtils.equals("workspace", sign)) { Workspace workspace = workspaceMapper.selectByPrimaryKey(sourceId); - user.setLastOrganizationId(workspace.getOrganizationId()); user.setLastWorkspaceId(sourceId); List projects = getProjectListByWsAndUserId(sourceId); if (projects.size() > 0) { @@ -548,67 +470,12 @@ public class UserService { User user = userMapper.selectByPrimaryKey(userId); if (StringUtils.equals(workspaceId, user.getLastWorkspaceId())) { user.setLastWorkspaceId(""); - user.setLastOrganizationId(""); userMapper.updateByPrimaryKeySelective(user); } userGroupMapper.deleteByExample(userGroupExample); } - public void addOrganizationMember(AddOrgMemberRequest request) { - if (!CollectionUtils.isEmpty(request.getUserIds())) { - for (String userId : request.getUserIds()) { - UserGroupExample userGroupExample = new UserGroupExample(); - userGroupExample.createCriteria().andUserIdEqualTo(userId).andSourceIdEqualTo(request.getOrganizationId()); - List userGroups = userGroupMapper.selectByExample(userGroupExample); - if (userGroups.size() > 0) { - MSException.throwException(Translator.get("user_already_exists") + ": " + userId); - } else { - for (String groupId : request.getGroupIds()) { - UserGroup userGroup = new UserGroup(); - userGroup.setId(UUID.randomUUID().toString()); - userGroup.setUserId(userId); - userGroup.setGroupId(groupId); - userGroup.setSourceId(request.getOrganizationId()); - userGroup.setCreateTime(System.currentTimeMillis()); - userGroup.setUpdateTime(System.currentTimeMillis()); - userGroupMapper.insertSelective(userGroup); - } - } - } - } - } - - public void delOrganizationMember(String organizationId, String userId) { - - GroupExample groupExample = new GroupExample(); - groupExample.createCriteria().andTypeEqualTo(UserGroupType.ORGANIZATION); - List groups = groupMapper.selectByExample(groupExample); - List groupIds = groups.stream().map(Group::getId).collect(Collectors.toList()); - - if (CollectionUtils.isEmpty(groupIds)) { - return; - } - - UserGroupExample userGroupExample = new UserGroupExample(); - userGroupExample.createCriteria().andUserIdEqualTo(userId) - .andGroupIdIn(groupIds) - .andSourceIdEqualTo(organizationId); - - User user = userMapper.selectByPrimaryKey(userId); - if (StringUtils.equals(organizationId, user.getLastOrganizationId())) { - user.setLastWorkspaceId(""); - user.setLastOrganizationId(""); - userMapper.updateByPrimaryKeySelective(user); - } - - userGroupMapper.deleteByExample(userGroupExample); - } - - public List getOrgMemberList(QueryOrgMemberRequest request) { - return extUserGroupMapper.getOrgMemberList(request); - } - public boolean checkUserPassword(String userId, String password) { if (StringUtils.isBlank(userId)) { MSException.throwException(Translator.get("user_name_is_null")); @@ -621,13 +488,6 @@ public class UserService { return userMapper.countByExample(example) > 0; } - /** - * 查询该组织外的其他用户列表 - */ - public List getBesideOrgMemberList(String orgId) { - return extUserRoleMapper.getBesideOrgMemberList(orgId); - } - public void setLanguage(String lang) { if (SessionUtils.getUser() != null) { User user = new User(); @@ -643,8 +503,7 @@ public class UserService { // 获取最新UserDTO UserDTO user = getUserDTO(sessionUser.getId()); User newUser = new User(); - if (StringUtils.equals("organization", sign) && StringUtils.equals(sourceId, user.getLastOrganizationId())) { - user.setLastOrganizationId(""); + if (StringUtils.equals("organization", sign)) { user.setLastWorkspaceId(""); } if (StringUtils.equals("workspace", sign) && StringUtils.equals(sourceId, user.getLastWorkspaceId())) { @@ -699,10 +558,6 @@ public class UserService { return extUserMapper.getDefaultLanguage(key); } - public List getTestManagerAndTestUserList(QueryMemberRequest request) { - return extUserRoleMapper.getTestManagerAndTestUserList(request); - } - public ResultHolder login(LoginRequest request) { String login = (String) SecurityUtils.getSubject().getSession().getAttribute("authenticate"); String username = StringUtils.trim(request.getUsername()); @@ -757,27 +612,16 @@ public class UserService { List project = userGroups.stream().filter(ug -> projectGroupIds.contains(ug.getGroupId())) .collect(Collectors.toList()); if (CollectionUtils.isEmpty(project)) { - // 项目用户组为空切换工作空间 - List orgIds = user.getGroups() - .stream() - .filter(ug -> StringUtils.equals(ug.getType(), UserGroupType.ORGANIZATION)) - .map(Group::getId) - .collect(Collectors.toList()); - List testIds = user.getGroups() + List workspaceIds = user.getGroups() .stream() .filter(ug -> StringUtils.equals(ug.getType(), UserGroupType.WORKSPACE)) .map(Group::getId) .collect(Collectors.toList()); - List org = userGroups.stream().filter(ug -> orgIds.contains(ug.getGroupId())) + List workspaces = userGroups.stream().filter(ug -> workspaceIds.contains(ug.getGroupId())) .collect(Collectors.toList()); - List test = userGroups.stream().filter(ug -> testIds.contains(ug.getGroupId())) - .collect(Collectors.toList()); - if (test.size() > 0) { - String wsId = test.get(0).getSourceId(); + if (workspaces.size() > 0) { + String wsId = workspaces.get(0).getSourceId(); switchUserRole("workspace", wsId); - } else if (org.size() > 0) { - String orgId = org.get(0).getSourceId(); - switchUserRole("organization", orgId); } } else { UserGroup userGroup = project.stream().filter(p -> StringUtils.isNotBlank(p.getSourceId())) @@ -785,16 +629,12 @@ public class UserService { String projectId = userGroup.getSourceId(); Project p = projectMapper.selectByPrimaryKey(projectId); String wsId = p.getWorkspaceId(); - Workspace workspace = workspaceMapper.selectByPrimaryKey(wsId); - String orgId = workspace.getOrganizationId(); user.setId(user.getId()); user.setLastProjectId(projectId); user.setLastWorkspaceId(wsId); - user.setLastOrganizationId(orgId); updateUser(user); SessionUtils.putUser(SessionUser.fromUser(user)); } - } public List searchUser(String condition) { @@ -827,20 +667,16 @@ public class UserService { data.setEmail(Translator.get("required")); data.setUserIsAdmin(Translator.get("options_no")); data.setUserIsTester(Translator.get("options_no")); - data.setUserIsOrgMember(Translator.get("options_no")); data.setUserIsViewer(Translator.get("options_no")); data.setUserIsTestManager(Translator.get("options_no")); data.setUserIsProjectAdmin(Translator.get("options_no")); data.setUserIsProjectMember(Translator.get("options_no")); - data.setUserIsOrgAdmin(Translator.get("options_yes")); - data.setOrgAdminOrganization("默认组织"); list.add(data); } list.add(new UserExcelData()); UserExcelData explain = new UserExcelData(); explain.setId("ID不支持中文"); explain.setName(Translator.get("do_not_modify_header_order")); - explain.setOrgAdminOrganization("多个组织请换行展示"); explain.setPassword(Translator.get("required") + ";" + Translator.get("password_format_is_incorrect")); list.add(explain); return list; @@ -856,15 +692,10 @@ public class UserService { try { Class clazz = new UserExcelDataFactory().getExcelDataByLocal(); - Map orgNameMap = new HashMap<>(); Map workspaceNameMap = new HashMap<>(); Map projectNameMap = new HashMap<>(); - List organizationList = extOrganizationMapper.findIdAndNameByOrganizationId("All"); - for (OrganizationMemberDTO model : organizationList) { - orgNameMap.put(model.getName(), model.getId()); - } - List workspaceList = workspaceService.findIdAndNameByOrganizationId("All"); + List workspaceList = workspaceService.getAllWorkspaceList(new WorkspaceRequest()); for (WorkspaceDTO model : workspaceList) { workspaceNameMap.put(model.getName(), model.getId()); } @@ -873,7 +704,7 @@ public class UserService { projectNameMap.put(pro.getName(), pro.getId()); } - EasyExcelListener easyExcelListener = new UserDataListener(clazz, workspaceNameMap, orgNameMap, projectNameMap); + EasyExcelListener easyExcelListener = new UserDataListener(clazz, workspaceNameMap, projectNameMap); EasyExcelFactory.read(multipartFile.getInputStream(), clazz, easyExcelListener).sheet().doRead(); if (CollectionUtils.isNotEmpty(((UserDataListener) easyExcelListener).getNames())) { request.setAttribute("ms-req-title", String.join(",", ((UserDataListener) easyExcelListener).getNames())); @@ -1012,11 +843,8 @@ public class UserService { if (request.getCondition() != null && request.getCondition().isSelectAll()) { List userIdList = new ArrayList<>(); - if (StringUtils.isEmpty(request.getOrganizationId())) { + if (StringUtils.isEmpty(request.getWorkspaceId())) { userIdList = extUserMapper.selectIdsByQuery(request.getCondition()); - } else { - //组织->成员 页面发起的请求 - userIdList = extUserRoleMapper.selectIdsByQuery(request.getOrganizationId(), request.getCondition()); } return userIdList; @@ -1026,86 +854,6 @@ public class UserService { } - private Map> genRoleResourceMap(List batchProcessValue) { - Map> returnMap = new HashMap<>(); - Map workspaceToOrgMap = new HashMap<>(); - for (String string : batchProcessValue) { - String[] stringArr = string.split("<->"); - // string格式: 资源ID<->权限<->workspace/org - if (stringArr.length == 3) { - String resourceID = stringArr[0]; - String role = stringArr[1]; - String sourceType = stringArr[2]; - String finalResourceId = resourceID; - if (StringUtils.equalsIgnoreCase(sourceType, "workspace")) { - if (StringUtils.equalsAnyIgnoreCase(role, RoleConstants.ORG_ADMIN, RoleConstants.ORG_MEMBER)) { - finalResourceId = workspaceToOrgMap.get(resourceID); - if (finalResourceId == null) { - finalResourceId = workspaceService.getOrganizationIdById(resourceID); - workspaceToOrgMap.put(resourceID, finalResourceId); - } - } - } - if (StringUtils.isNotEmpty(finalResourceId)) { - if (returnMap.containsKey(role)) { - if (!returnMap.get(role).contains(finalResourceId)) { - returnMap.get(role).add(finalResourceId); - } - - } else { - List list = new ArrayList<>(); - list.add(finalResourceId); - returnMap.put(role, list); - } - } - } - } - return returnMap; - } - - private UserRequest convert2UserRequest(String userID, Map> roleIdMap, List userRoles) { - Map> userRoleAndResourceMap = userRoles.stream().collect( - Collectors.groupingBy(UserRole::getRoleId, Collectors.mapping(UserRole::getSourceId, Collectors.toList()))); - List> roles = new ArrayList<>(); - for (Map.Entry> entry : roleIdMap.entrySet()) { - String role = entry.getKey(); - List rawResourceIDList = entry.getValue(); - List resourceIDList = new ArrayList<>(); - for (String resourceID : rawResourceIDList) { - if (userRoleAndResourceMap.containsKey(role) && userRoleAndResourceMap.get(role).contains(resourceID)) { - continue; - } - resourceIDList.add(resourceID); - } - if (resourceIDList.isEmpty()) { - continue; - } - Map roleMap = new HashMap<>(); - roleMap.put("id", role); - roleMap.put("ids", resourceIDList); - roles.add(roleMap); - } - UserRequest request = new UserRequest(); - request.setId(userID); - request.setRoles(roles); - return request; - } - - public void addUserWorkspaceAndRole(UserRequest user, List userRoles) { - List> roles = user.getRoles(); - if (!roles.isEmpty()) { - insertUserRole(roles, user.getId()); - } - List list = userRoles.stream().map(UserRole::getSourceId).collect(Collectors.toList()); - if (!CollectionUtils.isEmpty(list)) { - if (list.contains(user.getLastWorkspaceId()) || list.contains(user.getLastOrganizationId())) { - user.setLastOrganizationId(""); - user.setLastWorkspaceId(""); - userMapper.updateByPrimaryKeySelective(user); - } - } - } - public Set getUserPermission(String userId) { UserGroupExample userGroupExample = new UserGroupExample(); userGroupExample.createCriteria().andUserIdEqualTo(userId); @@ -1190,18 +938,12 @@ public class UserService { } private String getRoles(String userId) { - List> maps = userRoleService.getUserGroup(userId); + List> maps = userGroupService.getUserGroup(userId); List colNames = new LinkedList<>(); if (CollectionUtils.isNotEmpty(maps)) { for (Map map : maps) { String id = map.get("id").toString(); - OrganizationExample example = new OrganizationExample(); - example.createCriteria().andIdIn((List) map.get("ids")); - List list = organizationMapper.selectByExample(example); List names = new LinkedList<>(); - if (CollectionUtils.isNotEmpty(list)) { - names = list.stream().map(Organization::getName).collect(Collectors.toList()); - } WorkspaceExample workspaceExample = new WorkspaceExample(); workspaceExample.createCriteria().andIdIn((List) map.get("ids")); List workspaces = workspaceMapper.selectByExample(workspaceExample); @@ -1322,29 +1064,17 @@ public class UserService { return extUserGroupMapper.getProjectMemberList(request); } - public List getOrgAllMember(QueryOrgMemberRequest request) { - String orgId = request.getOrganizationId(); - if (StringUtils.isBlank(orgId)) { + public List getWsAllMember(String workspaceId) { + List sourceIds = new ArrayList<>(); + ProjectExample projectExample = new ProjectExample(); + projectExample.createCriteria().andWorkspaceIdEqualTo(workspaceId); + List projectList = projectMapper.selectByExample(projectExample); + if (CollectionUtils.isEmpty(projectList)) { 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); - } - } + 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); @@ -1366,8 +1096,7 @@ public class UserService { List list = userGroups.stream().map(UserGroup::getSourceId).collect(Collectors.toList()); if (!CollectionUtils.isEmpty(list)) { - if (list.contains(user.getLastWorkspaceId()) || list.contains(user.getLastOrganizationId())) { - user.setLastOrganizationId(""); + if (list.contains(user.getLastWorkspaceId())) { user.setLastWorkspaceId(""); userMapper.updateByPrimaryKeySelective(user); } @@ -1446,14 +1175,14 @@ public class UserService { return SessionUtils.getUser(); } - public UserDTO.PlatformInfo getCurrentPlatformInfo(String orgId) { + public UserDTO.PlatformInfo getCurrentPlatformInfo(String workspaceId) { User user = userMapper.selectByPrimaryKey(SessionUtils.getUserId()); String platformInfoStr = user.getPlatformInfo(); - if (StringUtils.isBlank(orgId) || StringUtils.isBlank(platformInfoStr)) { + if (StringUtils.isBlank(workspaceId) || StringUtils.isBlank(platformInfoStr)) { return null; } JSONObject platformInfos = JSONObject.parseObject(platformInfoStr); - JSONObject platformInfo = platformInfos.getJSONObject(orgId); + JSONObject platformInfo = platformInfos.getJSONObject(workspaceId); if (platformInfo == null) { return null; } @@ -1465,11 +1194,13 @@ public class UserService { if (project == null) { return; } - Workspace workspace = workspaceMapper.selectByPrimaryKey(project.getWorkspaceId()); SessionUser user = SessionUtils.getUser(); user.setLastProjectId(project.getId()); user.setLastWorkspaceId(project.getWorkspaceId()); - user.setLastOrganizationId(workspace.getOrganizationId()); userMapper.updateByPrimaryKeySelective(user); } + + public long getUserSize() { + return userMapper.countByExample(new UserExample()); + } } diff --git a/backend/src/main/java/io/metersphere/service/WorkspaceService.java b/backend/src/main/java/io/metersphere/service/WorkspaceService.java index aa8ef7ebae..0c010b0c1b 100644 --- a/backend/src/main/java/io/metersphere/service/WorkspaceService.java +++ b/backend/src/main/java/io/metersphere/service/WorkspaceService.java @@ -6,17 +6,15 @@ import io.metersphere.base.mapper.GroupMapper; import io.metersphere.base.mapper.ProjectMapper; import io.metersphere.base.mapper.UserGroupMapper; import io.metersphere.base.mapper.WorkspaceMapper; -import io.metersphere.base.mapper.ext.ExtOrganizationMapper; import io.metersphere.base.mapper.ext.ExtUserGroupMapper; import io.metersphere.base.mapper.ext.ExtUserMapper; import io.metersphere.base.mapper.ext.ExtWorkspaceMapper; import io.metersphere.commons.constants.UserGroupConstants; +import io.metersphere.commons.constants.UserGroupType; import io.metersphere.commons.exception.MSException; import io.metersphere.commons.utils.SessionUtils; import io.metersphere.controller.request.WorkspaceRequest; -import io.metersphere.dto.RelatedSource; -import io.metersphere.dto.WorkspaceDTO; -import io.metersphere.dto.WorkspaceMemberDTO; +import io.metersphere.dto.*; import io.metersphere.i18n.Translator; import io.metersphere.log.utils.ReflexObjectUtil; import io.metersphere.log.vo.DetailColumn; @@ -28,7 +26,6 @@ import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; import javax.annotation.Resource; -import java.util.ArrayList; import java.util.LinkedList; import java.util.List; import java.util.UUID; @@ -44,8 +41,6 @@ public class WorkspaceService { @Resource private GroupMapper groupMapper; @Resource - private ExtOrganizationMapper extOrganizationMapper; - @Resource private ProjectService projectService; @Resource private ProjectMapper projectMapper; @@ -62,11 +57,6 @@ public class WorkspaceService { if (StringUtils.isBlank(workspace.getName())) { MSException.throwException(Translator.get("workspace_name_is_null")); } - // set organization id - if (StringUtils.isBlank(workspace.getOrganizationId())) { - String currentOrgId = SessionUtils.getCurrentOrganizationId(); - workspace.setOrganizationId(currentOrgId); - } long currentTime = System.currentTimeMillis(); @@ -89,6 +79,8 @@ public class WorkspaceService { userGroupMapper.insert(userGroup); // 新项目创建新工作空间时设置 extUserMapper.updateLastWorkspaceIdIfNull(workspace.getId(), SessionUtils.getUserId()); + // 设置默认的通知 + extWorkspaceMapper.setDefaultMessageTask(workspace.getId()); } else { workspace.setUpdateTime(currentTime); workspaceMapper.updateByPrimaryKeySelective(workspace); @@ -99,9 +91,6 @@ public class WorkspaceService { public List getWorkspaceList(WorkspaceRequest request) { WorkspaceExample example = new WorkspaceExample(); WorkspaceExample.Criteria criteria = example.createCriteria(); - if (StringUtils.isNotBlank(request.getOrganizationId())) { - criteria.andOrganizationIdEqualTo(request.getOrganizationId()); - } if (StringUtils.isNotBlank(request.getName())) { criteria.andNameLike(StringUtils.wrapIfMissing(request.getName(), "%")); } @@ -113,7 +102,7 @@ public class WorkspaceService { if (StringUtils.isNotBlank(request.getName())) { request.setName(StringUtils.wrapIfMissing(request.getName(), "%")); } - return extWorkspaceMapper.getWorkspaceWithOrg(request); + return extWorkspaceMapper.getWorkspaces(request); } public void deleteWorkspace(String workspaceId) { @@ -138,53 +127,7 @@ public class WorkspaceService { scheduleService.deleteByWorkspaceId(workspaceId); } - /** - * ORG_ADMIN需要检查是否有操作此工作空间的权限 - */ - public void checkWorkspaceOwnerByOrgAdmin(String workspaceId) { - // todo -// checkWorkspaceIsExist(workspaceId); -// WorkspaceExample example = new WorkspaceExample(); -// SessionUser sessionUser = SessionUtils.getUser(); -// UserDTO user = userService.getUserDTO(sessionUser.getId()); -// List orgIds = user.getUserRoles().stream() -// .filter(ur -> RoleConstants.ORG_ADMIN.equals(ur.getRoleId())) -// .map(UserRole::getSourceId) -// .collect(Collectors.toList()); -// example.createCriteria() -// .andOrganizationIdIn(orgIds) -// .andIdEqualTo(workspaceId); -// if (workspaceMapper.countByExample(example) == 0) { -// MSException.throwException(Translator.get("workspace_does_not_belong_to_user")); -// } - } - public void checkWorkspaceOwner(String workspaceId) { - // todo -// checkWorkspaceIsExist(workspaceId); -// int size = 0; -// WorkspaceExample example = new WorkspaceExample(); -// SessionUser sessionUser = SessionUtils.getUser(); -// UserDTO user = userService.getUserDTO(sessionUser.getId()); -// List orgIds = user.getUserRoles().stream() -// .filter(ur -> RoleConstants.ORG_ADMIN.equals(ur.getRoleId())) -// .map(UserRole::getSourceId) -// .collect(Collectors.toList()); -// if (!CollectionUtils.isEmpty(orgIds)) { -// example.createCriteria() -// .andOrganizationIdIn(orgIds) -// .andIdEqualTo(workspaceId); -// size = (int) workspaceMapper.countByExample(example); -// } -// List wsIds = user.getUserRoles().stream() -// .filter(ur -> RoleConstants.TEST_MANAGER.equals(ur.getRoleId())) -// .map(UserRole::getSourceId) -// .collect(Collectors.toList()); -// boolean contains = wsIds.contains(workspaceId); -// if (size == 0 && !contains) { -// MSException.throwException(Translator.get("workspace_does_not_belong_to_user")); -// } - } public void checkWorkspaceIsExist(String workspaceId) { WorkspaceExample example = new WorkspaceExample(); @@ -206,30 +149,6 @@ public class WorkspaceService { return workspaceMapper.selectByExample(workspaceExample); } - public List getWorkspaceListByOrgIdAndUserId(String userId, String orgId) { - List relatedSource = extUserGroupMapper.getRelatedSource(userId); - List wsIds = relatedSource - .stream() - .filter(r -> StringUtils.equals(r.getOrganizationId(), orgId)) - .map(RelatedSource::getWorkspaceId) - .distinct() - .collect(Collectors.toList()); - if (CollectionUtils.isEmpty(wsIds)) { - return new ArrayList<>(); - } - WorkspaceExample workspaceExample = new WorkspaceExample(); - workspaceExample.createCriteria().andIdIn(wsIds); - return workspaceMapper.selectByExample(workspaceExample); - } - - public List getWorkspaceIdsOrgId(String orgId) { - return extWorkspaceMapper.getWorkspaceIdsByOrgId(orgId); - } - - public List getWorkspaceIdsByOrgId(String orgId) { - return extWorkspaceMapper.getWorkspaceIdsOrgId(orgId); - } - public void updateWorkspaceMember(WorkspaceMemberDTO memberDTO) { String workspaceId = memberDTO.getWorkspaceId(); String userId = memberDTO.getId(); @@ -262,7 +181,7 @@ public class WorkspaceService { } public Integer checkSourceRole(String workspaceId, String userId, String roleId) { - return extOrganizationMapper.checkSourceRole(workspaceId, userId, roleId); + return extUserGroupMapper.checkSourceRole(workspaceId, userId, roleId); } public void updateWorkspaceByAdmin(Workspace workspace) { @@ -289,7 +208,8 @@ public class WorkspaceService { userGroup.setGroupId(UserGroupConstants.WS_ADMIN); userGroup.setSourceId(workspace.getId()); userGroupMapper.insert(userGroup); - + // 设置默认的通知 + extWorkspaceMapper.setDefaultMessageTask(workspace.getId()); return workspace; } @@ -297,14 +217,10 @@ public class WorkspaceService { if (StringUtils.isBlank(workspace.getName())) { MSException.throwException(Translator.get("workspace_name_is_null")); } - if (StringUtils.isBlank(workspace.getOrganizationId())) { - MSException.throwException(Translator.get("organization_id_is_null")); - } WorkspaceExample example = new WorkspaceExample(); WorkspaceExample.Criteria criteria = example.createCriteria(); - criteria.andNameEqualTo(workspace.getName()) - .andOrganizationIdEqualTo(workspace.getOrganizationId()); + criteria.andNameEqualTo(workspace.getName()); if (StringUtils.isNotBlank(workspace.getId())) { criteria.andIdNotEqualTo(workspace.getId()); } @@ -321,14 +237,6 @@ public class WorkspaceService { return projectMapper.selectByExample(projectExample); } - public String getOrganizationIdById(String resourceID) { - return extWorkspaceMapper.getOrganizationIdById(resourceID); - } - - public List findIdAndNameByOrganizationId(String organizationId) { - return extWorkspaceMapper.findIdAndNameByOrganizationId(organizationId); - } - public String getLogDetails(String id) { Workspace user = workspaceMapper.selectByPrimaryKey(id); if (user != null) { @@ -370,4 +278,40 @@ public class WorkspaceService { return null; } + public long getWorkspaceSize() { + return workspaceMapper.countByExample(new WorkspaceExample()); + } + + public WorkspaceResource listResource(String groupId, String type) { + Group group = groupMapper.selectByPrimaryKey(groupId); + String workspaceId = group.getScopeId(); + WorkspaceResource resource = new WorkspaceResource(); + + if (StringUtils.equals(UserGroupType.WORKSPACE, type)) { + WorkspaceExample workspaceExample = new WorkspaceExample(); + WorkspaceExample.Criteria criteria = workspaceExample.createCriteria(); + if (!StringUtils.equals(workspaceId, "global")) { + criteria.andIdEqualTo(workspaceId); + } + List workspaces = workspaceMapper.selectByExample(workspaceExample); + resource.setWorkspaces(workspaces); + } + + if (StringUtils.equals(UserGroupType.PROJECT, type)) { + ProjectExample projectExample = new ProjectExample(); + ProjectExample.Criteria pc = projectExample.createCriteria(); + WorkspaceExample workspaceExample = new WorkspaceExample(); + WorkspaceExample.Criteria criteria = workspaceExample.createCriteria(); + if (!StringUtils.equals(workspaceId, "global")) { + criteria.andIdEqualTo(workspaceId); + List workspaces = workspaceMapper.selectByExample(workspaceExample); + List list = workspaces.stream().map(Workspace::getId).collect(Collectors.toList()); + pc.andWorkspaceIdIn(list); + } + List projects = projectMapper.selectByExample(projectExample); + resource.setProjects(projects); + } + + return resource; + } } diff --git a/backend/src/main/java/io/metersphere/track/controller/IssuesController.java b/backend/src/main/java/io/metersphere/track/controller/IssuesController.java index ad1b24553b..dc16bf1df5 100644 --- a/backend/src/main/java/io/metersphere/track/controller/IssuesController.java +++ b/backend/src/main/java/io/metersphere/track/controller/IssuesController.java @@ -66,9 +66,9 @@ public class IssuesController { return issuesService.getIssuesByPlanoId(planId); } - @GetMapping("/auth/{orgId}/{platform}") - public void testAuth(@PathVariable String orgId, @PathVariable String platform) { - issuesService.testAuth(orgId, platform); + @GetMapping("/auth/{workspaceId}/{platform}") + public void testAuth(@PathVariable String workspaceId, @PathVariable String platform) { + issuesService.testAuth(workspaceId, platform); } @PostMapping("/user/auth") diff --git a/backend/src/main/java/io/metersphere/track/controller/TestCaseNodeController.java b/backend/src/main/java/io/metersphere/track/controller/TestCaseNodeController.java index 098eaf7c44..9382227e35 100644 --- a/backend/src/main/java/io/metersphere/track/controller/TestCaseNodeController.java +++ b/backend/src/main/java/io/metersphere/track/controller/TestCaseNodeController.java @@ -2,7 +2,6 @@ package io.metersphere.track.controller; import io.metersphere.base.domain.TestCaseNode; import io.metersphere.commons.constants.OperLogConstants; -import io.metersphere.commons.constants.RoleConstants; import io.metersphere.log.annotation.MsAuditLog; import io.metersphere.service.CheckPermissionService; import io.metersphere.track.dto.TestCaseNodeDTO; @@ -10,8 +9,6 @@ import io.metersphere.track.request.testcase.DragNodeRequest; import io.metersphere.track.request.testcase.QueryNodeRequest; import io.metersphere.track.request.testplancase.QueryTestPlanCaseRequest; import io.metersphere.track.service.TestCaseNodeService; -import org.apache.shiro.authz.annotation.Logical; -import org.apache.shiro.authz.annotation.RequiresRoles; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; diff --git a/backend/src/main/java/io/metersphere/track/controller/TestCaseReportTemplateController.java b/backend/src/main/java/io/metersphere/track/controller/TestCaseReportTemplateController.java index adb66ea323..5b6669374e 100644 --- a/backend/src/main/java/io/metersphere/track/controller/TestCaseReportTemplateController.java +++ b/backend/src/main/java/io/metersphere/track/controller/TestCaseReportTemplateController.java @@ -2,12 +2,9 @@ package io.metersphere.track.controller; import io.metersphere.base.domain.TestCaseReportTemplate; import io.metersphere.commons.constants.OperLogConstants; -import io.metersphere.commons.constants.RoleConstants; import io.metersphere.log.annotation.MsAuditLog; import io.metersphere.track.request.testCaseReport.QueryTemplateRequest; import io.metersphere.track.service.TestCaseReportTemplateService; -import org.apache.shiro.authz.annotation.Logical; -import org.apache.shiro.authz.annotation.RequiresRoles; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; diff --git a/backend/src/main/java/io/metersphere/track/controller/TestCaseReviewScenarioCaseController.java b/backend/src/main/java/io/metersphere/track/controller/TestCaseReviewScenarioCaseController.java index f314ae3a7c..87108d019e 100644 --- a/backend/src/main/java/io/metersphere/track/controller/TestCaseReviewScenarioCaseController.java +++ b/backend/src/main/java/io/metersphere/track/controller/TestCaseReviewScenarioCaseController.java @@ -3,16 +3,11 @@ package io.metersphere.track.controller; import com.github.pagehelper.Page; import com.github.pagehelper.PageHelper; import io.metersphere.api.dto.automation.*; -import io.metersphere.commons.constants.RoleConstants; import io.metersphere.commons.utils.PageUtils; import io.metersphere.commons.utils.Pager; -import io.metersphere.commons.utils.SessionUtils; import io.metersphere.track.dto.RelevanceScenarioRequest; import io.metersphere.track.request.testcase.TestPlanApiCaseBatchRequest; import io.metersphere.track.service.TestCaseReviewScenarioCaseService; -import io.metersphere.track.service.TestPlanScenarioCaseService; -import org.apache.shiro.authz.annotation.Logical; -import org.apache.shiro.authz.annotation.RequiresRoles; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; diff --git a/backend/src/main/java/io/metersphere/track/issue/AbstractIssuePlatform.java b/backend/src/main/java/io/metersphere/track/issue/AbstractIssuePlatform.java index c75fa9a464..9eced3396a 100644 --- a/backend/src/main/java/io/metersphere/track/issue/AbstractIssuePlatform.java +++ b/backend/src/main/java/io/metersphere/track/issue/AbstractIssuePlatform.java @@ -5,12 +5,8 @@ import io.metersphere.base.domain.*; import io.metersphere.base.mapper.IssuesMapper; import io.metersphere.base.mapper.ProjectMapper; import io.metersphere.base.mapper.TestCaseIssuesMapper; -import io.metersphere.base.mapper.WorkspaceMapper; import io.metersphere.base.mapper.ext.ExtIssuesMapper; import io.metersphere.commons.exception.MSException; -import io.metersphere.commons.utils.CommonBeanFactory; -import io.metersphere.commons.utils.EncryptUtils; -import io.metersphere.commons.utils.LogUtil; import io.metersphere.commons.utils.*; import io.metersphere.controller.request.IntegrationRequest; import io.metersphere.dto.CustomFieldItemDTO; @@ -62,12 +58,11 @@ public abstract class AbstractIssuePlatform implements IssuesPlatform { protected ResourceService resourceService; protected RestTemplate restTemplateIgnoreSSL; protected UserService userService; - protected WorkspaceMapper workspaceMapper; protected ProjectMapper projectMapper; protected String testCaseId; protected String projectId; protected String key; - protected String orgId; + protected String workspaceId; protected String userId; @@ -98,7 +93,7 @@ public abstract class AbstractIssuePlatform implements IssuesPlatform { this(); this.testCaseId = issuesRequest.getTestCaseId(); this.projectId = issuesRequest.getProjectId(); - this.orgId = issuesRequest.getOrganizationId(); + this.workspaceId = issuesRequest.getWorkspaceId(); this.userId = issuesRequest.getUserId(); } @@ -117,10 +112,10 @@ public abstract class AbstractIssuePlatform implements IssuesPlatform { protected String getPlatformConfig(String platform) { IntegrationRequest request = new IntegrationRequest(); - if (StringUtils.isBlank(orgId)) { - MSException.throwException("organization id is null"); + if (StringUtils.isBlank(workspaceId)) { + MSException.throwException("workspace id is null"); } - request.setOrgId(orgId); + request.setWorkspaceId(workspaceId); request.setPlatform(platform); ServiceIntegration integration = integrationService.get(request); @@ -141,10 +136,10 @@ public abstract class AbstractIssuePlatform implements IssuesPlatform { */ public abstract String getProjectId(String projectId); - protected boolean isIntegratedPlatform(String orgId, String platform) { + protected boolean isIntegratedPlatform(String workspaceId, String platform) { IntegrationRequest request = new IntegrationRequest(); request.setPlatform(platform); - request.setOrgId(orgId); + request.setWorkspaceId(workspaceId); ServiceIntegration integration = integrationService.get(request); return StringUtils.isNotBlank(integration.getId()); } @@ -169,11 +164,11 @@ public abstract class AbstractIssuePlatform implements IssuesPlatform { protected void handleTestCaseIssues(IssuesUpdateRequest issuesRequest) { String issuesId = issuesRequest.getId(); if (StringUtils.isNotBlank(issuesRequest.getTestCaseId())) { - insertTestCaseIssues(issuesId, issuesRequest.getTestCaseId()); + insertTestCaseIssues(issuesId, issuesRequest.getTestCaseId()); } else { - List testCaseIds = issuesRequest.getTestCaseIds(); - TestCaseIssuesExample example = new TestCaseIssuesExample(); - example.createCriteria().andIssuesIdEqualTo(issuesId); + List testCaseIds = issuesRequest.getTestCaseIds(); + TestCaseIssuesExample example = new TestCaseIssuesExample(); + example.createCriteria().andIssuesIdEqualTo(issuesId); List testCaseIssues = testCaseIssuesMapper.selectByExample(example); List deleteCaseIds = testCaseIssues.stream().map(TestCaseIssues::getTestCaseId).collect(Collectors.toList()); if (!CollectionUtils.isEmpty(testCaseIds)) { @@ -181,11 +176,11 @@ public abstract class AbstractIssuePlatform implements IssuesPlatform { } testCaseIssuesMapper.deleteByExample(example); deleteCaseIds.forEach(testCaseIssueService::updateIssuesCount); - if (!CollectionUtils.isEmpty(testCaseIds)) { - testCaseIds.forEach(caseId -> { - insertTestCaseIssues(issuesId, caseId); - }); - } + if (!CollectionUtils.isEmpty(testCaseIds)) { + testCaseIds.forEach(caseId -> { + insertTestCaseIssues(issuesId, caseId); + }); + } } } @@ -232,6 +227,7 @@ public abstract class AbstractIssuePlatform implements IssuesPlatform { /** * 将html格式的缺陷描述转成ms平台的格式 + * * @param htmlDesc * @return */ @@ -258,7 +254,7 @@ public abstract class AbstractIssuePlatform implements IssuesPlatform { while (matcher.find()) { String path = matcher.group(2); if (endpoint.endsWith("/")) { - endpoint = endpoint.substring(0, endpoint.length() -1); + endpoint = endpoint.substring(0, endpoint.length() - 1); } path = " "; result = matcher.replaceFirst(path); @@ -307,7 +303,7 @@ public abstract class AbstractIssuePlatform implements IssuesPlatform { if (url.contains("/resource/md/get/")) { String path = url.substring(url.indexOf("/resource/md/get/")); String name = path.substring(path.indexOf("/resource/md/get/") + 26); - String mdLink = "![" + name + "](" + path + ")"; + String mdLink = "![" + name + "](" + path + ")"; result = matcher.replaceFirst(mdLink); matcher = pattern.matcher(result); } @@ -337,8 +333,8 @@ public abstract class AbstractIssuePlatform implements IssuesPlatform { return files; } - protected UserDTO.PlatformInfo getUserPlatInfo(String orgId) { - return userService.getCurrentPlatformInfo(orgId); + protected UserDTO.PlatformInfo getUserPlatInfo(String workspaceId) { + return userService.getCurrentPlatformInfo(workspaceId); } @Override diff --git a/backend/src/main/java/io/metersphere/track/issue/JiraPlatform.java b/backend/src/main/java/io/metersphere/track/issue/JiraPlatform.java index d2900d6173..f204b19ae6 100644 --- a/backend/src/main/java/io/metersphere/track/issue/JiraPlatform.java +++ b/backend/src/main/java/io/metersphere/track/issue/JiraPlatform.java @@ -56,7 +56,7 @@ public class JiraPlatform extends AbstractIssuePlatform { String config = getPlatformConfig(IssuesManagePlatform.Jira.toString()); if (StringUtils.isNotBlank(config)) { jiraConfig = JSONObject.parseObject(config, JiraConfig.class); - UserDTO.PlatformInfo userPlatInfo = getUserPlatInfo(this.orgId); + UserDTO.PlatformInfo userPlatInfo = getUserPlatInfo(this.workspaceId); if (userPlatInfo != null && StringUtils.isNotBlank(userPlatInfo.getJiraAccount()) && StringUtils.isNotBlank(userPlatInfo.getJiraPassword())) { jiraConfig.setAccount(userPlatInfo.getJiraAccount()); diff --git a/backend/src/main/java/io/metersphere/track/issue/TapdPlatform.java b/backend/src/main/java/io/metersphere/track/issue/TapdPlatform.java index 17ad97bb4a..469b0f5164 100644 --- a/backend/src/main/java/io/metersphere/track/issue/TapdPlatform.java +++ b/backend/src/main/java/io/metersphere/track/issue/TapdPlatform.java @@ -257,7 +257,7 @@ public class TapdPlatform extends AbstractIssuePlatform { } public String getReporter() { - UserDTO.PlatformInfo userPlatInfo = getUserPlatInfo(this.orgId); + UserDTO.PlatformInfo userPlatInfo = getUserPlatInfo(this.workspaceId); if (userPlatInfo != null && StringUtils.isNotBlank(userPlatInfo.getTapdUserName())) { return userPlatInfo.getTapdUserName(); } diff --git a/backend/src/main/java/io/metersphere/track/issue/ZentaoPlatform.java b/backend/src/main/java/io/metersphere/track/issue/ZentaoPlatform.java index 5e3239f773..98263d92b3 100644 --- a/backend/src/main/java/io/metersphere/track/issue/ZentaoPlatform.java +++ b/backend/src/main/java/io/metersphere/track/issue/ZentaoPlatform.java @@ -65,7 +65,7 @@ public class ZentaoPlatform extends AbstractIssuePlatform { this.password = object.getString("password"); this.url = object.getString("url"); String type = object.getString("request"); - this.orgId = issuesRequest.getOrganizationId(); + this.workspaceId = issuesRequest.getWorkspaceId(); this.zentaoClient = ZentaoFactory.getInstance(this.url, type); } @@ -282,7 +282,7 @@ public class ZentaoPlatform extends AbstractIssuePlatform { String config = getPlatformConfig(IssuesManagePlatform.Zentao.toString()); if (StringUtils.isNotBlank(config)) { zentaoConfig = JSONObject.parseObject(config, ZentaoConfig.class); - UserDTO.PlatformInfo userPlatInfo = getUserPlatInfo(this.orgId); + UserDTO.PlatformInfo userPlatInfo = getUserPlatInfo(this.workspaceId); if (userPlatInfo != null && StringUtils.isNotBlank(userPlatInfo.getZentaoUserName()) && StringUtils.isNotBlank(userPlatInfo.getZentaoPassword())) { zentaoConfig.setAccount(userPlatInfo.getZentaoUserName()); diff --git a/backend/src/main/java/io/metersphere/track/request/testcase/AuthUserIssueRequest.java b/backend/src/main/java/io/metersphere/track/request/testcase/AuthUserIssueRequest.java index cc2958ab9e..b1e9a3b9ca 100644 --- a/backend/src/main/java/io/metersphere/track/request/testcase/AuthUserIssueRequest.java +++ b/backend/src/main/java/io/metersphere/track/request/testcase/AuthUserIssueRequest.java @@ -8,6 +8,6 @@ import lombok.Setter; @Getter @Setter public class AuthUserIssueRequest extends UserDTO.PlatformInfo { - private String orgId; + private String workspaceId; private String platform; } diff --git a/backend/src/main/java/io/metersphere/track/request/testcase/IssuesUpdateRequest.java b/backend/src/main/java/io/metersphere/track/request/testcase/IssuesUpdateRequest.java index fff9f01bf0..29c2fd6bde 100644 --- a/backend/src/main/java/io/metersphere/track/request/testcase/IssuesUpdateRequest.java +++ b/backend/src/main/java/io/metersphere/track/request/testcase/IssuesUpdateRequest.java @@ -11,7 +11,7 @@ import java.util.List; public class IssuesUpdateRequest extends IssuesWithBLOBs { private String content; private String testCaseId; - private String organizationId; + private String workspaceId; private List tapdUsers; /** diff --git a/backend/src/main/java/io/metersphere/track/service/DemandService.java b/backend/src/main/java/io/metersphere/track/service/DemandService.java index 221980ac06..291740a40c 100644 --- a/backend/src/main/java/io/metersphere/track/service/DemandService.java +++ b/backend/src/main/java/io/metersphere/track/service/DemandService.java @@ -1,9 +1,7 @@ package io.metersphere.track.service; import io.metersphere.base.domain.Project; -import io.metersphere.base.domain.Workspace; import io.metersphere.base.mapper.ProjectMapper; -import io.metersphere.base.mapper.WorkspaceMapper; import io.metersphere.commons.constants.IssuesManagePlatform; import io.metersphere.track.dto.DemandDTO; import io.metersphere.track.issue.AbstractIssuePlatform; @@ -20,8 +18,6 @@ import java.util.List; @Service @Transactional(rollbackFor = Exception.class) public class DemandService { - @Resource - private WorkspaceMapper workspaceMapper; @Resource private IssuesService issuesService; @Resource @@ -29,12 +25,12 @@ public class DemandService { public List getDemandList(String projectId) { Project project = projectMapper.selectByPrimaryKey(projectId); - Workspace workspace = workspaceMapper.selectByPrimaryKey(project.getWorkspaceId()); - String orgId = workspace.getOrganizationId(); - boolean tapd = issuesService.isIntegratedPlatform(orgId, IssuesManagePlatform.Tapd.toString()); - boolean jira = issuesService.isIntegratedPlatform(orgId, IssuesManagePlatform.Jira.toString()); - boolean zentao = issuesService.isIntegratedPlatform(orgId, IssuesManagePlatform.Zentao.toString()); - boolean azureDevops = issuesService.isIntegratedPlatform(orgId, IssuesManagePlatform.AzureDevops.toString()); + + String workspaceId = project.getWorkspaceId(); + boolean tapd = issuesService.isIntegratedPlatform(workspaceId, IssuesManagePlatform.Tapd.toString()); + boolean jira = issuesService.isIntegratedPlatform(workspaceId, IssuesManagePlatform.Jira.toString()); + boolean zentao = issuesService.isIntegratedPlatform(workspaceId, IssuesManagePlatform.Zentao.toString()); + boolean azureDevops = issuesService.isIntegratedPlatform(workspaceId, IssuesManagePlatform.AzureDevops.toString()); List list = new ArrayList<>(); List platforms = new ArrayList<>(); IssuesRequest issueRequest = new IssuesRequest(); @@ -67,7 +63,7 @@ public class DemandService { } } - issueRequest.setOrganizationId(orgId); + issueRequest.setWorkspaceId(workspaceId); List platformList = IssueFactory.createPlatforms(platforms, issueRequest); platformList.forEach(platform -> { List demand = platform.getDemandList(projectId); diff --git a/backend/src/main/java/io/metersphere/track/service/IssuesService.java b/backend/src/main/java/io/metersphere/track/service/IssuesService.java index 048a05c1f9..93e90290bc 100644 --- a/backend/src/main/java/io/metersphere/track/service/IssuesService.java +++ b/backend/src/main/java/io/metersphere/track/service/IssuesService.java @@ -9,9 +9,7 @@ import io.metersphere.base.mapper.*; import io.metersphere.base.mapper.ext.ExtIssuesMapper; import io.metersphere.commons.constants.IssuesManagePlatform; import io.metersphere.commons.constants.IssuesStatus; -import io.metersphere.commons.constants.NoticeConstants; import io.metersphere.commons.exception.MSException; -import io.metersphere.commons.user.SessionUser; import io.metersphere.commons.utils.*; import io.metersphere.controller.request.IntegrationRequest; import io.metersphere.log.utils.ReflexObjectUtil; @@ -79,9 +77,9 @@ public class IssuesService { @Resource private TestPlanTestCaseService testPlanTestCaseService; - public void testAuth(String orgId, String platform) { + public void testAuth(String workspaceId, String platform) { IssuesRequest issuesRequest = new IssuesRequest(); - issuesRequest.setOrganizationId(orgId); + issuesRequest.setWorkspaceId(workspaceId); AbstractIssuePlatform abstractPlatform = IssueFactory.createPlatform(platform, issuesRequest); abstractPlatform.testAuth(); } @@ -136,11 +134,9 @@ public class IssuesService { return null; } String workspaceId = project.getWorkspaceId(); - Workspace workspace = workspaceMapper.selectByPrimaryKey(workspaceId); TestCase testCase = testCaseMapper.selectByPrimaryKey(caseId); - String orgId = workspace.getOrganizationId(); String userId = testCase.getMaintainer(); - issueRequest.setOrganizationId(orgId); + issueRequest.setWorkspaceId(workspaceId); issueRequest.setUserId(userId); return getIssuesByProjectIdOrCaseId(issueRequest); } @@ -182,11 +178,9 @@ public class IssuesService { public List getPlatforms(Project project) { String workspaceId = project.getWorkspaceId(); - Workspace workspace = workspaceMapper.selectByPrimaryKey(workspaceId); - String orgId = workspace.getOrganizationId(); - boolean tapd = isIntegratedPlatform(orgId, IssuesManagePlatform.Tapd.toString()); - boolean jira = isIntegratedPlatform(orgId, IssuesManagePlatform.Jira.toString()); - boolean zentao = isIntegratedPlatform(orgId, IssuesManagePlatform.Zentao.toString()); + boolean tapd = isIntegratedPlatform(workspaceId, IssuesManagePlatform.Tapd.toString()); + boolean jira = isIntegratedPlatform(workspaceId, IssuesManagePlatform.Jira.toString()); + boolean zentao = isIntegratedPlatform(workspaceId, IssuesManagePlatform.Zentao.toString()); List platforms = new ArrayList<>(); if (tapd) { @@ -244,10 +238,10 @@ public class IssuesService { /** * 是否关联平台 */ - public boolean isIntegratedPlatform(String orgId, String platform) { + public boolean isIntegratedPlatform(String workspaceId, String platform) { IntegrationRequest request = new IntegrationRequest(); request.setPlatform(platform); - request.setOrgId(orgId); + request.setWorkspaceId(workspaceId); ServiceIntegration integration = integrationService.get(request); return StringUtils.isNotBlank(integration.getId()); } @@ -289,9 +283,8 @@ public class IssuesService { platforms.add(issuesWithBLOBs.getPlatform()); String projectId = issuesWithBLOBs.getProjectId(); Project project = projectService.getProjectById(projectId); - Workspace workspace = workspaceMapper.selectByPrimaryKey(project.getWorkspaceId()); IssuesRequest issuesRequest = new IssuesRequest(); - issuesRequest.setOrganizationId(workspace.getOrganizationId()); + issuesRequest.setWorkspaceId(project.getWorkspaceId()); AbstractIssuePlatform platform = IssueFactory.createPlatform(issuesWithBLOBs.getPlatform(), issuesRequest); platform.deleteIssue(id); } @@ -395,8 +388,6 @@ public class IssuesService { public void syncThirdPartyIssues(String projectId) { if (StringUtils.isNotBlank(projectId)) { Project project = projectService.getProjectById(projectId); - Workspace workspace = workspaceMapper.selectByPrimaryKey(project.getWorkspaceId()); - List issues = extIssuesMapper.getIssueForSync(projectId); if (CollectionUtils.isEmpty(issues)) { @@ -418,7 +409,7 @@ public class IssuesService { IssuesRequest issuesRequest = new IssuesRequest(); issuesRequest.setProjectId(projectId); - issuesRequest.setOrganizationId(workspace.getOrganizationId()); + issuesRequest.setWorkspaceId(project.getWorkspaceId()); if (CollectionUtils.isNotEmpty(tapdIssues)) { TapdPlatform tapdPlatform = new TapdPlatform(issuesRequest); syncThirdPartyIssues(tapdPlatform::syncIssues, project, tapdIssues); @@ -458,7 +449,7 @@ public class IssuesService { if (StringUtils.isBlank(orgId)) { MSException.throwException("organization id is null"); } - request.setOrgId(orgId); + request.setWorkspaceId(orgId); request.setPlatform(platform); ServiceIntegration integration = integrationService.get(request); @@ -491,7 +482,7 @@ public class IssuesService { public void userAuth(AuthUserIssueRequest authUserIssueRequest) { IssuesRequest issuesRequest = new IssuesRequest(); - issuesRequest.setOrganizationId(authUserIssueRequest.getOrgId()); + issuesRequest.setWorkspaceId(authUserIssueRequest.getWorkspaceId()); AbstractIssuePlatform abstractPlatform = IssueFactory.createPlatform(authUserIssueRequest.getPlatform(), issuesRequest); abstractPlatform.userAuth(authUserIssueRequest); } diff --git a/backend/src/main/java/io/metersphere/track/service/TestPlanReportService.java b/backend/src/main/java/io/metersphere/track/service/TestPlanReportService.java index 37811f8e7d..5c4539e191 100644 --- a/backend/src/main/java/io/metersphere/track/service/TestPlanReportService.java +++ b/backend/src/main/java/io/metersphere/track/service/TestPlanReportService.java @@ -828,17 +828,13 @@ public class TestPlanReportService { assert noticeSendService != null; BaseSystemConfigDTO baseSystemConfigDTO = systemParameterService.getBaseInfo(); String url = baseSystemConfigDTO.getUrl() + "/#/track/testPlan/reportList"; - String successContext = ""; - String failedContext = ""; String subject = ""; String event = ""; + String successContext = "${operator}执行的 ${name} 测试计划运行成功, 报告: ${planShareUrl}"; + String failedContext = "${operator}执行的 ${name} 测试计划运行失败, 报告: ${planShareUrl}"; if (StringUtils.equals(testPlanReport.getTriggerMode(), ReportTriggerMode.API.name())) { - successContext = "测试计划jenkins任务通知:'" + testPlan.getName() + "'执行成功" + "\n" + "请点击下面链接进入测试报告页面" + "\n" + url; - failedContext = "测试计划jenkins任务通知:'" + testPlan.getName() + "'执行失败" + "\n" + "请点击下面链接进入测试报告页面" + "\n" + url; subject = Translator.get("task_notification_jenkins"); } else { - successContext = "测试计划定时任务通知:'" + testPlan.getName() + "'执行成功" + "\n" + "请点击下面链接进入测试报告页面" + "\n" + url; - failedContext = "测试计划定时任务通知:'" + testPlan.getName() + "'执行失败" + "\n" + "请点击下面链接进入测试报告页面" + "\n" + url; subject = Translator.get("task_notification"); } diff --git a/backend/src/main/java/io/metersphere/xpack b/backend/src/main/java/io/metersphere/xpack index 5ff61b9e3f..6aff490dd3 160000 --- a/backend/src/main/java/io/metersphere/xpack +++ b/backend/src/main/java/io/metersphere/xpack @@ -1 +1 @@ -Subproject commit 5ff61b9e3fa8ba5141b299db5100faef5717dad8 +Subproject commit 6aff490dd3321a760e2a519c0cb6aa6c90850f3f diff --git a/backend/src/main/resources/db/migration/V97__v1.14_release.sql b/backend/src/main/resources/db/migration/V97__v1.14_release.sql index 9ece69e985..a14878c56b 100644 --- a/backend/src/main/resources/db/migration/V97__v1.14_release.sql +++ b/backend/src/main/resources/db/migration/V97__v1.14_release.sql @@ -9,25 +9,187 @@ BEGIN DECLARE sourceId VARCHAR(64); DECLARE userId VARCHAR(64); DECLARE groupId VARCHAR(64); + DECLARE workspaceId VARCHAR(64); + DECLARE createTime BIGINT(13); + DECLARE updateTime BIGINT(13); DECLARE done INT DEFAULT 0; - DECLARE cursor1 CURSOR FOR (SELECT user_id, source_id, group_id + DECLARE sourceUserGroupId VARCHAR(64); + declare temp int default 0; + DECLARE cursor1 CURSOR FOR (SELECT user_id, source_id, group_id, id, create_time, update_time FROM user_group - WHERE group_id IN ('org_admin', 'org_member')); + WHERE group_id IN (select id from `group` where type = 'ORGANIZATION')); + DECLARE cursor2 CURSOR FOR (SELECT id + FROM workspace + WHERE organization_id = sourceId); DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; OPEN cursor1; outer_loop: LOOP - FETCH cursor1 INTO userId, sourceId, groupId; + FETCH cursor1 INTO userId, sourceId, groupId, sourceUserGroupId, createTime, updateTime; + IF done THEN LEAVE outer_loop; END IF; - INSERT INTO user_group (id, user_id, group_id, source_id, create_time, update_time) - SELECT UUID(), userId, REPLACE(groupId, 'org', 'ws'), id, create_time, update_time + OPEN cursor2; + inner_loop: + LOOP + FETCH cursor2 INTO workspaceId; + IF done + THEN + LEAVE inner_loop; + END IF; + set temp = 0; + select count(*) from user_group where user_id = userId and group_id = 'ws_admin' and source_id = workspaceId into temp; + select temp; + -- 不存在就新增数据 + IF temp = 0 then + INSERT INTO user_group (id, user_id, group_id, source_id, create_time, update_time) + values (UUID(), userId, 'ws_admin', workspaceId, createTime, updateTime); + END IF; + END LOOP; + DELETE FROM user_group where id = sourceUserGroupId; + SET done = 0; + CLOSE cursor2; + END LOOP; + CLOSE cursor1; +END +// +DELIMITER ; + +CALL test_cursor(); +DROP PROCEDURE IF EXISTS test_cursor; + +create table if not exists relationship_edge ( + source_id varchar(50) not null comment '源节点的ID', + target_id varchar(50) not null comment '目标节点的ID', + `type` varchar(20) not null comment '边的分类', + graph_id varchar(50) not null comment '所属关系图的ID', + creator varchar(50) not null comment '创建人', + create_time bigint(13) not null, + PRIMARY KEY (source_id, target_id) +) + ENGINE = InnoDB + DEFAULT CHARSET = utf8mb4 + COLLATE utf8mb4_general_ci; + +ALTER TABLE api_definition ADD remark TEXT NULL; +-- +ALTER TABLE message_task + ADD workspace_id VARCHAR(64) NULL; + +-- 消息通知去掉组织 + + +DROP PROCEDURE IF EXISTS test_cursor; +DELIMITER // +CREATE PROCEDURE test_cursor() +BEGIN + DECLARE userId VARCHAR(64); + DECLARE testId VARCHAR(64); + DECLARE type VARCHAR(64); + DECLARE event VARCHAR(64); + DECLARE taskType VARCHAR(64); + DECLARE webhook VARCHAR(255); + DECLARE identification VARCHAR(64); + DECLARE isSet VARCHAR(64); + DECLARE organizationId VARCHAR(64); + DECLARE createTime BIGINT; + DECLARE template TEXT; + + DECLARE done INT DEFAULT 0; + # 必须用 table_name.column_name + DECLARE cursor1 CURSOR FOR SELECT message_task.type, + message_task.event, + message_task.user_id, + message_task.task_type, + message_task.webhook, + message_task.identification, + message_task.is_set, + message_task.organization_id, + message_task.test_id, + message_task.create_time, + message_task.template + FROM message_task; + + + DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; + OPEN cursor1; + outer_loop: + LOOP + FETCH cursor1 INTO type, event, userId, taskType, webhook, identification, isSet, + organizationId, + testId, createTime, template; + IF done + THEN + LEAVE outer_loop; + END IF; + INSERT INTO message_task(id, type, event, user_id, task_type, webhook, identification, is_set, workspace_id, + test_id, create_time, template) + SELECT UUID(), + type, + event, + userId, + taskType, + webhook, + identification, + isSet, + id, + testId, + createTime, + template FROM workspace - WHERE organization_id = sourceId; + WHERE organization_id = organizationId; + DELETE FROM message_task WHERE organization_id = organizationId; + END LOOP; + CLOSE cursor1; +END +// +DELIMITER ; + +CALL test_cursor(); +DROP PROCEDURE IF EXISTS test_cursor; +-- 去掉组织id +ALTER TABLE message_task + DROP COLUMN organization_id; + +ALTER TABLE user + DROP COLUMN last_organization_id; + +alter table service_integration + add workspace_id varchar(50) null; + +ALTER TABLE test_case_review ADD COLUMN follow_people varchar(50); +ALTER TABLE test_plan ADD COLUMN follow_people varchar(50); + +-- 服务集成从组织转移到工作空间 +DROP PROCEDURE IF EXISTS test_cursor; +DELIMITER // +CREATE PROCEDURE test_cursor() +BEGIN + DECLARE organizationId VARCHAR(64); + DECLARE sourceConfig TEXT; + DECLARE sourcePlatform VARCHAR(64); + DECLARE sourceId VARCHAR(64); + DECLARE done INT DEFAULT 0; + DECLARE cursor1 CURSOR FOR (SELECT organization_id, configuration, platform, id from service_integration); + + DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; + OPEN cursor1; + outer_loop: + LOOP + FETCH cursor1 INTO organizationId, sourceConfig, sourcePlatform, sourceId; + IF done + THEN + LEAVE outer_loop; + END IF; + INSERT INTO service_integration(id, organization_id, workspace_id, configuration, platform) + SELECT UUID(), organizationId, id, sourceConfig, sourcePlatform + FROM workspace + WHERE organization_id = organizationId; + DELETE FROM service_integration where id = sourceId; END LOOP; CLOSE cursor1; END @@ -38,21 +200,138 @@ CALL test_cursor(); DROP PROCEDURE IF EXISTS test_cursor; -create table if not exists relationship_edge ( - source_id varchar(50) not null comment '源节点的ID', - target_id varchar(50) not null comment '目标节点的ID', - `type` varchar(20) not null comment '边的分类', - graph_id varchar(50) not null comment '所属关系图的ID', - creator varchar(50) not null comment '创建人', - create_time bigint(13) not null, - PRIMARY KEY (source_id, target_id) - ) - ENGINE = InnoDB - DEFAULT CHARSET = utf8mb4 - COLLATE utf8mb4_general_ci; -ALTER TABLE api_definition ADD remark TEXT NULL; +-- 处理组织级别全局用户组 +delete from `group` where type = 'ORGANIZATION' and scope_id = 'global'; +-- 处理组织级别非全局用户组 +DROP PROCEDURE IF EXISTS test_cursor; +DELIMITER // +CREATE PROCEDURE test_cursor() +BEGIN + DECLARE sourceGroupId VARCHAR(64); + DECLARE sourceName VARCHAR(64); + DECLARE sourceDescription VARCHAR(120); + DECLARE sourceSystem TINYINT(1); + DECLARE sourceType VARCHAR(20); + DECLARE sourceCreateTime BIGINT(13); + DECLARE sourceUpdateTime BIGINT(13); + DECLARE sourceCreator VARCHAR(64); + DECLARE sourceOrganizationId VARCHAR(64); + DECLARE done INT DEFAULT 0; + DECLARE cursor1 CURSOR FOR (select id, name, description, `system`, type, create_time, update_time, creator, scope_id + from `group` + where type = 'ORGANIZATION' and scope_id != 'global'); -ALTER TABLE test_case_review ADD COLUMN follow_people VARCHAR(100); -ALTER TABLE test_plan ADD COLUMN follow_people VARCHAR(100); + DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; + OPEN cursor1; + outer_loop: + LOOP + FETCH cursor1 INTO sourceGroupId, sourceName, sourceDescription, sourceSystem, + sourceType, sourceCreateTime, sourceUpdateTime, sourceCreator, sourceOrganizationId; + IF done + THEN + LEAVE outer_loop; + END IF; + INSERT INTO `group` (id, name, description, `system`, type, create_time, update_time, creator, scope_id) + SELECT UUID(), sourceName, sourceDescription, sourceSystem, 'WORKSPACE', sourceCreateTime, sourceUpdateTime, sourceCreator, id + FROM workspace + WHERE organization_id = sourceOrganizationId; + DELETE FROM `group` where id = sourceGroupId; + END LOOP; + CLOSE cursor1; +END +// +DELIMITER ; +CALL test_cursor(); +DROP PROCEDURE IF EXISTS test_cursor; + +-- 工作空间服务集成 +insert into user_group_permission (id, group_id, permission_id, module_id) +values (UUID(), 'ws_admin', 'WORKSPACE_SERVICE:READ', 'WORKSPACE_SERVICE'); +insert into user_group_permission (id, group_id, permission_id, module_id) +values (UUID(), 'ws_member', 'WORKSPACE_SERVICE:READ', 'WORKSPACE_SERVICE'); +insert into user_group_permission (id, group_id, permission_id, module_id) +values (UUID(), 'ws_admin', 'WORKSPACE_SERVICE:READ+EDIT', 'WORKSPACE_SERVICE'); +-- 工作空间消息设置 +insert into user_group_permission (id, group_id, permission_id, module_id) +values (UUID(), 'ws_admin', 'WORKSPACE_MESSAGE:READ', 'WORKSPACE_MESSAGE'); +insert into user_group_permission (id, group_id, permission_id, module_id) +values (UUID(), 'ws_member', 'WORKSPACE_MESSAGE:READ', 'WORKSPACE_MESSAGE'); +insert into user_group_permission (id, group_id, permission_id, module_id) +values (UUID(), 'ws_admin', 'WORKSPACE_MESSAGE:READ+EDIT', 'WORKSPACE_MESSAGE'); +-- 项目权限设置 +-- jar +insert into user_group_permission (id, group_id, permission_id, module_id) +values (UUID(), 'project_admin', 'PROJECT_FILE:READ+JAR', 'PROJECT_FILE'); +insert into user_group_permission (id, group_id, permission_id, module_id) +values (UUID(), 'project_admin', 'PROJECT_FILE:READ+UPLOAD+JAR', 'PROJECT_FILE'); +insert into user_group_permission (id, group_id, permission_id, module_id) +values (UUID(), 'project_admin', 'PROJECT_FILE:READ+DELETE+JAR', 'PROJECT_FILE'); +insert into user_group_permission (id, group_id, permission_id, module_id) +values (UUID(), 'project_member', 'PROJECT_FILE:READ+JAR', 'PROJECT_FILE'); +insert into user_group_permission (id, group_id, permission_id, module_id) +values (UUID(), 'project_member', 'PROJECT_FILE:READ+UPLOAD+JAR', 'PROJECT_FILE'); +insert into user_group_permission (id, group_id, permission_id, module_id) +values (UUID(), 'project_member', 'PROJECT_FILE:READ+DELETE+JAR', 'PROJECT_FILE'); +insert into user_group_permission (id, group_id, permission_id, module_id) +values (UUID(), 'read_only', 'PROJECT_FILE:READ+JAR', 'PROJECT_FILE'); +-- file +insert into user_group_permission (id, group_id, permission_id, module_id) +values (UUID(), 'project_admin', 'PROJECT_FILE:READ+FILE', 'PROJECT_FILE'); +insert into user_group_permission (id, group_id, permission_id, module_id) +values (UUID(), 'project_admin', 'PROJECT_FILE:READ+UPLOAD+FILE', 'PROJECT_FILE'); +insert into user_group_permission (id, group_id, permission_id, module_id) +values (UUID(), 'project_admin', 'PROJECT_FILE:READ+DELETE+FILE', 'PROJECT_FILE'); +insert into user_group_permission (id, group_id, permission_id, module_id) +values (UUID(), 'project_member', 'PROJECT_FILE:READ+FILE', 'PROJECT_FILE'); +insert into user_group_permission (id, group_id, permission_id, module_id) +values (UUID(), 'project_member', 'PROJECT_FILE:READ+UPLOAD+FILE', 'PROJECT_FILE'); +insert into user_group_permission (id, group_id, permission_id, module_id) +values (UUID(), 'project_member', 'PROJECT_FILE:READ+DELETE+FILE', 'PROJECT_FILE'); +insert into user_group_permission (id, group_id, permission_id, module_id) +values (UUID(), 'read_only', 'PROJECT_FILE:READ+FILE', 'PROJECT_FILE'); +-- custom code +insert into user_group_permission (id, group_id, permission_id, module_id) +values (UUID(), 'project_admin', 'PROJECT_CUSTOM_CODE:READ', 'PROJECT_CUSTOM_CODE'); +insert into user_group_permission (id, group_id, permission_id, module_id) +values (UUID(), 'project_admin', 'PROJECT_CUSTOM_CODE:READ+CREATE', 'PROJECT_CUSTOM_CODE'); +insert into user_group_permission (id, group_id, permission_id, module_id) +values (UUID(), 'project_admin', 'PROJECT_CUSTOM_CODE:READ+EDIT', 'PROJECT_CUSTOM_CODE'); +insert into user_group_permission (id, group_id, permission_id, module_id) +values (UUID(), 'project_admin', 'PROJECT_CUSTOM_CODE:READ+DELETE', 'PROJECT_CUSTOM_CODE'); +insert into user_group_permission (id, group_id, permission_id, module_id) +values (UUID(), 'project_admin', 'PROJECT_CUSTOM_CODE:READ+COPY', 'PROJECT_CUSTOM_CODE'); +-- member +insert into user_group_permission (id, group_id, permission_id, module_id) +values (UUID(), 'project_member', 'PROJECT_CUSTOM_CODE:READ', 'PROJECT_CUSTOM_CODE'); +insert into user_group_permission (id, group_id, permission_id, module_id) +values (UUID(), 'project_member', 'PROJECT_CUSTOM_CODE:READ+CREATE', 'PROJECT_CUSTOM_CODE'); +insert into user_group_permission (id, group_id, permission_id, module_id) +values (UUID(), 'project_member', 'PROJECT_CUSTOM_CODE:READ+EDIT', 'PROJECT_CUSTOM_CODE'); +insert into user_group_permission (id, group_id, permission_id, module_id) +values (UUID(), 'project_member', 'PROJECT_CUSTOM_CODE:READ+DELETE', 'PROJECT_CUSTOM_CODE'); +insert into user_group_permission (id, group_id, permission_id, module_id) +values (UUID(), 'project_member', 'PROJECT_CUSTOM_CODE:READ+COPY', 'PROJECT_CUSTOM_CODE'); + +insert into user_group_permission (id, group_id, permission_id, module_id) +values (UUID(), 'read_only', 'PROJECT_CUSTOM_CODE:READ', 'PROJECT_CUSTOM_CODE'); + +-- 删除组织相关权限 +delete from user_group_permission where module_id = 'ORGANIZATION_OPERATING_LOG'; +delete from user_group_permission where module_id = 'ORGANIZATION_MESSAGE'; +delete from user_group_permission where module_id = 'ORGANIZATION_SERVICE'; +delete from user_group_permission where module_id = 'ORGANIZATION_GROUP'; +delete from user_group_permission where module_id = 'ORGANIZATION_WORKSPACE'; + + +insert into system_parameter (param_key, param_value, type, sort) values ('project.jar.limit.size', 1, 'text', 1); + +ALTER TABLE quota + DROP COLUMN organization_id; + +ALTER TABLE service_integration + DROP COLUMN organization_id; + +ALTER TABLE workspace + DROP COLUMN organization_id; \ No newline at end of file diff --git a/backend/src/main/resources/generatorConfig.xml b/backend/src/main/resources/generatorConfig.xml index 38ff4aa1f3..35b8650013 100644 --- a/backend/src/main/resources/generatorConfig.xml +++ b/backend/src/main/resources/generatorConfig.xml @@ -78,7 +78,9 @@
--> -
+ + + diff --git a/backend/src/main/resources/i18n/messages_en_US.properties b/backend/src/main/resources/i18n/messages_en_US.properties index e2e516dfaa..8fe2bc555c 100644 --- a/backend/src/main/resources/i18n/messages_en_US.properties +++ b/backend/src/main/resources/i18n/messages_en_US.properties @@ -254,8 +254,8 @@ system_authorization_management=System authorization management organization_member=Organization member organization_workspace=Organization workspace project_project_member=Project member -organization_service_integration=Organization service integration -organization_message_settings=Organization message settings +workspace_service_integration=Workspace service integration +workspace_message_settings=Workspace message settings workspace_member=Workspace member workspace_template_settings_field=Workspace template settings field workspace_template_settings_case=Workspace template settings case diff --git a/backend/src/main/resources/i18n/messages_zh_CN.properties b/backend/src/main/resources/i18n/messages_zh_CN.properties index da7ce149ce..594b68af75 100644 --- a/backend/src/main/resources/i18n/messages_zh_CN.properties +++ b/backend/src/main/resources/i18n/messages_zh_CN.properties @@ -252,8 +252,8 @@ system_quota_management=系统-配额管理 system_authorization_management=系统-授权管理 organization_member=组织-成员 organization_workspace=组织-工作空间 -organization_service_integration=组织-服务集成 -organization_message_settings=组织-消息设置 +workspace_service_integration=工作空间-服务集成 +workspace_message_settings=工作空间-消息设置 workspace_member=工作空间-成员 workspace_template_settings_field=工作空间-模版设置-自定义字段 workspace_template_settings_case=工作空间-模版设置-用例模版 diff --git a/backend/src/main/resources/i18n/messages_zh_TW.properties b/backend/src/main/resources/i18n/messages_zh_TW.properties index d1acf792d0..b9f3b23a5c 100644 --- a/backend/src/main/resources/i18n/messages_zh_TW.properties +++ b/backend/src/main/resources/i18n/messages_zh_TW.properties @@ -253,8 +253,8 @@ system_quota_management=系统-配額管理 system_authorization_management=系统-授權管理 organization_member=組織-成員 organization_workspace=組織-工作空間 -organization_service_integration=組織-服務集成 -organization_message_settings=組織-消息設置 +workspace_service_integration=工作空間-服務集成 +workspace_message_settings=工作空間-消息設置 workspace_member=工作空間-成員 workspace_template_settings_field=工作空間-模版設置-自定義字段 workspace_template_settings_case=工作空間-模版設置-用例模版 diff --git a/backend/src/main/resources/mail/ApiFailedNotification.html b/backend/src/main/resources/mail/ApiFailedNotification.html index bc64b565b8..35ea1adb79 100644 --- a/backend/src/main/resources/mail/ApiFailedNotification.html +++ b/backend/src/main/resources/mail/ApiFailedNotification.html @@ -11,11 +11,8 @@

您好:

- -

${name} 接口测试运行失败
-

执行人:${operator}

-

执行时间:${executionTime}

- 请点击下面链接进入测试报告页面【接口定义暂无报告路径】
+

${operator}执行接口测试失败: ${name}

+ 报告: ${url}/#/api/automation/report/view/${id}
diff --git a/backend/src/main/resources/mail/ApiSuccessfulNotification.html b/backend/src/main/resources/mail/ApiSuccessfulNotification.html index 35b111c90d..b4b086ca29 100644 --- a/backend/src/main/resources/mail/ApiSuccessfulNotification.html +++ b/backend/src/main/resources/mail/ApiSuccessfulNotification.html @@ -10,10 +10,8 @@

您好:

-

${name} 接口测试运行成功
-

执行人:${operator}

-

执行时间:${executionTime}

- 请点击下面链接进入测试报告页面【接口定义暂无报告路径】
+

${operator}执行接口测试成功: ${name}

+ 报告: ${url}/#/api/automation/report/view/${id}
diff --git a/backend/src/main/resources/mail/TestPlanFailedNotification.html b/backend/src/main/resources/mail/TestPlanFailedNotification.html index 99d37baf5e..3d6614e9f6 100644 --- a/backend/src/main/resources/mail/TestPlanFailedNotification.html +++ b/backend/src/main/resources/mail/TestPlanFailedNotification.html @@ -11,7 +11,7 @@

您好:

-

您所执行的 ${name} 测试计划运行失败
+

${operator}执行的 ${name} 测试计划运行失败
请点击下面链接进入测试报告页面

${planShareUrl}
diff --git a/backend/src/main/resources/mail/TestPlanSuccessfulNotification.html b/backend/src/main/resources/mail/TestPlanSuccessfulNotification.html index e0dbfa885f..cbecc933be 100644 --- a/backend/src/main/resources/mail/TestPlanSuccessfulNotification.html +++ b/backend/src/main/resources/mail/TestPlanSuccessfulNotification.html @@ -10,7 +10,7 @@

您好:

-

您所执行的 ${name} 测试计划运行成功
+

${operator}执行的 ${name} 测试计划运行成功
请点击下面链接进入测试报告页面

${planShareUrl}
diff --git a/backend/src/main/resources/permission.json b/backend/src/main/resources/permission.json index 5d8b7e01d1..4679a87ed2 100644 --- a/backend/src/main/resources/permission.json +++ b/backend/src/main/resources/permission.json @@ -30,26 +30,6 @@ "name": "修改密码", "resourceId": "SYSTEM_USER" }, - { - "id": "SYSTEM_ORGANIZATION:READ", - "name": "查询组织", - "resourceId": "SYSTEM_ORGANIZATION" - }, - { - "id": "SYSTEM_ORGANIZATION:READ+CREATE", - "name": "创建组织", - "resourceId": "SYSTEM_ORGANIZATION" - }, - { - "id": "SYSTEM_ORGANIZATION:READ+EDIT", - "name": "编辑组织", - "resourceId": "SYSTEM_ORGANIZATION" - }, - { - "id": "SYSTEM_ORGANIZATION:READ+DELETE", - "name": "删除组织", - "resourceId": "SYSTEM_ORGANIZATION" - }, { "id": "SYSTEM_WORKSPACE:READ", "name": "查询工作空间", @@ -156,94 +136,24 @@ "resourceId": "SYSTEM_OPERATING_LOG" }, { - "id": "ORGANIZATION_USER:READ", - "name": "查询成员", - "resourceId": "ORGANIZATION_USER" - }, - { - "id": "ORGANIZATION_USER:READ+CREATE", - "name": "添加成员", - "resourceId": "ORGANIZATION_USER" - }, - { - "id": "ORGANIZATION_USER:READ+EDIT", - "name": "编辑成员", - "resourceId": "ORGANIZATION_USER" - }, - { - "id": "ORGANIZATION_USER:READ+DELETE", - "name": "移除成员", - "resourceId": "ORGANIZATION_USER" - }, - { - "id": "ORGANIZATION_WORKSPACE:READ", - "name": "查询工作空间", - "resourceId": "ORGANIZATION_WORKSPACE" - }, - { - "id": "ORGANIZATION_WORKSPACE:READ+CREATE", - "name": "创建工作空间", - "resourceId": "ORGANIZATION_WORKSPACE" - }, - { - "id": "ORGANIZATION_WORKSPACE:READ+EDIT", - "name": "编辑工作空间", - "resourceId": "ORGANIZATION_WORKSPACE" - }, - { - "id": "ORGANIZATION_WORKSPACE:READ+DELETE", - "name": "删除工作空间", - "resourceId": "ORGANIZATION_WORKSPACE" - }, - { - "id": "ORGANIZATION_GROUP:READ", - "name": "查询用户组与权限", - "resourceId": "ORGANIZATION_GROUP" - }, - { - "id": "ORGANIZATION_GROUP:READ+CREATE", - "name": "创建", - "resourceId": "ORGANIZATION_GROUP" - }, - { - "id": "ORGANIZATION_GROUP:READ+EDIT", - "name": "编辑", - "resourceId": "ORGANIZATION_GROUP" - }, - { - "id": "ORGANIZATION_GROUP:READ+SETTING_PERMISSION", - "name": "设置权限", - "resourceId": "ORGANIZATION_GROUP" - }, - { - "id": "ORGANIZATION_GROUP:READ+DELETE", - "name": "删除", - "resourceId": "ORGANIZATION_GROUP" - }, - { - "id": "ORGANIZATION_SERVICE:READ", + "id": "WORKSPACE_SERVICE:READ", "name": "查询", - "resourceId": "ORGANIZATION_SERVICE" + "resourceId": "WORKSPACE_SERVICE" }, { - "id": "ORGANIZATION_SERVICE:READ+EDIT", + "id": "WORKSPACE_SERVICE:READ+EDIT", "name": "编辑", - "resourceId": "ORGANIZATION_SERVICE" + "resourceId": "WORKSPACE_SERVICE" }, { - "id": "ORGANIZATION_MESSAGE:READ", + "id": "WORKSPACE_MESSAGE:READ", "name": "查询", - "resourceId": "ORGANIZATION_MESSAGE" + "resourceId": "WORKSPACE_MESSAGE" }, { - "id": "ORGANIZATION_MESSAGE:READ+EDIT", + "id": "WORKSPACE_MESSAGE:READ+EDIT", "name": "编辑", - "resourceId": "ORGANIZATION_MESSAGE" - }, - { - "id": "ORGANIZATION_OPERATING_LOG:READ", - "name": "查询操作日志", - "resourceId": "ORGANIZATION_OPERATING_LOG" + "resourceId": "WORKSPACE_MESSAGE" }, { "id": "WORKSPACE_USER:READ", @@ -420,6 +330,61 @@ "name": "查询操作日志", "resourceId": "PROJECT_OPERATING_LOG" }, + { + "id": "PROJECT_FILE:READ+JAR", + "name": "查询jar包", + "resourceId": "PROJECT_FILE" + }, + { + "id": "PROJECT_FILE:READ+UPLOAD+JAR", + "name": "上传jar包", + "resourceId": "PROJECT_FILE" + }, + { + "id": "PROJECT_FILE:READ+DELETE+JAR", + "name": "删除jar包", + "resourceId": "PROJECT_FILE" + }, + { + "id": "PROJECT_FILE:READ+FILE", + "name": "查询文件", + "resourceId": "PROJECT_FILE" + }, + { + "id": "PROJECT_FILE:READ+UPLOAD+FILE", + "name": "上传文件", + "resourceId": "PROJECT_FILE" + }, + { + "id": "PROJECT_FILE:READ+DELETE+FILE", + "name": "删除文件", + "resourceId": "PROJECT_FILE" + }, + { + "id": "PROJECT_CUSTOM_CODE:READ", + "name": "查询", + "resourceId": "PROJECT_CUSTOM_CODE" + }, + { + "id": "PROJECT_CUSTOM_CODE:READ+CREATE", + "name": "创建", + "resourceId": "PROJECT_CUSTOM_CODE" + }, + { + "id": "PROJECT_CUSTOM_CODE:READ+EDIT", + "name": "编辑", + "resourceId": "PROJECT_CUSTOM_CODE" + }, + { + "id": "PROJECT_CUSTOM_CODE:READ+DELETE", + "name": "删除", + "resourceId": "PROJECT_CUSTOM_CODE" + }, + { + "id": "PROJECT_CUSTOM_CODE:READ+COPY", + "name": "复制", + "resourceId": "PROJECT_CUSTOM_CODE" + }, { "id": "PROJECT_TRACK_CASE:READ", "name": "查询用例", @@ -835,10 +800,6 @@ "id": "SYSTEM_USER", "name": "用户" }, - { - "id": "SYSTEM_ORGANIZATION", - "name": "组织" - }, { "id": "SYSTEM_WORKSPACE", "name": "工作空间" @@ -868,33 +829,17 @@ "name": "操作日志" }, { - "id": "ORGANIZATION_USER", + "id": "WORKSPACE_USER", "name": "成员" }, { - "id": "ORGANIZATION_WORKSPACE", - "name": "工作空间" - }, - { - "id": "ORGANIZATION_GROUP", - "name": "用户组与权限" - }, - { - "id": "ORGANIZATION_SERVICE", + "id": "WORKSPACE_SERVICE", "name": "服务集成" }, { - "id": "ORGANIZATION_MESSAGE", + "id": "WORKSPACE_MESSAGE", "name": "消息设置" }, - { - "id": "ORGANIZATION_OPERATING_LOG", - "name": "操作日志" - }, - { - "id": "WORKSPACE_USER", - "name": "成员" - }, { "id": "WORKSPACE_TEMPLATE", "name": "模版设置" @@ -927,6 +872,14 @@ "id": "PROJECT_OPERATING_LOG", "name": "操作日志" }, + { + "id": "PROJECT_CUSTOM_CODE", + "name": "自定义代码片段" + }, + { + "id": "PROJECT_FILE", + "name": "文件管理" + }, { "id": "PROJECT_TRACK_CASE", "name": "测试用例" diff --git a/frontend/src/business/components/api/automation/scenario/ApiScenarioList.vue b/frontend/src/business/components/api/automation/scenario/ApiScenarioList.vue index 93d9120f17..d684203cdc 100644 --- a/frontend/src/business/components/api/automation/scenario/ApiScenarioList.vue +++ b/frontend/src/business/components/api/automation/scenario/ApiScenarioList.vue @@ -237,7 +237,7 @@ - + diff --git a/frontend/src/business/components/api/automation/scenario/EditApiScenario.vue b/frontend/src/business/components/api/automation/scenario/EditApiScenario.vue index 13a27b44ed..0252152ed3 100644 --- a/frontend/src/business/components/api/automation/scenario/EditApiScenario.vue +++ b/frontend/src/business/components/api/automation/scenario/EditApiScenario.vue @@ -322,7 +322,7 @@ - + diff --git a/frontend/src/business/components/api/automation/scenario/common/Jsr233ProcessorContent.vue b/frontend/src/business/components/api/automation/scenario/common/Jsr233ProcessorContent.vue index 2a2ea657ec..8f263571ab 100644 --- a/frontend/src/business/components/api/automation/scenario/common/Jsr233ProcessorContent.vue +++ b/frontend/src/business/components/api/automation/scenario/common/Jsr233ProcessorContent.vue @@ -27,9 +27,9 @@ diff --git a/frontend/src/business/components/common/components/MsScheduleEdit.vue b/frontend/src/business/components/common/components/MsScheduleEdit.vue index 8e995ccf21..7ef6a4b1db 100644 --- a/frontend/src/business/components/common/components/MsScheduleEdit.vue +++ b/frontend/src/business/components/common/components/MsScheduleEdit.vue @@ -41,11 +41,16 @@ diff --git a/frontend/src/business/components/common/head/HeaderOrgWs.vue b/frontend/src/business/components/common/head/HeaderOrgWs.vue index 1cc29c8dc6..7001b206fd 100644 --- a/frontend/src/business/components/common/head/HeaderOrgWs.vue +++ b/frontend/src/business/components/common/head/HeaderOrgWs.vue @@ -1,15 +1,23 @@