From 459aa78c84cf552ebea6ef056d978c2531d71ac8 Mon Sep 17 00:00:00 2001
From: liusheng <337615773@qq.com>
Date: 星期五, 06 三月 2026 17:14:27 +0800
Subject: [PATCH] 代码提交

---
 ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java |  106 +++++++++++++++++++---------------------------------
 1 files changed, 39 insertions(+), 67 deletions(-)

diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java
index 4aebae5..fc8b79d 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java
@@ -7,7 +7,6 @@
 import com.ruoyi.common.core.domain.entity.SysUserDept;
 import com.ruoyi.common.core.domain.model.LoginBody;
 import com.ruoyi.common.exception.base.BaseException;
-import com.ruoyi.common.utils.RSAPublicKeyExample;
 import com.ruoyi.common.utils.SecurityUtils;
 import com.ruoyi.common.utils.StringUtils;
 import com.ruoyi.framework.web.service.SysLoginService;
@@ -16,17 +15,15 @@
 import com.ruoyi.system.service.ISysDeptService;
 import com.ruoyi.system.service.ISysMenuService;
 import com.smartor.mapper.SysUserDeptMapper;
-import com.smartor.service.impl.ServiceSLTDHealthcareRecordServiceImpl;
+import com.smartor.service.IServiceSLTDHealthcareRecordService;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
 import org.springframework.http.HttpStatus;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.servlet.view.RedirectView;
 
 import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
-import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -53,21 +50,8 @@
 
     @Autowired
     private ISysConfigService sysConfigService;
-
-
-    @Value("${pri_key}")
-    private String pri_key;
-
-    @Value("${isEncryp}")
-    private Integer isEncryp;
-
-
-    @Value("${sltd_pub_path}")
-    private String sltdPubPath;
-
-
-    @Value("${spring.profiles.active}")
-    private String active;
+    @Autowired
+    private IServiceSLTDHealthcareRecordService iServiceSLTDHealthcareRecordService;
 
     @Autowired
     private SysUserDeptMapper sysUserDeptMapper;
@@ -82,9 +66,21 @@
     public AjaxResult login(@RequestBody LoginBody loginBody) {
         AjaxResult ajax = AjaxResult.success();
         // 鐢熸垚浠ょ墝
-        String token = loginService.login(loginBody.getUsername(), loginBody.getPassword(), loginBody.getCode(), loginBody.getUuid(), loginBody.getOrgid());
+        String token = loginService.login(loginBody.getUsername(), loginBody.getPassword(), loginBody.getCode(), loginBody.getUuid(), loginBody.getOrgid(), loginBody.getCampusid());
         ajax.put(Constants.TOKEN, token);
         return ajax;
+    }
+
+
+    /**
+     * 鐧诲綍鏂规硶
+     *
+     * @param map 鐧诲綍淇℃伅
+     * @return 缁撴灉
+     */
+    @PostMapping("/test")
+    public void test(@RequestBody Map<String, Object> map) {
+        iServiceSLTDHealthcareRecordService.aa(map);
     }
 
     /**
@@ -101,53 +97,37 @@
      */
 //    @IpWhitelist
     @GetMapping("/SSOLogin")
-    public RedirectView SSOLogin(@RequestParam(required = false) String userName, @RequestParam(required = false) String orgid, @RequestParam(required = false) String deptId, @RequestParam(required = false) String token) {
+    public RedirectView SSOLogin(@RequestParam(required = false) String userName,
+                                 @RequestParam(required = false) String orgid,
+                                 @RequestParam(required = false) String campusid,
+                                 @RequestParam(required = false) String deptId,
+                                 String token) {
         if (StringUtils.isEmpty(userName) && StringUtils.isEmpty(token)) {
             throw new BaseException("鍙傛暟涓嶈兘涓虹┖");
-        }
-        log.info("--------杩涙柟娉曚簡鍚�?{}", token);
-        // 閲嶅畾鍚戝湴鍧�瀵硅薄(閲嶅畾鍚戝湴鍧�
-        RedirectView redirectView = new RedirectView();
-//        if (active.equals("sltd")) {
-//            Map<String, String> headers = buildRequestHeaders();
-//            Map<String, String> requestParams = new HashMap<>();
-//            requestParams.put("token", token);
-//            String reqData = HttpUtil.postFormRequest(sltdPubPath + "/checkSsoTokenId", requestParams, headers, null);
-//            log.info("銆�-----杩斿洖鐨勭粨鏋滀负銆戯細{}", reqData);
-//            if (StringUtils.isEmpty(reqData)) {
-//                throw new BaseException("token楠岃瘉澶辫触");
-//            }
-//
-//            Map<String, Object> map = JSONObject.parseObject(reqData, Map.class);
-//            if (ObjectUtils.isEmpty(map) || (Integer) map.get("code") != 200) {
-//                throw new BaseException("token楠岃瘉澶辫触");
-//            }
-//
-//            Map<String, Object> data = (Map<String, Object>) map.get("data");
-//            //鍛樺伐缂栫爜
-//            userName = (String) data.get("accountNo");
-//        }
-        log.info("銆�-----------userName鐨勫�间负锛歿}銆�", userName);
-        // 鐢熸垚浠ょ墝
-        if (StringUtils.isEmpty(userName) || StringUtils.isEmpty(orgid)) {
-            throw new BaseException("鐢ㄦ埛鍚嶆垨缁勭粐鏈烘瀯鎴栭儴闂ㄤ笉鑳戒负绌�");
-        }
-        if (isEncryp != null && isEncryp == 1) {
-            RSAPublicKeyExample rsaPublicKeyExample = new RSAPublicKeyExample();
-            userName = rsaPublicKeyExample.decryptedData(userName, pri_key);
-        }
-
-        String token2 = loginService.loginByUserName(userName + "&" + orgid + "&" + deptId);
-        if (StringUtils.isEmpty(token2)) {
-            throw new BaseException("鐧婚檰澶辫触");
         }
 
         String path = sysConfigService.selectConfigByKey("sys.qddz");
         if (StringUtils.isEmpty(path)) {
             throw new BaseException("璇烽厤缃墠绔湴鍧�");
         }
-        log.info("鍗曠偣鐧婚檰閲嶅畾鍚戝湴鍧�涓猴細{}", path + "/loginSSO?token=" + token2 + "&orgid=" + orgid + "&orgname=''" + "&ZuHuID=''&deptCode=''");
-        redirectView.setUrl(path + "/loginSSO?token=" + token2 + "&orgid=" + orgid + "&orgname=null" + "&ZuHuID=null&deptCode=null");
+
+        String loginToken = loginService.ssoLogin(userName, orgid, deptId, campusid, token);
+        if (StringUtils.isEmpty(loginToken)) {
+            log.error("銆怱SO鐧诲綍銆戠櫥褰曞け璐ワ紝userName={}, orgid={}", userName, orgid);
+            return buildRedirect(path + "/login");
+        }
+
+        String redirectUrl = path + "/loginSSO?token=" + loginToken + "&orgid=" + orgid + "&orgname=null&ZuHuID=null&deptCode=null";
+        log.info("銆怱SO鐧诲綍銆戦噸瀹氬悜鍦板潃锛歿}", redirectUrl);
+        return buildRedirect(redirectUrl);
+    }
+
+    /**
+     * 鏋勫缓閲嶅畾鍚戣鍥�
+     */
+    private RedirectView buildRedirect(String url) {
+        RedirectView redirectView = new RedirectView();
+        redirectView.setUrl(url);
         redirectView.setStatusCode(HttpStatus.MOVED_PERMANENTLY);
         return redirectView;
     }
@@ -212,13 +192,5 @@
     @GetMapping("/getDept/{orgid}")
     public AjaxResult getDept(@PathVariable String orgid) {
         return AjaxResult.success(sysDeptService.selectDept(orgid));
-    }
-
-
-    private Map<String, String> buildRequestHeaders() {
-        Map<String, String> headers = new HashMap<>();
-//        headers.put("Content-Type", "application/json");
-        headers.put("app-key", ServiceSLTDHealthcareRecordServiceImpl.APP_KEY);
-        return headers;
     }
 }

--
Gitblit v1.9.3