Merge remote-tracking branch 'origin/main' into main

This commit is contained in:
陈绍鑫 2025-12-30 10:32:22 +08:00
commit 9cf27e4d1b
2 changed files with 27 additions and 37 deletions

View File

@ -1,21 +1,18 @@
package shkd.sys.sys.eoss;
import kd.bos.cache.CacheFactory;
import kd.bos.cache.DistributeSessionlessCache;
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 kd.bos.servicehelper.user.UserServiceHelper;
import org.apache.commons.lang3.StringUtils;
import shkd.sys.sys.utils.AesUtils;
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 +27,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 +34,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 +54,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;
@ -82,28 +67,33 @@ 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));
//调用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);
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;
}

View File

@ -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"), "");
}
}
}