From 20fece55233ec20ac8b289151162a255a8ef09d1 Mon Sep 17 00:00:00 2001
From: zhangfeng <1603559716@qq.com>
Date: 星期一, 16 一月 2023 08:35:05 +0800
Subject: [PATCH] 安全物资和设备优化
---
safePlatfrom-out-web/src/main/java/com/gkhy/safePlatform/accountController/LoginController.java | 22 +++++++++++++++++-----
1 files changed, 17 insertions(+), 5 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 e257ec2..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,27 +1,39 @@
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.model.UserLoginRespDTO;
+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;
+
+import java.security.Principal;
+import java.util.List;
@RestController
@RequestMapping("/auth")
public class LoginController {
@DubboReference(check = false)
- private UserAccountService userAccountService;
+ private AccountAuthService accountAuthService;
@RequestMapping("/login")
- public ResultVO<UserLoginRespDTO> authLogin(@RequestBody JSONObject loginForm){
+ 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(Authentication authentication, Long projectId){
+ ContextCacheUser currentUser = (ContextCacheUser) authentication.getPrincipal();
+ return accountAuthService.getMenu(currentUser, projectId);
}
}
--
Gitblit v1.9.2