feat(测试用例): 功能用例操作日志细化

This commit is contained in:
WangXu10 2024-11-05 15:15:20 +08:00 committed by Craftsman
parent 5562e57f63
commit cc6424f1ca
9 changed files with 148 additions and 61 deletions

View File

@ -122,7 +122,7 @@ public class FunctionalCaseAttachmentController {
@CheckOwner(resourceId = "#projectId", resourceType = "project") @CheckOwner(resourceId = "#projectId", resourceType = "project")
public String update(@PathVariable String projectId, @PathVariable String id) { public String update(@PathVariable String projectId, @PathVariable String id) {
FileLogRecord fileLogRecord = FileLogRecord.builder() FileLogRecord fileLogRecord = FileLogRecord.builder()
.logModule(OperationLogModule.FUNCTIONAL_CASE) .logModule(OperationLogModule.CASE_MANAGEMENT_CASE_CASE)
.operator(SessionUtils.getUserId()) .operator(SessionUtils.getUserId())
.projectId(projectId) .projectId(projectId)
.build(); .build();
@ -138,7 +138,7 @@ public class FunctionalCaseAttachmentController {
byte[] fileByte = functionalCaseAttachmentService.getFileByte(request); byte[] fileByte = functionalCaseAttachmentService.getFileByte(request);
FunctionalCaseAttachment attachment = functionalCaseAttachmentService.getAttachment(request); FunctionalCaseAttachment attachment = functionalCaseAttachmentService.getAttachment(request);
FileLogRecord fileLogRecord = FileLogRecord.builder() FileLogRecord fileLogRecord = FileLogRecord.builder()
.logModule(OperationLogModule.FUNCTIONAL_CASE) .logModule(OperationLogModule.CASE_MANAGEMENT_CASE_CASE)
.operator(SessionUtils.getUserId()) .operator(SessionUtils.getUserId())
.projectId(request.getProjectId()) .projectId(request.getProjectId())
.build(); .build();

View File

@ -263,7 +263,7 @@ public class FunctionalCaseAttachmentService {
private FileLogRecord createFileLogRecord(String logUrl, String operator, String projectId) { private FileLogRecord createFileLogRecord(String logUrl, String operator, String projectId) {
return FileLogRecord.builder() return FileLogRecord.builder()
.logModule(OperationLogModule.FUNCTIONAL_CASE) .logModule(OperationLogModule.CASE_MANAGEMENT_CASE_CASE)
.operator(operator) .operator(operator)
.projectId(projectId) .projectId(projectId)
.build(); .build();

View File

@ -141,7 +141,7 @@ public class FunctionalCaseLogService {
functionalCase.getId(), functionalCase.getId(),
null, null,
OperationLogType.DELETE.name(), OperationLogType.DELETE.name(),
OperationLogModule.FUNCTIONAL_CASE, OperationLogModule.CASE_MANAGEMENT_CASE_CASE,
functionalCase.getName()); functionalCase.getName());
dto.setPath("/functional/case/delete"); dto.setPath("/functional/case/delete");
@ -168,7 +168,7 @@ public class FunctionalCaseLogService {
functionalCase.getId(), functionalCase.getId(),
null, null,
OperationLogType.DELETE.name(), OperationLogType.DELETE.name(),
OperationLogModule.FUNCTIONAL_CASE, OperationLogModule.CASE_MANAGEMENT_CASE_CASE,
functionalCase.getName()); functionalCase.getName());
dto.setPath(path); dto.setPath(path);
@ -195,7 +195,7 @@ public class FunctionalCaseLogService {
id, id,
null, null,
OperationLogType.RECOVER.name(), OperationLogType.RECOVER.name(),
OperationLogModule.FUNCTIONAL_CASE, OperationLogModule.CASE_MANAGEMENT_CASE_RECYCLE,
functionalCase.getName()); functionalCase.getName());
dto.setOriginalValue(JSON.toJSONBytes(functionalCase)); dto.setOriginalValue(JSON.toJSONBytes(functionalCase));
return dto; return dto;
@ -221,7 +221,7 @@ public class FunctionalCaseLogService {
functionalCase.getId(), functionalCase.getId(),
null, null,
OperationLogType.RECOVER.name(), OperationLogType.RECOVER.name(),
OperationLogModule.FUNCTIONAL_CASE, OperationLogModule.CASE_MANAGEMENT_CASE_RECYCLE,
functionalCase.getName()); functionalCase.getName());
dto.setPath("/functional/case/batch/recover"); dto.setPath("/functional/case/batch/recover");
@ -248,7 +248,7 @@ public class FunctionalCaseLogService {
functionalCase.getId(), functionalCase.getId(),
null, null,
OperationLogType.DELETE.name(), OperationLogType.DELETE.name(),
OperationLogModule.FUNCTIONAL_CASE, OperationLogModule.CASE_MANAGEMENT_CASE_RECYCLE,
functionalCase.getName()); functionalCase.getName());
dto.setPath("/functional/case/trash/delete"); dto.setPath("/functional/case/trash/delete");
@ -279,7 +279,7 @@ public class FunctionalCaseLogService {
functionalCase.getId(), functionalCase.getId(),
null, null,
OperationLogType.DISASSOCIATE.name(), OperationLogType.DISASSOCIATE.name(),
OperationLogModule.FUNCTIONAL_CASE, OperationLogModule.CASE_MANAGEMENT_CASE_CASE,
functionalCase.getName()); functionalCase.getName());
dto.setPath("/functional/case/demand/cancel/"); dto.setPath("/functional/case/demand/cancel/");
@ -305,7 +305,7 @@ public class FunctionalCaseLogService {
functionalCase.getId(), functionalCase.getId(),
null, null,
OperationLogType.DISASSOCIATE.name(), OperationLogType.DISASSOCIATE.name(),
OperationLogModule.FUNCTIONAL_CASE, OperationLogModule.CASE_MANAGEMENT_CASE_CASE,
functionalCase.getName()); functionalCase.getName());
dto.setPath("/functional/case/test/disassociate/case"); dto.setPath("/functional/case/test/disassociate/case");
@ -344,7 +344,7 @@ public class FunctionalCaseLogService {
functionalCase.getId(), functionalCase.getId(),
null, null,
OperationLogType.DELETE.name(), OperationLogType.DELETE.name(),
OperationLogModule.FUNCTIONAL_CASE, OperationLogModule.CASE_MANAGEMENT_CASE_RECYCLE,
functionalCase.getName()); functionalCase.getName());
dto.setPath("/functional/case/batch/delete"); dto.setPath("/functional/case/batch/delete");
@ -379,7 +379,7 @@ public class FunctionalCaseLogService {
bugRelationCase.getBugId(), bugRelationCase.getBugId(),
null, null,
OperationLogType.DISASSOCIATE.name(), OperationLogType.DISASSOCIATE.name(),
OperationLogModule.FUNCTIONAL_CASE, OperationLogModule.CASE_MANAGEMENT_CASE_CASE,
bug.getTitle() + "缺陷"); bug.getTitle() + "缺陷");
dto.setPath("/functional/case/test/disassociate/bug/" + id); dto.setPath("/functional/case/test/disassociate/bug/" + id);
@ -400,7 +400,7 @@ public class FunctionalCaseLogService {
functionalCase.getId(), functionalCase.getId(),
null, null,
OperationLogType.DISASSOCIATE.name(), OperationLogType.DISASSOCIATE.name(),
OperationLogModule.FUNCTIONAL_CASE, OperationLogModule.CASE_MANAGEMENT_CASE_CASE,
functionalCase.getName()); functionalCase.getName());
dto.setPath("/functional/case/relationship/delete"); dto.setPath("/functional/case/relationship/delete");
@ -419,7 +419,7 @@ public class FunctionalCaseLogService {
sourceId, sourceId,
null, null,
OperationLogType.UPDATE.name(), OperationLogType.UPDATE.name(),
OperationLogModule.FUNCTIONAL_CASE, OperationLogModule.CASE_MANAGEMENT_CASE_CASE,
content); content);
dto.setHistory(true); dto.setHistory(true);
dto.setPath(path); dto.setPath(path);
@ -435,7 +435,7 @@ public class FunctionalCaseLogService {
request.getFileId(), request.getFileId(),
userId, userId,
OperationLogType.EXPORT.name(), OperationLogType.EXPORT.name(),
OperationLogModule.FUNCTIONAL_CASE, OperationLogModule.CASE_MANAGEMENT_CASE_CASE,
""); "");
dto.setHistory(true); dto.setHistory(true);
dto.setPath("/functional/case/export/" + url); dto.setPath("/functional/case/export/" + url);

View File

@ -109,9 +109,6 @@ public class FunctionalCaseMinderService {
@Resource @Resource
private ExtFunctionalCaseModuleMapper extFunctionalCaseModuleMapper; private ExtFunctionalCaseModuleMapper extFunctionalCaseModuleMapper;
@Resource
private FunctionalCaseLogService functionalCaseLogService;
@Resource @Resource
private FunctionalCaseNoticeService functionalCaseNoticeService; private FunctionalCaseNoticeService functionalCaseNoticeService;
@ -120,6 +117,8 @@ public class FunctionalCaseMinderService {
@Resource @Resource
private ProjectTemplateService projectTemplateService; private ProjectTemplateService projectTemplateService;
@Resource
private FunctionalCaseModuleLogService functionalCaseModuleLogService;
/** /**
@ -527,7 +526,7 @@ public class FunctionalCaseMinderService {
functionalCase.getId(), functionalCase.getId(),
userId, userId,
OperationLogType.DELETE.name(), OperationLogType.DELETE.name(),
OperationLogModule.FUNCTIONAL_CASE, OperationLogModule.CASE_MANAGEMENT_CASE_CASE,
functionalCase.getName()); functionalCase.getName());
dto.setPath("/functional/mind/case/edit"); dto.setPath("/functional/mind/case/edit");
@ -1005,7 +1004,7 @@ public class FunctionalCaseMinderService {
caseId, caseId,
userId, userId,
operationLogType.name(), operationLogType.name(),
OperationLogModule.FUNCTIONAL_CASE, OperationLogModule.CASE_MANAGEMENT_CASE_CASE,
historyLogDTO.getFunctionalCase().getName()); historyLogDTO.getFunctionalCase().getName());
dto.setHistory(true); dto.setHistory(true);
dto.setPath("/functional/mind/case/edit"); dto.setPath("/functional/mind/case/edit");
@ -1238,7 +1237,7 @@ public class FunctionalCaseMinderService {
throw new MSException(Translator.get("functional_case.module.default.name.cut_error")); throw new MSException(Translator.get("functional_case.module.default.name.cut_error"));
} }
List<FunctionalCase> functionalCases = functionalCaseModuleService.deleteModuleByIds(moduleIds, new ArrayList<>(), user.getId()); List<FunctionalCase> functionalCases = functionalCaseModuleService.deleteModuleByIds(moduleIds, new ArrayList<>(), user.getId());
functionalCaseModuleService.batchDelLog(functionalCases, request.getProjectId()); functionalCaseModuleLogService.batchDelLog(functionalCases, request.getProjectId(), user.getId(), "/functional/mind/case/edit");
List<String> finalCaseIds = caseIds; List<String> finalCaseIds = caseIds;
List<String> caseIdList = functionalCases.stream().map(FunctionalCase::getId).filter(id -> !finalCaseIds.contains(id)).toList(); List<String> caseIdList = functionalCases.stream().map(FunctionalCase::getId).filter(id -> !finalCaseIds.contains(id)).toList();
if (CollectionUtils.isNotEmpty(caseIdList)) { if (CollectionUtils.isNotEmpty(caseIdList)) {

View File

@ -0,0 +1,107 @@
package io.metersphere.functional.service;
import io.metersphere.functional.domain.FunctionalCase;
import io.metersphere.functional.domain.FunctionalCaseModule;
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.system.dto.builder.LogDTOBuilder;
import io.metersphere.system.log.constants.OperationLogModule;
import io.metersphere.system.log.constants.OperationLogType;
import io.metersphere.system.log.dto.LogDTO;
import io.metersphere.system.log.service.OperationLogService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.List;
@Service
@Transactional(rollbackFor = Exception.class)
public class FunctionalCaseModuleLogService {
private static final String FUNCTIONAL_CASE_MODULE = "/functional/case/module";
private static final String ADD = FUNCTIONAL_CASE_MODULE + "/add";
private static final String UPDATE = FUNCTIONAL_CASE_MODULE + "/update";
@Resource
private ProjectMapper projectMapper;
@Resource
private OperationLogService operationLogService;
/**
* 功能用例添加模块日志
*
* @param functionalCaseModule
* @param userId
*/
public void addModuleLog(FunctionalCaseModule functionalCaseModule, String userId) {
Project project = projectMapper.selectByPrimaryKey(functionalCaseModule.getProjectId());
LogDTO dto = LogDTOBuilder.builder()
.projectId(functionalCaseModule.getProjectId())
.organizationId(project.getOrganizationId())
.type(OperationLogType.ADD.name())
.module(OperationLogModule.CASE_MANAGEMENT_CASE_MODULE)
.method(HttpMethodConstants.POST.name())
.path(ADD)
.sourceId(functionalCaseModule.getId())
.content(functionalCaseModule.getName())
.originalValue(JSON.toJSONBytes(functionalCaseModule))
.createUser(userId)
.build().getLogDTO();
operationLogService.add(dto);
}
/**
* 功能用例更新模块日志
*
* @param module
* @param operator
*/
public void updateModuleLog(FunctionalCaseModule module, String operator) {
Project project = projectMapper.selectByPrimaryKey(module.getProjectId());
LogDTO dto = LogDTOBuilder.builder()
.projectId(project.getId())
.organizationId(project.getOrganizationId())
.type(OperationLogType.UPDATE.name())
.module(OperationLogModule.CASE_MANAGEMENT_CASE_MODULE)
.method(HttpMethodConstants.POST.name())
.path(UPDATE)
.sourceId(module.getId())
.content(module.getName())
.originalValue(JSON.toJSONBytes(module))
.createUser(operator)
.build().getLogDTO();
operationLogService.add(dto);
}
/**
* 功能用例模块删除日志
*
* @param functionalCases
* @param projectId
*/
public void batchDelLog(List<FunctionalCase> functionalCases, String projectId, String userId, String path) {
Project project = projectMapper.selectByPrimaryKey(projectId);
List<LogDTO> dtoList = new ArrayList<>();
functionalCases.forEach(item -> {
LogDTO dto = new LogDTO(
projectId,
project.getOrganizationId(),
item.getId(),
userId,
OperationLogType.DELETE.name(),
OperationLogModule.CASE_MANAGEMENT_CASE_MODULE,
item.getName());
dto.setPath(path);
dto.setMethod(HttpMethodConstants.GET.name());
dto.setOriginalValue(JSON.toJSONBytes(item));
dtoList.add(dto);
});
operationLogService.batchAdd(dtoList);
}
}

View File

@ -7,7 +7,10 @@
package io.metersphere.functional.service; package io.metersphere.functional.service;
import io.metersphere.functional.domain.*; import io.metersphere.functional.domain.FunctionalCase;
import io.metersphere.functional.domain.FunctionalCaseExample;
import io.metersphere.functional.domain.FunctionalCaseModule;
import io.metersphere.functional.domain.FunctionalCaseModuleExample;
import io.metersphere.functional.mapper.ExtFunctionalCaseMapper; import io.metersphere.functional.mapper.ExtFunctionalCaseMapper;
import io.metersphere.functional.mapper.ExtFunctionalCaseModuleMapper; import io.metersphere.functional.mapper.ExtFunctionalCaseModuleMapper;
import io.metersphere.functional.mapper.FunctionalCaseMapper; import io.metersphere.functional.mapper.FunctionalCaseMapper;
@ -17,18 +20,12 @@ import io.metersphere.functional.request.FunctionalCaseModuleUpdateRequest;
import io.metersphere.project.dto.ModuleCountDTO; import io.metersphere.project.dto.ModuleCountDTO;
import io.metersphere.project.dto.NodeSortDTO; import io.metersphere.project.dto.NodeSortDTO;
import io.metersphere.project.service.ModuleTreeService; import io.metersphere.project.service.ModuleTreeService;
import io.metersphere.sdk.constants.HttpMethodConstants;
import io.metersphere.sdk.constants.ModuleConstants; import io.metersphere.sdk.constants.ModuleConstants;
import io.metersphere.sdk.exception.MSException; import io.metersphere.sdk.exception.MSException;
import io.metersphere.sdk.util.JSON;
import io.metersphere.sdk.util.Translator; import io.metersphere.sdk.util.Translator;
import io.metersphere.system.domain.User; import io.metersphere.system.domain.User;
import io.metersphere.system.dto.sdk.BaseTreeNode; import io.metersphere.system.dto.sdk.BaseTreeNode;
import io.metersphere.system.dto.sdk.request.NodeMoveRequest; import io.metersphere.system.dto.sdk.request.NodeMoveRequest;
import io.metersphere.system.log.constants.OperationLogModule;
import io.metersphere.system.log.constants.OperationLogType;
import io.metersphere.system.log.dto.LogDTO;
import io.metersphere.system.log.service.OperationLogService;
import io.metersphere.system.mapper.UserMapper; import io.metersphere.system.mapper.UserMapper;
import io.metersphere.system.notice.constants.NoticeConstants; import io.metersphere.system.notice.constants.NoticeConstants;
import io.metersphere.system.uid.IDGenerator; import io.metersphere.system.uid.IDGenerator;
@ -60,11 +57,11 @@ public class FunctionalCaseModuleService extends ModuleTreeService {
@Resource @Resource
private FunctionalCaseMapper functionalCaseMapper; private FunctionalCaseMapper functionalCaseMapper;
@Resource @Resource
private OperationLogService operationLogService;
@Resource
private UserMapper userMapper; private UserMapper userMapper;
@Resource @Resource
private FunctionalCaseNoticeService functionalCaseNoticeService; private FunctionalCaseNoticeService functionalCaseNoticeService;
@Resource
private FunctionalCaseModuleLogService functionalCaseModuleLogService;
public List<BaseTreeNode> getTree(String projectId) { public List<BaseTreeNode> getTree(String projectId) {
@ -85,6 +82,7 @@ public class FunctionalCaseModuleService extends ModuleTreeService {
functionalCaseModule.setCreateUser(userId); functionalCaseModule.setCreateUser(userId);
functionalCaseModule.setUpdateUser(userId); functionalCaseModule.setUpdateUser(userId);
functionalCaseModuleMapper.insert(functionalCaseModule); functionalCaseModuleMapper.insert(functionalCaseModule);
functionalCaseModuleLogService.addModuleLog(functionalCaseModule, userId);
return functionalCaseModule.getId(); return functionalCaseModule.getId();
} }
@ -100,6 +98,7 @@ public class FunctionalCaseModuleService extends ModuleTreeService {
updateModule.setCreateUser(null); updateModule.setCreateUser(null);
updateModule.setCreateTime(null); updateModule.setCreateTime(null);
functionalCaseModuleMapper.updateByPrimaryKeySelective(updateModule); functionalCaseModuleMapper.updateByPrimaryKeySelective(updateModule);
functionalCaseModuleLogService.updateModuleLog(updateModule, userId);
} }
public void moveNode(NodeMoveRequest request, String userId) { public void moveNode(NodeMoveRequest request, String userId) {
@ -129,33 +128,13 @@ public class FunctionalCaseModuleService extends ModuleTreeService {
FunctionalCaseModule deleteModule = functionalCaseModuleMapper.selectByPrimaryKey(moduleId); FunctionalCaseModule deleteModule = functionalCaseModuleMapper.selectByPrimaryKey(moduleId);
if (deleteModule != null) { if (deleteModule != null) {
List<FunctionalCase> functionalCases = this.deleteModuleByIds(Collections.singletonList(moduleId), new ArrayList<>(), userId); List<FunctionalCase> functionalCases = this.deleteModuleByIds(Collections.singletonList(moduleId), new ArrayList<>(), userId);
batchDelLog(functionalCases, deleteModule.getProjectId()); functionalCaseModuleLogService.batchDelLog(functionalCases, deleteModule.getProjectId(), userId, "/functional/case/module/delete/" + moduleId);
List<String> ids = functionalCases.stream().map(FunctionalCase::getId).toList(); List<String> ids = functionalCases.stream().map(FunctionalCase::getId).toList();
User user = userMapper.selectByPrimaryKey(userId); User user = userMapper.selectByPrimaryKey(userId);
functionalCaseNoticeService.batchSendNotice(deleteModule.getProjectId(), ids, user, NoticeConstants.Event.DELETE); functionalCaseNoticeService.batchSendNotice(deleteModule.getProjectId(), ids, user, NoticeConstants.Event.DELETE);
} }
} }
public void batchDelLog(List<FunctionalCase> functionalCases, String projectId) {
List<LogDTO> dtoList = new ArrayList<>();
functionalCases.forEach(item -> {
LogDTO dto = new LogDTO(
projectId,
"",
item.getId(),
item.getCreateUser(),
OperationLogType.DELETE.name(),
OperationLogModule.FUNCTIONAL_CASE,
item.getName());
dto.setPath("/functional/case/module/delete/");
dto.setMethod(HttpMethodConstants.GET.name());
dto.setOriginalValue(JSON.toJSONBytes(item));
dtoList.add(dto);
});
operationLogService.batchAdd(dtoList);
}
public List<FunctionalCase> deleteModuleByIds(List<String> deleteIds, List<FunctionalCase> functionalCases, String userId) { public List<FunctionalCase> deleteModuleByIds(List<String> deleteIds, List<FunctionalCase> functionalCases, String userId) {
if (CollectionUtils.isEmpty(deleteIds)) { if (CollectionUtils.isEmpty(deleteIds)) {
return functionalCases; return functionalCases;

View File

@ -205,7 +205,7 @@ public class FunctionalCaseService {
//记录日志 //记录日志
FunctionalCaseHistoryLogDTO historyLogDTO = getAddLogModule(functionalCase); FunctionalCaseHistoryLogDTO historyLogDTO = getAddLogModule(functionalCase);
saveAddDataLog(functionalCase, new FunctionalCaseHistoryLogDTO(), historyLogDTO, userId, organizationId, OperationLogType.ADD.name(), OperationLogModule.FUNCTIONAL_CASE); saveAddDataLog(functionalCase, new FunctionalCaseHistoryLogDTO(), historyLogDTO, userId, organizationId, OperationLogType.ADD.name(), OperationLogModule.CASE_MANAGEMENT_CASE_CASE);
return functionalCase; return functionalCase;
} }
@ -459,7 +459,7 @@ public class FunctionalCaseService {
//获取变更历史数量数量 //获取变更历史数量数量
OperationHistoryExample operationHistoryExample = new OperationHistoryExample(); OperationHistoryExample operationHistoryExample = new OperationHistoryExample();
List<String> types = List.of(OperationLogType.ADD.name(), OperationLogType.IMPORT.name(), OperationLogType.UPDATE.name()); List<String> types = List.of(OperationLogType.ADD.name(), OperationLogType.IMPORT.name(), OperationLogType.UPDATE.name());
operationHistoryExample.createCriteria().andSourceIdEqualTo(functionalCaseDetailDTO.getId()).andModuleEqualTo(OperationLogModule.FUNCTIONAL_CASE).andTypeIn(types); operationHistoryExample.createCriteria().andSourceIdEqualTo(functionalCaseDetailDTO.getId()).andModuleEqualTo(OperationLogModule.CASE_MANAGEMENT_CASE_CASE).andTypeIn(types);
functionalCaseDetailDTO.setHistoryCount((int) operationHistoryMapper.countByExample(operationHistoryExample)); functionalCaseDetailDTO.setHistoryCount((int) operationHistoryMapper.countByExample(operationHistoryExample));
} }
@ -927,7 +927,7 @@ public class FunctionalCaseService {
functionalCaseAttachmentService.association(entry.getValue(), entry.getKey(), userId, FUNCTIONAL_CASE_BATCH_COPY_FILE_LOG_URL, request.getProjectId()); functionalCaseAttachmentService.association(entry.getValue(), entry.getKey(), userId, FUNCTIONAL_CASE_BATCH_COPY_FILE_LOG_URL, request.getProjectId());
}); });
addLogMap.entrySet().forEach(entry -> { addLogMap.entrySet().forEach(entry -> {
saveAddDataLog(entry.getKey(), new FunctionalCaseHistoryLogDTO(), entry.getValue(), userId, organizationId, OperationLogType.ADD.name(), OperationLogModule.FUNCTIONAL_CASE); saveAddDataLog(entry.getKey(), new FunctionalCaseHistoryLogDTO(), entry.getValue(), userId, organizationId, OperationLogType.ADD.name(), OperationLogModule.CASE_MANAGEMENT_CASE_CASE);
}); });
User user = userMapper.selectByPrimaryKey(userId); User user = userMapper.selectByPrimaryKey(userId);
@ -1128,7 +1128,7 @@ public class FunctionalCaseService {
//新增用例记录日志 //新增用例记录日志
historyLogDTOS.forEach(historyLogDTO -> { historyLogDTOS.forEach(historyLogDTO -> {
batchSaveImportData(historyLogDTO, new FunctionalCaseHistoryLogDTO(), user, OperationLogType.IMPORT.name(), OperationLogModule.FUNCTIONAL_CASE, logDTOS); batchSaveImportData(historyLogDTO, new FunctionalCaseHistoryLogDTO(), user, OperationLogType.IMPORT.name(), OperationLogModule.CASE_MANAGEMENT_CASE_CASE, logDTOS);
}); });
operationLogService.batchAdd(logDTOS); operationLogService.batchAdd(logDTOS);
@ -1372,7 +1372,7 @@ public class FunctionalCaseService {
FunctionalCase oldCase = collect.get(newData.getFunctionalCase().getId()).getFirst(); FunctionalCase oldCase = collect.get(newData.getFunctionalCase().getId()).getFirst();
FunctionalCaseBlob oldBlod = blobsCollect.get(newData.getFunctionalCase().getId()).getFirst(); FunctionalCaseBlob oldBlod = blobsCollect.get(newData.getFunctionalCase().getId()).getFirst();
List<FunctionalCaseCustomField> oldCustomFields = customFieldMap.get(newData.getFunctionalCase().getId()); List<FunctionalCaseCustomField> oldCustomFields = customFieldMap.get(newData.getFunctionalCase().getId());
batchSaveImportData(newData, new FunctionalCaseHistoryLogDTO(oldCase, oldBlod, oldCustomFields, new ArrayList<>(), new ArrayList<>()), user, OperationLogType.IMPORT.name(), OperationLogModule.FUNCTIONAL_CASE, logDTOS); batchSaveImportData(newData, new FunctionalCaseHistoryLogDTO(oldCase, oldBlod, oldCustomFields, new ArrayList<>(), new ArrayList<>()), user, OperationLogType.IMPORT.name(), OperationLogModule.CASE_MANAGEMENT_CASE_CASE, logDTOS);
} }
/** /**

View File

@ -19,7 +19,6 @@ import io.metersphere.system.base.BaseTest;
import io.metersphere.system.controller.handler.ResultHolder; import io.metersphere.system.controller.handler.ResultHolder;
import io.metersphere.system.dto.sdk.BaseTreeNode; import io.metersphere.system.dto.sdk.BaseTreeNode;
import io.metersphere.system.dto.sdk.request.NodeMoveRequest; import io.metersphere.system.dto.sdk.request.NodeMoveRequest;
import io.metersphere.system.log.constants.OperationLogType;
import io.metersphere.system.uid.IDGenerator; import io.metersphere.system.uid.IDGenerator;
import jakarta.annotation.Resource; import jakarta.annotation.Resource;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
@ -704,8 +703,6 @@ public class FunctionalCaseModuleControllerTests extends BaseTest {
//service层判断测试删除空集合 //service层判断测试删除空集合
functionalCaseModuleService.deleteModuleByIds(new ArrayList<>(), new ArrayList<>(), "admin"); functionalCaseModuleService.deleteModuleByIds(new ArrayList<>(), new ArrayList<>(), "admin");
checkLog(functionalCase.getId(), OperationLogType.DELETE, URL_MODULE_TREE_DELETE);
} }

View File

@ -136,7 +136,12 @@ public class OperationLogModule {
public static final String FUNCTIONAL_CASE = "CASE_MANAGEMENT_CASE"; public static final String FUNCTIONAL_CASE = "CASE_MANAGEMENT_CASE";
public static final String CASE_MANAGEMENT_CASE_CREATE = "CASE_MANAGEMENT_CASE_CREATE"; public static final String CASE_MANAGEMENT_CASE_CREATE = "CASE_MANAGEMENT_CASE_CREATE";
public static final String CASE_MANAGEMENT_CASE_UPDATE = "CASE_MANAGEMENT_CASE_UPDATE"; public static final String CASE_MANAGEMENT_CASE_UPDATE = "CASE_MANAGEMENT_CASE_UPDATE";
//功能用例-回收站
public static final String CASE_MANAGEMENT_CASE_RECYCLE = "CASE_MANAGEMENT_CASE_RECYCLE"; public static final String CASE_MANAGEMENT_CASE_RECYCLE = "CASE_MANAGEMENT_CASE_RECYCLE";
//功能用例-模块
public static final String CASE_MANAGEMENT_CASE_MODULE = "CASE_MANAGEMENT_CASE_MODULE";
//功能用例-用例
public static final String CASE_MANAGEMENT_CASE_CASE = "CASE_MANAGEMENT_CASE_CASE";
public static final String CASE_REVIEW = "CASE_MANAGEMENT_REVIEW"; public static final String CASE_REVIEW = "CASE_MANAGEMENT_REVIEW";