From 108ed1c548b7dc17ce47dcadea80e4c42a2f29e7 Mon Sep 17 00:00:00 2001
From: lyfO_o <764716047@qq.com>
Date: 星期六, 16 七月 2022 17:33:17 +0800
Subject: [PATCH] 改造

---
 safePlatfrom-out-web/src/main/java/com/gkhy/safePlatform/accountController/LoginController.java |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/safePlatfrom-out-web/src/main/java/com/gkhy/safePlatform/accountController/LoginController.java b/safePlatfrom-out-web/src/main/java/com/gkhy/safePlatform/accountController/LoginController.java
index d139e52..c7b3ca3 100644
--- a/safePlatfrom-out-web/src/main/java/com/gkhy/safePlatform/accountController/LoginController.java
+++ b/safePlatfrom-out-web/src/main/java/com/gkhy/safePlatform/accountController/LoginController.java
@@ -4,10 +4,12 @@
 import com.gkhy.safePlatform.account.rpc.apimodel.AccountAuthService;
 import com.gkhy.safePlatform.account.rpc.apimodel.model.resp.MenuRPCRespDTO;
 import com.gkhy.safePlatform.account.rpc.apimodel.model.resp.UserLoginRPCRespDTO;
+import com.gkhy.safePlatform.commons.co.ContextCacheUser;
 import com.gkhy.safePlatform.commons.vo.ResultVO;
 import org.apache.dubbo.config.annotation.DubboReference;
 import org.apache.dubbo.config.annotation.DubboService;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.core.Authentication;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
@@ -30,8 +32,8 @@
     }
 
     @RequestMapping("/menu")
-    public ResultVO<List<MenuRPCRespDTO>> getMenu(Principal principal, Long projectId){
-        String userId = principal.getName();
-        return accountAuthService.getMenu(Long.valueOf(userId), projectId);
+    public ResultVO<List<MenuRPCRespDTO>> getMenu(Authentication authentication, Long projectId){
+        ContextCacheUser currentUser = (ContextCacheUser) authentication.getPrincipal();
+        return accountAuthService.getMenu(currentUser.getUid(), projectId);
     }
 }

--
Gitblit v1.9.2