|
|
@ -50,7 +50,7 @@ public class SysLogAspect { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
@Autowired |
|
|
|
private SysLogQueue sysLogQueue; |
|
|
|
private SysLogQueue sysLogQueue; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 请求地址 |
|
|
|
* 请求地址 |
|
|
@ -75,6 +75,17 @@ public class SysLogAspect { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
|
|
|
|
* 开始时间 |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
private Long startTime = 0L; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 结束时间 |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
private Long endTime = 0L; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* 设置操作日志切入点 在注解的位置切入代码 |
|
|
|
* 设置操作日志切入点 在注解的位置切入代码 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@Pointcut("@annotation(com.hnac.hzims.common.logs.annotation.OperationAnnotation)") |
|
|
|
@Pointcut("@annotation(com.hnac.hzims.common.logs.annotation.OperationAnnotation)") |
|
|
@ -87,7 +98,10 @@ public class SysLogAspect { |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@Before(value = "logPointCut()") |
|
|
|
@Before(value = "logPointCut()") |
|
|
|
public void before(JoinPoint joinPoint) { |
|
|
|
public void before(JoinPoint joinPoint) { |
|
|
|
stopWatch.start(); |
|
|
|
// if (!stopWatch.isRunning()) {
|
|
|
|
|
|
|
|
// stopWatch.start();
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
startTime = System.currentTimeMillis(); |
|
|
|
log.info("前置通知"); |
|
|
|
log.info("前置通知"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -224,8 +238,11 @@ public class SysLogAspect { |
|
|
|
sysLog.setOperationUserId(userId); |
|
|
|
sysLog.setOperationUserId(userId); |
|
|
|
sysLog.setTenantId(Func.toStr(AuthUtil.getTenantId(), BladeConstant.ADMIN_TENANT_ID)); |
|
|
|
sysLog.setTenantId(Func.toStr(AuthUtil.getTenantId(), BladeConstant.ADMIN_TENANT_ID)); |
|
|
|
sysLog.setLocalIp(WebUtil.getIP(request));// 请求IP
|
|
|
|
sysLog.setLocalIp(WebUtil.getIP(request));// 请求IP
|
|
|
|
stopWatch.stop(); |
|
|
|
// if (stopWatch.isRunning()) {
|
|
|
|
sysLog.setCostTime(stopWatch.getTotalTimeMillis() + "ms"); |
|
|
|
// stopWatch.stop();
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
endTime = System.currentTimeMillis(); |
|
|
|
|
|
|
|
sysLog.setCostTime((endTime - startTime) + "ms"); |
|
|
|
sysLog.setPath(requestPath); |
|
|
|
sysLog.setPath(requestPath); |
|
|
|
sysLog.setTitle(title); |
|
|
|
sysLog.setTitle(title); |
|
|
|
sysLog.setAction(action); |
|
|
|
sysLog.setAction(action); |
|
|
|