|
@@ -2,7 +2,6 @@ package com.ydtech.aop;
|
|
|
|
|
|
|
|
import cn.dev33.satoken.stp.StpUtil;
|
|
import cn.dev33.satoken.stp.StpUtil;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSON;
|
|
|
-import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
import com.ydtech.core.page.HttpResult;
|
|
import com.ydtech.core.page.HttpResult;
|
|
|
import com.ydtech.modules.admin.model.SysLog;
|
|
import com.ydtech.modules.admin.model.SysLog;
|
|
|
import com.ydtech.modules.admin.service.SysLogService;
|
|
import com.ydtech.modules.admin.service.SysLogService;
|
|
@@ -37,7 +36,8 @@ public class LogAspect {
|
|
|
private SysLogService sysLogService;
|
|
private SysLogService sysLogService;
|
|
|
|
|
|
|
|
|
|
|
|
|
- @Pointcut("execution(public * com.ydtech.modules.*.controller.*.*(..)) ")
|
|
|
|
|
|
|
+ @Pointcut("@within(org.springframework.stereotype.Controller) || " +
|
|
|
|
|
+ "@within(org.springframework.web.bind.annotation.RestController)")
|
|
|
public void log() {
|
|
public void log() {
|
|
|
|
|
|
|
|
}
|
|
}
|
|
@@ -50,7 +50,8 @@ public class LogAspect {
|
|
|
String userId = StpUtil.getLoginId("").toString();
|
|
String userId = StpUtil.getLoginId("").toString();
|
|
|
//请求人 url method ip class_method
|
|
//请求人 url method ip class_method
|
|
|
SysLog sysLog = new SysLog(userId, request.getRequestURL().toString(), request.getMethod(),
|
|
SysLog sysLog = new SysLog(userId, request.getRequestURL().toString(), request.getMethod(),
|
|
|
- joinPoint.getSignature().getDeclaringTypeName(), joinPoint.getSignature().getName(), request.getRemoteAddr(), new Date());
|
|
|
|
|
|
|
+ joinPoint.getSignature().getDeclaringTypeName(), joinPoint.getSignature()
|
|
|
|
|
+ .getName(), request.getRemoteAddr(), new Date());
|
|
|
|
|
|
|
|
try {
|
|
try {
|
|
|
//获取注解注释
|
|
//获取注解注释
|
|
@@ -60,7 +61,9 @@ public class LogAspect {
|
|
|
//获取请求参数
|
|
//获取请求参数
|
|
|
Object[] args = joinPoint.getArgs();
|
|
Object[] args = joinPoint.getArgs();
|
|
|
for (Object obj : args) {
|
|
for (Object obj : args) {
|
|
|
- if (null != obj && (obj.getClass().getName().startsWith("com.ydtech.modules") || obj instanceof String)) {
|
|
|
|
|
|
|
+ if (null != obj && (obj.getClass()
|
|
|
|
|
+ .getName()
|
|
|
|
|
+ .startsWith("com.ydtech.modules") || obj instanceof String)) {
|
|
|
sysLog.setParams(JSON.toJSON(obj).toString());
|
|
sysLog.setParams(JSON.toJSON(obj).toString());
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|