diff --git a/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/eoss/SSOPluginLogin.java b/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/eoss/SSOPluginLogin.java index e1a8451..6e5631b 100644 --- a/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/eoss/SSOPluginLogin.java +++ b/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/eoss/SSOPluginLogin.java @@ -43,11 +43,11 @@ public class SSOPluginLogin implements ThirdSSOAuthHandler { String secret; String queryUrlOld = httpServletRequest.getQueryString(); //有code无需再次获取code,直接结束 - if (queryUrlOld.contains("code") && queryUrlOld.contains("sessionId") ) { + if (queryUrlOld != null && queryUrlOld.contains("code") && queryUrlOld.contains("sessionId")) { String replace = queryUrlOld.replace("sessionId", "eossSessionId"); try { - httpServletResponse.sendRedirect(httpServletRequest.getRequestURI()+"?"+replace); - logger.info(String.format("callTrdSSOLogin→sendRedirect:%s", httpServletRequest.getRequestURI()+"?"+replace)); + httpServletResponse.sendRedirect(httpServletRequest.getRequestURI() + "?" + replace); + logger.info(String.format("callTrdSSOLogin→sendRedirect:%s", httpServletRequest.getRequestURI() + "?" + replace)); } catch (IOException e) { throw new RuntimeException(e); } @@ -78,9 +78,13 @@ public class SSOPluginLogin implements ThirdSSOAuthHandler { DistributeSessionlessCache cache = CacheFactory.getCommonCacheFactory().getDistributeSessionlessCache("customRegion"); String userKey = "user_sessionId_" + userName; // 构造存储sessionId的键 String sessionId = cache.get(userKey); + String isNew = cache.get("isNew"); if (sessionId != null) { AuthService.logout(ip, sessionId); } + if (StringUtils.equals("true",isNew)){ + ip = EOSS_IP2; + } //退出系统跳转到eoss登录页 ssoUrl = ip + "/service/SGE-project-sctz-master/pc/dist/login.html"; } else { @@ -107,10 +111,13 @@ public class SSOPluginLogin implements ThirdSSOAuthHandler { String secret; String queryUrlOld = httpServletRequest.getQueryString(); logger.info(String.format("getTrdSSOAuth→queryUrlOld:%s", queryUrlOld)); + DistributeSessionlessCache cache = CacheFactory.getCommonCacheFactory().getDistributeSessionlessCache("customRegion"); + if (StringUtils.isNotEmpty(queryUrlOld) && queryUrlOld.contains("isNew")) { ip = EOSS_IP2; client = CLIENT_ID2; secret = CLIENT_SECRET2; + cache.put("isNew", String.valueOf(queryUrlOld.contains("isNew"))); } else { ip = EOSS_IP; client = CLIENT_ID; @@ -133,9 +140,9 @@ public class SSOPluginLogin implements ThirdSSOAuthHandler { logger.info(String.format("getTrdSSOAuth→sessionId:%s", sessionId)); try { //如果直接携带了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"); - httpServletResponse.sendRedirect(requestURI+"?"+replace); + httpServletResponse.sendRedirect(requestURI + "?" + replace); logger.info(String.format("getTrdSSOAuth→sendRedirect:%s", replace)); } //携带了code,并且加密成param,解密param,并重定向进入司库 @@ -160,7 +167,6 @@ public class SSOPluginLogin implements ThirdSSOAuthHandler { logger.info(String.format("getTrdSSOAuth→getUserInfo返回数据:%s", user)); String userKey = "user_sessionId_" + user; //存储sessionId用于退出系统 - DistributeSessionlessCache cache = CacheFactory.getCommonCacheFactory().getDistributeSessionlessCache("customRegion"); cache.put(userKey, httpServletRequest.getParameter("eossSessionId")); //当前返回类型手机,用户名,email,工号 result.setUserType(UserProperType.UserName); diff --git a/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/midservice/servicehandler/BacklogServiceHandle.java b/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/midservice/servicehandler/BacklogServiceHandle.java index 46ce880..4ff8352 100644 --- a/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/midservice/servicehandler/BacklogServiceHandle.java +++ b/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/midservice/servicehandler/BacklogServiceHandle.java @@ -244,8 +244,9 @@ public class BacklogServiceHandle extends AbstractServiceHandler { } cache.put(ctx.getBusinessKey(), "true", z); } else if (Objects.equals(shkd_type, "1")) { + String replace = form.toString().replace("&ado=view", "&ado=view&isNew=true"); //新 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 环境 已办 DealToDoHandler.get_DealToDoHandler().sendDealToDoNew(next.getLong("fid"), userName, next.getString("fbillno")); if (ObjectUtils.isEmpty(shkd_cache)) { @@ -255,9 +256,10 @@ public class BacklogServiceHandle extends AbstractServiceHandler { } cache.put(ctx.getBusinessKey(), "true", z); } 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().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().sendDealToDoNew(next.getLong("fid"), userName, next.getString("fbillno"));