From cc560edc4af2755297b4b8368e8fb816b35e1ed3 Mon Sep 17 00:00:00 2001
From: 陈昶聿 <chychen@nbjetron.com>
Date: 星期四, 17 九月 2026 14:00:58 +0800
Subject: [PATCH] 【丽水】ssoGoServiceSubtaskList 调整

---
 ruoyi-admin/src/main/java/com/ruoyi/web/controller/sso/SSOController.java |   81 +++++++++++++++++++++-------------------
 1 files changed, 43 insertions(+), 38 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 3824360..eeb9416 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
@@ -1,6 +1,7 @@
 package com.ruoyi.web.controller.sso;
 
 import com.alibaba.fastjson.JSON;
+import com.ruoyi.common.core.domain.entity.SysDept;
 import com.ruoyi.common.core.domain.entity.SysUser;
 import com.ruoyi.common.core.domain.model.LoginUser;
 import com.ruoyi.common.exception.base.BaseException;
@@ -11,15 +12,22 @@
 import com.ruoyi.framework.web.service.SysLoginService;
 import com.ruoyi.framework.web.service.TokenService;
 import com.ruoyi.system.service.ISysConfigService;
+import com.ruoyi.system.service.ISysDeptService;
 import com.ruoyi.system.service.ISysUserService;
 import com.smartor.domain.SSOTokenResponse;
 import com.smartor.domain.SSOUserInfo;
+import com.smartor.domain.ServiceSubtask;
 import com.smartor.domain.VO.ServiceSubtaskVO;
+import com.smartor.domain.entity.ServiceSubtaskEntity;
+import com.smartor.service.IServiceSubtaskService;
+import com.smartor.service.impl.ServiceSubtaskServiceImpl;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.collections.CollectionUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.http.*;
 import org.springframework.http.client.SimpleClientHttpRequestFactory;
+
 import org.springframework.util.LinkedMultiValueMap;
 import org.springframework.util.MultiValueMap;
 import org.springframework.util.ObjectUtils;
@@ -32,9 +40,7 @@
 import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
 import java.net.URLEncoder;
-import java.util.HashMap;
-import java.util.LinkedHashMap;
-import java.util.Map;
+import java.util.*;
 
 /**
  * SSO鍗曠偣鐧诲綍鎺у埗鍣�
@@ -92,7 +98,13 @@
     @Autowired
     private ISysConfigService sysConfigService;
 
+    @Autowired
+    private ISysDeptService sysDeptService;
+
     private final RestTemplate restTemplate;
+
+    @Autowired
+    private IServiceSubtaskService serviceSubtaskService;
 
     public SSOController() {
         // 閰嶇疆RestTemplate瓒呮椂
@@ -182,49 +194,42 @@
 
     /**
      * 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";
+    @PostMapping("ssoGoServiceSubtaskList")
+    public RedirectView ssoGoServiceSubtaskList(@RequestBody SysUser sysUserVo) {
         // 閲嶅畾鍚戝湴鍧�瀵硅薄(閲嶅畾鍚戝湴鍧�
         RedirectView redirectView = new RedirectView();
+        String path = sysConfigService.selectConfigByKey("sys.qddz");
+        String userName = sysUserVo.getUserName();
+        String orgid = sysUserVo.getOrgid();
+        String campusid = sysUserVo.getCampusid();
+        Long deptId = sysUserVo.getDeptId();
+        List<String> deptCodes = sysUserVo.getDeptCodes();
+        List<String> wardCodes = sysUserVo.getWardCodes();
         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");
+            if(ObjectUtils.isEmpty(deptId)){
+                SysDept sysDeptVo = new SysDept();
+                sysDeptVo.setOrgid(orgid);
+                sysDeptVo.setCampusid(campusid);
+                if(CollectionUtils.isNotEmpty(deptCodes)){
+                    sysDeptVo.setDeptType("1");
+                    sysDeptVo.setDeptCodes(deptCodes);
+                }else {
+                    sysDeptVo.setDeptType("2");
+                    sysDeptVo.setDeptCodes(wardCodes);
+                }
+                List<SysDept> sysDepts = sysDeptService.selectSysDeptList(sysDeptVo);
+                if(CollectionUtils.isNotEmpty(sysDepts)){
+                    deptId = sysDepts.get(0).getDeptId();
+                }
             }
-
-            String redirectUrl = path + "/loginSSO?token=" + loginToken + "&orgid=" + orgid +
-                     "&sfzh=" + sfzh + "&orgname=null&ZuHuID=null&deptCode=null";
+            String loginToken  = loginService.loginByUserName(userName + "&" + orgid + "&null" + "&" + campusid);
+            String redirectUrl = path + "/loginSSO?token=" + loginToken +
+                    "&orgid=" + orgid + "&campusid=" + campusid +
+                    "&deptId=" + deptId + "&orgname=null&ZuHuID=null&deptCode=null";
             log.info("銆怱SO鐧诲綍銆戦噸瀹氬悜鍦板潃锛歿}", redirectUrl);
             return buildRedirect(redirectUrl);
 

--
Gitblit v1.9.3