|
@ -14,6 +14,7 @@ import org.aspectj.lang.ProceedingJoinPoint; |
|
|
import org.aspectj.lang.annotation.Around; |
|
|
import org.aspectj.lang.annotation.Around; |
|
|
import org.aspectj.lang.annotation.Aspect; |
|
|
import org.aspectj.lang.annotation.Aspect; |
|
|
import org.aspectj.lang.annotation.Pointcut; |
|
|
import org.aspectj.lang.annotation.Pointcut; |
|
|
|
|
|
import org.aspectj.lang.reflect.MethodSignature; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.core.annotation.Order; |
|
|
import org.springframework.core.annotation.Order; |
|
|
import org.springframework.stereotype.Component; |
|
|
import org.springframework.stereotype.Component; |
|
@ -96,14 +97,10 @@ public class LogAspect { |
|
|
//参数
|
|
|
//参数
|
|
|
Object[] args = pjp.getArgs(); |
|
|
Object[] args = pjp.getArgs(); |
|
|
StringBuilder param = new StringBuilder(); |
|
|
StringBuilder param = new StringBuilder(); |
|
|
//方法注解
|
|
|
|
|
|
|
|
|
|
|
|
Class<?>[] argTypes = new Class[args.length]; |
|
|
|
|
|
for (int i = 0; i < args.length; i++) { |
|
|
for (int i = 0; i < args.length; i++) { |
|
|
//参数类型
|
|
|
if (args[i] == null) { |
|
|
argTypes[i] = args[i].getClass(); |
|
|
continue; |
|
|
//参数值
|
|
|
}else if (args[i] instanceof ServletResponse) { |
|
|
if (args[i] instanceof ServletResponse) { |
|
|
|
|
|
continue; |
|
|
continue; |
|
|
} else if (args[i] instanceof ServletRequest) { |
|
|
} else if (args[i] instanceof ServletRequest) { |
|
|
Object claims = request.getAttribute(WebConstant.REQUEST_KEY_CLAIMS); |
|
|
Object claims = request.getAttribute(WebConstant.REQUEST_KEY_CLAIMS); |
|
@ -111,6 +108,7 @@ public class LogAspect { |
|
|
if (userId != null) { |
|
|
if (userId != null) { |
|
|
param.append("userId:").append(userId).append("--"); |
|
|
param.append("userId:").append(userId).append("--"); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} else if (args[i] instanceof Part) { |
|
|
} else if (args[i] instanceof Part) { |
|
|
param.append("file:").append(UploadFileUtil_Servlet3.getFileNameByPart((Part)args[i])).append("--"); |
|
|
param.append("file:").append(UploadFileUtil_Servlet3.getFileNameByPart((Part)args[i])).append("--"); |
|
|
}else { |
|
|
}else { |
|
@ -120,7 +118,8 @@ public class LogAspect { |
|
|
} |
|
|
} |
|
|
dto.setParams(param.length() > 1000 ? param.substring(0, 1000) : param.toString()); |
|
|
dto.setParams(param.length() > 1000 ? param.substring(0, 1000) : param.toString()); |
|
|
try { |
|
|
try { |
|
|
Method method = pjp.getTarget().getClass().getMethod(pjp.getSignature().getName(), argTypes); |
|
|
MethodSignature methodSignature = (MethodSignature) pjp.getSignature(); |
|
|
|
|
|
Method method = pjp.getTarget().getClass().getMethod(methodSignature.getName(), methodSignature.getParameterTypes()); |
|
|
ApiOperation annotation = method.getAnnotation(ApiOperation.class); |
|
|
ApiOperation annotation = method.getAnnotation(ApiOperation.class); |
|
|
dto.setMethodDesc(annotation == null ? "" : annotation.value()); |
|
|
dto.setMethodDesc(annotation == null ? "" : annotation.value()); |
|
|
} catch (Exception e) { |
|
|
} catch (Exception e) { |
|
|