From 90c8796a0984368270d395296eb5b1687baf63db Mon Sep 17 00:00:00 2001 From: root Date: Mon, 29 Dec 2025 11:54:35 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BA=BA=EF=BC=9A?= =?UTF-8?q?=E9=82=B9=E6=B1=9F=E6=B6=9B=20=E6=8F=90=E4=BA=A4=E6=97=B6?= =?UTF-8?q?=E9=97=B4=EF=BC=9A2025=E5=B9=B412=E6=9C=8829=E6=97=A5=20?= =?UTF-8?q?=E6=8F=90=E4=BA=A4=E5=86=85=E5=AE=B9=EF=BC=9A=E5=8D=95=E7=82=B9?= =?UTF-8?q?=E7=99=BB=E5=BD=95=E4=BB=A3=E7=A0=81=EF=BC=88=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E4=B8=8D=E9=9C=80=E8=A6=81=E7=9A=84=E4=BB=A3=E7=A0=81=EF=BC=8C?= =?UTF-8?q?=E8=B0=83=E6=95=B4=E9=80=80=E5=87=BA=E7=B3=BB=E7=BB=9F=E5=8D=95?= =?UTF-8?q?=E7=82=B9=E5=88=B0=E6=96=B0eoss=E7=99=BB=E5=BD=95=E5=9C=B0?= =?UTF-8?q?=E5=9D=80=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../shkd/sys/sys/eoss/SSOPluginLogin.java | 25 +------------------ 1 file changed, 1 insertion(+), 24 deletions(-) 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 2415627..cc2648a 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 @@ -1,21 +1,15 @@ package shkd.sys.sys.eoss; -import kd.bos.cache.CacheFactory; -import kd.bos.cache.DistributeSessionlessCache; import kd.bos.logging.Log; import kd.bos.logging.LogFactory; import kd.bos.login.thirdauth.ThirdSSOAuthHandler; import kd.bos.login.thirdauth.UserAuthResult; import kd.bos.login.thirdauth.UserProperType; -import kd.bos.servicehelper.user.UserServiceHelper; import org.apache.commons.lang3.StringUtils; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; -import java.net.URLEncoder; -import java.nio.charset.StandardCharsets; -import java.util.Base64; /** @@ -30,8 +24,6 @@ public class SSOPluginLogin implements ThirdSSOAuthHandler { private final String CLIENT_ID2 = System.getProperty("scnyfz-clientKey"); private final String CLIENT_SECRET2 = System.getProperty("scnyfz-scict"); private final String EOSS_IP2 = System.getProperty("scnyfz-ip2"); - private final String skIP = System.getProperty("backlog-url"); - /** * 方法实现用户没有登录的时候跳转认证中心的登录地址 @@ -39,17 +31,9 @@ public class SSOPluginLogin implements ThirdSSOAuthHandler { @Override public void callTrdSSOLogin(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, String s) { logger.info(String.format("callTrdSSOLogin→httpServletRequest:%s", httpServletRequest)); - String ip; try { //退出系统 - DistributeSessionlessCache cache = CacheFactory.getCommonCacheFactory().getDistributeSessionlessCache("customRegion"); - String isNew = cache.get("isNew"); - if (StringUtils.equals("true", isNew)) { - ip = EOSS_IP2; - } else { - ip = EOSS_IP; - } - httpServletResponse.sendRedirect(ip + "/service/SGE-project-sctz-master/pc/dist/login.html"); + httpServletResponse.sendRedirect(EOSS_IP2 + "/service/SGE-project-sctz-master/pc/dist/login.html"); } catch (IOException e) { logger.info(String.format("callTrdSSOLogin→sendRedirect异常:%s", e)); throw new RuntimeException(e); @@ -67,12 +51,10 @@ 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; @@ -93,11 +75,6 @@ public class SSOPluginLogin implements ThirdSSOAuthHandler { //调用EOSS获取用户信息接口 String user = AuthService.getUserInfo(access_token, ip, client, secret); logger.info(String.format("getTrdSSOAuth→getUserInfo返回数据:%s", user)); - String userKey = "user_sessionId_" + user; - if (httpServletRequest.getParameter("eossSessionId") != null) { - //存储sessionId用于退出系统 - cache.put(userKey, httpServletRequest.getParameter("eossSessionId")); - } //当前返回类型手机,用户名,email,工号 result.setUserType(UserProperType.Mobile); // result.setUserType(UserProperType.UserName); From 4264e005cfb2da6484225de487209168cdb0afd3 Mon Sep 17 00:00:00 2001 From: Tao Date: Tue, 30 Dec 2025 10:10:10 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BA=BA=EF=BC=9A?= =?UTF-8?q?=E9=82=B9=E6=B1=9F=E6=B6=9B=20=E6=97=B6=E9=97=B4=EF=BC=9A2025-1?= =?UTF-8?q?2-18=2017=EF=BC=9A50=20=E6=8F=90=E4=BA=A4=E5=86=85=E5=AE=B9?= =?UTF-8?q?=EF=BC=9A=E5=8D=95=E7=82=B9=EF=BC=88=E5=A2=9E=E5=8A=A0=E5=A6=82?= =?UTF-8?q?=E6=9E=9Ccode=E6=B2=A1=E6=9C=89=E5=B0=B1=E7=94=A8username?= =?UTF-8?q?=E6=9D=A5=E9=AA=8C=E8=AF=81=E7=9A=84=E9=80=BB=E8=BE=91=EF=BC=89?= =?UTF-8?q?=E3=80=81=E5=BE=85=E5=8A=9E=EF=BC=88=E5=B7=B2=E5=8A=9E=E5=92=8C?= =?UTF-8?q?=E6=92=A4=E9=94=80=E4=B9=9F=E6=94=B9=E4=B8=BA=E6=89=8B=E6=9C=BA?= =?UTF-8?q?=E5=8F=B7=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../shkd/sys/sys/eoss/SSOPluginLogin.java | 23 +++++++++++++++---- .../servicehandler/BacklogServiceHandle.java | 16 ++++++------- 2 files changed, 26 insertions(+), 13 deletions(-) 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 cc2648a..37c0c6b 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 @@ -1,11 +1,14 @@ package shkd.sys.sys.eoss; +import kd.bos.exception.ErrorCode; +import kd.bos.exception.KDException; import kd.bos.logging.Log; import kd.bos.logging.LogFactory; import kd.bos.login.thirdauth.ThirdSSOAuthHandler; import kd.bos.login.thirdauth.UserAuthResult; import kd.bos.login.thirdauth.UserProperType; import org.apache.commons.lang3.StringUtils; +import shkd.sys.sys.utils.AesUtils; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -64,11 +67,9 @@ public class SSOPluginLogin implements ThirdSSOAuthHandler { UserAuthResult result = new UserAuthResult(); //获取返回的授权码 String code = httpServletRequest.getParameter("code"); - logger.info(String.format("getTrdSSOAuth→授权码code:%s", code)); - if (StringUtils.isEmpty(code)) { - result.setSucess(false); - return result; - } else { + String userName = httpServletRequest.getParameter("userName"); + + if (StringUtils.isNotEmpty(code)) { //调用EOSS获取token接口 String access_token = AuthService.accessToken(code, ip, client, secret); logger.info(String.format("getTrdSSOAuth→accessToken返回数据:%s", access_token)); @@ -81,6 +82,18 @@ public class SSOPluginLogin implements ThirdSSOAuthHandler { result.setUser(user); result.setSucess(true); logger.info("SSO用户登录成功,进入苍穹系统"); + } else if (StringUtils.isNotEmpty(userName)) { + logger.info("加密后user:" + userName); + String user = AesUtils.aesDecryptString(userName); + logger.info("SSO用户名:" + user); + result.setUserType(UserProperType.UserName); + result.setUser(user); + result.setSucess(true); + logger.info("SSO用户登录成功,进入苍穹系统"); + + } else { + result.setSucess(false); + logger.info("SSO用户登录失败"); } return result; } 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 96484b7..ff5dbdc 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 @@ -493,9 +493,9 @@ public class BacklogServiceHandle extends AbstractServiceHandler { Long taskId = ctx.getTaskId(); for (DynamicObject queryOne : query) { if (dynamicObject != null) { - DealToDoHandler.get_DealToDoHandler().sendDealToDo(taskId, queryOne.getString("username"), dynamicObject.getString("billno")); + DealToDoHandler.get_DealToDoHandler().sendDealToDo(taskId, queryOne.getString("phone"), dynamicObject.getString("billno")); } else { - DealToDoHandler.get_DealToDoHandler().sendDealToDo(taskId, queryOne.getString("username"), ""); + DealToDoHandler.get_DealToDoHandler().sendDealToDo(taskId, queryOne.getString("phone"), ""); } } } @@ -514,9 +514,9 @@ public class BacklogServiceHandle extends AbstractServiceHandler { Long taskId = ctx.getTaskId(); for (DynamicObject queryOne : query) { if (dynamicObject != null) { - DealToDoHandler.get_DealToDoHandler().sendDealToDoNew(taskId, queryOne.getString("username"), dynamicObject.getString("billno")); + DealToDoHandler.get_DealToDoHandler().sendDealToDoNew(taskId, queryOne.getString("phone"), dynamicObject.getString("billno")); } else { - DealToDoHandler.get_DealToDoHandler().sendDealToDoNew(taskId, queryOne.getString("username"), ""); + DealToDoHandler.get_DealToDoHandler().sendDealToDoNew(taskId, queryOne.getString("phone"), ""); } } } @@ -534,9 +534,9 @@ public class BacklogServiceHandle extends AbstractServiceHandler { logger.info("####撤销taskid:" + info.getTaskId()); for (DynamicObject queryOne : query) { if (dynamicObject != null) { - deleteToDoHandler.get_deleteToDoHandler().sendDeleteToDo(taskId, queryOne.getString("username"), dynamicObject.getString("billno")); + deleteToDoHandler.get_deleteToDoHandler().sendDeleteToDo(taskId, queryOne.getString("phone"), dynamicObject.getString("billno")); } else { - deleteToDoHandler.get_deleteToDoHandler().sendDeleteToDo(taskId, queryOne.getString("username"), ""); + deleteToDoHandler.get_deleteToDoHandler().sendDeleteToDo(taskId, queryOne.getString("phone"), ""); } } } @@ -554,9 +554,9 @@ public class BacklogServiceHandle extends AbstractServiceHandler { logger.info("####撤销taskid:" + info.getTaskId()); for (DynamicObject queryOne : query) { if (dynamicObject != null) { - deleteToDoHandler.get_deleteToDoHandler().sendDeleteToDoNew(taskId, queryOne.getString("username"), dynamicObject.getString("billno")); + deleteToDoHandler.get_deleteToDoHandler().sendDeleteToDoNew(taskId, queryOne.getString("phone"), dynamicObject.getString("billno")); } else { - deleteToDoHandler.get_deleteToDoHandler().sendDeleteToDoNew(taskId, queryOne.getString("username"), ""); + deleteToDoHandler.get_deleteToDoHandler().sendDeleteToDoNew(taskId, queryOne.getString("phone"), ""); } } }