浏览代码

内部接口鉴权

dengsixing 5 月之前
父节点
当前提交
f2b9f848db

+ 34 - 0
src/main/java/com/fdkankan/scene/Interceptor/LogProxy.java

@@ -0,0 +1,34 @@
+package com.fdkankan.scene.Interceptor;
+
+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 java.util.Arrays;
+import java.util.List;
+
+@Slf4j
+@Aspect
+@Component
+public class LogProxy {
+
+	@AfterReturning(value = "execution(* com.fdkankan.contro.controller.*.*(..))", returning = "result")
+	public void afterMethod(JoinPoint point, Object result){
+		String methodName = point.getSignature().getName();
+		List<Object> args = Arrays.asList(point.getArgs());
+		System.out.println("连接点方法为:" + methodName + ",参数为:" + JSON.toJSONString(args) + ",目标方法执行结果为:" + JSON.toJSONString(result));
+	}
+
+	@AfterThrowing(value = "execution(* com.fdkankan.kz.pms.controller.*.*.*(..))")
+	public void afterThrowing(JoinPoint point){
+		String methodName = point.getSignature().getName();
+		List<Object> args = Arrays.asList(point.getArgs());
+		System.out.println("连接点方法为:" + methodName + ",参数为:" + JSON.toJSONString(args));
+	}
+
+
+}

+ 9 - 7
src/main/java/com/fdkankan/scene/controller/TestController.java

@@ -2,8 +2,11 @@ package com.fdkankan.scene.controller;
 
 import cn.hutool.core.date.DateUtil;
 import cn.hutool.core.date.TimeInterval;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.fdkankan.fyun.face.FYunFileServiceInterface;
 import com.fdkankan.rabbitmq.util.RabbitMqProducer;
+import com.fdkankan.scene.entity.User;
+import com.fdkankan.scene.service.IUserService;
 import com.fdkankan.web.response.ResultData;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -11,6 +14,8 @@ import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
+import java.util.List;
+
 /**
  * <p>
  * TODO
@@ -28,16 +33,13 @@ public class TestController {
     private RabbitMqProducer rabbitMqProducer;
     @Autowired
     private FYunFileServiceInterface fYunFileService;
+    @Autowired
+    private IUserService userService;
+
 
     @GetMapping("/test")
     public ResultData<Void> test(){
-        TimeInterval timer = DateUtil.timer();
-        fYunFileService.deleteFolder("test001/hotspot");
-        long l = timer.intervalRestart();
-        log.info("删除文件花费时间:{}", l);
-        fYunFileService.copyFileInBucketParallel("test/hotspot", "test001/hotspot");
-        long l2 = timer.intervalRestart();
-        log.info("删除文件花费时间:{}", l2);
+        List<User> list = userService.list(new LambdaQueryWrapper<User>().eq(User::getUserName, null));
         return ResultData.ok();
     }