|
@@ -1,51 +1,51 @@
|
|
|
-package com.fdkankan.openApi.aop;
|
|
|
-
|
|
|
-import com.alibaba.fastjson.JSON;
|
|
|
-import lombok.extern.slf4j.Slf4j;
|
|
|
-import org.aspectj.lang.JoinPoint;
|
|
|
-import org.aspectj.lang.annotation.AfterReturning;
|
|
|
-import org.aspectj.lang.annotation.AfterThrowing;
|
|
|
-import org.aspectj.lang.annotation.Aspect;
|
|
|
-import org.springframework.stereotype.Component;
|
|
|
-import org.springframework.web.multipart.MultipartFile;
|
|
|
-
|
|
|
-import java.util.Arrays;
|
|
|
-import java.util.List;
|
|
|
-
|
|
|
-@Slf4j
|
|
|
-@Aspect
|
|
|
-@Component
|
|
|
-public class LogProxy {
|
|
|
-
|
|
|
- @AfterReturning(value = "execution(* com.fdkankan.openApi.controller.*.*.*(..))", returning = "result")
|
|
|
- public void afterMethod(JoinPoint point, Object result){
|
|
|
- String methodName = point.getSignature().getName();
|
|
|
- List<Object> args = (List<Object>) Arrays.asList(point.getArgs()).stream().filter(v -> {
|
|
|
- if(v instanceof MultipartFile){
|
|
|
- return false;
|
|
|
- }
|
|
|
- if(v instanceof String && ((String) v).startsWith("data:image/png;base64")){
|
|
|
- return false;
|
|
|
- }
|
|
|
- return true;
|
|
|
- });
|
|
|
- System.out.println("连接点方法为:" + methodName + ",参数为:" + JSON.toJSONString(args) + ",目标方法执行结果为:" + JSON.toJSONString(result));
|
|
|
- }
|
|
|
-
|
|
|
- @AfterThrowing(value = "execution(* com.fdkankan.openApi.controller.*.*.*(..))")
|
|
|
- public void afterThrowing(JoinPoint point){
|
|
|
- String methodName = point.getSignature().getName();
|
|
|
- List<Object> args = (List<Object>) Arrays.asList(point.getArgs()).stream().filter(v -> {
|
|
|
- if(v instanceof MultipartFile){
|
|
|
- return false;
|
|
|
- }
|
|
|
- if(v instanceof String && ((String) v).startsWith("data:image/png;base64")){
|
|
|
- return false;
|
|
|
- }
|
|
|
- return true;
|
|
|
- });
|
|
|
- System.out.println("连接点方法为:" + methodName + ",参数为:" + JSON.toJSONString(args));
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-}
|
|
|
+//package com.fdkankan.openApi.aop;
|
|
|
+//
|
|
|
+//import com.alibaba.fastjson.JSON;
|
|
|
+//import lombok.extern.slf4j.Slf4j;
|
|
|
+//import org.aspectj.lang.JoinPoint;
|
|
|
+//import org.aspectj.lang.annotation.AfterReturning;
|
|
|
+//import org.aspectj.lang.annotation.AfterThrowing;
|
|
|
+//import org.aspectj.lang.annotation.Aspect;
|
|
|
+//import org.springframework.stereotype.Component;
|
|
|
+//import org.springframework.web.multipart.MultipartFile;
|
|
|
+//
|
|
|
+//import java.util.Arrays;
|
|
|
+//import java.util.List;
|
|
|
+//
|
|
|
+//@Slf4j
|
|
|
+//@Aspect
|
|
|
+//@Component
|
|
|
+//public class LogProxy {
|
|
|
+//
|
|
|
+// @AfterReturning(value = "execution(* com.fdkankan.openApi.controller.*.*.*(..))", returning = "result")
|
|
|
+// public void afterMethod(JoinPoint point, Object result){
|
|
|
+// String methodName = point.getSignature().getName();
|
|
|
+// List<Object> args = (List<Object>) Arrays.asList(point.getArgs()).stream().filter(v -> {
|
|
|
+// if(v instanceof MultipartFile){
|
|
|
+// return false;
|
|
|
+// }
|
|
|
+// if(v instanceof String && ((String) v).startsWith("data:image/png;base64")){
|
|
|
+// return false;
|
|
|
+// }
|
|
|
+// return true;
|
|
|
+// });
|
|
|
+// System.out.println("连接点方法为:" + methodName + ",参数为:" + JSON.toJSONString(args) + ",目标方法执行结果为:" + JSON.toJSONString(result));
|
|
|
+// }
|
|
|
+//
|
|
|
+// @AfterThrowing(value = "execution(* com.fdkankan.openApi.controller.*.*.*(..))")
|
|
|
+// public void afterThrowing(JoinPoint point){
|
|
|
+// String methodName = point.getSignature().getName();
|
|
|
+// List<Object> args = (List<Object>) Arrays.asList(point.getArgs()).stream().filter(v -> {
|
|
|
+// if(v instanceof MultipartFile){
|
|
|
+// return false;
|
|
|
+// }
|
|
|
+// if(v instanceof String && ((String) v).startsWith("data:image/png;base64")){
|
|
|
+// return false;
|
|
|
+// }
|
|
|
+// return true;
|
|
|
+// });
|
|
|
+// System.out.println("连接点方法为:" + methodName + ",参数为:" + JSON.toJSONString(args));
|
|
|
+// }
|
|
|
+//
|
|
|
+//
|
|
|
+//}
|