fix(测试用例): 功能用例脑图模式下模块操作日志记录问题

This commit is contained in:
WangXu10 2024-11-19 17:50:20 +08:00 committed by 刘瑞斌
parent 2a44695c7e
commit 4bba38798a
3 changed files with 8 additions and 9 deletions

View File

@ -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<FunctionalCaseModuleEditRequest> 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<FunctionalCaseModule> 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<FunctionalCase> functionalCases = functionalCaseModuleService.deleteModuleByIds(moduleIds, new ArrayList<>(), user.getId());
functionalCaseModuleLogService.batchDelLog(functionalCases, request.getProjectId(), user.getId(), "/functional/mind/case/edit");

View File

@ -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<FunctionalCaseModule> deleteModule, String projectId, String userId, String path, String type) {
public void handleModuleLog(List<FunctionalCaseModule> deleteModule, String projectId, String userId, String path, String type, String deleteDesc) {
Project project = projectMapper.selectByPrimaryKey(projectId);
List<LogDTO> 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));

View File

@ -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<String> ids = functionalCases.stream().map(FunctionalCase::getId).toList();
User user = userMapper.selectByPrimaryKey(userId);
functionalCaseNoticeService.batchSendNotice(deleteModule.getProjectId(), ids, user, NoticeConstants.Event.DELETE);