From 4bba38798ac1a1b5f918c5741cbe73208f6a31fc Mon Sep 17 00:00:00 2001 From: WangXu10 Date: Tue, 19 Nov 2024 17:50:20 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=B5=8B=E8=AF=95=E7=94=A8=E4=BE=8B):=20?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=E7=94=A8=E4=BE=8B=E8=84=91=E5=9B=BE=E6=A8=A1?= =?UTF-8?q?=E5=BC=8F=E4=B8=8B=E6=A8=A1=E5=9D=97=E6=93=8D=E4=BD=9C=E6=97=A5?= =?UTF-8?q?=E5=BF=97=E8=AE=B0=E5=BD=95=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/FunctionalCaseMinderService.java | 10 +++++----- .../service/FunctionalCaseModuleLogService.java | 5 ++--- .../service/FunctionalCaseModuleService.java | 2 +- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/service/FunctionalCaseMinderService.java b/backend/services/case-management/src/main/java/io/metersphere/functional/service/FunctionalCaseMinderService.java index 90491495c5..775c04f8b4 100644 --- a/backend/services/case-management/src/main/java/io/metersphere/functional/service/FunctionalCaseMinderService.java +++ b/backend/services/case-management/src/main/java/io/metersphere/functional/service/FunctionalCaseMinderService.java @@ -579,8 +579,8 @@ public class FunctionalCaseMinderService { beforeNode = sources; afterNode = new ArrayList<>(); } else { - beforeNode = sources.subList(0, targetIndex-1); - afterNode = sources.subList(targetIndex-1, sources.size()); + beforeNode = sources.subList(0, targetIndex - 1); + afterNode = sources.subList(targetIndex - 1, sources.size()); } } else { beforeNode = sources.subList(0, targetIndex); @@ -878,7 +878,7 @@ public class FunctionalCaseMinderService { checkModules(module, parentIdInDBMap, OperationLogType.ADD.toString()); moduleMapper.insert(module); } - functionalCaseModuleLogService.handleModuleLog(modules, request.getProjectId(), userId, "/functional/mind/case/edit", OperationLogType.ADD.name()); + functionalCaseModuleLogService.handleModuleLog(modules, request.getProjectId(), userId, "/functional/mind/case/edit", OperationLogType.ADD.name(), ""); } //处理更新(更新的情况是可能换数据本身,可能换父节点,可能换顺序) List updateList = resourceMap.get(OperationLogType.UPDATE.toString()); @@ -901,7 +901,7 @@ public class FunctionalCaseMinderService { checkModules(module, parentIdInDBMap, OperationLogType.UPDATE.toString()); moduleMapper.updateByPrimaryKeySelective(module); } - functionalCaseModuleLogService.handleModuleLog(modules, request.getProjectId(), userId, "/functional/mind/case/edit", OperationLogType.UPDATE.name()); + functionalCaseModuleLogService.handleModuleLog(modules, request.getProjectId(), userId, "/functional/mind/case/edit", OperationLogType.UPDATE.name(), ""); } } setDTOTargetMap(functionalMinderUpdateDTO, sourceIdAndTargetIdsMap); @@ -1242,7 +1242,7 @@ public class FunctionalCaseMinderService { FunctionalCaseModuleExample moduleExample = new FunctionalCaseModuleExample(); moduleExample.createCriteria().andIdIn(moduleIds); List modules = functionalCaseModuleMapper.selectByExample(moduleExample); - functionalCaseModuleLogService.handleModuleLog(modules, request.getProjectId(), user.getId(), "/functional/mind/case/edit", OperationLogType.DELETE.name()); + functionalCaseModuleLogService.handleModuleLog(modules, request.getProjectId(), user.getId(), "/functional/mind/case/edit", OperationLogType.DELETE.name(), " " + Translator.get("log.delete_module")); List functionalCases = functionalCaseModuleService.deleteModuleByIds(moduleIds, new ArrayList<>(), user.getId()); functionalCaseModuleLogService.batchDelLog(functionalCases, request.getProjectId(), user.getId(), "/functional/mind/case/edit"); 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 2742d058fd..16e2cef3d7 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,7 +6,6 @@ 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; @@ -113,7 +112,7 @@ public class FunctionalCaseModuleLogService { * @param userId * @param path */ - public void handleModuleLog(List deleteModule, String projectId, String userId, String path, String type) { + public void handleModuleLog(List deleteModule, String projectId, String userId, String path, String type, String deleteDesc) { Project project = projectMapper.selectByPrimaryKey(projectId); List dtoList = new ArrayList<>(); deleteModule.forEach(item -> { @@ -124,7 +123,7 @@ public class FunctionalCaseModuleLogService { userId, type, OperationLogModule.CASE_MANAGEMENT_CASE_MODULE, - item.getName() + " " + Translator.get("log.delete_module")); + item.getName() + deleteDesc); 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/FunctionalCaseModuleService.java b/backend/services/case-management/src/main/java/io/metersphere/functional/service/FunctionalCaseModuleService.java index b5e3be173d..106640378e 100644 --- a/backend/services/case-management/src/main/java/io/metersphere/functional/service/FunctionalCaseModuleService.java +++ b/backend/services/case-management/src/main/java/io/metersphere/functional/service/FunctionalCaseModuleService.java @@ -132,7 +132,7 @@ public class FunctionalCaseModuleService extends ModuleTreeService { //用例日志 functionalCaseModuleLogService.batchDelLog(functionalCases, deleteModule.getProjectId(), userId, "/functional/case/module/delete/" + moduleId); //模块日志 - functionalCaseModuleLogService.handleModuleLog(List.of(deleteModule), deleteModule.getProjectId(), userId, "/functional/case/module/delete/" + moduleId, OperationLogType.DELETE.name()); + functionalCaseModuleLogService.handleModuleLog(List.of(deleteModule), deleteModule.getProjectId(), userId, "/functional/case/module/delete/" + moduleId, OperationLogType.DELETE.name(), " " + Translator.get("log.delete_module")); List ids = functionalCases.stream().map(FunctionalCase::getId).toList(); User user = userMapper.selectByPrimaryKey(userId); functionalCaseNoticeService.batchSendNotice(deleteModule.getProjectId(), ids, user, NoticeConstants.Event.DELETE);