feat(项目设置): 删除及更新缺陷模板未插入操作日志的问题

--bug=1015966 --user=宋昌昌 【项目设置】删除/更新缺陷模版,操作日志没有记录 https://www.tapd.cn/55049933/s/1227059
This commit is contained in:
song-cc-rock 2022-08-18 18:47:34 +08:00 committed by 刘瑞斌
parent ee740ad063
commit 740d562b7e
2 changed files with 15 additions and 3 deletions

View File

@ -40,13 +40,13 @@ public class IssueTemplateController {
}
@GetMapping("/delete/{id}")
@MsAuditLog(module = OperLogModule.WORKSPACE_TEMPLATE_SETTINGS_ISSUE, type = OperLogConstants.DELETE, beforeEvent = "#msClass.getLogDetails(#id)", msClass = IssueTemplateService.class)
@MsAuditLog(module = OperLogModule.PROJECT_TEMPLATE_MANAGEMENT, type = OperLogConstants.DELETE, beforeEvent = "#msClass.getLogDetails(#id)", msClass = IssueTemplateService.class)
public void delete(@PathVariable(value = "id") String id) {
issueTemplateService.delete(id);
}
@PostMapping("/update")
@MsAuditLog(module = OperLogModule.WORKSPACE_TEMPLATE_SETTINGS_ISSUE, type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails(#request.id,#request.customFields)", content = "#msClass.getLogDetails(#request)", msClass = IssueTemplateService.class)
@MsAuditLog(module = OperLogModule.PROJECT_TEMPLATE_MANAGEMENT, type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails(#request.id, #request.customFields)", content = "#msClass.getLogDetails(#request)", msClass = IssueTemplateService.class)
public void update(@RequestBody UpdateIssueTemplateRequest request) {
issueTemplateService.update(request);
}

View File

@ -510,7 +510,7 @@ public class IssueTemplateService extends TemplateBaseService {
}
List<DetailColumn> columnIssues = ReflexObjectUtil.getColumns(templateWithBLOBs, SystemReference.issueFieldColumns);
columns.addAll(columnIssues);
OperatingLogDetails details = new OperatingLogDetails(JSON.toJSONString(templateWithBLOBs.getId()), null, templateWithBLOBs.getName(), templateWithBLOBs.getCreateUser(), columns);
OperatingLogDetails details = new OperatingLogDetails(JSON.toJSONString(templateWithBLOBs.getId()), templateWithBLOBs.getProjectId(), templateWithBLOBs.getName(), templateWithBLOBs.getCreateUser(), columns);
return JSON.toJSONString(details);
}
@ -535,4 +535,16 @@ public class IssueTemplateService extends TemplateBaseService {
OperatingLogDetails details = new OperatingLogDetails(targetProjectId, targetProjectId, targetProjectName, null, null);
return JSON.toJSONString(details);
}
public String getLogDetails(String issueTemplateId) {
if (StringUtils.isEmpty(issueTemplateId)) {
return null;
}
IssueTemplate issueTemplate = issueTemplateMapper.selectByPrimaryKey(issueTemplateId);
if (issueTemplate == null) {
return null;
}
OperatingLogDetails details = new OperatingLogDetails(issueTemplateId, issueTemplate.getProjectId(), issueTemplate.getName(), issueTemplate.getCreateUser(), null);
return JSON.toJSONString(details);
}
}