提交 e6ca8750 作者: 张开石

1、修改操作日志切面类

父级 6bec2b7a
...@@ -7,11 +7,14 @@ import com.cmeeting.pojo.OperationLog; ...@@ -7,11 +7,14 @@ import com.cmeeting.pojo.OperationLog;
import com.cmeeting.service.OperationLogService; import com.cmeeting.service.OperationLogService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.JoinPoint; import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before; import org.aspectj.lang.annotation.Before;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.Date;
@Aspect @Aspect
@Slf4j @Slf4j
...@@ -21,9 +24,11 @@ public class OperLogAspect { ...@@ -21,9 +24,11 @@ public class OperLogAspect {
@Autowired @Autowired
private OperationLogService operationLogService; private OperationLogService operationLogService;
@Before(value = "@annotation(operLog)") @After(value = "@annotation(operLog)")
public void before(JoinPoint point, OperLog operLog) { public void after(JoinPoint point, OperLog operLog) {
new Thread(() -> {
Date now = new Date();
RobotSecurityUser user = SecurityUtil.getUser(); RobotSecurityUser user = SecurityUtil.getUser();
String location = operLog.location(); String location = operLog.location();
...@@ -34,7 +39,9 @@ public class OperLogAspect { ...@@ -34,7 +39,9 @@ public class OperLogAspect {
operationLog.setOperation(operation); operationLog.setOperation(operation);
operationLog.setUserId(user.getId()); operationLog.setUserId(user.getId());
operationLog.setUserName(user.getUsername()); operationLog.setUserName(user.getUsername());
operationLog.setCreateTime(now);
operationLogService.save(operationLog); operationLogService.save(operationLog);
}).start();
} }
} }
...@@ -22,7 +22,7 @@ public class OperationLog { ...@@ -22,7 +22,7 @@ public class OperationLog {
* *
*/ */
@TableId(type = IdType.AUTO) @TableId(type = IdType.AUTO)
private String id; private Integer id;
/** /**
* 用户名 * 用户名
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论