refactor(缺陷管理): 优化缺陷相关的日志

This commit is contained in:
song-cc-rock 2024-03-18 20:42:33 +08:00 committed by 刘瑞斌
parent 64edda812a
commit 393bcabc3e
1 changed files with 6 additions and 5 deletions

View File

@ -396,7 +396,7 @@ public class BugService {
List<String> batchIds = getBatchIdsByRequest(request);
batchIds.forEach(id -> delete(id, currentUser));
// 批量日志
List<LogDTO> logs = getBatchLogByRequest(batchIds, OperationLogType.DELETE.name(), "/bug/batch-delete", request.getProjectId(), false, false, null, currentUser);
List<LogDTO> logs = getBatchLogByRequest(batchIds, OperationLogType.DELETE.name(), OperationLogModule.BUG_MANAGEMENT_INDEX, "/bug/batch-delete", request.getProjectId(), false, false, null, currentUser);
operationLogService.batchAdd(logs);
}
@ -408,7 +408,7 @@ public class BugService {
List<String> batchIds = getBatchIdsByRequest(request);
batchIds.forEach(this::recover);
// 批量日志
List<LogDTO> logs = getBatchLogByRequest(batchIds, OperationLogType.RECOVER.name(), "/bug/batch-recover", request.getProjectId(), false, false, null, currentUser);
List<LogDTO> logs = getBatchLogByRequest(batchIds, OperationLogType.RECOVER.name(), OperationLogModule.BUG_MANAGEMENT_RECYCLE, "/bug/batch-recover", request.getProjectId(), false, false, null, currentUser);
operationLogService.batchAdd(logs);
}
@ -432,7 +432,7 @@ public class BugService {
List<String> batchIds = getBatchIdsByRequest(request);
// 批量日志{修改之前}
List<LogDTO> logs = getBatchLogByRequest(batchIds, OperationLogType.UPDATE.name(), "/bug/batch-update",
List<LogDTO> logs = getBatchLogByRequest(batchIds, OperationLogType.UPDATE.name(), OperationLogModule.BUG_MANAGEMENT_INDEX, "/bug/batch-update",
request.getProjectId(), true, request.isAppend(), request.getTags(), currentUser);
operationLogService.batchAdd(logs);
// 目前只做标签的批量编辑
@ -1574,11 +1574,12 @@ public class BugService {
* 根据批量操作参数获取批量日志
* @param batchIds 批量操作ID
* @param operationType 操作类型
* @param module 操作对象
* @param path 请求路径
* @param batchUpdate 是否批量更新
* @return 日志集合
*/
private List<LogDTO> getBatchLogByRequest(List<String> batchIds, String operationType, String path, String projectId, boolean batchUpdate,
private List<LogDTO> getBatchLogByRequest(List<String> batchIds, String operationType, String module, String path, String projectId, boolean batchUpdate,
boolean appendTag, List<String> modifiedTags, String currentUser) {
Project project = projectMapper.selectByPrimaryKey(projectId);
BugExample example = new BugExample();
@ -1586,7 +1587,7 @@ public class BugService {
List<Bug> bugs = bugMapper.selectByExample(example);
List<LogDTO> logs = new ArrayList<>();
bugs.forEach(bug -> {
LogDTO log = new LogDTO(bug.getProjectId(), project.getOrganizationId(), bug.getId(), currentUser, operationType, OperationLogModule.BUG_MANAGEMENT_INDEX, bug.getTitle());
LogDTO log = new LogDTO(bug.getProjectId(), project.getOrganizationId(), bug.getId(), currentUser, operationType, module, bug.getTitle());
log.setPath(path);
log.setMethod(HttpMethodConstants.POST.name());
if (batchUpdate) {