From 933855e14ac2b613176966d491b929984a02b20c Mon Sep 17 00:00:00 2001
From: 陈昶聿 <chychen@nbjetron.com>
Date: 星期三, 26 八月 2026 15:23:32 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'
---
ruoyi-admin/src/main/java/com/ruoyi/web/controller/sso/SSOController.java | 61 ++++++++++++++++++++++++++++--
1 files changed, 57 insertions(+), 4 deletions(-)
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/sso/SSOController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/sso/SSOController.java
index 1338a84..3824360 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/sso/SSOController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/sso/SSOController.java
@@ -14,6 +14,7 @@
import com.ruoyi.system.service.ISysUserService;
import com.smartor.domain.SSOTokenResponse;
import com.smartor.domain.SSOUserInfo;
+import com.smartor.domain.VO.ServiceSubtaskVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
@@ -22,10 +23,7 @@
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.util.ObjectUtils;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.servlet.view.RedirectView;
import org.springframework.web.util.UriComponentsBuilder;
@@ -183,6 +181,61 @@
}
/**
+ * ssoGoServiceSubtaskList
+ * code 鏄�/mediinfo-lyra-authserver/connect/authorize 鐢県is鎻愪緵
+ * 鐧诲綍瀹㈡埛绔疘D鏄浐瀹氱殑 clientId = 1553588321874087936 clientSecret = suifangxt
+ */
+ @GetMapping("ssoGoServiceSubtaskList")
+ public RedirectView ssoGoServiceSubtaskList(@RequestParam(value = "code", required = false) String code,
+ @RequestParam(value = "sfzh", required = false) String sfzh) {
+ log.info("鏀跺埌ssoGoServiceSubtaskList璇锋眰锛屽紑濮嬮噸瀹氬悜鍒版巿鏉冩湇鍔″櫒,code = {}, sfzh = {}",code, sfzh);
+ String path = sysConfigService.selectConfigByKey("sys.qddz");
+ String redirectUri = "https://9.208.2.190:8092/prod-api/sso/ssoLoginLyra";
+ String lyraPath = "https://9.0.124.104:13021";
+ String clientId = "1553588321874087936";
+ String clientSecret = "suifangxt";
+ String scope = "openid";
+
+// String authorizeUrl = lyraPath + "/mediinfo-lyra-authserver/connect/authorize";
+ String accessTokenUrl = lyraPath + "/mediinfo-lyra-authserver/connect/token";
+ String userInfoUrl = lyraPath + "/mediinfo-lyra-authserver/connect/userinfo";
+ // 閲嶅畾鍚戝湴鍧�瀵硅薄(閲嶅畾鍚戝湴鍧�
+ RedirectView redirectView = new RedirectView();
+ try {
+ SSOTokenResponse accessToken = getAccessTokenLyra(code, accessTokenUrl, clientId, clientSecret, redirectUri,true);
+ log.info("鑾峰彇鍒扮殑token锛�" + accessToken);
+ SSOUserInfo userInfo = getUserInfoLyra(accessToken.getAccess_token(), userInfoUrl,true);
+ log.info("鑾峰彇鍒扮殑鐢ㄦ埛淇℃伅锛�" + userInfo);
+// createLocalSession(userInfo);
+ if (StringUtils.isEmpty(path)) {
+ throw new BaseException("璇烽厤缃墠绔湴鍧�");
+ }
+
+ String userName = userInfo.getZhiGongID();
+ String orgid = userInfo.getZuZhiJGID();
+ String campusid = "1";
+ String deptId = null;
+ String token = null;
+ log.info("銆怱SO鐧诲綍銆戣幏鍙栫敤鎴稵oken鍙傛暟锛�" + userInfo);
+ 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 +
+ "&sfzh=" + sfzh + "&orgname=null&ZuHuID=null&deptCode=null";
+ log.info("銆怱SO鐧诲綍銆戦噸瀹氬悜鍦板潃锛歿}", redirectUrl);
+ return buildRedirect(redirectUrl);
+
+ } catch (Exception e) {
+ log.error("SSO鐧诲綍澶辫触", e);
+ redirectView.setUrl(path + "/login?error=sso_failed");
+ return redirectView;
+
+ }
+ }
+ /**
* 鏋勫缓閲嶅畾鍚戣鍥�
*/
private RedirectView buildRedirect(String url) {
--
Gitblit v1.9.3