fix(操作日志):优化消息对比内容问题 #1005218

--bug=1005218 --user=赵勇 【系统设置-操作日志】... https://www.tapd.cn/55049933/s/1025939
This commit is contained in:
fit2-zhao 2021-07-19 19:13:21 +08:00 committed by fit2-zhao
parent 6a7055e9cd
commit b815b251f1
2 changed files with 16 additions and 7 deletions

View File

@ -16,7 +16,7 @@ public class NoticeController {
private NoticeService noticeService;
@PostMapping("save/message/task")
@MsAuditLog(module = "organization_message_settings", type = OperLogConstants.UPDATE, content = "#msClass.getLogDetails(#messageDetail.id)", msClass = NoticeService.class)
@MsAuditLog(module = "organization_message_settings", type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails(#messageDetail.id)", content = "#msClass.getLogDetails(#messageDetail.id)", msClass = NoticeService.class)
public void saveMessage(@RequestBody MessageDetail messageDetail) {
noticeService.saveMessageTask(messageDetail);
}

View File

@ -216,12 +216,21 @@ public class NoticeService {
public String getLogDetails(String id) {
MessageTask task = messageTaskMapper.selectByPrimaryKey(id);
if (task == null) {
MessageTaskExample example = new MessageTaskExample();
example.createCriteria().andIdentificationEqualTo(id);
List<MessageTask> tasks = messageTaskMapper.selectByExample(example);
List<String> names = tasks.stream().map(MessageTask::getType).collect(Collectors.toList());
OperatingLogDetails details = new OperatingLogDetails(JSON.toJSONString(id), null, String.join(",", names), null, new LinkedList<>());
return JSON.toJSONString(details);
try {
MessageTaskExample example = new MessageTaskExample();
example.createCriteria().andIdentificationEqualTo(id);
List<MessageTask> tasks = messageTaskMapper.selectByExample(example);
List<String> names = tasks.stream().map(MessageTask::getType).collect(Collectors.toList());
OperatingLogDetails details = new OperatingLogDetails(JSON.toJSONString(id), null, String.join(",", names), null, new LinkedList<>());
return JSON.toJSONString(details);
} catch (Exception e) {
task = new MessageTask();
List<DetailColumn> columns = ReflexObjectUtil.getColumns(task, SystemReference.messageColumns);
OperatingLogDetails details = new OperatingLogDetails(JSON.toJSONString(task.getId()), null,
StatusReference.statusMap.containsKey(task.getTaskType()) ? StatusReference.statusMap.get(task.getTaskType()) : task.getTaskType(), task.getUserId(), columns);
return JSON.toJSONString(details);
}
}
if (task != null) {
List<DetailColumn> columns = ReflexObjectUtil.getColumns(task, SystemReference.messageColumns);