两套单点登录+两套系统待办跳转bug修复8

This commit is contained in:
wenlukang1 2025-07-04 15:10:44 +08:00
parent 06502dbbc0
commit 77a779b0f9
2 changed files with 16 additions and 8 deletions

View File

@ -43,11 +43,11 @@ public class SSOPluginLogin implements ThirdSSOAuthHandler {
String secret; String secret;
String queryUrlOld = httpServletRequest.getQueryString(); String queryUrlOld = httpServletRequest.getQueryString();
//有code无需再次获取code直接结束 //有code无需再次获取code直接结束
if (queryUrlOld.contains("code") && queryUrlOld.contains("sessionId") ) { if (queryUrlOld != null && queryUrlOld.contains("code") && queryUrlOld.contains("sessionId")) {
String replace = queryUrlOld.replace("sessionId", "eossSessionId"); String replace = queryUrlOld.replace("sessionId", "eossSessionId");
try { try {
httpServletResponse.sendRedirect(httpServletRequest.getRequestURI()+"?"+replace); httpServletResponse.sendRedirect(httpServletRequest.getRequestURI() + "?" + replace);
logger.info(String.format("callTrdSSOLogin→sendRedirect%s", httpServletRequest.getRequestURI()+"?"+replace)); logger.info(String.format("callTrdSSOLogin→sendRedirect%s", httpServletRequest.getRequestURI() + "?" + replace));
} catch (IOException e) { } catch (IOException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
@ -78,9 +78,13 @@ public class SSOPluginLogin implements ThirdSSOAuthHandler {
DistributeSessionlessCache cache = CacheFactory.getCommonCacheFactory().getDistributeSessionlessCache("customRegion"); DistributeSessionlessCache cache = CacheFactory.getCommonCacheFactory().getDistributeSessionlessCache("customRegion");
String userKey = "user_sessionId_" + userName; // 构造存储sessionId的键 String userKey = "user_sessionId_" + userName; // 构造存储sessionId的键
String sessionId = cache.get(userKey); String sessionId = cache.get(userKey);
String isNew = cache.get("isNew");
if (sessionId != null) { if (sessionId != null) {
AuthService.logout(ip, sessionId); AuthService.logout(ip, sessionId);
} }
if (StringUtils.equals("true",isNew)){
ip = EOSS_IP2;
}
//退出系统跳转到eoss登录页 //退出系统跳转到eoss登录页
ssoUrl = ip + "/service/SGE-project-sctz-master/pc/dist/login.html"; ssoUrl = ip + "/service/SGE-project-sctz-master/pc/dist/login.html";
} else { } else {
@ -107,10 +111,13 @@ public class SSOPluginLogin implements ThirdSSOAuthHandler {
String secret; String secret;
String queryUrlOld = httpServletRequest.getQueryString(); String queryUrlOld = httpServletRequest.getQueryString();
logger.info(String.format("getTrdSSOAuth→queryUrlOld%s", queryUrlOld)); logger.info(String.format("getTrdSSOAuth→queryUrlOld%s", queryUrlOld));
DistributeSessionlessCache cache = CacheFactory.getCommonCacheFactory().getDistributeSessionlessCache("customRegion");
if (StringUtils.isNotEmpty(queryUrlOld) && queryUrlOld.contains("isNew")) { if (StringUtils.isNotEmpty(queryUrlOld) && queryUrlOld.contains("isNew")) {
ip = EOSS_IP2; ip = EOSS_IP2;
client = CLIENT_ID2; client = CLIENT_ID2;
secret = CLIENT_SECRET2; secret = CLIENT_SECRET2;
cache.put("isNew", String.valueOf(queryUrlOld.contains("isNew")));
} else { } else {
ip = EOSS_IP; ip = EOSS_IP;
client = CLIENT_ID; client = CLIENT_ID;
@ -133,9 +140,9 @@ public class SSOPluginLogin implements ThirdSSOAuthHandler {
logger.info(String.format("getTrdSSOAuth→sessionId%s", sessionId)); logger.info(String.format("getTrdSSOAuth→sessionId%s", sessionId));
try { try {
//如果直接携带了code与session并且未通过加密成param需要去除session参数并将其key替换为eossSessionId即可 //如果直接携带了code与session并且未通过加密成param需要去除session参数并将其key替换为eossSessionId即可
if (StringUtils.isNotEmpty(code) && StringUtils.isNotEmpty(sessionId) && StringUtils.isEmpty(param)){ if (StringUtils.isNotEmpty(code) && StringUtils.isNotEmpty(sessionId) && StringUtils.isEmpty(param)) {
String replace = queryUrlOld.replace("sessionId", "eossSessionId"); String replace = queryUrlOld.replace("sessionId", "eossSessionId");
httpServletResponse.sendRedirect(requestURI+"?"+replace); httpServletResponse.sendRedirect(requestURI + "?" + replace);
logger.info(String.format("getTrdSSOAuth→sendRedirect%s", replace)); logger.info(String.format("getTrdSSOAuth→sendRedirect%s", replace));
} }
//携带了code并且加密成param解密param并重定向进入司库 //携带了code并且加密成param解密param并重定向进入司库
@ -160,7 +167,6 @@ public class SSOPluginLogin implements ThirdSSOAuthHandler {
logger.info(String.format("getTrdSSOAuth→getUserInfo返回数据%s", user)); logger.info(String.format("getTrdSSOAuth→getUserInfo返回数据%s", user));
String userKey = "user_sessionId_" + user; String userKey = "user_sessionId_" + user;
//存储sessionId用于退出系统 //存储sessionId用于退出系统
DistributeSessionlessCache cache = CacheFactory.getCommonCacheFactory().getDistributeSessionlessCache("customRegion");
cache.put(userKey, httpServletRequest.getParameter("eossSessionId")); cache.put(userKey, httpServletRequest.getParameter("eossSessionId"));
//当前返回类型手机用户名email工号 //当前返回类型手机用户名email工号
result.setUserType(UserProperType.UserName); result.setUserType(UserProperType.UserName);

View File

@ -244,8 +244,9 @@ public class BacklogServiceHandle extends AbstractServiceHandler {
} }
cache.put(ctx.getBusinessKey(), "true", z); cache.put(ctx.getBusinessKey(), "true", z);
} else if (Objects.equals(shkd_type, "1")) { } else if (Objects.equals(shkd_type, "1")) {
String replace = form.toString().replace("&ado=view", "&ado=view&isNew=true");
// eoss 环境 待办 // eoss 环境 待办
CreateToDoHandler.get_CreateToDoHandler().sendCreateToDoNew(form.toString(), title, next.getLong("fid").toString(), userName, next.getString("fbillno")); CreateToDoHandler.get_CreateToDoHandler().sendCreateToDoNew(replace, title, next.getLong("fid").toString(), userName, next.getString("fbillno"));
// eoss 环境 已办 // eoss 环境 已办
DealToDoHandler.get_DealToDoHandler().sendDealToDoNew(next.getLong("fid"), userName, next.getString("fbillno")); DealToDoHandler.get_DealToDoHandler().sendDealToDoNew(next.getLong("fid"), userName, next.getString("fbillno"));
if (ObjectUtils.isEmpty(shkd_cache)) { if (ObjectUtils.isEmpty(shkd_cache)) {
@ -255,9 +256,10 @@ public class BacklogServiceHandle extends AbstractServiceHandler {
} }
cache.put(ctx.getBusinessKey(), "true", z); cache.put(ctx.getBusinessKey(), "true", z);
} else if (Objects.equals(shkd_type, "2")) { } else if (Objects.equals(shkd_type, "2")) {
String replace = form.toString().replace("&ado=view", "&ado=view&isNew=true");
//二套环境 待办 //二套环境 待办
CreateToDoHandler.get_CreateToDoHandler().sendCreateToDo(form.toString(), title, next.getLong("fid").toString(), userName, next.getString("fbillno")); CreateToDoHandler.get_CreateToDoHandler().sendCreateToDo(form.toString(), title, next.getLong("fid").toString(), userName, next.getString("fbillno"));
CreateToDoHandler.get_CreateToDoHandler().sendCreateToDoNew(form.toString(), title, next.getLong("fid").toString(), userName, next.getString("fbillno")); CreateToDoHandler.get_CreateToDoHandler().sendCreateToDoNew(replace, title, next.getLong("fid").toString(), userName, next.getString("fbillno"));
//二套环境 已办 //二套环境 已办
DealToDoHandler.get_DealToDoHandler().sendDealToDo(next.getLong("fid"), userName, next.getString("fbillno")); DealToDoHandler.get_DealToDoHandler().sendDealToDo(next.getLong("fid"), userName, next.getString("fbillno"));
DealToDoHandler.get_DealToDoHandler().sendDealToDoNew(next.getLong("fid"), userName, next.getString("fbillno")); DealToDoHandler.get_DealToDoHandler().sendDealToDoNew(next.getLong("fid"), userName, next.getString("fbillno"));