新oa待办跳转到待办页面bug修复

This commit is contained in:
wenlukang1 2025-06-25 16:59:29 +08:00
parent da6d39dc02
commit 9f8e22db41
1 changed files with 12 additions and 10 deletions

View File

@ -9,6 +9,7 @@ import kd.bos.login.thirdauth.ThirdSSOAuthHandler;
import kd.bos.login.thirdauth.UserAuthResult; import kd.bos.login.thirdauth.UserAuthResult;
import kd.bos.login.thirdauth.UserProperType; import kd.bos.login.thirdauth.UserProperType;
import kd.bos.servicehelper.user.UserServiceHelper; import kd.bos.servicehelper.user.UserServiceHelper;
import kd.bos.util.RevProxyUtil;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import javax.servlet.http.*; import javax.servlet.http.*;
@ -27,7 +28,7 @@ public class SSOPluginLogin implements ThirdSSOAuthHandler {
private final String CLIENT_ID2 = System.getProperty("scnyfz-clientKey"); private final String CLIENT_ID2 = System.getProperty("scnyfz-clientKey");
private final String CLIENT_SECRET2 = System.getProperty("scnyfz-scict"); private final String CLIENT_SECRET2 = System.getProperty("scnyfz-scict");
private final String EOSS_IP2 = System.getProperty("scnyfz-ip"); private final String EOSS_IP2 = System.getProperty("scnyfz-ip2");
/** /**
* 方法实现用户没有登录的时候跳转认证中心的登录地址 * 方法实现用户没有登录的时候跳转认证中心的登录地址
@ -57,10 +58,11 @@ public class SSOPluginLogin implements ThirdSSOAuthHandler {
}else{ }else{
queryUrl = Base64.getEncoder().encodeToString(queryUrl.getBytes(StandardCharsets.UTF_8)); queryUrl = Base64.getEncoder().encodeToString(queryUrl.getBytes(StandardCharsets.UTF_8));
// String skIp = httpServletRequest.getRemoteAddr(); // String skIp = httpServletRequest.getRemoteAddr();
String skUrl = httpServletRequest.getRequestURL().toString(); // String skUrl = httpServletRequest.getRequestURL().toString();
skUrl = skUrl.substring(0, skUrl.indexOf("ierp")); // skUrl = skUrl.substring(0, skUrl.indexOf("ierp"));
String skUrl = RevProxyUtil.getURLContextPath(httpServletRequest);
logger.info("获取地址:"+skUrl); logger.info("获取地址:"+skUrl);
String redirect = "http://10.1.7.83:8022/"+"ierp/index.html?param="+queryUrl; String redirect = skUrl+"index.html?param="+queryUrl;
//认证中心的登录地址 //认证中心的登录地址
logger.info(String.format("eoss_ip:%s,client_id:%s,client_secret:%s,重定向地址:%s", ip, client, secret, s)); logger.info(String.format("eoss_ip:%s,client_id:%s,client_secret:%s,重定向地址:%s", ip, client, secret, s));
String ssourl = ip + "/service/SGE-project-sctz-master/pc/dist/login.html"; String ssourl = ip + "/service/SGE-project-sctz-master/pc/dist/login.html";
@ -76,7 +78,7 @@ public class SSOPluginLogin implements ThirdSSOAuthHandler {
} }
} else { } else {
//重定向的统一认证的地址 获取授权码 //重定向的统一认证的地址 获取授权码
ssourl = String.format("%s/sso2/authCenter/authorize?client_id=%s&response_type=code&sessionKeep=false&authType=0&redirect_uri=%s", ssourl = String.format("%s/sso2/authCenter/authorize?client_id=%s&response_type=code&sessionKeep=true&authType=0&redirect_uri=%s",
ip, client, redirect); ip, client, redirect);
logger.info(String.format("重定向地址→sendRedirect%s", ssourl)); logger.info(String.format("重定向地址→sendRedirect%s", ssourl));
} }
@ -124,8 +126,8 @@ public class SSOPluginLogin implements ThirdSSOAuthHandler {
} }
// //获取返回的 sessionId //获取返回的 sessionId
// String sessionId = httpServletRequest.getParameter("sessionId"); String sessionId = httpServletRequest.getParameter("sessionId");
// String userName = httpServletRequest.getParameter("userName"); // String userName = httpServletRequest.getParameter("userName");
// if (userName != null) { // if (userName != null) {
// userName = userName.replace(" ", "+"); // 将空格替换为 + // userName = userName.replace(" ", "+"); // 将空格替换为 +
@ -154,9 +156,9 @@ public class SSOPluginLogin implements ThirdSSOAuthHandler {
result.setUser(user); result.setUser(user);
result.setSucess(true); result.setSucess(true);
logger.info("SSO用户登录成功进入苍穹系统"); logger.info("SSO用户登录成功进入苍穹系统");
// String userKey = "user_sessionId_" + user; // 构造一个唯一的键 String userKey = "user_sessionId_" + user; // 构造一个唯一的键
// DistributeSessionlessCache cache = CacheFactory.getCommonCacheFactory().getDistributeSessionlessCache("customRegion"); DistributeSessionlessCache cache = CacheFactory.getCommonCacheFactory().getDistributeSessionlessCache("customRegion");
// cache.put(userKey, sessionId);//将自定义参数加入缓存 cache.put(userKey, sessionId);//将自定义参数加入缓存
} }
} catch (Exception e) { } catch (Exception e) {
throw new KDBizException("获取用户信息接口异常SSO用户登录失败" + e); throw new KDBizException("获取用户信息接口异常SSO用户登录失败" + e);