From e478b98a093c527619fc0ad195002d9843186e1e Mon Sep 17 00:00:00 2001 From: shilei Date: Tue, 14 Feb 2023 19:26:21 +0800 Subject: [PATCH] =?UTF-8?q?#HJ-27#=20=E6=8F=90=E4=BA=A4=E6=9C=80=E6=96=B0?= =?UTF-8?q?=E7=9A=84=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- interface/mobilejump/mobilejump.jsp | 2 +- .../dito/sendtodo/SendPortalDoneUtil.java | 10 + .../dito/sendtodo/SendPortalToReadUtil.java | 27 +- .../dito/sendtodo/SendPortalTodoUtil.java | 15 +- .../sendtodo/SendPortalWithRawRunnable.java | 6 + .../sendtodo/SendRemarkOperateTodoCmd.java | 485 +++++++++--------- .../dito/reqremark/cmd/RequestRemarkCmd.java | 28 +- .../dito/job/WorkflowSyncCornJob.java | 16 +- .../dito/job/WorkflowUserCronJob.java | 19 +- 9 files changed, 352 insertions(+), 256 deletions(-) diff --git a/interface/mobilejump/mobilejump.jsp b/interface/mobilejump/mobilejump.jsp index 034cc68f..d4be12d0 100644 --- a/interface/mobilejump/mobilejump.jsp +++ b/interface/mobilejump/mobilejump.jsp @@ -16,7 +16,7 @@ } //alert("jump"); - my.postMessage({name:"onMessage"}); + //my.postMessage({name:"onMessage"}); // 接收来自小程序的消息。 // my.onMessage = function(e) { diff --git a/src/com/customization/dito/sendtodo/SendPortalDoneUtil.java b/src/com/customization/dito/sendtodo/SendPortalDoneUtil.java index c0bce86e..f6cdabd2 100644 --- a/src/com/customization/dito/sendtodo/SendPortalDoneUtil.java +++ b/src/com/customization/dito/sendtodo/SendPortalDoneUtil.java @@ -3,6 +3,7 @@ package com.customization.dito.sendtodo; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.time.util.DateUtil; +import org.apache.commons.lang.StringUtils; import weaver.conn.RecordSet; import weaver.general.BaseBean; import weaver.general.Util; @@ -465,6 +466,9 @@ public class SendPortalDoneUtil { public void sendPortalDoneData(String requestid, String nodeid, User user, String portal_doneurl, String bpm_app_workflowurl, String username, String passwd, String bpm_workflowurl, String bpm_app_requesturl) { BaseBean bb = new BaseBean(); bb.writeLog("sendPortalDoneData"); + + String mobileJumpUrl = PropBean.getUfPropValue("mobileJumpUrl"); + try { HttpRequestUtil httpRequestUtil = new HttpRequestUtil(); RecordSet rs = new RecordSet(); @@ -488,6 +492,12 @@ public class SendPortalDoneUtil { String replace = bpm_app_workflowurl.replace("/bpm", ""); String urlDing = replace+bpm_app_requesturl+requestid; String urlApp = replace+bpm_app_requesturl+requestid; + + if(StringUtils.isNotEmpty(mobileJumpUrl)){ + urlDing += "&returnUrl="+URLEncoder.encode(mobileJumpUrl,"UTF-8"); + urlApp += "&returnUrl="+URLEncoder.encode(mobileJumpUrl,"UTF-8"); + } + sql = " select t1.workflowid,t1.requestname,t1.requestmark,t1.creater,t1.createdate,t1.createtime,h1.lastname,h1.loginid,\n" + " t1.requestid as taskCode,t1.currentnodeid as nodeid,d1.nodename\n" + " from workflow_requestbase t1\n" + diff --git a/src/com/customization/dito/sendtodo/SendPortalToReadUtil.java b/src/com/customization/dito/sendtodo/SendPortalToReadUtil.java index c8360961..33321cfe 100644 --- a/src/com/customization/dito/sendtodo/SendPortalToReadUtil.java +++ b/src/com/customization/dito/sendtodo/SendPortalToReadUtil.java @@ -53,6 +53,8 @@ public class SendPortalToReadUtil { String processTime = DateUtil.getCurrentTime("yyyy-MM-dd HH:mm:ss"); JSONArray taskObjectList = new JSONArray(); int u_userid = user.getUID(); + String lastname = user.getLastname(); + String workcode = ""; String sql = " select * from (select id, lastname,loginid from hrmresource where status = 1 union all select id, lastname,loginid from hrmresourcemanager ) w where w.id = '" + u_userid + "'"; rs.executeQuery(sql); @@ -194,9 +196,12 @@ public class SendPortalToReadUtil { bb.writeLog("emailArray:"+emailArray); if(StringUtils.isNotEmpty(emailArray)) { - String notificationSubject = "You have a new to-read list:"+requestname+",Please handle it in time"; - String notificationContent = "You have a new to-read list:"+requestname+",Please handle it in time"; - sendMailUtil.sendMail(requestid,emailArray,notificationSubject,notificationContent); + Map templateMap = getEmailTemplate(requestname,lastname,processTime); + String notificationSubject = templateMap.get("notificationSubject"); + String notificationContent = templateMap.get("notificationContent"); + + + //sendMailUtil.sendMail(requestid,emailArray,notificationSubject,notificationContent); } } catch (Exception e) { @@ -239,6 +244,8 @@ public class SendPortalToReadUtil { try { int u_userid = user.getUID(); + String lastname = user.getLastname(); + String workcode = ""; String sql = " select * from (select id, lastname,loginid from hrmresource where status = 1 union all select id, lastname,loginid from hrmresourcemanager ) w where w.id = '" + u_userid + "'"; rs.executeQuery(sql); @@ -404,9 +411,11 @@ public class SendPortalToReadUtil { bb.writeLog("emailArray:" + emailArray); if (StringUtils.isNotEmpty(emailArray)) { - String notificationSubject = "You have a new to-read list:" + requestname + ",Please handle it in time"; - String notificationContent = "You have a new to-read list:" + requestname + ",Please handle it in time"; - sendMailUtil.sendMail(requestid, emailArray, notificationSubject, notificationContent); + + Map templateMap = getEmailTemplate(requestname,lastname,processTime); + String notificationSubject = templateMap.get("notificationSubject"); + String notificationContent = templateMap.get("notificationContent"); + //sendMailUtil.sendMail(requestid, emailArray, notificationSubject, notificationContent); } } } catch (Exception e) { @@ -429,12 +438,12 @@ public class SendPortalToReadUtil { * @param operatorTime * @return */ - public Map getEmailTemplate(String requestname, String operator, String operatorTime){ + public Map getEmailTemplate(String requestname,String operator,String operatorTime){ Map dataMap = new HashMap(); - String notificationSubject = "You have a new To-Do task - <"+requestname+"> "; + String notificationSubject = "You have a new To-Read - <"+requestname+"> "; String notificationContent = operator + " created this task on "+operatorTime+"\n" + - "Please handle it in time."; + " Please handle it in time."; dataMap.put("notificationSubject",notificationSubject); dataMap.put("notificationContent",notificationContent); diff --git a/src/com/customization/dito/sendtodo/SendPortalTodoUtil.java b/src/com/customization/dito/sendtodo/SendPortalTodoUtil.java index 6ba1826c..201ede99 100644 --- a/src/com/customization/dito/sendtodo/SendPortalTodoUtil.java +++ b/src/com/customization/dito/sendtodo/SendPortalTodoUtil.java @@ -512,6 +512,12 @@ public class SendPortalTodoUtil { String replace = bpm_app_workflowurl.replace("/bpm", ""); String urlDing = replace+bpm_app_requesturl+requestid; String urlApp = replace+bpm_app_requesturl+requestid; + if(StringUtils.isNotEmpty(mobileJumpUrl)){ + urlDing += "&returnUrl="+URLEncoder.encode(mobileJumpUrl,"UTF-8"); + urlApp += "&returnUrl="+URLEncoder.encode(mobileJumpUrl,"UTF-8"); + } + + bb.writeLog("urlDing", urlDing); requestObject.put("center",center); @@ -792,6 +798,9 @@ public class SendPortalTodoUtil { return name; } + + + /*** * * @param requestname @@ -799,12 +808,12 @@ public class SendPortalTodoUtil { * @param operatorTime * @return */ - public Map getEmailTemplate(String requestname,String operator,String operatorTime){ + public Map getEmailTemplate(String requestname, String operator, String operatorTime){ Map dataMap = new HashMap(); - String notificationSubject = "You have a new To-Read - <"+requestname+"> "; + String notificationSubject = "You have a new To-Do task - <"+requestname+"> "; String notificationContent = operator + " created this task on "+operatorTime+"\n" + - "Please handle it in time."; + "Please handle it in time."; dataMap.put("notificationSubject",notificationSubject); dataMap.put("notificationContent",notificationContent); diff --git a/src/com/customization/dito/sendtodo/SendPortalWithRawRunnable.java b/src/com/customization/dito/sendtodo/SendPortalWithRawRunnable.java index 950b9c15..3fca6619 100644 --- a/src/com/customization/dito/sendtodo/SendPortalWithRawRunnable.java +++ b/src/com/customization/dito/sendtodo/SendPortalWithRawRunnable.java @@ -294,8 +294,14 @@ public class SendPortalWithRawRunnable implements Runnable{ String replace = bpm_app_workflowurl.replace("/bpm", ""); String urlDing = replace+bpm_app_requesturl+requestid; String urlApp = replace+bpm_app_requesturl+requestid; + + if(StringUtils.isNotEmpty(mobileJumpUrl)){ + urlDing += "&returnUrl="+URLEncoder.encode(mobileJumpUrl,"UTF-8"); + urlApp += "&returnUrl="+URLEncoder.encode(mobileJumpUrl,"UTF-8"); + } bb.writeLog("urlDing", urlDing); + String requestname = "" ; String workflowname = "" ; String nodeId = "" ; diff --git a/src/com/customization/dito/sendtodo/SendRemarkOperateTodoCmd.java b/src/com/customization/dito/sendtodo/SendRemarkOperateTodoCmd.java index de7e5be6..9d01ada1 100644 --- a/src/com/customization/dito/sendtodo/SendRemarkOperateTodoCmd.java +++ b/src/com/customization/dito/sendtodo/SendRemarkOperateTodoCmd.java @@ -6,6 +6,7 @@ import com.engine.core.cfg.annotation.CommandDynamicProxy; import com.engine.core.interceptor.AbstractCommandProxy; import com.engine.core.interceptor.Command; import com.engine.workflow.cmd.requestForm.ForwardSubmitCmd; +import org.apache.commons.lang.StringUtils; import weaver.conn.RecordSet; import weaver.file.FileUpload; import weaver.general.BaseBean; @@ -14,6 +15,7 @@ import weaver.hrm.User; import weaver.interfaces.dito.comInfo.PropBean; import javax.servlet.http.HttpServletRequest; +import java.net.URLEncoder; import java.util.Map; @@ -80,248 +82,248 @@ public class SendRemarkOperateTodoCmd extends AbstractCommandProxy 1 or t1.deleted is null or t1.deleted = '')\n" + - " and ((t2.isremark = '0' and (t2.takisremark is null or t2.takisremark = 0)) or t2.isremark in ('1', '5', '8', '9', '7', '11'))\n" + - " and t2.islasttimes = 1\n" + - " and (t2.isprocessing = '' or t2.isprocessing is null)\n" + - " and t2.REQUESTID = " + requestid + - " and t2.nodeid = " + noideid; - bb.writeLog("sendTodoDataByNode--sql:" + sql); - rs.executeQuery(sql); - while (rs.next()) { - count++; - } - bb.writeLog("sendTodoDataByNode--count:" + count); - if (count > 0) { - - JSONArray taskObjectList = new JSONArray(); - actionType = "1"; - - sql = " select t1.requestname,t1.requestmark,t1.creater,t1.createdate,t1.createtime,h1.lastname,h1.loginid,\n" + - " t1.requestid as taskCode,t1.currentnodeid as nodeid,d1.nodename\n" + - " from workflow_requestbase t1\n" + - " inner join workflow_base t3 on t1.workflowid = t3.id\n" + - " left join workflow_nodebase d1 on d1.id = t1.currentnodeid " + - " left join (select id, lastname,loginid from hrmresource where status = 1 union all select id, lastname,loginid from hrmresourcemanager ) h1 on h1.id = t1.creater\n" + - " where (t1.deleted <> 1 or t1.deleted is null or t1.deleted = '')\n" + - " and t1.requestid = " + requestid + - " and t1.currentnodeid = " + noideid; - - bb.writeLog("sendTodoDataByNode--sql:" + sql); - - rs.executeQuery(sql); - if (rs.next()) { - - String title = Util.null2String(rs.getString("requestname")); - String creator = Util.null2String(rs.getString("loginid")); - String taskCode = Util.null2String(rs.getString("taskcode")); - String nodeId = Util.null2String(rs.getString("nodeid")); - - String createdate = Util.null2String(rs.getString("createdate")); - String createtime = Util.null2String(rs.getString("createtime")); - String messageTitle = Util.null2String(rs.getString("requestname")); -// messageTitle = getShortMessageTitle(messageTitle); - String messageContent = Util.null2String(rs.getString("requestname")); - - String taskType = "0"; - - String urlPc = "[newtab]" + bpm_workflowurl + "/workflow/request/ViewRequestForwardSPA.jsp?requestid=" + requestid; - String urlApp = "[newtab]" + bpm_workflowurl + "/spa/workflow/static4mobileform/index.html#/req?requestid=" + requestid; - String urlDing = "[newtab]" + bpm_workflowurl + "/spa/workflow/static4mobileform/index.html#/req?requestid=" + requestid; - String nodeName = Util.null2String(rs.getString("nodeName")); - - - requestObject.put("center", center); - requestObject.put("title", title); - requestObject.put("creator", creator); - requestObject.put("taskCode", taskCode); - requestObject.put("nodeId", nodeId); - requestObject.put("taskType", taskType); - requestObject.put("actionType", actionType); - requestObject.put("createDate", createdate + " " + createtime); - requestObject.put("messageTitle", messageTitle); - requestObject.put("messageContent", messageContent); - requestObject.put("terminal", terminal); - requestObject.put("urlPc", urlPc); - requestObject.put("urlApp", urlApp); - requestObject.put("urlDing", urlDing); - requestObject.put("nodeName", nodeName); - requestObject.put("ticketType", ticketType); - } - - JSONObject taskObject = new JSONObject(); - String objectAction = "1"; - String objectType = "0"; - String objectCode = user.getLoginid(); - String objectId = ""; - String operatorCode = user.getLoginid(); - - taskObject.put("objectAction", objectAction); - taskObject.put("objectType", objectType); - taskObject.put("objectCode", objectCode); - taskObject.put("objectId", objectId); - taskObject.put("operatorCode", operatorCode); - taskObjectList.add(taskObject); - requestObject.put("taskObjectList", taskObjectList); - - } else { - - JSONArray taskObjectList = new JSONArray(); - actionType = "2"; - - sql = " select t1.requestname,t1.requestmark,t1.creater,t1.createdate,t1.createtime,h1.lastname,h1.loginid,\n" + - " t1.requestid as taskCode,t1.currentnodeid as nodeid,d1.nodename\n" + - " from workflow_requestbase t1\n" + - " inner join workflow_base t3 on t1.workflowid = t3.id\n" + - " left join workflow_nodebase d1 on d1.id = t1.currentnodeid " + - " left join (select id, lastname,loginid from hrmresource where status = 1 union all select id, lastname,loginid from hrmresourcemanager ) h1 on h1.id = t1.creater\n" + - " where (t1.deleted <> 1 or t1.deleted is null or t1.deleted = '')\n" + - " and t1.requestid = " + requestid; - bb.writeLog("sendTodoDataByNode--sql:" + sql); - rs.executeQuery(sql); - if (rs.next()) { - - String title = Util.null2String(rs.getString("requestname")); - String creator = Util.null2String(rs.getString("loginid")); - String taskCode = Util.null2String(rs.getString("taskcode")); - String nodeId = Util.null2String(rs.getString("nodeid")); - - String createdate = Util.null2String(rs.getString("createdate")); - String createtime = Util.null2String(rs.getString("createtime")); - String messageTitle = Util.null2String(rs.getString("requestname")); -// messageTitle = getShortMessageTitle(messageTitle); - String messageContent = Util.null2String(rs.getString("requestname")); - - String taskType = "0"; - - String urlPc = "[newtab]" + bpm_workflowurl + "/workflow/request/ViewRequestForwardSPA.jsp?requestid=" + requestid; - String urlApp = "[newtab]" + bpm_workflowurl + "/spa/workflow/static4mobileform/index.html#/req?requestid=" + requestid; - String urlDing = "[newtab]" + bpm_workflowurl + "/spa/workflow/static4mobileform/index.html#/req?requestid=" + requestid; - String nodeName = Util.null2String(rs.getString("nodeName")); - - requestObject.put("center", center); - requestObject.put("title", title); - requestObject.put("creator", creator); - requestObject.put("taskCode", taskCode); - requestObject.put("nodeId", nodeId); - requestObject.put("taskType", taskType); - requestObject.put("actionType", actionType); - requestObject.put("createDate", createdate + " " + createtime); - requestObject.put("messageTitle", messageTitle); - requestObject.put("messageContent", messageContent); - requestObject.put("terminal", terminal); - requestObject.put("urlPc", urlPc); - requestObject.put("urlApp", urlApp); - requestObject.put("urlDing", urlDing); - requestObject.put("nodeName", nodeName); - requestObject.put("ticketType", ticketType); - } - -// sql = " select t2.userid,h1.loginid\n" + +// public void sendTodoDataByNode(String requestid, String noideid, User user, String portal_todourl, String username, String passwd, String bpm_workflowurl, String center) { +// HttpReqUtils httpReqUtils = new HttpReqUtils(); +// JSONObject requestObject = new JSONObject(); +// +// BaseBean bb = new BaseBean(); +// bb.writeLog("sendTodoDataByNode"); +// RecordSet rs = new RecordSet(); +// String ticketType = center; +// String terminal = "1"; +// try { +// +// String currentnodetype = ""; +// String sql = " select currentnodetype from workflow_requestbase where requestid=" + requestid; +// rs.executeQuery(sql); +// bb.writeLog("sendTodoDataByNode--sql:" + sql); +// if (rs.next()) { +// currentnodetype = Util.null2String(rs.getString("CURRENTNODETYPE")); +// } +// bb.writeLog("sendTodoDataByNode--currentnodetype:" + currentnodetype); +// if ("3".equals(currentnodetype)) { +// String actionType = "3"; +// +// } else { +// +// String actionType = ""; +// int count = 0; +// sql = " select t2.userid,h1.loginid\n" + +// " from workflow_requestbase t1\n" + +// " inner join workflow_currentoperator t2 on t1.requestid = t2.requestid\n" + +// " left join (select id, lastname,loginid from hrmresource where status = 1 union all select id,lastname,loginid from hrmresourcemanager ) h1 on h1.id = t2.userid\n" + +// " where (t1.deleted <> 1 or t1.deleted is null or t1.deleted = '')\n" + +// " and ((t2.isremark = '0' and (t2.takisremark is null or t2.takisremark = 0)) or t2.isremark in ('1', '5', '8', '9', '7', '11'))\n" + +// " and t2.islasttimes = 1\n" + +// " and (t2.isprocessing = '' or t2.isprocessing is null)\n" + +// " and t2.REQUESTID = " + requestid + +// " and t2.nodeid = " + noideid; +// bb.writeLog("sendTodoDataByNode--sql:" + sql); +// rs.executeQuery(sql); +// while (rs.next()) { +// count++; +// } +// bb.writeLog("sendTodoDataByNode--count:" + count); +// if (count > 0) { +// +// JSONArray taskObjectList = new JSONArray(); +// actionType = "1"; +// +// sql = " select t1.requestname,t1.requestmark,t1.creater,t1.createdate,t1.createtime,h1.lastname,h1.loginid,\n" + +// " t1.requestid as taskCode,t1.currentnodeid as nodeid,d1.nodename\n" + +// " from workflow_requestbase t1\n" + +// " inner join workflow_base t3 on t1.workflowid = t3.id\n" + +// " left join workflow_nodebase d1 on d1.id = t1.currentnodeid " + +// " left join (select id, lastname,loginid from hrmresource where status = 1 union all select id, lastname,loginid from hrmresourcemanager ) h1 on h1.id = t1.creater\n" + +// " where (t1.deleted <> 1 or t1.deleted is null or t1.deleted = '')\n" + +// " and t1.requestid = " + requestid + +// " and t1.currentnodeid = " + noideid; +// +// bb.writeLog("sendTodoDataByNode--sql:" + sql); +// +// rs.executeQuery(sql); +// if (rs.next()) { +// +// String title = Util.null2String(rs.getString("requestname")); +// String creator = Util.null2String(rs.getString("loginid")); +// String taskCode = Util.null2String(rs.getString("taskcode")); +// String nodeId = Util.null2String(rs.getString("nodeid")); +// +// String createdate = Util.null2String(rs.getString("createdate")); +// String createtime = Util.null2String(rs.getString("createtime")); +// String messageTitle = Util.null2String(rs.getString("requestname")); +//// messageTitle = getShortMessageTitle(messageTitle); +// String messageContent = Util.null2String(rs.getString("requestname")); +// +// String taskType = "0"; +// +// String urlPc = "[newtab]" + bpm_workflowurl + "/workflow/request/ViewRequestForwardSPA.jsp?requestid=" + requestid; +// String urlApp = "[newtab]" + bpm_workflowurl + "/spa/workflow/static4mobileform/index.html#/req?requestid=" + requestid; +// String urlDing = "[newtab]" + bpm_workflowurl + "/spa/workflow/static4mobileform/index.html#/req?requestid=" + requestid; +// String nodeName = Util.null2String(rs.getString("nodeName")); +// +// +// requestObject.put("center", center); +// requestObject.put("title", title); +// requestObject.put("creator", creator); +// requestObject.put("taskCode", taskCode); +// requestObject.put("nodeId", nodeId); +// requestObject.put("taskType", taskType); +// requestObject.put("actionType", actionType); +// requestObject.put("createDate", createdate + " " + createtime); +// requestObject.put("messageTitle", messageTitle); +// requestObject.put("messageContent", messageContent); +// requestObject.put("terminal", terminal); +// requestObject.put("urlPc", urlPc); +// requestObject.put("urlApp", urlApp); +// requestObject.put("urlDing", urlDing); +// requestObject.put("nodeName", nodeName); +// requestObject.put("ticketType", ticketType); +// } +// +// JSONObject taskObject = new JSONObject(); +// String objectAction = "1"; +// String objectType = "0"; +// String objectCode = user.getLoginid(); +// String objectId = ""; +// String operatorCode = user.getLoginid(); +// +// taskObject.put("objectAction", objectAction); +// taskObject.put("objectType", objectType); +// taskObject.put("objectCode", objectCode); +// taskObject.put("objectId", objectId); +// taskObject.put("operatorCode", operatorCode); +// taskObjectList.add(taskObject); +// requestObject.put("taskObjectList", taskObjectList); +// +// } else { +// +// JSONArray taskObjectList = new JSONArray(); +// actionType = "2"; +// +// sql = " select t1.requestname,t1.requestmark,t1.creater,t1.createdate,t1.createtime,h1.lastname,h1.loginid,\n" + +// " t1.requestid as taskCode,t1.currentnodeid as nodeid,d1.nodename\n" + +// " from workflow_requestbase t1\n" + +// " inner join workflow_base t3 on t1.workflowid = t3.id\n" + +// " left join workflow_nodebase d1 on d1.id = t1.currentnodeid " + +// " left join (select id, lastname,loginid from hrmresource where status = 1 union all select id, lastname,loginid from hrmresourcemanager ) h1 on h1.id = t1.creater\n" + +// " where (t1.deleted <> 1 or t1.deleted is null or t1.deleted = '')\n" + +// " and t1.requestid = " + requestid; +// bb.writeLog("sendTodoDataByNode--sql:" + sql); +// rs.executeQuery(sql); +// if (rs.next()) { +// +// String title = Util.null2String(rs.getString("requestname")); +// String creator = Util.null2String(rs.getString("loginid")); +// String taskCode = Util.null2String(rs.getString("taskcode")); +// String nodeId = Util.null2String(rs.getString("nodeid")); +// +// String createdate = Util.null2String(rs.getString("createdate")); +// String createtime = Util.null2String(rs.getString("createtime")); +// String messageTitle = Util.null2String(rs.getString("requestname")); +//// messageTitle = getShortMessageTitle(messageTitle); +// String messageContent = Util.null2String(rs.getString("requestname")); +// +// String taskType = "0"; +// +// String urlPc = "[newtab]" + bpm_workflowurl + "/workflow/request/ViewRequestForwardSPA.jsp?requestid=" + requestid; +// String urlApp = "[newtab]" + bpm_workflowurl + "/spa/workflow/static4mobileform/index.html#/req?requestid=" + requestid; +// String urlDing = "[newtab]" + bpm_workflowurl + "/spa/workflow/static4mobileform/index.html#/req?requestid=" + requestid; +// String nodeName = Util.null2String(rs.getString("nodeName")); +// +// requestObject.put("center", center); +// requestObject.put("title", title); +// requestObject.put("creator", creator); +// requestObject.put("taskCode", taskCode); +// requestObject.put("nodeId", nodeId); +// requestObject.put("taskType", taskType); +// requestObject.put("actionType", actionType); +// requestObject.put("createDate", createdate + " " + createtime); +// requestObject.put("messageTitle", messageTitle); +// requestObject.put("messageContent", messageContent); +// requestObject.put("terminal", terminal); +// requestObject.put("urlPc", urlPc); +// requestObject.put("urlApp", urlApp); +// requestObject.put("urlDing", urlDing); +// requestObject.put("nodeName", nodeName); +// requestObject.put("ticketType", ticketType); +// } +// +//// sql = " select t2.userid,h1.loginid\n" + +//// " from workflow_requestbase t1\n" + +//// " inner join workflow_currentoperator t2 on t1.requestid = t2.requestid\n" + +//// " left join (select id, lastname,loginid from hrmresource where STATUS = 1 union all select id, lastname,loginid from hrmresourcemanager ) h1 on h1.id = t2.userid\n" + +//// " where (t1.deleted <> 1 or t1.deleted is null or t1.deleted = '')\n" + +//// " and t2.REQUESTID = "+requestid+ +//// " and t2.nodeid = " + noideid ; +//// bb.writeLog("sendTodoDataByNode--sql:"+sql); +//// rs.executeQuery(sql); +//// while (rs.next()){ +//// JSONObject taskObject = new JSONObject(); +//// String objectAction = "1" ; +//// String objectType = "0"; +//// String objectCode = user.getLoginid() ; +//// String objectId = "" ; +//// String operatorCode = user.getLoginid() ; +//// +//// taskObject.put("objectAction",objectAction); +//// taskObject.put("objectType",objectType); +//// taskObject.put("objectCode",objectCode); +//// taskObject.put("objectId",objectId); +//// taskObject.put("operatorCode",operatorCode); +//// taskObjectList.add(taskObject); +//// } +// +// sql = " select t2.userid,h1.loginid\n" + // " from workflow_requestbase t1\n" + // " inner join workflow_currentoperator t2 on t1.requestid = t2.requestid\n" + // " left join (select id, lastname,loginid from hrmresource where STATUS = 1 union all select id, lastname,loginid from hrmresourcemanager ) h1 on h1.id = t2.userid\n" + // " where (t1.deleted <> 1 or t1.deleted is null or t1.deleted = '')\n" + -// " and t2.REQUESTID = "+requestid+ -// " and t2.nodeid = " + noideid ; -// bb.writeLog("sendTodoDataByNode--sql:"+sql); +// " and ((t2.isremark = '0' and (t2.takisremark is null or t2.takisremark = 0)) or t2.isremark in ('1', '5', '8', '9', '7', '11'))\n" + +// " and t2.islasttimes = 1\n" + +// " and (t2.isprocessing = '' or t2.isprocessing is null)\n" + +// " and t2.REQUESTID = " + requestid; +// bb.writeLog("sendTodoDataByNode--sql:" + sql); // rs.executeQuery(sql); -// while (rs.next()){ +// while (rs.next()) { +// +// String usercode = Util.null2String(rs.getString("loginid")); // JSONObject taskObject = new JSONObject(); -// String objectAction = "1" ; +// String objectAction = "0"; // String objectType = "0"; -// String objectCode = user.getLoginid() ; -// String objectId = "" ; -// String operatorCode = user.getLoginid() ; +// String objectCode = usercode; +// String objectId = ""; +// String operatorCode = usercode; // -// taskObject.put("objectAction",objectAction); -// taskObject.put("objectType",objectType); -// taskObject.put("objectCode",objectCode); -// taskObject.put("objectId",objectId); -// taskObject.put("operatorCode",operatorCode); +// taskObject.put("objectAction", objectAction); +// taskObject.put("objectType", objectType); +// taskObject.put("objectCode", objectCode); +// taskObject.put("objectId", objectId); +// taskObject.put("operatorCode", operatorCode); // taskObjectList.add(taskObject); // } - - sql = " select t2.userid,h1.loginid\n" + - " from workflow_requestbase t1\n" + - " inner join workflow_currentoperator t2 on t1.requestid = t2.requestid\n" + - " left join (select id, lastname,loginid from hrmresource where STATUS = 1 union all select id, lastname,loginid from hrmresourcemanager ) h1 on h1.id = t2.userid\n" + - " where (t1.deleted <> 1 or t1.deleted is null or t1.deleted = '')\n" + - " and ((t2.isremark = '0' and (t2.takisremark is null or t2.takisremark = 0)) or t2.isremark in ('1', '5', '8', '9', '7', '11'))\n" + - " and t2.islasttimes = 1\n" + - " and (t2.isprocessing = '' or t2.isprocessing is null)\n" + - " and t2.REQUESTID = " + requestid; - bb.writeLog("sendTodoDataByNode--sql:" + sql); - rs.executeQuery(sql); - while (rs.next()) { - - String usercode = Util.null2String(rs.getString("loginid")); - JSONObject taskObject = new JSONObject(); - String objectAction = "0"; - String objectType = "0"; - String objectCode = usercode; - String objectId = ""; - String operatorCode = usercode; - - taskObject.put("objectAction", objectAction); - taskObject.put("objectType", objectType); - taskObject.put("objectCode", objectCode); - taskObject.put("objectId", objectId); - taskObject.put("operatorCode", operatorCode); - taskObjectList.add(taskObject); - } - requestObject.put("taskObjectList", taskObjectList); - } - -// String username = "admin"; -// String passwd = "Uportal_123"; -// String todourl = "http://172.16.25.133/portal-web/centerTodo/sync" ; - - //"Basic YWRtaW46VXBvcnRhbF8xMjM=" - - String auth = username + ":" + passwd; - bb.writeLog("requestObject:" + requestObject.toJSONString()); - String msgdata = httpReqUtils.doPostByAuth2(portal_todourl, requestObject.toJSONString(), auth); - bb.writeLog("msgdata:" + msgdata); - if (!"".equals(msgdata)) { - JSONObject msgObject = JSONObject.parseObject(msgdata); - System.out.println(msgObject); - } - } - } catch (Exception e) { - e.printStackTrace(); - } - } +// requestObject.put("taskObjectList", taskObjectList); +// } +// +//// String username = "admin"; +//// String passwd = "Uportal_123"; +//// String todourl = "http://172.16.25.133/portal-web/centerTodo/sync" ; +// +// //"Basic YWRtaW46VXBvcnRhbF8xMjM=" +// +// String auth = username + ":" + passwd; +// bb.writeLog("requestObject:" + requestObject.toJSONString()); +// String msgdata = httpReqUtils.doPostByAuth2(portal_todourl, requestObject.toJSONString(), auth); +// bb.writeLog("msgdata:" + msgdata); +// if (!"".equals(msgdata)) { +// JSONObject msgObject = JSONObject.parseObject(msgdata); +// System.out.println(msgObject); +// } +// } +// } catch (Exception e) { +// e.printStackTrace(); +// } +// } /*** * @@ -333,7 +335,7 @@ public class SendRemarkOperateTodoCmd extends AbstractCommandProxy> String passwd = PropBean.getUfPropValue("passwd"); String center = PropBean.getUfPropValue("center"); String bpm_workflowurl = PropBean.getUfPropValue("bpm_workflowurl"); - + String mobileJumpUrl = PropBean.getUfPropValue("mobileJumpUrl"); BaseBean bb = new BaseBean(); RecordSet rs = new RecordSet(); @@ -195,11 +195,19 @@ public class RequestRemarkCmd extends AbstractCommonCommand> } String urlPc = "[newtab]" + bpm_workflowurl + "/workflow/request/ViewRequestForwardSPA.jsp?requestid=" + requestid; - String app_requestUrl = bpm_app_requesturl + requestid; - app_requestUrl = URLEncoder.encode(app_requestUrl, "UTF-8"); - String urlApp = "[newtab]" + bpm_app_workflowurl + "/interface/mobilelogin/loginsso.jsp?em_auth_usercode=" + workcode + "&forwardurl=" + app_requestUrl; +// String app_requestUrl = bpm_app_requesturl + requestid; +// app_requestUrl = URLEncoder.encode(app_requestUrl, "UTF-8"); +// String urlApp = "[newtab]" + bpm_app_workflowurl + "/interface/mobilelogin/loginsso.jsp?em_auth_usercode=" + workcode + "&forwardurl=" + app_requestUrl; String replace = bpm_app_workflowurl.replace("/bpm", ""); +// String urlDing = replace+bpm_app_requesturl+requestid; + String urlDing = replace+bpm_app_requesturl+requestid; + String urlApp = replace+bpm_app_requesturl+requestid; + if(StringUtils.isNotEmpty(mobileJumpUrl)){ + urlDing += "&returnUrl="+URLEncoder.encode(mobileJumpUrl,"UTF-8"); + urlApp += "&returnUrl="+URLEncoder.encode(mobileJumpUrl,"UTF-8"); + } + String requestname = ""; String workflowname = "" ; @@ -298,6 +306,7 @@ public class RequestRemarkCmd extends AbstractCommonCommand> String passwd = PropBean.getUfPropValue("passwd"); String bpm_workflowurl = PropBean.getUfPropValue("bpm_workflowurl"); String center = PropBean.getUfPropValue("center"); + String mobileJumpUrl = PropBean.getUfPropValue("mobileJumpUrl"); String isRecall = "1"; String actionType = "0"; @@ -312,11 +321,16 @@ public class RequestRemarkCmd extends AbstractCommonCommand> } String urlPc = "[newtab]" + bpm_workflowurl + "/workflow/request/ViewRequestForwardSPA.jsp?requestid=" + requestid; - String app_requestUrl = bpm_app_requesturl + requestid; - app_requestUrl = URLEncoder.encode(app_requestUrl, "UTF-8"); - String urlApp = "[newtab]" + bpm_app_workflowurl + "/interface/mobilelogin/loginsso.jsp?em_auth_usercode=" + workcode + "&forwardurl=" + app_requestUrl; +// String app_requestUrl = bpm_app_requesturl + requestid; +// app_requestUrl = URLEncoder.encode(app_requestUrl, "UTF-8"); +// String urlApp = "[newtab]" + bpm_app_workflowurl + "/interface/mobilelogin/loginsso.jsp?em_auth_usercode=" + workcode + "&forwardurl=" + app_requestUrl; String replace = bpm_app_workflowurl.replace("/bpm", ""); String urlDing = replace+bpm_app_requesturl+requestid; + String urlApp = replace+bpm_app_requesturl+requestid; + if(StringUtils.isNotEmpty(mobileJumpUrl)){ + urlDing += "&returnUrl="+URLEncoder.encode(mobileJumpUrl,"UTF-8"); + urlApp += "&returnUrl="+URLEncoder.encode(mobileJumpUrl,"UTF-8"); + } int count = 0; sql = " select t2.userid,h1.loginid,h1.email,t2.isremark,t1.requestid,t2.nodeid\n" + diff --git a/src/weaver/interfaces/dito/job/WorkflowSyncCornJob.java b/src/weaver/interfaces/dito/job/WorkflowSyncCornJob.java index de2991b8..450bf754 100644 --- a/src/weaver/interfaces/dito/job/WorkflowSyncCornJob.java +++ b/src/weaver/interfaces/dito/job/WorkflowSyncCornJob.java @@ -10,6 +10,8 @@ import weaver.interfaces.dito.comInfo.PropBean; import weaver.interfaces.dito.util.HttpUtils; import weaver.interfaces.schedule.BaseCronJob; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; import java.util.*; import static com.engine.dito.ssologin.constant.DitoConstant.*; @@ -118,6 +120,9 @@ public class WorkflowSyncCornJob extends BaseCronJob { * @param modeCataCode */ private void syncWorkflow(String actionType, String workflowSyncFormModeId, Set updateOrAddSet, HashSet modeWorkflowSet, HashMap workflowInfo, HashMap baseCataCode, HashMap modeCataCode) { + + String mobileJumpUrl = PropBean.getUfPropValue("mobileJumpUrl"); + String center = PropBean.getUfPropValue("newWorkflowCenter"); String bpm_app_workflowurl = PropBean.getUfPropValue("bpm_app_workflowurl"); String synchronizeFlowUrl = PropBean.getUfPropValue("synchronizeFlowUrl"); @@ -142,7 +147,16 @@ public class WorkflowSyncCornJob extends BaseCronJob { workflowMap.put("cataCode", cataCode); workflowMap.put("center", center); workflowMap.put("urlPc", "/bpm/workflow/request/CreateRequestForward.jsp?workflowid=" + workflowId); - workflowMap.put("urlApp", bpm_app_workflowurl + "/spa/workflow/static4mobileform/index.html#/req?iscreate=1&workflowid=" + workflowId); + String urlApp = bpm_app_workflowurl + "/spa/workflow/static4mobileform/index.html#/req?iscreate=1&workflowid=" + workflowId ; + if(StringUtils.isNotEmpty(mobileJumpUrl)){ + try { + urlApp += "&returnUrl="+ URLEncoder.encode(mobileJumpUrl,"UTF-8"); + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + } + } + workflowMap.put("urlApp", urlApp); + workflowMap.put("urlDing", urlApp); HashMap headers = new HashMap<>(); headers.put("Authorization", "Basic " + Base64.getUrlEncoder().encodeToString((accountName + ":" + password).getBytes())); diff --git a/src/weaver/interfaces/dito/job/WorkflowUserCronJob.java b/src/weaver/interfaces/dito/job/WorkflowUserCronJob.java index 9b86971a..64a12b9d 100644 --- a/src/weaver/interfaces/dito/job/WorkflowUserCronJob.java +++ b/src/weaver/interfaces/dito/job/WorkflowUserCronJob.java @@ -12,6 +12,8 @@ import weaver.interfaces.dito.util.HttpUtils; import weaver.interfaces.schedule.BaseCronJob; import weaver.share.ShareManager; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; import java.util.*; import static com.engine.dito.ssologin.constant.DitoConstant.ACTION_TYPE_ADD_USER; @@ -177,6 +179,9 @@ public class WorkflowUserCronJob extends BaseCronJob { private void syncWorkflowByHttp(String action, String center, HashSet needUpdateSet, Map modeWorkflowName, Map modeWorkflowCataCode, HashMap headers) { String bpm_app_workflowurl = PropBean.getUfPropValue("bpm_app_workflowurl"); String synchronizeFlowUrl = PropBean.getUfPropValue("synchronizeFlowUrl"); + String mobileJumpUrl = PropBean.getUfPropValue("mobileJumpUrl"); + + for (String workflowId : needUpdateSet) { Map workflowMap = new HashMap<>(); workflowMap.put("flowCode", workflowId); @@ -185,7 +190,19 @@ public class WorkflowUserCronJob extends BaseCronJob { workflowMap.put("cataCode", modeWorkflowCataCode.get(workflowId)); workflowMap.put("center", center); workflowMap.put("urlPc", "/bpm/workflow/request/CreateRequestForward.jsp?workflowid=" + workflowId); - workflowMap.put("urlApp", bpm_app_workflowurl + "/spa/workflow/static4mobileform/index.html#/req?iscreate=1&workflowid=" + workflowId); + + + String urlApp = bpm_app_workflowurl + "/spa/workflow/static4mobileform/index.html#/req?iscreate=1&workflowid=" + workflowId ; + if(StringUtils.isNotEmpty(mobileJumpUrl)){ + try { + urlApp += "&returnUrl="+URLEncoder.encode(mobileJumpUrl,"UTF-8"); + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + } + } + workflowMap.put("urlApp",urlApp); + workflowMap.put("urlDing", urlApp); + String data = HttpUtils.doPost(synchronizeFlowUrl, workflowMap, headers); logger.info("syncWorkflowByHttp-resultData:" + data); }