From 290a8d64295fa753711fe7d15fd22200b75269a6 Mon Sep 17 00:00:00 2001 From: WangXu10 Date: Mon, 18 Nov 2024 11:20:34 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E6=B5=8B=E8=AF=95=E7=94=A8=E4=BE=8B):?= =?UTF-8?q?=20=E4=BC=98=E5=8C=96=E6=A8=A1=E5=9D=97=E6=93=8D=E4=BD=9C?= =?UTF-8?q?=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../functional/service/CaseReviewModuleLogService.java | 9 +++++---- .../functional/service/CaseReviewModuleService.java | 4 ++-- .../service/FunctionalCaseModuleLogService.java | 4 +++- .../plan/service/TestPlanModuleLogService.java | 2 +- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/service/CaseReviewModuleLogService.java b/backend/services/case-management/src/main/java/io/metersphere/functional/service/CaseReviewModuleLogService.java index cde1c97621..9d4d0d35f0 100644 --- a/backend/services/case-management/src/main/java/io/metersphere/functional/service/CaseReviewModuleLogService.java +++ b/backend/services/case-management/src/main/java/io/metersphere/functional/service/CaseReviewModuleLogService.java @@ -6,6 +6,7 @@ import io.metersphere.project.domain.Project; import io.metersphere.project.mapper.ProjectMapper; import io.metersphere.sdk.constants.HttpMethodConstants; import io.metersphere.sdk.util.JSON; +import io.metersphere.sdk.util.Translator; import io.metersphere.system.dto.builder.LogDTOBuilder; import io.metersphere.system.log.constants.OperationLogModule; import io.metersphere.system.log.constants.OperationLogType; @@ -79,15 +80,15 @@ public class CaseReviewModuleLogService { /** * 评审删除模块日志 * - * @param caseReviews + * @param deleteModule * @param projectId * @param userId * @param path */ - public void batchDelLog(List caseReviews, String projectId, String userId, String path) { + public void batchDelLog(List deleteModule, String projectId, String userId, String path) { Project project = projectMapper.selectByPrimaryKey(projectId); List dtoList = new ArrayList<>(); - caseReviews.forEach(item -> { + deleteModule.forEach(item -> { LogDTO dto = new LogDTO( projectId, project.getOrganizationId(), @@ -95,7 +96,7 @@ public class CaseReviewModuleLogService { userId, OperationLogType.DELETE.name(), OperationLogModule.CASE_MANAGEMENT_REVIEW_REVIEW_MODULE, - item.getName()); + item.getName() + " " + Translator.get("log.delete_module")); dto.setPath(path); dto.setMethod(HttpMethodConstants.GET.name()); dto.setOriginalValue(JSON.toJSONBytes(item)); diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/service/CaseReviewModuleService.java b/backend/services/case-management/src/main/java/io/metersphere/functional/service/CaseReviewModuleService.java index ae6f3843da..3fd47b6bc9 100644 --- a/backend/services/case-management/src/main/java/io/metersphere/functional/service/CaseReviewModuleService.java +++ b/backend/services/case-management/src/main/java/io/metersphere/functional/service/CaseReviewModuleService.java @@ -119,8 +119,8 @@ public class CaseReviewModuleService extends ModuleTreeService { public void deleteModule(String moduleId, String userId) { CaseReviewModule deleteModule = caseReviewModuleMapper.selectByPrimaryKey(moduleId); if (deleteModule != null) { - List caseReviews = this.deleteModuleByIds(Collections.singletonList(moduleId), new ArrayList<>(), deleteModule.getProjectId()); - caseReviewModuleLogService.batchDelLog(caseReviews, deleteModule.getProjectId(), userId, "/case/review/module/delete/" + moduleId); + this.deleteModuleByIds(Collections.singletonList(moduleId), new ArrayList<>(), deleteModule.getProjectId()); + caseReviewModuleLogService.batchDelLog(List.of(deleteModule), deleteModule.getProjectId(), userId, "/case/review/module/delete/" + moduleId); } } diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/service/FunctionalCaseModuleLogService.java b/backend/services/case-management/src/main/java/io/metersphere/functional/service/FunctionalCaseModuleLogService.java index 6fbcf5009f..2742d058fd 100644 --- a/backend/services/case-management/src/main/java/io/metersphere/functional/service/FunctionalCaseModuleLogService.java +++ b/backend/services/case-management/src/main/java/io/metersphere/functional/service/FunctionalCaseModuleLogService.java @@ -6,6 +6,7 @@ import io.metersphere.project.domain.Project; import io.metersphere.project.mapper.ProjectMapper; import io.metersphere.sdk.constants.HttpMethodConstants; import io.metersphere.sdk.util.JSON; +import io.metersphere.sdk.util.Translator; import io.metersphere.system.dto.builder.LogDTOBuilder; import io.metersphere.system.log.constants.OperationLogModule; import io.metersphere.system.log.constants.OperationLogType; @@ -106,6 +107,7 @@ public class FunctionalCaseModuleLogService { /** * 功能用例模块删除日志 + * * @param deleteModule * @param projectId * @param userId @@ -122,7 +124,7 @@ public class FunctionalCaseModuleLogService { userId, type, OperationLogModule.CASE_MANAGEMENT_CASE_MODULE, - item.getName()); + item.getName() + " " + Translator.get("log.delete_module")); dto.setPath(path); dto.setMethod(HttpMethodConstants.GET.name()); dto.setOriginalValue(JSON.toJSONBytes(item)); diff --git a/backend/services/test-plan/src/main/java/io/metersphere/plan/service/TestPlanModuleLogService.java b/backend/services/test-plan/src/main/java/io/metersphere/plan/service/TestPlanModuleLogService.java index c18f562e53..af9b1cd1a8 100644 --- a/backend/services/test-plan/src/main/java/io/metersphere/plan/service/TestPlanModuleLogService.java +++ b/backend/services/test-plan/src/main/java/io/metersphere/plan/service/TestPlanModuleLogService.java @@ -73,7 +73,7 @@ public class TestPlanModuleLogService { .method(requestMethod) .path(requestUrl) .sourceId(deleteModule.getId()) - .content(deleteModule.getName()) + .content(deleteModule.getName() + " " + Translator.get("log.delete_module")) .originalValue(JSON.toJSONBytes(deleteModule)) .createUser(operator) .build().getLogDTO();