Merge remote-tracking branch 'origin/main' into main
This commit is contained in:
commit
adeb9e68c3
|
@ -43,7 +43,14 @@ public class SSOPluginLogin implements ThirdSSOAuthHandler {
|
|||
String secret;
|
||||
String queryUrlOld = httpServletRequest.getQueryString();
|
||||
//有code无需再次获取code,直接结束
|
||||
if (queryUrlOld.contains("code")) {
|
||||
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));
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return;
|
||||
}
|
||||
String redirect;
|
||||
|
@ -63,9 +70,7 @@ public class SSOPluginLogin implements ThirdSSOAuthHandler {
|
|||
}
|
||||
logger.info(String.format("eoss_ip:%s,client_id:%s,client_secret:%s,重定向地址:%s", ip, client, secret, s));
|
||||
logger.info(String.format("callTrdSSOLogin→redirect:%s", redirect));
|
||||
|
||||
String ssoUrl;
|
||||
|
||||
try {
|
||||
//退出系统
|
||||
if (httpServletRequest.getRequestURI().contains("/auth/logout.do")) {
|
||||
|
@ -73,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 {
|
||||
|
@ -83,9 +92,10 @@ public class SSOPluginLogin implements ThirdSSOAuthHandler {
|
|||
ssoUrl = String.format("%s/sso2/authCenter/authorize?client_id=%s&response_type=code&sessionKeep=true&authType=0&redirect_uri=%s",
|
||||
ip, client, redirect);
|
||||
}
|
||||
logger.info(String.format("callTrdSSOLogin→→sendRedirect:%s", ssoUrl));
|
||||
httpServletResponse.sendRedirect(ssoUrl);
|
||||
logger.info(String.format("callTrdSSOLogin→sendRedirect:%s", ssoUrl));
|
||||
} catch (IOException e) {
|
||||
logger.info(String.format("callTrdSSOLogin→sendRedirect异常:%s", e));
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
@ -101,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;
|
||||
|
@ -154,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);
|
||||
|
|
|
@ -33,17 +33,15 @@ import java.util.Objects;
|
|||
import static shkd.sys.sys.midservice.utils.MobApproveListServiceHelper.allowMobApprove;
|
||||
|
||||
/**
|
||||
* @Description:
|
||||
* @Author: FangShiXiao
|
||||
* @Date: 2024/11/5 14:07
|
||||
* @Version: 1.0
|
||||
* @Ability
|
||||
*/
|
||||
public class BacklogServiceHandle extends AbstractServiceHandler {
|
||||
|
||||
public static final String TYPE = "todo";
|
||||
|
||||
private static final Log logger = LogFactory.getLog(BacklogServiceHandle.class);
|
||||
|
||||
private static final Object shkd_type =SystemParamServiceHelper.getPublicParameter("shkd_type");
|
||||
|
||||
private static final DistributeSessionlessCache cache = CacheFactory.getCommonCacheFactory().getDistributeSessionlessCache();
|
||||
|
||||
public void createToDo(MessageContext ctx, ToDoInfo todoInfo) {
|
||||
|
@ -51,7 +49,6 @@ public class BacklogServiceHandle extends AbstractServiceHandler {
|
|||
boolean b = allowMobApprove(ctx, todoInfo);
|
||||
logger.info("###推送结果为:" + b + "(true为不推送,false为推送)");
|
||||
if (!b) {
|
||||
Object shkd_type = SystemParamServiceHelper.getPublicParameter("shkd_type");
|
||||
logger.info("###shkd_type参数为"+shkd_type);
|
||||
if (Objects.equals(shkd_type, "0")) {
|
||||
//旧 eoss 环境
|
||||
|
@ -74,7 +71,7 @@ public class BacklogServiceHandle extends AbstractServiceHandler {
|
|||
// 发送首节的已办
|
||||
sendToDo(ctx);
|
||||
} catch (Exception e) {
|
||||
logger.info("###获得缓存失败,发送首节的已办失败:" + e.getMessage()+" ctx:"+ctx.toString()+" ctx.getBusinessKey:"+ctx.getBusinessKey());
|
||||
logger.info("###获得缓存失败,发送首节的已办失败:" + e.getMessage()+" ctx:"+ctx+" ctx.getBusinessKey:"+ctx.getBusinessKey());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -87,7 +84,6 @@ public class BacklogServiceHandle extends AbstractServiceHandler {
|
|||
private void sendToDo(MessageContext ctx) {
|
||||
logger.info("###进入首节已办推送方法");
|
||||
String accountId = System.getProperty("backlog-accountid");
|
||||
Object shkd_type = SystemParamServiceHelper.getPublicParameter("shkd_type");
|
||||
StringBuilder cwbSql1 = new StringBuilder();
|
||||
cwbSql1.append("SELECT ");
|
||||
cwbSql1.append("b.FID,");
|
||||
|
@ -179,7 +175,15 @@ public class BacklogServiceHandle extends AbstractServiceHandler {
|
|||
//接收人手机号
|
||||
DynamicObject dynamicObject = QueryServiceHelper.queryOne("bos_user", "number,name," +
|
||||
"phone,username", new QFilter[]{new QFilter("id", "=", next.getString("freceiveuserid"))});
|
||||
String userName = dynamicObject.getString("username");
|
||||
String userName1 = dynamicObject.getString("username");
|
||||
String userName;
|
||||
try {
|
||||
userName = AesUtils.aesEncryptString(dynamicObject.getString("username"));
|
||||
logger.info("AES加密后user:" + userName);
|
||||
} catch (Exception e) {
|
||||
ErrorCode errorCode = new ErrorCode("error_code", "AES加密出现异常,请联系运维人员排查!");
|
||||
throw new KDException(errorCode, e);
|
||||
}
|
||||
//判断是否移动端
|
||||
boolean allowMobApprove = allowMobApprove(next.get("fid"));
|
||||
if (allowMobApprove) {
|
||||
|
@ -210,21 +214,21 @@ public class BacklogServiceHandle extends AbstractServiceHandler {
|
|||
form.append("\"sendUserName\":");
|
||||
form.append("\"").append(next.getString("fstartname")).append("\",");
|
||||
form.append("\"receiveUsersysName\":");
|
||||
form.append("\"").append(userName).append("\",");
|
||||
form.append("\"").append(userName1).append("\",");
|
||||
form.append("\"receiveUserId\":");
|
||||
form.append("\"").append(userName).append("\",");
|
||||
form.append("\"").append(userName1).append("\",");
|
||||
form.append("\"handleUrl\":");
|
||||
form.append("\"").append(pcUrl).append("\",");
|
||||
form.append("\"").append(pcUrl).append("&userName=").append(userName).append("\",");
|
||||
form.append("\"appHandleUrl\":");
|
||||
form.append("\"").append(pcUrl).append("\",");
|
||||
form.append("\"").append(pcUrl).append("&userName=").append(userName).append("\",");
|
||||
// appUrl移动端查看模式
|
||||
form.append("\"appViewUrl\":");
|
||||
form.append("\"").append(pcUrl).append("&ado=view").append("\",");
|
||||
form.append("\"").append(pcUrl).append("&ado=view&userName=").append(userName).append("\",");
|
||||
form.append("\"appName\":");
|
||||
form.append("\"").append(next.getString("fentityname")).append("\",");
|
||||
//pc端查看模式
|
||||
form.append("\"viewUrl\":");
|
||||
form.append("\"").append(pcUrl).append("&ado=view").append("\",");
|
||||
form.append("\"").append(pcUrl).append("&ado=view&userName=").append(userName).append("\",");
|
||||
form.append("\"pendingId\":");
|
||||
form.append("\"").append(next.getLong("fid")).append("\",");
|
||||
form.append("\"pendingAttr\":");
|
||||
|
@ -234,9 +238,9 @@ public class BacklogServiceHandle extends AbstractServiceHandler {
|
|||
int z = 0;
|
||||
if (Objects.equals(shkd_type, "0")) {
|
||||
//旧 eoss 环境 待办
|
||||
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(), userName1, next.getString("fbillno"));
|
||||
//旧 eoss 环境 已办
|
||||
DealToDoHandler.get_DealToDoHandler().sendDealToDo(next.getLong("fid"), userName, next.getString("fbillno"));
|
||||
DealToDoHandler.get_DealToDoHandler().sendDealToDo(next.getLong("fid"), userName1, next.getString("fbillno"));
|
||||
if (ObjectUtils.isEmpty(shkd_cache)) {
|
||||
z = 604800;
|
||||
} else {
|
||||
|
@ -244,10 +248,11 @@ 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(), userName1, next.getString("fbillno"));
|
||||
//新 eoss 环境 已办
|
||||
DealToDoHandler.get_DealToDoHandler().sendDealToDoNew(next.getLong("fid"), userName, next.getString("fbillno"));
|
||||
DealToDoHandler.get_DealToDoHandler().sendDealToDoNew(next.getLong("fid"), userName1, next.getString("fbillno"));
|
||||
if (ObjectUtils.isEmpty(shkd_cache)) {
|
||||
z = 604800;
|
||||
} else {
|
||||
|
@ -255,12 +260,13 @@ 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().sendCreateToDo(form.toString(), title, next.getLong("fid").toString(), userName1, next.getString("fbillno"));
|
||||
CreateToDoHandler.get_CreateToDoHandler().sendCreateToDoNew(replace, title, next.getLong("fid").toString(), userName1, 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().sendDealToDo(next.getLong("fid"), userName1, next.getString("fbillno"));
|
||||
DealToDoHandler.get_DealToDoHandler().sendDealToDoNew(next.getLong("fid"), userName1, next.getString("fbillno"));
|
||||
if (ObjectUtils.isEmpty(shkd_cache)) {
|
||||
z = 604800;
|
||||
} else {
|
||||
|
@ -281,7 +287,6 @@ public class BacklogServiceHandle extends AbstractServiceHandler {
|
|||
boolean b = allowMobApprove(ctx, info);
|
||||
logger.info("###推送结果为:" + b + "(true为不推送,false为推送)");
|
||||
if (!b) {
|
||||
Object shkd_type = SystemParamServiceHelper.getPublicParameter("shkd_type");
|
||||
logger.info("###shkd_type参数为"+shkd_type);
|
||||
if (Objects.equals(shkd_type, "0")) {
|
||||
//旧 eoss 环境
|
||||
|
@ -304,7 +309,6 @@ public class BacklogServiceHandle extends AbstractServiceHandler {
|
|||
boolean b = allowMobApprove(ctx, info);
|
||||
logger.info("###推送结果为:" + b + "(true为不推送,false为推送)");
|
||||
if (!b) {
|
||||
Object shkd_type = SystemParamServiceHelper.getPublicParameter("shkd_type");
|
||||
logger.info("###shkd_type参数为"+shkd_type);
|
||||
if (Objects.equals(shkd_type, "0")) {
|
||||
//旧 eoss 环境
|
||||
|
@ -333,8 +337,16 @@ public class BacklogServiceHandle extends AbstractServiceHandler {
|
|||
new QFilter[]{new QFilter("id", "=", todoInfo.getTaskId())});
|
||||
logger.info("####待办taskid:" + todoInfo.getTaskId());
|
||||
for (DynamicObject query_one : query) {
|
||||
String userName;
|
||||
try {
|
||||
userName = AesUtils.aesEncryptString(query_one.getString("username"));
|
||||
logger.info("AES加密后user:" + userName);
|
||||
} catch (Exception e) {
|
||||
logger.info("####AES加密出现异常,请联系运维人员排查!");
|
||||
ErrorCode errorCode = new ErrorCode("error_code", "AES加密出现异常,请联系运维人员排查!");
|
||||
throw new KDException(errorCode, e);
|
||||
}
|
||||
StringBuilder form = new StringBuilder();
|
||||
// BacklogMessage backlogMessage = new BacklogMessage();
|
||||
form.append("{");
|
||||
form.append("\"title\":");
|
||||
form.append("\"").append(dynamicObject.getString("subject")).append("\",");
|
||||
|
@ -355,17 +367,17 @@ public class BacklogServiceHandle extends AbstractServiceHandler {
|
|||
form.append("\"handleUrl\":");
|
||||
Map<String, Object> taskInfo = GetUrlUtils.getTaskInfo(todoInfo.getTaskId());
|
||||
String url = GetUrlUtils.buildTaskUrl(taskInfo);
|
||||
form.append("\"").append(url).append("\",");
|
||||
form.append("\"").append(url).append("&userName=").append(userName).append("\",");
|
||||
form.append("\"appHandleUrl\":");
|
||||
form.append("\"").append(url).append("\",");
|
||||
form.append("\"").append(url).append("&userName=").append(userName).append("\",");
|
||||
// appUrl移动端查看模式
|
||||
form.append("\"appViewUrl\":");
|
||||
form.append("\"").append(url).append("&ado=view").append("\",");
|
||||
form.append("\"").append(url).append("&userName=").append(userName).append("&ado=view").append("\",");
|
||||
form.append("\"appName\":");
|
||||
form.append("\"").append(ctx.getEntityName()).append("\",");
|
||||
//pc端查看模式
|
||||
form.append("\"viewUrl\":");
|
||||
form.append("\"").append(url).append("&ado=view").append("\",");
|
||||
form.append("\"").append(url).append("&userName=").append(userName).append("&ado=view").append("\",");
|
||||
form.append("\"pendingId\":");
|
||||
form.append("\"").append(todoInfo.getTaskId()).append("\",");
|
||||
form.append("\"pendingAttr\":");
|
||||
|
@ -389,6 +401,15 @@ public class BacklogServiceHandle extends AbstractServiceHandler {
|
|||
new QFilter[]{new QFilter("id", "=", todoInfo.getTaskId())});
|
||||
logger.info("####新EOSS待办taskid:" + todoInfo.getTaskId());
|
||||
for (DynamicObject query_one : query) {
|
||||
String userName;
|
||||
try {
|
||||
userName = AesUtils.aesEncryptString(query_one.getString("username"));
|
||||
logger.info("AES加密后user:" + userName);
|
||||
} catch (Exception e) {
|
||||
logger.info("####AES加密出现异常,请联系运维人员排查!");
|
||||
ErrorCode errorCode = new ErrorCode("error_code", "AES加密出现异常,请联系运维人员排查!");
|
||||
throw new KDException(errorCode, e);
|
||||
}
|
||||
StringBuilder form = new StringBuilder();
|
||||
form.append("{");
|
||||
form.append("\"title\":");
|
||||
|
@ -410,18 +431,17 @@ public class BacklogServiceHandle extends AbstractServiceHandler {
|
|||
form.append("\"handleUrl\":");
|
||||
Map<String, Object> taskInfo = GetUrlUtils.getTaskInfo(todoInfo.getTaskId());
|
||||
String url = GetUrlUtils.buildTaskUrl(taskInfo);
|
||||
form.append("\"").append(url).append("&isNew=true").append("\",");
|
||||
form.append("\"").append(url).append("&userName=").append(userName).append("\",");
|
||||
form.append("\"appHandleUrl\":");
|
||||
form.append("\"").append(url).append("&isNew=true").append("\",");
|
||||
form.append("\"").append(url).append("&userName=").append(userName).append("\",");
|
||||
// appUrl移动端查看模式
|
||||
form.append("\"appViewUrl\":");
|
||||
form.append("\"").append(url).append("&isNew=true").append("&ado=view").append("\",");
|
||||
|
||||
form.append("\"").append(url).append("&userName=").append(userName).append("&ado=view").append("\",");
|
||||
form.append("\"appName\":");
|
||||
form.append("\"").append(ctx.getEntityName()).append("\",");
|
||||
//pc端查看模式
|
||||
form.append("\"viewUrl\":");
|
||||
form.append("\"").append(url).append("&isNew=true").append("&ado=view").append("\",");
|
||||
form.append("\"").append(url).append("&userName=").append(userName).append("&ado=view").append("\",");
|
||||
form.append("\"pendingId\":");
|
||||
form.append("\"").append(todoInfo.getTaskId()).append("\",");
|
||||
form.append("\"pendingAttr\":");
|
||||
|
|
Loading…
Reference in New Issue