From 0414ddb0b2b3a7199ae6181a770f97ac140dbd73 Mon Sep 17 00:00:00 2001
From: zhangf <1603559716@qq.com>
Date: 星期三, 08 五月 2024 16:46:22 +0800
Subject: [PATCH] spi统计

---
 safePlatfrom-out-web/src/main/java/com/gkhy/safePlatform/accountController/LoginController.java |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 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 608b319..1abbf63 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
@@ -1,13 +1,15 @@
 package com.gkhy.safePlatform.accountController;
 
 import com.alibaba.fastjson.JSONObject;
-import com.gkhy.safePlatform.account.rpc.apimodel.UserAccountService;
+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;
@@ -20,18 +22,18 @@
 public class LoginController {
 
     @DubboReference(check = false)
-    private UserAccountService userAccountService;
+    private AccountAuthService accountAuthService;
 
     @RequestMapping("/login")
     public ResultVO<UserLoginRPCRespDTO> authLogin(@RequestBody JSONObject loginForm){
         String username = loginForm.getString("username");
         String password = loginForm.getString("password");
-        return userAccountService.authLogin(username, password);
+        return accountAuthService.authLogin(username, password);
     }
 
     @RequestMapping("/menu")
-    public ResultVO<List<MenuRPCRespDTO>> getMenu(Principal principal, Long projectId){
-        String userId = principal.getName();
-        return userAccountService.getMenu(Long.valueOf(userId), projectId);
+    public ResultVO<List<MenuRPCRespDTO>> getMenu(Authentication authentication, Long projectId){
+        ContextCacheUser currentUser = (ContextCacheUser) authentication.getPrincipal();
+        return accountAuthService.getMenu(currentUser, projectId);
     }
 }

--
Gitblit v1.9.2