From 93c7226d536d312fc083a57619629192ba076413 Mon Sep 17 00:00:00 2001 From: xiejun <xj@2023> Date: 星期五, 01 十二月 2023 12:36:50 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/controller/PasswordFreeLoginController.java | 53 ++++++++++++++++++++++++++++++++++++++++++++--------- 1 files changed, 44 insertions(+), 9 deletions(-) diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/controller/PasswordFreeLoginController.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/controller/PasswordFreeLoginController.java index 4e04c10..c4d7e8e 100644 --- a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/controller/PasswordFreeLoginController.java +++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/controller/PasswordFreeLoginController.java @@ -2,12 +2,27 @@ import com.vci.ubcs.code.service.IPasswordFreeLoginService; import io.swagger.annotations.Api; +import lombok.extern.slf4j.Slf4j; +import org.springblade.core.log.exception.ServiceException; import org.springblade.core.tool.api.R; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.servlet.ModelAndView; +import org.springframework.web.servlet.mvc.support.RedirectAttributes; +import org.springframework.web.servlet.view.RedirectView; import javax.annotation.Resource; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; + +import java.io.IOException; + +import static com.vci.ubcs.starter.util.AESUtils.aesDecrypt; +import static com.vci.ubcs.starter.util.AESUtils.aesEncrypt; /** * @author ludc @@ -16,18 +31,38 @@ @RestController @RequestMapping("/passwordFree") @Api(value = "鍏嶅瘑鐧诲綍鎺ュ彛", tags = "鍏嶅瘑鐧诲綍鎺ュ彛") +@Slf4j public class PasswordFreeLoginController { @Resource private IPasswordFreeLoginService passwordFreeLoginService; - @GetMapping("/login") - public R passwordFreeLogin(String account) { - boolean resBoolean = passwordFreeLoginService.passwordFreeLogin(account); - return R.status(resBoolean); + @PostMapping("/login") + public R passwordFreeLogin(@RequestParam("userName") String username, HttpServletRequest request) { + boolean status; + try { + status = passwordFreeLoginService.pwdFreeLoginByBoolean(username,request); + }catch (Exception e){ + throw new ServiceException("鍏嶅瘑鐧诲綍鑾峰彇token澶辫触锛�"+e.getMessage()); + } + return R.status(status); } - - + /** + * 鍗曠偣鐧诲綍 + * @param empCode + * @return + * @throws Exception + */ + @PostMapping("/ssoLogin") + public String oaSsoLogin(String empCode){ + String token; + try { + token = passwordFreeLoginService.ssoFreeLogin(empCode); + }catch (Exception e){ + throw new ServiceException("鍗曠偣鐧诲綍鑾峰彇token澶辫触:"+e.getMessage()); + } + return token; + } } -- Gitblit v1.9.3