From 9dadc2039d66401d97b7acc06240963fb45414e2 Mon Sep 17 00:00:00 2001 From: wxg0103 <727495428@qq.com> Date: Wed, 23 Aug 2023 10:16:41 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E7=B3=BB=E7=BB=9F=E8=AE=BE=E7=BD=AE):?= =?UTF-8?q?=20=E4=BC=98=E5=8C=96=E9=A1=B9=E7=9B=AE=E6=97=A5=E5=BF=97?= =?UTF-8?q?=E6=93=8D=E4=BD=9C=E5=AF=B9=E8=B1=A1=E7=9A=84=E8=AE=B0=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sdk/log/constants/OperationLogModule.java | 3 +++ .../system/service/CommonProjectService.java | 2 +- .../system/service/OrganizationProjectLogService.java | 8 ++++---- .../system/service/OrganizationProjectService.java | 8 ++++---- .../system/service/SystemProjectLogService.java | 10 +++++----- .../system/service/SystemProjectService.java | 8 ++++---- 6 files changed, 21 insertions(+), 18 deletions(-) diff --git a/backend/framework/sdk/src/main/java/io/metersphere/sdk/log/constants/OperationLogModule.java b/backend/framework/sdk/src/main/java/io/metersphere/sdk/log/constants/OperationLogModule.java index d4994544ec..d95c527f59 100644 --- a/backend/framework/sdk/src/main/java/io/metersphere/sdk/log/constants/OperationLogModule.java +++ b/backend/framework/sdk/src/main/java/io/metersphere/sdk/log/constants/OperationLogModule.java @@ -71,5 +71,8 @@ public class OperationLogModule { public static final String SETTING_ORGANIZATION = "SETTING_ORGANIZATION"; public static final String SETTING_ORGANIZATION_MEMBER = "SETTING_ORGANIZATION_MEMBER"; public static final String SETTING_ORGANIZATION_SERVICE = "SETTING_ORGANIZATION_SERVICE"; + + //系统设置-组织-项目 + public static final String SETTING_SYSTEM_ORGANIZATION_PROJECT = "SETTING_SYSTEM_ORGANIZATION_PROJECT"; } diff --git a/backend/services/system-setting/src/main/java/io/metersphere/system/service/CommonProjectService.java b/backend/services/system-setting/src/main/java/io/metersphere/system/service/CommonProjectService.java index 3fe9b22432..dd530e9c86 100644 --- a/backend/services/system-setting/src/main/java/io/metersphere/system/service/CommonProjectService.java +++ b/backend/services/system-setting/src/main/java/io/metersphere/system/service/CommonProjectService.java @@ -232,7 +232,7 @@ public class CommonProjectService { memberRequest.setProjectIds(List.of(project.getId())); memberRequest.setUserIds(insertIds); this.addProjectAdmin(memberRequest, updateUser, path, OperationLogType.ADD.name(), - Translator.get("update"), module); + Translator.get("add"), module); } } else { if (CollectionUtils.isNotEmpty(orgUserIds)) { diff --git a/backend/services/system-setting/src/main/java/io/metersphere/system/service/OrganizationProjectLogService.java b/backend/services/system-setting/src/main/java/io/metersphere/system/service/OrganizationProjectLogService.java index 011c5ee5b6..c85cb52bdd 100644 --- a/backend/services/system-setting/src/main/java/io/metersphere/system/service/OrganizationProjectLogService.java +++ b/backend/services/system-setting/src/main/java/io/metersphere/system/service/OrganizationProjectLogService.java @@ -32,7 +32,7 @@ public class OrganizationProjectLogService { null, null, OperationLogType.ADD.name(), - OperationLogModule.ORGANIZATION_PROJECT, + OperationLogModule.SETTING_SYSTEM_ORGANIZATION_PROJECT, project.getName()); dto.setOriginalValue(JSON.toJSONBytes(project)); @@ -52,7 +52,7 @@ public class OrganizationProjectLogService { project.getId(), project.getCreateUser(), OperationLogType.UPDATE.name(), - OperationLogModule.ORGANIZATION_PROJECT, + OperationLogModule.SETTING_SYSTEM_ORGANIZATION_PROJECT, project.getName()); dto.setOriginalValue(JSON.toJSONBytes(project)); @@ -95,7 +95,7 @@ public class OrganizationProjectLogService { id, project.getCreateUser(), OperationLogType.DELETE.name(), - OperationLogModule.ORGANIZATION_PROJECT, + OperationLogModule.SETTING_SYSTEM_ORGANIZATION_PROJECT, project.getName()); dto.setOriginalValue(JSON.toJSONBytes(project)); @@ -118,7 +118,7 @@ public class OrganizationProjectLogService { id, null, OperationLogType.RECOVER.name(), - OperationLogModule.ORGANIZATION_PROJECT, + OperationLogModule.SETTING_SYSTEM_ORGANIZATION_PROJECT, project.getName()); dto.setOriginalValue(JSON.toJSONBytes(project)); return dto; diff --git a/backend/services/system-setting/src/main/java/io/metersphere/system/service/OrganizationProjectService.java b/backend/services/system-setting/src/main/java/io/metersphere/system/service/OrganizationProjectService.java index 4f9c66ccce..331e88a224 100644 --- a/backend/services/system-setting/src/main/java/io/metersphere/system/service/OrganizationProjectService.java +++ b/backend/services/system-setting/src/main/java/io/metersphere/system/service/OrganizationProjectService.java @@ -46,7 +46,7 @@ public class OrganizationProjectService { * @return */ public ProjectExtendDTO add(AddProjectRequest addProjectDTO, String createUser) { - return commonProjectService.add(addProjectDTO, createUser, ADD_PROJECT, OperationLogModule.ORGANIZATION_PROJECT); + return commonProjectService.add(addProjectDTO, createUser, ADD_PROJECT, OperationLogModule.SETTING_SYSTEM_ORGANIZATION_PROJECT); } public List getProjectList(OrganizationProjectRequest request) { @@ -57,7 +57,7 @@ public class OrganizationProjectService { } public ProjectExtendDTO update(UpdateProjectRequest updateProjectDto, String updateUser) { - return commonProjectService.update(updateProjectDto, updateUser, UPDATE_PROJECT, OperationLogModule.ORGANIZATION_PROJECT); + return commonProjectService.update(updateProjectDto, updateUser, UPDATE_PROJECT, OperationLogModule.SETTING_SYSTEM_ORGANIZATION_PROJECT); } public int delete(String id, String deleteUser) { @@ -76,11 +76,11 @@ public class OrganizationProjectService { */ public void addProjectMember(ProjectAddMemberBatchRequest request, String createUser) { commonProjectService.addProjectMember(request, createUser, ADD_MEMBER, - OperationLogType.ADD.name(), Translator.get("add"), OperationLogModule.ORGANIZATION_PROJECT); + OperationLogType.ADD.name(), Translator.get("add"), OperationLogModule.SETTING_SYSTEM_ORGANIZATION_PROJECT); } public int removeProjectMember(String projectId, String userId, String createUser) { - return commonProjectService.removeProjectMember(projectId, userId, createUser,OperationLogModule.ORGANIZATION_PROJECT, StringUtils.join(REMOVE_PROJECT_MEMBER,projectId, "/", userId)); + return commonProjectService.removeProjectMember(projectId, userId, createUser, OperationLogModule.SETTING_SYSTEM_ORGANIZATION_PROJECT, StringUtils.join(REMOVE_PROJECT_MEMBER, projectId, "/", userId)); } public int revoke(String id) { diff --git a/backend/services/system-setting/src/main/java/io/metersphere/system/service/SystemProjectLogService.java b/backend/services/system-setting/src/main/java/io/metersphere/system/service/SystemProjectLogService.java index 6de07d41cc..aa63023541 100644 --- a/backend/services/system-setting/src/main/java/io/metersphere/system/service/SystemProjectLogService.java +++ b/backend/services/system-setting/src/main/java/io/metersphere/system/service/SystemProjectLogService.java @@ -32,7 +32,7 @@ public class SystemProjectLogService { null, null, OperationLogType.ADD.name(), - OperationLogModule.SYSTEM_PROJECT, + OperationLogModule.SETTING_SYSTEM_ORGANIZATION, project.getName()); dto.setOriginalValue(JSON.toJSONBytes(project)); @@ -52,7 +52,7 @@ public class SystemProjectLogService { project.getId(), project.getCreateUser(), OperationLogType.UPDATE.name(), - OperationLogModule.SYSTEM_PROJECT, + OperationLogModule.SETTING_SYSTEM_ORGANIZATION, project.getName()); dto.setOriginalValue(JSON.toJSONBytes(project)); @@ -70,7 +70,7 @@ public class SystemProjectLogService { project.getId(), project.getCreateUser(), OperationLogType.UPDATE.name(), - OperationLogModule.SYSTEM_PROJECT, + OperationLogModule.SETTING_SYSTEM_ORGANIZATION, project.getName()); dto.setMethod(HttpMethodConstants.GET.name()); @@ -96,7 +96,7 @@ public class SystemProjectLogService { id, project.getCreateUser(), OperationLogType.DELETE.name(), - OperationLogModule.SYSTEM_PROJECT, + OperationLogModule.SETTING_SYSTEM_ORGANIZATION, project.getName()); dto.setOriginalValue(JSON.toJSONBytes(project)); @@ -119,7 +119,7 @@ public class SystemProjectLogService { id, null, OperationLogType.RECOVER.name(), - OperationLogModule.SYSTEM_PROJECT, + OperationLogModule.SETTING_SYSTEM_ORGANIZATION, project.getName()); dto.setOriginalValue(JSON.toJSONBytes(project)); return dto; diff --git a/backend/services/system-setting/src/main/java/io/metersphere/system/service/SystemProjectService.java b/backend/services/system-setting/src/main/java/io/metersphere/system/service/SystemProjectService.java index 22353c2c45..0d2e78fadf 100644 --- a/backend/services/system-setting/src/main/java/io/metersphere/system/service/SystemProjectService.java +++ b/backend/services/system-setting/src/main/java/io/metersphere/system/service/SystemProjectService.java @@ -45,7 +45,7 @@ public class SystemProjectService { * @return */ public ProjectExtendDTO add(AddProjectRequest addProjectDTO, String createUser) { - return commonProjectService.add(addProjectDTO, createUser, ADD_PROJECT, OperationLogModule.SYSTEM_PROJECT); + return commonProjectService.add(addProjectDTO, createUser, ADD_PROJECT, OperationLogModule.SETTING_SYSTEM_ORGANIZATION); } public List getProjectList(ProjectRequest request) { @@ -54,7 +54,7 @@ public class SystemProjectService { } public ProjectExtendDTO update(UpdateProjectRequest updateProjectDto, String updateUser) { - return commonProjectService.update(updateProjectDto, updateUser, UPDATE_PROJECT, OperationLogModule.SYSTEM_PROJECT); + return commonProjectService.update(updateProjectDto, updateUser, UPDATE_PROJECT, OperationLogModule.SETTING_SYSTEM_ORGANIZATION); } public int delete(String id, String deleteUser) { @@ -73,11 +73,11 @@ public class SystemProjectService { */ public void addProjectMember(ProjectAddMemberBatchRequest request, String createUser) { commonProjectService.addProjectMember(request, createUser, ADD_MEMBER, - OperationLogType.ADD.name(), Translator.get("add"), OperationLogModule.SYSTEM_PROJECT); + OperationLogType.ADD.name(), Translator.get("add"), OperationLogModule.SETTING_SYSTEM_ORGANIZATION); } public int removeProjectMember(String projectId, String userId, String createUser) { - return commonProjectService.removeProjectMember(projectId, userId, createUser,OperationLogModule.SYSTEM_PROJECT, StringUtils.join(REMOVE_PROJECT_MEMBER,projectId, "/", userId)); + return commonProjectService.removeProjectMember(projectId, userId, createUser, OperationLogModule.SETTING_SYSTEM_ORGANIZATION, StringUtils.join(REMOVE_PROJECT_MEMBER, projectId, "/", userId)); } public int revoke(String id) {