fix(测试用例): 用例模块操作&脑图操作模块日志
--bug=1048748 --user=王旭 【测试用例】用例-模块树-模块下无用例时-删除模块,未生成日志 https://www.tapd.cn/55049933/s/1609868 --bug=1048745 --user=王旭 【测试用例】用例-脑图模块-脑图模式下创建/更新/删除模块-未生成日志 https://www.tapd.cn/55049933/s/1609869
This commit is contained in:
parent
1f46ee6b9a
commit
60da55b95e
|
@ -878,6 +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());
|
||||
}
|
||||
//处理更新(更新的情况是可能换数据本身,可能换父节点,可能换顺序)
|
||||
List<FunctionalCaseModuleEditRequest> updateList = resourceMap.get(OperationLogType.UPDATE.toString());
|
||||
|
@ -900,6 +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());
|
||||
}
|
||||
}
|
||||
setDTOTargetMap(functionalMinderUpdateDTO, sourceIdAndTargetIdsMap);
|
||||
|
@ -1236,6 +1238,12 @@ public class FunctionalCaseMinderService {
|
|||
if (moduleIds.contains("root")) {
|
||||
throw new MSException(Translator.get("functional_case.module.default.name.cut_error"));
|
||||
}
|
||||
//模块日志
|
||||
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());
|
||||
|
||||
List<FunctionalCase> functionalCases = functionalCaseModuleService.deleteModuleByIds(moduleIds, new ArrayList<>(), user.getId());
|
||||
functionalCaseModuleLogService.batchDelLog(functionalCases, request.getProjectId(), user.getId(), "/functional/mind/case/edit");
|
||||
List<String> finalCaseIds = caseIds;
|
||||
|
|
|
@ -78,7 +78,7 @@ public class FunctionalCaseModuleLogService {
|
|||
|
||||
|
||||
/**
|
||||
* 功能用例模块删除日志
|
||||
* 功能用例用例删除日志
|
||||
*
|
||||
* @param functionalCases
|
||||
* @param projectId
|
||||
|
@ -93,7 +93,7 @@ public class FunctionalCaseModuleLogService {
|
|||
item.getId(),
|
||||
userId,
|
||||
OperationLogType.DELETE.name(),
|
||||
OperationLogModule.CASE_MANAGEMENT_CASE_MODULE,
|
||||
OperationLogModule.CASE_MANAGEMENT_CASE_CASE,
|
||||
item.getName());
|
||||
dto.setPath(path);
|
||||
dto.setMethod(HttpMethodConstants.GET.name());
|
||||
|
@ -104,4 +104,30 @@ public class FunctionalCaseModuleLogService {
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* 功能用例模块删除日志
|
||||
* @param deleteModule
|
||||
* @param projectId
|
||||
* @param userId
|
||||
* @param path
|
||||
*/
|
||||
public void handleModuleLog(List<FunctionalCaseModule> deleteModule, String projectId, String userId, String path, String type) {
|
||||
Project project = projectMapper.selectByPrimaryKey(projectId);
|
||||
List<LogDTO> dtoList = new ArrayList<>();
|
||||
deleteModule.forEach(item -> {
|
||||
LogDTO dto = new LogDTO(
|
||||
projectId,
|
||||
project.getOrganizationId(),
|
||||
item.getId(),
|
||||
userId,
|
||||
type,
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@ import io.metersphere.sdk.util.Translator;
|
|||
import io.metersphere.system.domain.User;
|
||||
import io.metersphere.system.dto.sdk.BaseTreeNode;
|
||||
import io.metersphere.system.dto.sdk.request.NodeMoveRequest;
|
||||
import io.metersphere.system.log.constants.OperationLogType;
|
||||
import io.metersphere.system.mapper.UserMapper;
|
||||
import io.metersphere.system.notice.constants.NoticeConstants;
|
||||
import io.metersphere.system.uid.IDGenerator;
|
||||
|
@ -128,7 +129,10 @@ public class FunctionalCaseModuleService extends ModuleTreeService {
|
|||
FunctionalCaseModule deleteModule = functionalCaseModuleMapper.selectByPrimaryKey(moduleId);
|
||||
if (deleteModule != null) {
|
||||
List<FunctionalCase> functionalCases = this.deleteModuleByIds(Collections.singletonList(moduleId), new ArrayList<>(), userId);
|
||||
//用例日志
|
||||
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());
|
||||
List<String> ids = functionalCases.stream().map(FunctionalCase::getId).toList();
|
||||
User user = userMapper.selectByPrimaryKey(userId);
|
||||
functionalCaseNoticeService.batchSendNotice(deleteModule.getProjectId(), ids, user, NoticeConstants.Event.DELETE);
|
||||
|
|
Loading…
Reference in New Issue