#HJ-26# 提交最新的代码

feature-LeeD-20221025
shilei 2 years ago
parent 26dab42f53
commit c076ff2e4e

@ -0,0 +1,36 @@
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%@ page import="weaver.general.Util,weaver.hrm.*" %>
<%@ page import="weaver.general.BaseBean" %>
<%@ page import="java.net.URLDecoder" %>
<%@ page import="com.engine.common.util.ParamUtil" %>
<%@ page import="java.util.Map" %>
<jsp:useBean id="rs" class="weaver.conn.RecordSet" scope="page"/>
<%
%>
<!-- html -->
<script type="text/javascript" src="https://appx/web-view.min.js"></script>
<script>
if (navigator.userAgent.indexOf('AlipayClient') > -1 || navigator.userAgent.indexOf('mPaaSClient') > -1) {
document.writeln('<script src="https://appx/web-view.min.js"' + '>' + '<' + '/' + 'script>');
}
//alert("jump");
my.postMessage({name:"onMessage"});
// 接收来自小程序的消息。
// my.onMessage = function(e) {
// console.log(e); //{'sendToWebView': '1'}
// }
// 判断是否运行在小程序环境里
my.getEnv(function(res) {
if(res.miniprogram){
my.postMessage({name:"onMessage"});
}else{
window.location.href="/spa/workflow/static4mobile/index.html#/center/doing?moduleid=1";
}
});
// my.startShare();
</script>

@ -13,457 +13,458 @@ import java.net.URLEncoder;
public class SendPortalDoneUtil {
/***
* ,
* @param requestid
* @param noideid
* @param user
*/
public void sendDoneDataByCreateNode(String requestid, String noideid, User user, String portal_doneurl, String bpm_app_workflowurl, String username, String passwd, String bpm_workflowurl, String center,String bpm_app_requesturl) {
HttpRequestUtil httpRequestUtil = new HttpRequestUtil();
SendPortalErrorUtil sendPortalErrorUtil = new SendPortalErrorUtil();
RecordSet rs = new RecordSet();
JSONObject requestObject = new JSONObject();
BaseBean bb = new BaseBean();
bb.writeLog("sendTodoDataByCreateNode");
String ticketType = center;
String terminal = "1";
String actionType = "0";
String taskType = "0";
String objectAction = "0";
String objectType = "0";
String objectId = "";
try {
JSONArray taskObjectList = new JSONArray();
String 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 workcode = 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"));
String messageContent = Util.null2String(rs.getString("requestname"));
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 = 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;
// String urlDing = bpm_app_workflowurl + "/interface/mobilelogin/loginsso.jsp?em_auth_usercode=" + workcode + "&forwardurl=" + app_requestUrl;
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);
}
String usercode = user.getLoginid();
JSONObject taskObject = new JSONObject();
String objectCode = usercode;
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 auth = username + ":" + passwd;
bb.writeLog("requestObject:" + requestObject.toJSONString());
String msgdata = httpRequestUtil.doPostByAuth(portal_doneurl, requestObject.toJSONString(), auth);
bb.writeLog("msgdata:" + msgdata);
if (!"".equals(msgdata)) {
JSONObject msgObject = JSONObject.parseObject(msgdata);
//{"resultCode":"1","resultMsg":"No Result"}
if (msgObject.containsKey("resultCode")) {
String resultCode = msgObject.getString("resultCode");
if (!"0".equals(resultCode)) {
sendPortalErrorUtil.doCreateSendPortalDoneErrorInfo();
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
/***
*
*
*
* @param requestid
* @param noideid
* @param user
*/
public void sendDoneDataByNode(String requestid, String noideid, User user, String portal_todourl, String bpm_app_workflowurl, String username, String passwd, String bpm_workflowurl, String center,String bpm_app_requesturl) {
HttpRequestUtil httpRequestUtil = new HttpRequestUtil();
SendPortalErrorUtil sendPortalErrorUtil = new SendPortalErrorUtil();
JSONObject requestObject = new JSONObject();
RecordSet rs = new RecordSet();
BaseBean bb = new BaseBean();
bb.writeLog("sendTodoDataByNode");
String ticketType = center;
String terminal = "1";
String taskType = "0";
String objectId = "";
try {
int count = 0;
String countSql = " 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--countSql:" + countSql);
rs.executeQuery(countSql);
while (rs.next()) {
count++;
}
bb.writeLog("sendTodoDataByNode--count:" + count);
String 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);
if (count > 0) {
JSONArray taskObjectList = new JSONArray();
String actionType = "1";
String objectAction = "1";
String objectType = "0";
rs.executeQuery(sql);
if (rs.next()) {
String title = Util.null2String(rs.getString("requestname"));
String creator = Util.null2String(rs.getString("loginid"));
String workcode = 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"));
String messageContent = Util.null2String(rs.getString("requestname"));
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 = 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;
// String urlDing = bpm_app_workflowurl + "/interface/mobilelogin/loginsso.jsp?em_auth_usercode=" + workcode + "&forwardurl=" + app_requestUrl;
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);
}
String objectCode = user.getLoginid();
String operatorCode = user.getLoginid();
JSONObject taskObject = new JSONObject();
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 {
String actionType = "2";
String objectAction = "0";
String objectType = "0";
JSONArray taskObjectList = new JSONArray();
rs.executeQuery(sql);
if (rs.next()) {
String title = Util.null2String(rs.getString("requestname"));
String creator = Util.null2String(rs.getString("loginid"));
String workcode = 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"));
String messageContent = Util.null2String(rs.getString("requestname"));
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 = 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;
// String urlDing = bpm_app_workflowurl + "/interface/mobilelogin/loginsso.jsp?em_auth_usercode=" + workcode + "&forwardurl=" + app_requestUrl;
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,h1.email\n" +
" from workflow_requestbase t1\n" +
" inner join workflow_currentoperator t2 on t1.requestid = t2.requestid\n" +
" left join (select id, lastname,loginid,email from hrmresource where STATUS = 1 union all select id,lastname,loginid,'' as email 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"));
String objectCode = usercode;
String operatorCode = usercode;
JSONObject taskObject = new JSONObject();
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 auth = username + ":" + passwd;
bb.writeLog("requestObject:" + requestObject.toJSONString());
String msgdata = httpRequestUtil.doPostByAuth(portal_todourl, requestObject.toJSONString(), auth);
bb.writeLog("msgdata:" + msgdata);
if (!"".equals(msgdata)) {
JSONObject msgObject = JSONObject.parseObject(msgdata);
//{"resultCode":"1","resultMsg":"No Result"}
if (msgObject.containsKey("resultCode")) {
String resultCode = msgObject.getString("resultCode");
if (!"0".equals(resultCode)) {
sendPortalErrorUtil.doCreateSendPortalTodoErrorInfo();
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
/***
* 退退
*
* @param requestid
* @param noideid
* @param user
*/
public void sendTodoDataByReject(String requestid, String noideid, User user, String portal_todourl, String bpm_app_workflowurl, String username, String passwd, String bpm_workflowurl, String center,String bpm_app_requesturl) {
HttpRequestUtil httpRequestUtil = new HttpRequestUtil();
SendPortalErrorUtil sendPortalErrorUtil = new SendPortalErrorUtil();
JSONObject requestObject = new JSONObject();
BaseBean bb = new BaseBean();
bb.writeLog("sendTodoDataByReject");
RecordSet rs = new RecordSet();
String ticketType = center;
String terminal = "1";
String taskType = "0";
String objectAction = "0";
String objectType = "0";
String objectId = "";
try {
String actionType = "2";
JSONArray taskObjectList = new JSONArray();
String 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("sendTodoDataByReject--sql:" + sql);
rs.executeQuery(sql);
if (rs.next()) {
String title = Util.null2String(rs.getString("requestname"));
String creator = Util.null2String(rs.getString("loginid"));
String workcode = 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"));
String messageContent = Util.null2String(rs.getString("requestname"));
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 = 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;
// String urlDing = bpm_app_workflowurl + "/interface/mobilelogin/loginsso.jsp?em_auth_usercode=" + workcode + "&forwardurl=" + app_requestUrl;
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,h1.email\n" +
" from workflow_requestbase t1\n" +
" inner join workflow_currentoperator t2 on t1.requestid = t2.requestid\n" +
" left join (select id, lastname,loginid,email from hrmresource where STATUS = 1 union all select id,lastname,loginid,'' as email 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("sendTodoDataByReject--sql:" + sql);
rs.executeQuery(sql);
while (rs.next()) {
String usercode = Util.null2String(rs.getString("loginid"));
JSONObject taskObject = new JSONObject();
String objectCode = usercode;
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 auth = username + ":" + passwd;
bb.writeLog("requestObject:" + requestObject.toJSONString());
String msgdata = httpRequestUtil.doPostByAuth(portal_todourl, requestObject.toJSONString(), auth);
bb.writeLog("msgdata:" + msgdata);
if (!"".equals(msgdata)) {
JSONObject msgObject = JSONObject.parseObject(msgdata);
//{"resultCode":"1","resultMsg":"No Result"}
if (msgObject.containsKey("resultCode")) {
String resultCode = msgObject.getString("resultCode");
if (!"0".equals(resultCode)) {
sendPortalErrorUtil.doCreateSendPortalTodoErrorInfo();
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
// /***
// * 流程发起节点提交下个节点,产生发起人一个已办
// * @param requestid
// * @param noideid
// * @param user
// */
// public void sendDoneDataByCreateNode(String requestid, String noideid, User user, String portal_doneurl, String bpm_app_workflowurl, String username, String passwd, String bpm_workflowurl, String center,String bpm_app_requesturl) {
//
// HttpRequestUtil httpRequestUtil = new HttpRequestUtil();
// SendPortalErrorUtil sendPortalErrorUtil = new SendPortalErrorUtil();
// RecordSet rs = new RecordSet();
// JSONObject requestObject = new JSONObject();
// BaseBean bb = new BaseBean();
// bb.writeLog("sendDoneDataByCreateNode");
//
// String ticketType = center;
// String terminal = "1";
// String actionType = "0";
// String taskType = "0";
// String objectAction = "0";
// String objectType = "0";
// String objectId = "";
//
// try {
// JSONArray taskObjectList = new JSONArray();
// String 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 workcode = 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"));
// String messageContent = Util.null2String(rs.getString("requestname"));
//
//
// 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 = 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;
//// String urlDing = bpm_app_workflowurl + "/interface/mobilelogin/loginsso.jsp?em_auth_usercode=" + workcode + "&forwardurl=" + app_requestUrl;
// 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);
// }
//
// String usercode = user.getLoginid();
// JSONObject taskObject = new JSONObject();
//
// String objectCode = usercode;
// 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 auth = username + ":" + passwd;
// bb.writeLog("requestObject:" + requestObject.toJSONString());
// String msgdata = httpRequestUtil.doPostByAuth(portal_doneurl, requestObject.toJSONString(), auth);
// bb.writeLog("msgdata:" + msgdata);
// if (!"".equals(msgdata)) {
// JSONObject msgObject = JSONObject.parseObject(msgdata);
// //{"resultCode":"1","resultMsg":"No Result"}
// if (msgObject.containsKey("resultCode")) {
// String resultCode = msgObject.getString("resultCode");
// if (!"0".equals(resultCode)) {
// sendPortalErrorUtil.doCreateSendPortalDoneErrorInfo();
// }
// }
// }
// } catch (Exception e) {
// e.printStackTrace();
// }
// }
//
//
// /***
// * 流程提交到写个节点,
// * 如果流程提交节点还有待办,意味着流程还是提交节点,只是提交节点一个人删除待办
// * 如果流程提交节点没有待办,意味着流程流转到下个节点,那么查询出来的待办都有新增,并且删除提交节点的所有待办
// * @param requestid
// * @param noideid
// * @param user
// */
// public void sendDoneDataByNode(String requestid, String noideid, User user, String portal_todourl, String bpm_app_workflowurl, String username, String passwd, String bpm_workflowurl, String center,String bpm_app_requesturl) {
// HttpRequestUtil httpRequestUtil = new HttpRequestUtil();
// SendPortalErrorUtil sendPortalErrorUtil = new SendPortalErrorUtil();
//
// JSONObject requestObject = new JSONObject();
// RecordSet rs = new RecordSet();
//
// BaseBean bb = new BaseBean();
// bb.writeLog("sendDoneDataByNode");
//
// String ticketType = center;
// String terminal = "1";
// String taskType = "0";
// String objectId = "";
//
// try {
//
// int count = 0;
// String countSql = " 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--countSql:" + countSql);
// rs.executeQuery(countSql);
// while (rs.next()) {
// count++;
// }
// bb.writeLog("sendTodoDataByNode--count:" + count);
//
// String 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);
//
// if (count > 0) {
//
// JSONArray taskObjectList = new JSONArray();
// String actionType = "1";
// String objectAction = "1";
// String objectType = "0";
//
// rs.executeQuery(sql);
// if (rs.next()) {
// String title = Util.null2String(rs.getString("requestname"));
// String creator = Util.null2String(rs.getString("loginid"));
// String workcode = 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"));
// String messageContent = Util.null2String(rs.getString("requestname"));
//
// 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 = 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;
//// String urlDing = bpm_app_workflowurl + "/interface/mobilelogin/loginsso.jsp?em_auth_usercode=" + workcode + "&forwardurl=" + app_requestUrl;
// 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);
// }
//
// String objectCode = user.getLoginid();
// String operatorCode = user.getLoginid();
// JSONObject taskObject = new JSONObject();
// 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 {
// String actionType = "2";
// String objectAction = "0";
// String objectType = "0";
//
// JSONArray taskObjectList = new JSONArray();
// rs.executeQuery(sql);
// if (rs.next()) {
//
// String title = Util.null2String(rs.getString("requestname"));
// String creator = Util.null2String(rs.getString("loginid"));
// String workcode = 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"));
// String messageContent = Util.null2String(rs.getString("requestname"));
//
// 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 = 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;
//// String urlDing = bpm_app_workflowurl + "/interface/mobilelogin/loginsso.jsp?em_auth_usercode=" + workcode + "&forwardurl=" + app_requestUrl;
// 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,h1.email\n" +
// " from workflow_requestbase t1\n" +
// " inner join workflow_currentoperator t2 on t1.requestid = t2.requestid\n" +
// " left join (select id, lastname,loginid,email from hrmresource where STATUS = 1 union all select id,lastname,loginid,'' as email 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"));
// String objectCode = usercode;
// String operatorCode = usercode;
//
// JSONObject taskObject = new JSONObject();
// 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 auth = username + ":" + passwd;
// bb.writeLog("requestObject:" + requestObject.toJSONString());
// String msgdata = httpRequestUtil.doPostByAuth(portal_todourl, requestObject.toJSONString(), auth);
// bb.writeLog("msgdata:" + msgdata);
// if (!"".equals(msgdata)) {
// JSONObject msgObject = JSONObject.parseObject(msgdata);
// //{"resultCode":"1","resultMsg":"No Result"}
// if (msgObject.containsKey("resultCode")) {
// String resultCode = msgObject.getString("resultCode");
// if (!"0".equals(resultCode)) {
// sendPortalErrorUtil.doCreateSendPortalTodoErrorInfo();
// }
// }
// }
// } catch (Exception e) {
// e.printStackTrace();
// }
// }
//
//
// /***
// * 操作退回时执行,就是退回到某个节点,意味着查询出来的待办要新增,提交节点的所有待办都有删除
// *
// * @param requestid
// * @param noideid
// * @param user
// */
// public void sendTodoDataByReject(String requestid, String noideid, User user, String portal_todourl, String bpm_app_workflowurl, String username, String passwd, String bpm_workflowurl, String center,String bpm_app_requesturl) {
//
// HttpRequestUtil httpRequestUtil = new HttpRequestUtil();
// SendPortalErrorUtil sendPortalErrorUtil = new SendPortalErrorUtil();
//
// JSONObject requestObject = new JSONObject();
//
// BaseBean bb = new BaseBean();
// bb.writeLog("sendTodoDataByReject");
// RecordSet rs = new RecordSet();
// String ticketType = center;
// String terminal = "1";
// String taskType = "0";
// String objectAction = "0";
// String objectType = "0";
// String objectId = "";
// try {
//
// String actionType = "2";
// JSONArray taskObjectList = new JSONArray();
//
// String 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("sendTodoDataByReject--sql:" + sql);
// rs.executeQuery(sql);
// if (rs.next()) {
//
// String title = Util.null2String(rs.getString("requestname"));
// String creator = Util.null2String(rs.getString("loginid"));
// String workcode = 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"));
// String messageContent = Util.null2String(rs.getString("requestname"));
//
// 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 = 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;
//// String urlDing = bpm_app_workflowurl + "/interface/mobilelogin/loginsso.jsp?em_auth_usercode=" + workcode + "&forwardurl=" + app_requestUrl;
// 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,h1.email\n" +
// " from workflow_requestbase t1\n" +
// " inner join workflow_currentoperator t2 on t1.requestid = t2.requestid\n" +
// " left join (select id, lastname,loginid,email from hrmresource where STATUS = 1 union all select id,lastname,loginid,'' as email 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("sendTodoDataByReject--sql:" + sql);
// rs.executeQuery(sql);
// while (rs.next()) {
//
// String usercode = Util.null2String(rs.getString("loginid"));
// JSONObject taskObject = new JSONObject();
//
// String objectCode = usercode;
//
// 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 auth = username + ":" + passwd;
// bb.writeLog("requestObject:" + requestObject.toJSONString());
// String msgdata = httpRequestUtil.doPostByAuth(portal_todourl, requestObject.toJSONString(), auth);
// bb.writeLog("msgdata:" + msgdata);
// if (!"".equals(msgdata)) {
// JSONObject msgObject = JSONObject.parseObject(msgdata);
// //{"resultCode":"1","resultMsg":"No Result"}
// if (msgObject.containsKey("resultCode")) {
// String resultCode = msgObject.getString("resultCode");
// if (!"0".equals(resultCode)) {
// sendPortalErrorUtil.doCreateSendPortalTodoErrorInfo();
// }
// }
// }
// } catch (Exception e) {
// e.printStackTrace();
// }
// }
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");
try {
HttpRequestUtil httpRequestUtil = new HttpRequestUtil();
RecordSet rs = new RecordSet();
@ -523,7 +524,6 @@ public class SendPortalDoneUtil {
String msgdata = httpRequestUtil.doPostByAuth(portal_doneurl, requestObject.toJSONString(), auth);
bb.writeLog("done msgdata:" + msgdata);
}
} catch (Exception e) {
bb.writeLog("done Exception");
bb.writeLog(e.getMessage());

@ -8,8 +8,11 @@ import weaver.conn.RecordSet;
import weaver.general.BaseBean;
import weaver.general.Util;
import weaver.hrm.User;
import weaver.interfaces.dito.comInfo.PropBean;
import java.net.URLEncoder;
import java.util.HashMap;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@ -32,6 +35,11 @@ public class SendPortalToReadUtil {
BaseBean bb = new BaseBean();
bb.writeLog("SendPortalToReadUtil-sendToReadDataByCreateNode");
String mobileJumpUrl = PropBean.getUfPropValue("mobileJumpUrl");
String cus_staff = PropBean.getUfPropValue("cus_staff") ;
String scopeid = "-1";
String scope = "HrmCustomFieldByInfoType" ;
JSONObject requestObject = new JSONObject();
Pattern regex = Pattern.compile(EMAIL_REGEX_DEFAULT);
String terminal = "1" ;
@ -39,38 +47,41 @@ public class SendPortalToReadUtil {
String taskType = "1";
String objectAction = "0" ;
String objectType = "0";
String objectId = "" ;
String emailArray = "";
try {
String processTime = DateUtil.getCurrentTime("yyyy-MM-dd HH:mm:ss");
JSONArray taskObjectList = new JSONArray();
// int userid = user.getUID();
// String workcode = "";
// String sql = "select loginid from hrmresource where id = '" + userid + "'";
// rs.execute(sql);
// while (rs.next()) {
// workcode = Util.null2String(rs.getString("loginid"));
// }
int u_userid = user.getUID();
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);
while (rs.next()) {
workcode = Util.null2String(rs.getString("loginid"));
}
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 app_requestUrl = bpm_app_requesturl+requestid;
// app_requestUrl = URLEncoder.encode(app_requestUrl,"UTF-8");
String replace = bpm_app_workflowurl.replace("/bpm", "");
// String urlDing = replace+bpm_app_requesturl+requestid;
// bb.writeLog("urlDing", urlDing);
// String urlApp = replace+bpm_app_requesturl+requestid;
String urlDing = replace+bpm_app_requesturl+requestid;
bb.writeLog("urlDing", urlDing);
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 = "" ;
String title = "" ;
String sql =" select t1.requestname,t1.requestmark,t3.workflowname\n" +
sql =" select t1.requestname,t1.requestmark,t3.workflowname\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 ;
@ -79,23 +90,25 @@ public class SendPortalToReadUtil {
if (rs.next()){
workflowname = Util.null2String(rs.getString("workflowname")) ;
requestname = Util.null2String(rs.getString("requestname")) ;
title = getShortMessageTitle(requestname);
}
requestObject.put("center",center);
requestObject.put("title",title);
requestObject.put("title",requestname);
requestObject.put("taskType",taskType);
requestObject.put("actionType",actionType);
requestObject.put("createDate",processTime);
requestObject.put("messageTitle",title);
requestObject.put("messageContent",title);
requestObject.put("messageTitle",getShortMessageTitle(requestname));
requestObject.put("messageContent",requestname);
requestObject.put("terminal",terminal);
requestObject.put("urlPc",urlPc);
requestObject.put("urlDing",urlDing);
requestObject.put("ticketType",workflowname);
requestObject.put("urlApp",urlApp);
requestObject.put("creator",workcode);
sql = " select t2.userid,h1.loginid,h1.email,t2.isremark,t1.requestid,t2.nodeid,d1.nodename \n" +
sql = " select t2.userid,h1.loginid,h1.email,t2.isremark,t1.requestid,t2.nodeid,d1.nodename,c1."+cus_staff+" as staffid "+
" from workflow_requestbase t1\n" +
" inner join workflow_currentoperator t2 on t1.requestid = t2.requestid\n" +
" left join cus_fielddata c1 on c1.id = t2.userid and c1.scopeid= "+scopeid+" and c1.scope = '"+scope+"' "+
" left join (select id, lastname,loginid,email from hrmresource where STATUS = 1 union all select id,lastname,loginid,'' as email from hrmresourcemanager ) h1 on h1.id = t2.userid\n" +
" left join workflow_nodebase d1 on d1.id = t2.nodeid "+
" where (t1.deleted <> 1 or t1.deleted is null or t1.deleted = '')\n" +
@ -111,6 +124,7 @@ public class SendPortalToReadUtil {
String nodeid = Util.null2String(rs.getString("nodeid")) ;
String nodename = Util.null2String(rs.getString("nodename")) ;
String email = Util.null2String(rs.getString("email")) ;
String staffid = Util.null2String(rs.getString("staffid")) ;
String creator = Util.null2String(rs.getString("loginid")) ;
String userid = Util.null2String(rs.getString("userid")) ;
@ -120,6 +134,7 @@ public class SendPortalToReadUtil {
taskObject.put("nodename",nodename);
taskObject.put("email",email);
taskObject.put("creator",creator);
taskObject.put("staffid",staffid);
taskObject.put("userid",userid);
taskObjectList.add(taskObject);
}
@ -135,24 +150,24 @@ public class SendPortalToReadUtil {
if("sysadmin".equals(creator)){
creator = "Admin";
}
String staffid = dataObject.getString("staffid");
String userid = dataObject.getString("userid");
JSONObject taskObject = new JSONObject();
String objectCode = creator ;
String operatorCode = creator ;
taskObject.put("objectAction",objectAction);
taskObject.put("objectType",objectType);
taskObject.put("objectCode",objectCode);
taskObject.put("objectId",objectId);
taskObject.put("objectId",staffid);
taskObject.put("operatorCode",operatorCode);
JSONArray taskArray = new JSONArray();
taskArray.add(taskObject);
String urlApp = bpm_app_workflowurl+"/interface/mobilelogin/loginsso.jsp?em_auth_usercode="+creator+"&forwardurl="+app_requestUrl;
requestObject.put("creator",creator);
requestObject.put("nodeName",nodename);
requestObject.put("nodeId",nodeid);
requestObject.put("urlApp",urlApp);
requestObject.put("taskCode",lcid+"_cs_"+nodeid+"_"+userid);
requestObject.put("taskObjectList",taskArray);
@ -203,10 +218,15 @@ public class SendPortalToReadUtil {
SendMailUtil sendMailUtil = new SendMailUtil();
Pattern regex = Pattern.compile(EMAIL_REGEX_DEFAULT);
String mobileJumpUrl = PropBean.getUfPropValue("mobileJumpUrl");
RecordSet rs = new RecordSet();
BaseBean bb = new BaseBean();
bb.writeLog("SendPortalToReadUtil-sendToReadDataByNode");
String cus_staff = PropBean.getUfPropValue("cus_staff") ;
String scopeid = "-1";
String scope = "HrmCustomFieldByInfoType" ;
JSONObject requestObject = new JSONObject();
String emailArray = "";
@ -215,10 +235,17 @@ public class SendPortalToReadUtil {
String objectType = "0";
String terminal = "1" ;
String taskType = "1";
String objectId = "" ;
try {
int u_userid = user.getUID();
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);
while (rs.next()) {
workcode = Util.null2String(rs.getString("loginid"));
}
int count = 0 ;
String countSql =" select t2.userid \n" +
" from workflow_requestbase t1\n" +
@ -243,18 +270,25 @@ public class SendPortalToReadUtil {
String urlPc = "[newtab]"+bpm_workflowurl+"/workflow/request/ViewRequestForwardSPA.jsp?requestid="+requestid ;
String replace = bpm_app_workflowurl.replace("/bpm", "");
// String urlDing = replace+bpm_app_requesturl+requestid;
//// String urlApp = bpm_app_workflowurl+"/interface/mobilelogin/loginsso.jsp?em_auth_usercode="+creator+"&forwardurl="+app_requestUrl;
// String urlApp = replace+bpm_app_requesturl+requestid;
String urlDing = replace+bpm_app_requesturl+requestid;
bb.writeLog("urlDing", urlDing);
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 app_requestUrl = bpm_app_requesturl+requestid;
app_requestUrl = URLEncoder.encode(app_requestUrl,"UTF-8");
bb.writeLog("urlDing", urlDing);
String workflowname = "" ;
String requestname = "";
String title = "";
JSONArray taskObjectList = new JSONArray();
String sql =" select t1.workflowid,t1.requestname,t1.requestmark,t3.workflowname\n" +
sql =" select t1.workflowid,t1.requestname,t1.requestmark,t3.workflowname\n" +
" from workflow_requestbase t1\n" +
" inner join workflow_base t3 on t1.workflowid = t3.id\n" +
" where (t1.deleted <> 1 or t1.deleted is null or t1.deleted = '')\n" +
@ -264,25 +298,27 @@ public class SendPortalToReadUtil {
if (rs.next()) {
workflowname = Util.null2String(rs.getString("workflowname"));
requestname = Util.null2String(rs.getString("requestname"));
title = getShortMessageTitle(requestname);
}
requestObject.put("center", center);
requestObject.put("title", title);
requestObject.put("title", requestname);
requestObject.put("taskType", taskType);
requestObject.put("actionType", actionType);
requestObject.put("createDate", processTime);
requestObject.put("messageTitle", title);
requestObject.put("messageContent", title);
requestObject.put("messageTitle",getShortMessageTitle(requestname));
requestObject.put("messageContent", requestname);
requestObject.put("terminal", terminal);
requestObject.put("urlPc", urlPc);
requestObject.put("urlDing", urlDing);
requestObject.put("ticketType", workflowname);
requestObject.put("creator",workcode);
requestObject.put("urlApp",urlApp);
sql = " select t2.userid,h1.loginid,h1.email,t2.isremark,t1.requestid,t2.nodeid,d1.nodename \n" +
sql = " select t2.userid,h1.loginid,h1.email,t2.isremark,t1.requestid,t2.nodeid,d1.nodename,c1."+cus_staff+" as staffid "+
" from workflow_requestbase t1\n" +
" inner join workflow_currentoperator t2 on t1.requestid = t2.requestid\n" +
" left join cus_fielddata c1 on c1.id = t2.userid and c1.scopeid= "+scopeid+" and c1.scope = '"+scope+"' "+
" left join (select id, lastname,loginid,email from hrmresource where STATUS = 1 union all select id,lastname,loginid,'' as email from hrmresourcemanager ) h1 on h1.id = t2.userid\n" +
" left join workflow_nodebase d1 on d1.id = t2.nodeid "+
" where (t1.deleted <> 1 or t1.deleted is null or t1.deleted = '')\n" +
@ -299,6 +335,8 @@ public class SendPortalToReadUtil {
String nodeid = Util.null2String(rs.getString("nodeid")) ;
String nodename = Util.null2String(rs.getString("nodename")) ;
String email = Util.null2String(rs.getString("email")) ;
String staffid = Util.null2String(rs.getString("staffid")) ;
String creator = Util.null2String(rs.getString("loginid")) ;
String userid = Util.null2String(rs.getString("userid")) ;
@ -308,6 +346,7 @@ public class SendPortalToReadUtil {
taskObject.put("nodename",nodename);
taskObject.put("email",email);
taskObject.put("creator",creator);
taskObject.put("staffid",staffid);
taskObject.put("userid",userid);
taskObjectList.add(taskObject);
}
@ -327,19 +366,19 @@ public class SendPortalToReadUtil {
JSONObject taskObject = new JSONObject();
String objectCode = creator ;
String operatorCode = creator ;
String staffid = dataObject.getString("staffid");
taskObject.put("objectAction",objectAction);
taskObject.put("objectType",objectType);
taskObject.put("objectCode",objectCode);
taskObject.put("objectId",objectId);
taskObject.put("objectId",staffid);
taskObject.put("operatorCode",operatorCode);
JSONArray taskArray = new JSONArray();
taskArray.add(taskObject);
String urlApp = bpm_app_workflowurl+"/interface/mobilelogin/loginsso.jsp?em_auth_usercode="+creator+"&forwardurl="+app_requestUrl;
requestObject.put("creator",creator);
requestObject.put("nodeName",nodename);
requestObject.put("nodeId",nodeid);
requestObject.put("urlApp",urlApp);
requestObject.put("taskCode",lcid+"_cs_"+nodeid+"_"+userid);
requestObject.put("taskObjectList",taskArray);
@ -382,4 +421,24 @@ public class SendPortalToReadUtil {
return messageTitle;
}
/***
*
* @param requestname
* @param operator
* @param operatorTime
* @return
*/
public Map<String,String> getEmailTemplate(String requestname, String operator, String operatorTime){
Map<String,String> dataMap = new HashMap<String,String>();
String notificationSubject = "You have a new To-Do task - <"+requestname+"> ";
String notificationContent = operator + " created this task on "+operatorTime+"\n" +
"Please handle it in time.";
dataMap.put("notificationSubject",notificationSubject);
dataMap.put("notificationContent",notificationContent);
return dataMap;
}
}

@ -2,6 +2,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;
@ -10,6 +11,8 @@ import weaver.hrm.User;
import weaver.interfaces.dito.comInfo.PropBean;
import java.net.URLEncoder;
import java.util.HashMap;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@ -18,18 +21,19 @@ public class SendPortalTodoUtil {
//public static String EMAIL_REGEX_DEFAULT = "^([a-z0-9A-Z]+[-|\\.]?)+[a-z0-9A-Z]@([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?\\.)+[a-zA-Z]{2,}$";
public static String EMAIL_REGEX_DEFAULT = "^\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*$";
//cus_fielddata存储的staffid字段名
private String staffIdFieldByCus = PropBean.getUfPropValue("staffIdFieldByCus");
//private String staffIdFieldByCus = PropBean.getUfPropValue("staffIdFieldByCus");
/***
*
* @param requestId
* @param requestid
* @param user
*/
public void sendTodoDataByCreater(String requestId, User user, String portal_todourl,String bpm_app_workflowurl, String username, String passwd, String bpm_workflowurl, String center,String bpm_app_requesturl){
public void sendTodoDataByCreater(String requestid, User user, String portal_todourl,String bpm_app_workflowurl, String username, String passwd, String bpm_workflowurl, String center,String bpm_app_requesturl){
HttpRequestUtil httpRequestUtil = new HttpRequestUtil();
SendMailUtil sendMailUtil = new SendMailUtil();
SendPortalErrorUtil sendPortalErrorUtil = new SendPortalErrorUtil();
String mobileJumpUrl = PropBean.getUfPropValue("mobileJumpUrl");
BaseBean bb = new BaseBean();
RecordSet rs = new RecordSet();
@ -41,74 +45,73 @@ public class SendPortalTodoUtil {
String taskType = "0";
String objectAction = "0" ;
String objectType = "0";
String objectId = "" ;
String ticketType = center ;
String cus_staff = PropBean.getUfPropValue("cus_staff") ;
String scopeid = "-1";
String scope = "HrmCustomFieldByInfoType" ;
Pattern regex = Pattern.compile(EMAIL_REGEX_DEFAULT);
JSONObject requestObject = new JSONObject();
String lastname = user.getLastname();
try {
String processTime = DateUtil.getCurrentTime("yyyy-MM-dd HH:mm:ss");
int userid = user.getUID();
String sql =" select t1.workflowid,t1.requestname,t1.requestmark,t1.creater,t2.nodeid,t1.createdate,t1.createtime,h1.lastname,h1.loginid,\n" +
" t1.requestid as taskcode,d1.nodename,h1.email,c1."+staffIdFieldByCus+" as staffid"+
String sql =" select t1.requestname,h1.loginid,d1.nodename,h1.email,c1."+cus_staff+" as staffid,t3.workflowname "+
" from workflow_requestbase t1\n" +
" inner join workflow_currentoperator t2 on t1.requestid = t2.requestid\n" +
" inner join workflow_base t3 on t1.workflowid = t3.id\n" +
" left join workflow_nodebase d1 on d1.id = t1.currentnodeid "+
" LEFT JOIN cus_fielddata c1 on c1.ID=t2.USERID"+
" left join (select id, lastname,loginid,email from hrmresource where status = 1 union all select id,lastname,loginid,'' as email from hrmresourcemanager ) h1 on h1.id = t1.creater\n" +
" left join cus_fielddata c1 on c1.id = t2.userid and scopeid= "+scopeid+" and scope = '"+scope+"' "+
" left join (select id, lastname,loginid,email from hrmresource where status = 1 union all select id,lastname,loginid,'' as email from hrmresourcemanager ) h1 on h1.id = t2.userid \n" +
" where t2.userid in ("+userid+") \n" +
" and (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','7','8','9','11'))\n" +
" and (ifnull(t1.currentstatus, -1) = -1 or (ifnull(t1.currentstatus, -1) = 0 and t1.creater in ("+userid+"))) \n" +
" and t2.islasttimes = 1 \n" +
" and (t2.isprocessing = '' or t2.isprocessing is null) \n" +
" and t2.requestid = "+requestId ;
" and t2.requestid = "+requestid ;
bb.writeLog("sendTodoDataByCreater-sql:"+sql);
rs.executeQuery(sql);
if (rs.next()){
objectId = rs.getString("staffid");
String workflowid = Util.null2String(rs.getString("workflowid")) ;
String workflowname = getWorkflowname(workflowid);
String title = Util.null2String(rs.getString("requestname")) ;
String creator = Util.null2String(rs.getString("loginid")) ;
String workcode = Util.null2String(rs.getString("loginid")) ;
String taskCode = Util.null2String(rs.getString("taskcode")) ;
String workflowname = Util.null2String(rs.getString("workflowname")) ;
requestname = Util.null2String(rs.getString("requestname")) ;
String nodeId = Util.null2String(rs.getString("nodeid")) ;
String nodeName = Util.null2String(rs.getString("nodeName")) ;
String loginid = Util.null2String(rs.getString("loginid")) ;
String createdate = Util.null2String(rs.getString("createdate")) ;
String createtime = Util.null2String(rs.getString("createtime")) ;
String messageTitle = Util.null2String(rs.getString("requestname")) ;
String urlPc = "[newtab]"+bpm_workflowurl+"/workflow/request/ViewRequestForwardSPA.jsp?requestid="+requestid ;
String replace = bpm_app_workflowurl.replace("/bpm", "");
String messageContent = Util.null2String(rs.getString("requestname")) ;
requestname = messageTitle;
String urlDing = replace+bpm_app_requesturl+requestid;
String urlApp = replace+bpm_app_requesturl+requestid;
messageTitle = getShortMessageTitle(messageTitle);
if(StringUtils.isNotEmpty(mobileJumpUrl)){
urlDing += "&returnUrl="+URLEncoder.encode(mobileJumpUrl,"UTF-8");
urlApp += "&returnUrl="+URLEncoder.encode(mobileJumpUrl,"UTF-8");
}
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 = 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;
bb.writeLog("urlDing", urlDing);
// String urlDing = bpm_app_workflowurl+"/interface/mobilelogin/loginsso.jsp?em_auth_usercode="+workcode+"&forwardurl="+app_requestUrl;
String nodeName = Util.null2String(rs.getString("nodeName")) ;
String isremark = Util.null2String(rs.getString("isremark")) ;
// String urlDing = replace+bpm_app_requesturl+requestid;
// String urlApp = replace+bpm_app_requesturl+requestid;
bb.writeLog("urlDing", urlDing);
requestObject.put("center",center);
requestObject.put("title",title);
requestObject.put("creator",creator);
requestObject.put("taskCode",taskCode);
requestObject.put("title",requestname);
requestObject.put("creator",loginid);
requestObject.put("taskCode",requestid);
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("createDate",processTime);
requestObject.put("messageTitle",getShortMessageTitle(requestname));
requestObject.put("messageContent",requestname);
requestObject.put("terminal",terminal);
requestObject.put("urlPc",urlPc);
requestObject.put("urlApp",urlApp);
@ -119,14 +122,14 @@ public class SendPortalTodoUtil {
JSONArray taskObjectList = new JSONArray();
JSONObject taskObject = new JSONObject();
String objectCode = creator ;
String operatorCode = creator ;
String objectCode = loginid ;
String operatorCode = loginid ;
String staffid = Util.null2String(rs.getString("staffid"));
taskObject.put("objectAction",objectAction);
taskObject.put("objectType",objectType);
taskObject.put("objectCode",objectCode);
taskObject.put("objectId",objectId);
taskObject.put("objectId",staffid);
taskObject.put("operatorCode",operatorCode);
taskObjectList.add(taskObject);
@ -157,9 +160,12 @@ public class SendPortalTodoUtil {
bb.writeLog("emailArray:"+emailArray);
if(StringUtils.isNotEmpty(emailArray))
{
String notificationSubject = "You have a new to-do list:"+requestname+",Please handle it in time";
String notificationContent = "You have a new to-do list:"+requestname+",Please handle it in time";
sendMailUtil.sendMail(requestId,emailArray,notificationSubject,notificationContent);
Map<String,String> templateMap = getEmailTemplate(requestname,lastname,processTime);
String notificationSubject = templateMap.get("notificationSubject");
String notificationContent = templateMap.get("notificationContent");
sendMailUtil.sendMail(requestid,emailArray,notificationSubject,notificationContent);
}
}else{
@ -183,92 +189,100 @@ public class SendPortalTodoUtil {
HttpRequestUtil httpRequestUtil = new HttpRequestUtil();
SendMailUtil sendMailUtil = new SendMailUtil();
String mobileJumpUrl = PropBean.getUfPropValue("mobileJumpUrl");
RecordSet rs = new RecordSet();
String requestname = "";
String requestremark = "" ;
JSONObject requestObject = new JSONObject();
String emailArray = "";
Pattern regex = Pattern.compile(EMAIL_REGEX_DEFAULT);
String cus_staff = PropBean.getUfPropValue("cus_staff") ;
String scopeid = "-1";
String scope = "HrmCustomFieldByInfoType" ;
BaseBean bb = new BaseBean();
bb.writeLog("sendTodoDataByCreateNode");
String ticketType = center ;
String terminal = "1" ;
String actionType = "0" ;
String taskType = "0";
String objectAction = "0" ;
String objectType = "0";
String objectId = "" ;
try {
int 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 = '" + userid + "'";
rs.executeQuery(sql);
while (rs.next()) {
workcode = Util.null2String(rs.getString("loginid"));
}
String processTime = DateUtil.getCurrentTime("yyyy-MM-dd HH:mm:ss");
JSONArray taskObjectList = new JSONArray();
String 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,c1."+staffIdFieldByCus+" as staffid"+
" 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 cus_fielddata c1 on c1.ID=t1.creater"+
" 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 ;
String requestname = "" ;
String nodeId = "" ;
String nodeName = "";
String workflowname = "" ;
sql =" select t1.requestname,t1.currentnodeid as nodeid,d1.nodename,t3.workflowname"+
" 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 "+
" 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()){
objectId = rs.getString("staffid");
String workflowid = Util.null2String(rs.getString("workflowid")) ;
String workflowname = getWorkflowname(workflowid);
String title = Util.null2String(rs.getString("requestname")) ;
String creator = Util.null2String(rs.getString("loginid")) ;
String workcode = 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")) ;
String messageContent = Util.null2String(rs.getString("requestname")) ;
requestname = messageTitle;
messageTitle = getShortMessageTitle(messageTitle);
requestname = Util.null2String(rs.getString("requestname")) ;
nodeId = Util.null2String(rs.getString("nodeid")) ;
nodeName = Util.null2String(rs.getString("nodeName")) ;
workflowname = Util.null2String(rs.getString("workflowname")) ;
}
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 = 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;
bb.writeLog("urlDing", urlDing);
// String urlDing = bpm_app_workflowurl+"/interface/mobilelogin/loginsso.jsp?em_auth_usercode="+workcode+"&forwardurl="+app_requestUrl;
String nodeName = Util.null2String(rs.getString("nodeName")) ;
String urlPc = "[newtab]"+bpm_workflowurl+"/workflow/request/ViewRequestForwardSPA.jsp?requestid="+requestid ;
String replace = bpm_app_workflowurl.replace("/bpm", "");
String urlDing = replace+bpm_app_requesturl+requestid ;
String urlApp = replace+bpm_app_requesturl+requestid ;
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",workflowname);
if(StringUtils.isNotEmpty(mobileJumpUrl)){
urlDing += "&returnUrl="+URLEncoder.encode(mobileJumpUrl,"UTF-8");
urlApp += "&returnUrl="+URLEncoder.encode(mobileJumpUrl,"UTF-8");
}
sql = " select t2.userid,h1.loginid,h1.email\n" +
// String urlDing = replace+bpm_app_requesturl+requestid;
// String urlApp = replace+bpm_app_requesturl+requestid;
bb.writeLog("urlDing", urlDing);
JSONObject requestObject = new JSONObject();
requestObject.put("center",center);
requestObject.put("title",requestname);
requestObject.put("creator",workcode);
requestObject.put("taskCode",requestid);
requestObject.put("nodeId",nodeId);
requestObject.put("taskType",taskType);
requestObject.put("actionType",actionType);
requestObject.put("createDate",processTime);
requestObject.put("messageTitle",getShortMessageTitle(requestname));
requestObject.put("messageContent",requestname);
requestObject.put("terminal",terminal);
requestObject.put("urlPc",urlPc);
requestObject.put("urlApp",urlApp);
requestObject.put("urlDing",urlDing);
requestObject.put("nodeName",nodeName);
requestObject.put("ticketType",workflowname);
sql = " select t2.userid,h1.loginid,h1.email,c1."+cus_staff+" as staffid "+
" from workflow_requestbase t1\n" +
" inner join workflow_currentoperator t2 on t1.requestid = t2.requestid\n" +
" left join cus_fielddata c1 on c1.id = t2.userid and c1.scopeid= "+scopeid+" and c1.scope = '"+scope+"' "+
" left join (select id, lastname,loginid,email from hrmresource where STATUS = 1 union all select id,lastname,loginid,'' as email from hrmresourcemanager ) h1 on h1.id = t2.userid\n" +
" left join workflow_nodebase d1 on d1.id = t2.nodeid "+
" 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','7','11'))\n" +
" and t2.islasttimes = 1\n" +
@ -279,15 +293,17 @@ public class SendPortalTodoUtil {
rs.executeQuery(sql);
while (rs.next()){
String usercode = Util.null2String(rs.getString("loginid")) ;
JSONObject taskObject = new JSONObject();
String loginid = Util.null2String(rs.getString("loginid")) ;
String staffid = Util.null2String(rs.getString("staffid")) ;
String objectCode = usercode ;
String operatorCode = usercode ;
String objectCode = loginid ;
String operatorCode = loginid ;
JSONObject taskObject = new JSONObject();
taskObject.put("objectAction",objectAction);
taskObject.put("objectType",objectType);
taskObject.put("objectCode",objectCode);
taskObject.put("objectId",objectId);
taskObject.put("objectId",staffid);
taskObject.put("operatorCode",operatorCode);
taskObjectList.add(taskObject);
@ -298,6 +314,7 @@ public class SendPortalTodoUtil {
emailArray += StringUtils.isEmpty(emailArray) ? email : ","+email ;
}
}
requestObject.put("taskObjectList",taskObjectList);
String auth = username + ":" + passwd;
@ -313,8 +330,14 @@ public class SendPortalTodoUtil {
bb.writeLog("emailArray:"+emailArray);
if(StringUtils.isNotEmpty(emailArray))
{
String notificationSubject = "You have a new to-do list:"+requestname+",Please handle it in time";
String notificationContent = "You have a new to-do list:"+requestname+",Please handle it in time";
// String notificationSubject = "You have a new to-do list:"+requestname+",Please handle it in time";
// String notificationContent = "You have a new to-do list:"+requestname+",Please handle it in time";
Map<String,String> templateMap = getEmailTemplate(requestname,lastname,processTime);
String notificationSubject = templateMap.get("notificationSubject");
String notificationContent = templateMap.get("notificationContent");
sendMailUtil.sendMail(requestid,emailArray,notificationSubject,notificationContent);
}
}
@ -338,34 +361,43 @@ public class SendPortalTodoUtil {
HttpRequestUtil httpRequestUtil = new HttpRequestUtil();
SendMailUtil sendMailUtil = new SendMailUtil();
SendPortalErrorUtil sendPortalErrorUtil = new SendPortalErrorUtil();
String mobileJumpUrl = PropBean.getUfPropValue("mobileJumpUrl");
JSONObject requestObject = new JSONObject();
RecordSet rs = new RecordSet();
BaseBean bb = new BaseBean();
bb.writeLog("sendTodoDataByNode");
String cus_staff = PropBean.getUfPropValue("cus_staff") ;
String scopeid = "-1";
String scope = "HrmCustomFieldByInfoType" ;
String ticketType = center ;
String terminal = "1" ;
String taskType = "0";
String objectId = "" ;
String requestname = "" ;
String emailArray = "";
Pattern regex = Pattern.compile(EMAIL_REGEX_DEFAULT);
try {
int 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 = '" + userid + "'";
rs.executeQuery(sql);
while (rs.next()) {
workcode = Util.null2String(rs.getString("loginid"));
}
String processTime = DateUtil.getCurrentTime("yyyy-MM-dd HH:mm:ss");
int count = 0 ;
String countSql =" 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','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 ;
String countSql =" select t2.userid\n" +
" from workflow_requestbase t1\n" +
" inner join workflow_currentoperator t2 on t1.requestid = t2.requestid\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','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--countSql:"+countSql);
rs.executeQuery(countSql);
while (rs.next()){
@ -373,16 +405,7 @@ public class SendPortalTodoUtil {
}
bb.writeLog("sendTodoDataByNode--count:"+count);
String 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" +
" inner join workflow_base t3 on t1.workflowid = t3.id\n" +
" left join workflow_nodebase d1 on d1.id = t1.currentnodeid "+
" LEFT JOIN cus_fielddata c1 on c1.ID=t1.creater"+
" 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);
String requestname = "" ;
if(count >0){
@ -390,52 +413,62 @@ public class SendPortalTodoUtil {
String actionType = "1" ;
String objectAction = "1" ;
String objectType = "0";
String objectId = "" ;
String nodeId = "";
String nodeName = "" ;
String workflowname = "" ;
sql =" select t1.requestname,t1.currentnodeid as nodeid,d1.nodename,t3.workflowname\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 "+
" 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()){
objectId = rs.getString("staffid");
String workflowid = Util.null2String(rs.getString("workflowid")) ;
String workflowname = getWorkflowname(workflowid);
String title = Util.null2String(rs.getString("requestname")) ;
requestname = title;
String creator = Util.null2String(rs.getString("loginid")) ;
String taskCode = Util.null2String(rs.getString("taskcode")) ;
String nodeId = Util.null2String(rs.getString("nodeid")) ;
String workcode = Util.null2String(rs.getString("loginid")) ;
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 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 = 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;
bb.writeLog("urlDing", urlDing);
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",workflowname);
requestname = Util.null2String(rs.getString("requestname")) ;
workflowname = Util.null2String(rs.getString("workflowname")) ;
nodeId = Util.null2String(rs.getString("nodeid")) ;
nodeName = Util.null2String(rs.getString("nodeName")) ;
}
String urlPc = "[newtab]"+bpm_workflowurl+"/workflow/request/ViewRequestForwardSPA.jsp?requestid="+requestid ;
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");
}
// String urlDing = replace+bpm_app_requesturl+requestid;
// String urlApp = replace+bpm_app_requesturl+requestid;
bb.writeLog("urlDing", urlDing);
requestObject.put("center",center);
requestObject.put("title",requestname);
requestObject.put("creator",workcode);
requestObject.put("taskCode",requestid);
requestObject.put("nodeId",nodeId);
requestObject.put("taskType",taskType);
requestObject.put("actionType",actionType);
requestObject.put("createDate",processTime);
requestObject.put("messageTitle",getShortMessageTitle(requestname));
requestObject.put("messageContent",requestname);
requestObject.put("terminal",terminal);
requestObject.put("urlPc",urlPc);
requestObject.put("urlApp",urlApp);
requestObject.put("urlDing",urlDing);
requestObject.put("nodeName",nodeName);
requestObject.put("ticketType",workflowname);
String objectCode = user.getLoginid() ;
String operatorCode = user.getLoginid() ;
JSONObject taskObject = new JSONObject();
@ -453,65 +486,68 @@ public class SendPortalTodoUtil {
String objectType = "0";
JSONArray taskObjectList = new JSONArray();
String workflowname = "" ;
String nodeId = "" ;
String nodeName = "" ;
sql =" select t1.requestname,t1.currentnodeid as nodeid,d1.nodename,t3.workflowname\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 "+
" where (t1.deleted <> 1 or t1.deleted is null or t1.deleted = '')\n" +
" and t1.requestid = "+requestid ;
bb.writeLog("sendTodoDataByNode--sql2:"+sql);
rs.executeQuery(sql);
if (rs.next()){
String workflowid = Util.null2String(rs.getString("workflowid")) ;
String workflowname = getWorkflowname(workflowid);
String title = Util.null2String(rs.getString("requestname")) ;
requestname = title;
String creator = Util.null2String(rs.getString("loginid")) ;
String taskCode = Util.null2String(rs.getString("taskcode")) ;
String nodeId = Util.null2String(rs.getString("nodeid")) ;
String workcode = Util.null2String(rs.getString("loginid")) ;
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 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 = 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;
bb.writeLog("urlDing", urlDing);
// String urlDing = bpm_app_workflowurl+"/interface/mobilelogin/loginsso.jsp?em_auth_usercode="+workcode+"&forwardurl="+app_requestUrl;
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",workflowname);
requestname = Util.null2String(rs.getString("requestname")) ;
workflowname = Util.null2String(rs.getString("workflowname")) ;
nodeId = Util.null2String(rs.getString("nodeid")) ;
nodeName = Util.null2String(rs.getString("nodeName")) ;
}
sql = " select t2.userid,h1.loginid,h1.email\n" +
String urlPc = "[newtab]"+bpm_workflowurl+"/workflow/request/ViewRequestForwardSPA.jsp?requestid="+requestid ;
String replace = bpm_app_workflowurl.replace("/bpm", "");
String urlDing = replace+bpm_app_requesturl+requestid;
String urlApp = replace+bpm_app_requesturl+requestid;
bb.writeLog("urlDing", urlDing);
requestObject.put("center",center);
requestObject.put("title",requestname);
requestObject.put("creator",workcode);
requestObject.put("taskCode",requestid);
requestObject.put("nodeId",nodeId);
requestObject.put("taskType",taskType);
requestObject.put("actionType",actionType);
requestObject.put("createDate",processTime);
requestObject.put("messageTitle",getShortMessageTitle(requestname));
requestObject.put("messageContent",requestname);
requestObject.put("terminal",terminal);
requestObject.put("urlPc",urlPc);
requestObject.put("urlApp",urlApp);
requestObject.put("urlDing",urlDing);
requestObject.put("nodeName",nodeName);
requestObject.put("ticketType",workflowname);
sql = " select t2.userid,h1.loginid,h1.email,c1."+cus_staff+" as staffid "+
" from workflow_requestbase t1\n" +
" inner join workflow_currentoperator t2 on t1.requestid = t2.requestid\n" +
" left join cus_fielddata c1 on c1.id = t2.userid and c1.scopeid= "+scopeid+" and c1.scope = '"+scope+"' "+
" left join (select id, lastname,loginid,email from hrmresource where STATUS = 1 union all select id,lastname,loginid,'' as email 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', '7','8','9','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")) ;
String staffid = Util.null2String(rs.getString("staffid")) ;
String objectCode = usercode ;
String operatorCode = usercode ;
@ -519,7 +555,7 @@ public class SendPortalTodoUtil {
taskObject.put("objectAction",objectAction);
taskObject.put("objectType",objectType);
taskObject.put("objectCode",objectCode);
taskObject.put("objectId",objectId);
taskObject.put("objectId",staffid);
taskObject.put("operatorCode",operatorCode);
taskObjectList.add(taskObject);
@ -547,8 +583,13 @@ public class SendPortalTodoUtil {
bb.writeLog("emailArray:"+emailArray);
if(StringUtils.isNotEmpty(emailArray))
{
String notificationSubject = "You have a new to-do list:"+requestname+",Please handle it in time";
String notificationContent = "You have a new to-do list:"+requestname+",Please handle it in time";
// String notificationSubject = "You have a new To-Do task:"+requestname+",Please handle it in time";
// String notificationContent = "You have a new to-do list:"+requestname+",Please handle it in time";
Map<String,String> templateMap = getEmailTemplate(requestname,lastname,processTime);
String notificationSubject = templateMap.get("notificationSubject");
String notificationContent = templateMap.get("notificationContent");
sendMailUtil.sendMail(requestid,emailArray,notificationSubject,notificationContent);
}
@ -575,95 +616,109 @@ public class SendPortalTodoUtil {
HttpRequestUtil httpRequestUtil = new HttpRequestUtil();
SendMailUtil sendMailUtil = new SendMailUtil();
SendPortalErrorUtil sendPortalErrorUtil = new SendPortalErrorUtil();
JSONObject requestObject = new JSONObject();
String mobileJumpUrl = PropBean.getUfPropValue("mobileJumpUrl");
String emailArray = "";
Pattern regex = Pattern.compile(EMAIL_REGEX_DEFAULT);
BaseBean bb = new BaseBean();
bb.writeLog("sendTodoDataByReject");
RecordSet rs = new RecordSet();
String ticketType = center ;
String terminal = "1" ;
String taskType = "0";
String objectAction = "0" ;
String objectType = "0";
String objectId = "" ;
String requestname = "";
String cus_staff = PropBean.getUfPropValue("cus_staff") ;
String scopeid = "-1";
String scope = "HrmCustomFieldByInfoType" ;
try {
int 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 = '" + userid + "'";
rs.executeQuery(sql);
while (rs.next()) {
workcode = Util.null2String(rs.getString("loginid"));
}
String processTime = DateUtil.getCurrentTime("yyyy-MM-dd HH:mm:ss");
String actionType = "2" ;
JSONArray taskObjectList = new JSONArray();
String 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" +
String workflowname = "" ;
String requestname = "";
String nodeId = "";
String nodeName = "" ;
sql =" select t1.requestname,t1.currentnodeid as nodeid,d1.nodename,t3.workflowname\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("sendTodoDataByReject--sql:"+sql);
rs.executeQuery(sql);
if (rs.next()){
String workflowid = Util.null2String(rs.getString("workflowid")) ;
String workflowname = getWorkflowname(workflowid);
String title = Util.null2String(rs.getString("requestname")) ;
requestname = title ;
String creator = Util.null2String(rs.getString("loginid")) ;
String taskCode = Util.null2String(rs.getString("taskcode")) ;
String nodeId = Util.null2String(rs.getString("nodeid")) ;
String workcode = Util.null2String(rs.getString("loginid")) ;
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")) ;
workflowname = Util.null2String(rs.getString("workflowname")) ;
requestname = Util.null2String(rs.getString("requestname")) ;
nodeId = Util.null2String(rs.getString("nodeid")) ;
nodeName = Util.null2String(rs.getString("nodeName")) ;
}
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 = 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;
bb.writeLog("urlDing", urlDing);
// String urlDing = bpm_app_workflowurl+"/interface/mobilelogin/loginsso.jsp?em_auth_usercode="+workcode+"&forwardurl="+app_requestUrl;
String nodeName = Util.null2String(rs.getString("nodeName")) ;
String urlPc = "[newtab]"+bpm_workflowurl+"/workflow/request/ViewRequestForwardSPA.jsp?requestid="+requestid ;
String replace = bpm_app_workflowurl.replace("/bpm", "");
String urlDing = replace+bpm_app_requesturl+requestid ;
String urlApp = replace+bpm_app_requesturl+requestid ;
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",workflowname);
if(StringUtils.isNotEmpty(mobileJumpUrl)){
urlDing += "&returnUrl="+URLEncoder.encode(mobileJumpUrl,"UTF-8");
urlApp += "&returnUrl="+URLEncoder.encode(mobileJumpUrl,"UTF-8");
}
sql = " select t2.userid,h1.loginid,h1.email\n" +
// String urlDing = replace+bpm_app_requesturl+requestid ;
// String urlApp = replace+bpm_app_requesturl+requestid ;
bb.writeLog("urlDing", urlDing);
JSONObject requestObject = new JSONObject();
requestObject.put("center",center);
requestObject.put("title",requestname);
requestObject.put("creator",workcode);
requestObject.put("taskCode",requestid);
requestObject.put("nodeId",nodeId);
requestObject.put("taskType",taskType);
requestObject.put("actionType",actionType);
requestObject.put("createDate",processTime);
requestObject.put("messageTitle",getShortMessageTitle(requestname));
requestObject.put("messageContent",requestname);
requestObject.put("terminal",terminal);
requestObject.put("urlPc",urlPc);
requestObject.put("urlApp",urlApp);
requestObject.put("urlDing",urlDing);
requestObject.put("nodeName",nodeName);
requestObject.put("ticketType",workflowname);
sql = " select t2.userid,h1.loginid,h1.email,c1."+cus_staff+" as staffid "+
" from workflow_requestbase t1\n" +
" inner join workflow_currentoperator t2 on t1.requestid = t2.requestid\n" +
" left join cus_fielddata c1 on c1.id = t2.userid and c1.scopeid= "+scopeid+" and c1.scope = '"+scope+"' "+
" left join (select id, lastname,loginid,email from hrmresource where STATUS = 1 union all select id,lastname,loginid,'' as email 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','7', '11'))\n" +
" and t2.islasttimes = 1\n" +
" and (t2.isprocessing = '' or t2.isprocessing is null)\n" +
" and t2.REQUESTID = "+requestid;
" and t2.requestid = "+requestid;
bb.writeLog("sendTodoDataByReject--sql:"+sql);
rs.executeQuery(sql);
while (rs.next()){
String usercode = Util.null2String(rs.getString("loginid")) ;
String staffid = Util.null2String(rs.getString("staffid")) ;
JSONObject taskObject = new JSONObject();
String objectCode = usercode ;
@ -672,7 +727,7 @@ public class SendPortalTodoUtil {
taskObject.put("objectAction",objectAction);
taskObject.put("objectType",objectType);
taskObject.put("objectCode",objectCode);
taskObject.put("objectId",objectId);
taskObject.put("objectId",staffid);
taskObject.put("operatorCode",operatorCode);
taskObjectList.add(taskObject);
@ -700,8 +755,13 @@ public class SendPortalTodoUtil {
bb.writeLog("emailArray:"+emailArray);
if(StringUtils.isNotEmpty(emailArray))
{
String notificationSubject = "You have a new to-do list:"+requestname+",Please handle it in time";
String notificationContent = "You have a new to-do list:"+requestname+",Please handle it in time";
// String notificationSubject = "You have a new to-do list:"+requestname+",Please handle it in time";
// String notificationContent = "You have a new to-do list:"+requestname+",Please handle it in time";
Map<String,String> templateMap = getEmailTemplate(requestname,lastname,processTime);
String notificationSubject = templateMap.get("notificationSubject");
String notificationContent = templateMap.get("notificationContent");
sendMailUtil.sendMail(requestid,emailArray,notificationSubject,notificationContent);
}
}else{
@ -732,4 +792,25 @@ public class SendPortalTodoUtil {
return name;
}
/***
*
* @param requestname
* @param operator
* @param operatorTime
* @return
*/
public Map<String,String> getEmailTemplate(String requestname,String operator,String operatorTime){
Map<String,String> dataMap = new HashMap<String,String>();
String notificationSubject = "You have a new To-Read - <"+requestname+"> ";
String notificationContent = operator + " created this task on "+operatorTime+"\n" +
"Please handle it in time.";
dataMap.put("notificationSubject",notificationSubject);
dataMap.put("notificationContent",notificationContent);
return dataMap;
}
}

@ -0,0 +1,437 @@
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;
import weaver.hrm.User;
import weaver.interfaces.dito.comInfo.PropBean;
import java.net.URLEncoder;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class SendPortalWithRawRunnable implements Runnable{
private String workflowid;
private String requestid;
private String recallnodeid;
private User user;
public SendPortalWithRawRunnable(String workflowid, String requestid, String recallnodeid, User user){
this.workflowid = workflowid;
this.requestid = requestid;
this.recallnodeid = recallnodeid;
this.user = user;
}
@Override
public void run() {
String bpm_app_workflowurl = PropBean.getUfPropValue("bpm_app_workflowurl");
String bpm_app_requesturl = PropBean.getUfPropValue("bpm_app_requesturl");
String portal_todourl = PropBean.getUfPropValue("portal_todourl");
String username = PropBean.getUfPropValue("username");
String passwd = PropBean.getUfPropValue("passwd");
String center = PropBean.getUfPropValue("center");
String bpm_workflowurl = PropBean.getUfPropValue("bpm_workflowurl");
sendTodoDataByNode(requestid,recallnodeid,user,username,passwd,center,portal_todourl,bpm_workflowurl,bpm_app_workflowurl,bpm_app_requesturl);
sendToReadDataByNode(requestid,recallnodeid,user,username,passwd,center,portal_todourl,bpm_workflowurl,bpm_app_workflowurl,bpm_app_requesturl);
}
/**
*
* @param username
* @param passwd
* @param center
* @param portal_todourl
* @param bpm_workflowurl
* @param bpm_app_workflowurl
* @param bpm_app_requesturl
*/
public void sendToReadDataByNode(String requestid,String recallnodeid,User user,String username,String passwd,String center,String portal_todourl,String bpm_workflowurl,String bpm_app_workflowurl,String bpm_app_requesturl){
HttpRequestUtil httpRequestUtil = new HttpRequestUtil();
String mobileJumpUrl = PropBean.getUfPropValue("mobileJumpUrl");
RecordSet rs = new RecordSet();
BaseBean bb = new BaseBean();
bb.writeLog("SendPortalQithRawRunnable-sendToReadDataByNode");
String actionType = "1";
String objectAction = "1";
String objectType = "0";
String terminal = "1" ;
String taskType = "1";
try {
int u_userid = user.getUID();
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);
while (rs.next()) {
workcode = Util.null2String(rs.getString("loginid"));
}
String requestname = "" ;
String workflowname = "" ;
String nodeId = "" ;
String nodeName = "" ;
sql =" select t1.requestname,t1.currentnodeid as nodeid,d1.nodename,t3.workflowname\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 "+
" where (t1.deleted <> 1 or t1.deleted is null or t1.deleted = '')\n" +
" and t1.requestid = "+requestid ;
bb.writeLog("sendTodoDataByNode--sql2:"+sql);
rs.executeQuery(sql);
if (rs.next()){
requestname = Util.null2String(rs.getString("requestname")) ;
workflowname = Util.null2String(rs.getString("workflowname")) ;
nodeId = Util.null2String(rs.getString("nodeid")) ;
nodeName = Util.null2String(rs.getString("nodeName")) ;
}
String processTime = DateUtil.getCurrentTime("yyyy-MM-dd HH:mm:ss");
String urlPc = "[newtab]"+bpm_workflowurl+"/workflow/request/ViewRequestForwardSPA.jsp?requestid="+requestid ;
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");
}
String recall_id = "" ;
String recall_userid = "";
String recall_nodeid = "";
String recall_receivedate = "";
String recall_receivetime = "";
rs.executeQuery("select * from workflow_currentoperator where requestid = ? and userid = ? and isremark = '2' and preisremark in ('0','2','7') and nodeid = ? order by id desc", requestid, user.getUID(),recallnodeid);
if (rs.next()) {
recall_id = rs.getString("id");
recall_userid = rs.getString("userid");
recall_nodeid = rs.getString("nodeid");
recall_receivedate = rs.getString("receivedate");
recall_receivetime = rs.getString("receivetime");
}
bb.writeLog("recall_id:"+recall_id);
bb.writeLog("recall_userid:"+recall_userid);
bb.writeLog("recall_receivedate:"+recall_receivedate);
bb.writeLog("recall_receivetime:"+recall_receivetime);
String withdrawNodes = "";
sql = "select distinct nodeid from workflow_currentoperator where requestid = ?";
rs.executeQuery(sql,requestid);
bb.writeLog("sql:"+sql);
while (rs.next()) {
withdrawNodes += StringUtils.isEmpty(withdrawNodes) ? rs.getString("nodeid") : ","+rs.getString("nodeid");
}
bb.writeLog("withdrawNodes:"+withdrawNodes);
//需要撤回的节点包含本节点比如A-B-C,撤回到A则此值为ABC.
String sql_temp = "select distinct nodeid from workflow_currentoperator where requestid = ? and nodeid in (" + withdrawNodes + ") and id >= ?";
withdrawNodes = "";
rs.executeQuery(sql_temp,new Object[]{requestid, recall_id});
bb.writeLog("sql_temp:"+sql_temp);
while(rs.next()){
withdrawNodes += StringUtils.isEmpty(withdrawNodes) ? rs.getString("nodeid") : ","+rs.getString("nodeid");
}
bb.writeLog("withdrawNodes:"+withdrawNodes);
JSONArray taskObjectList = new JSONArray();
sql = " select t2.userid,h1.loginid,t1.requestid,t2.nodeid "+
" from workflow_requestbase t1\n" +
" inner join workflow_currentoperator t2 on t1.requestid = t2.requestid\n" +
" left join (select id, lastname,loginid,email from hrmresource where STATUS = 1 union all select id,lastname,loginid,'' as email from hrmresourcemanager ) h1 on h1.id = t2.userid\n" +
" where (t1.deleted <> 1 or t1.deleted is null or t1.deleted = '')\n" +
" and t1.requestid = ? " +
" and t2.nodeid in (" + withdrawNodes + ") " +
" and t2.nodeid != ? " +
" and t2.userid != ? " +
" and t2.receivedate >= ? " +
" and t2.receivetime >= ? " +
" and t2.operatetype = 4 " ;
bb.writeLog("sendTodoDataByNode--sql:"+sql);
rs.executeQuery(sql, requestid,recall_nodeid , recall_userid, recall_receivedate, recall_receivetime);
while (rs.next()) {
String lcid = Util.null2String(rs.getString("requestid")) ;
String nodeid = Util.null2String(rs.getString("nodeid")) ;
String nodename = Util.null2String(rs.getString("nodename")) ;
String creator = Util.null2String(rs.getString("loginid")) ;
String userid = Util.null2String(rs.getString("userid")) ;
JSONObject taskObject = new JSONObject();
taskObject.put("lcid",lcid);
taskObject.put("nodeid",nodeid);
taskObject.put("nodename",nodename);
taskObject.put("creator",creator);
taskObject.put("userid",userid);
taskObjectList.add(taskObject);
}
for (int i = 0; i < taskObjectList.size(); i++)
{
JSONObject dataObject = taskObjectList.getJSONObject(i);
String lcid = dataObject.getString("lcid");
String nodeid = dataObject.getString("nodeid");
String nodename = dataObject.getString("nodename");
String creator = dataObject.getString("creator");
String userid = dataObject.getString("userid");
if("sysadmin".equals(creator)){
creator = "Admin";
}
JSONObject taskObject = new JSONObject();
String objectCode = creator ;
String operatorCode = creator ;
taskObject.put("objectAction",objectAction);
taskObject.put("objectType",objectType);
taskObject.put("objectCode",objectCode);
taskObject.put("objectId","");
taskObject.put("operatorCode",operatorCode);
JSONArray taskArray = new JSONArray();
taskArray.add(taskObject);
JSONObject requestObject = new JSONObject();
requestObject.put("center", center);
requestObject.put("title", requestname);
requestObject.put("taskType", taskType);
requestObject.put("actionType", actionType);
requestObject.put("createDate", processTime);
requestObject.put("messageTitle",getShortMessageTitle(requestname));
requestObject.put("messageContent", requestname);
requestObject.put("terminal", terminal);
requestObject.put("urlPc", urlPc);
requestObject.put("urlDing", urlDing);
requestObject.put("ticketType", workflowname);
requestObject.put("creator",workcode);
requestObject.put("urlApp",urlApp);
requestObject.put("nodeName",nodename);
requestObject.put("nodeId",nodeid);
requestObject.put("taskCode",lcid+"_cs_"+nodeid+"_"+userid);
requestObject.put("taskObjectList",taskArray);
String auth = username + ":" + passwd;
bb.writeLog("SendPortalToReadUtil--requestObject:" + requestObject.toJSONString());
String msgdata = httpRequestUtil.doPostByAuth(portal_todourl, requestObject.toJSONString(), auth);
bb.writeLog("SendPortalToReadUtil-msgdata:" + msgdata);
if (!"".equals(msgdata)) {
JSONObject msgObject = JSONObject.parseObject(msgdata);
if (msgObject.containsKey("resultCode")) {
String resultCode = msgObject.getString("resultCode");
if ("0".equals(resultCode)) {
}
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
private String getShortMessageTitle(String messageTitle) {
if (messageTitle.length() > 20) {
messageTitle = messageTitle.substring(0, 17) + "...";
}
return messageTitle;
}
/**
*
* @param username
* @param passwd
* @param portal_todourl
* @param bpm_workflowurl
* @param bpm_app_workflowurl
* @param bpm_app_requesturl
*/
public void sendTodoDataByNode(String requestid,String recallnodeid,User user,String username,String passwd,String center,String portal_todourl,String bpm_workflowurl,String bpm_app_workflowurl,String bpm_app_requesturl){
HttpRequestUtil httpRequestUtil = new HttpRequestUtil();
SendPortalErrorUtil sendPortalErrorUtil = new SendPortalErrorUtil();
String mobileJumpUrl = PropBean.getUfPropValue("mobileJumpUrl");
JSONObject requestObject = new JSONObject();
RecordSet rs = new RecordSet();
BaseBean bb = new BaseBean();
bb.writeLog("SendPortalQithRawRunnable--sendTodoDataByNode");
String terminal = "1" ;
String taskType = "0";
String actionType = "2" ;
String objectAction = "0" ;
String objectType = "0";
try {
int userid = user.getUID();
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 = '" + userid + "'";
rs.executeQuery(sql);
while (rs.next()) {
workcode = Util.null2String(rs.getString("loginid"));
}
String processTime = DateUtil.getCurrentTime("yyyy-MM-dd HH:mm:ss");
String urlPc = "[newtab]"+bpm_workflowurl+"/workflow/request/ViewRequestForwardSPA.jsp?requestid="+requestid ;
String replace = bpm_app_workflowurl.replace("/bpm", "");
String urlDing = replace+bpm_app_requesturl+requestid;
String urlApp = replace+bpm_app_requesturl+requestid;
bb.writeLog("urlDing", urlDing);
String requestname = "" ;
String workflowname = "" ;
String nodeId = "" ;
String nodeName = "" ;
sql =" select t1.requestname,t1.currentnodeid as nodeid,d1.nodename,t3.workflowname\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 "+
" where (t1.deleted <> 1 or t1.deleted is null or t1.deleted = '')\n" +
" and t1.requestid = "+requestid ;
bb.writeLog("sendTodoDataByNode--sql2:"+sql);
rs.executeQuery(sql);
if (rs.next()){
requestname = Util.null2String(rs.getString("requestname")) ;
workflowname = Util.null2String(rs.getString("workflowname")) ;
nodeId = Util.null2String(rs.getString("nodeid")) ;
nodeName = Util.null2String(rs.getString("nodeName")) ;
}
// String recall_id = "" ;
// String recall_userid = "";
// String recall_nodeid = "";
// String recall_receivedate = "";
// String recall_receivetime = "";
// rs.executeQuery(" select * from workflow_currentoperator where requestid = ? and userid = ? and isremark = '2' and preisremark in ('0','2','7') and nodeid = ? order by id desc", requestid, user.getUID(),recallnodeid);
// if (rs.next()) {
// recall_id = rs.getString("id");
// recall_userid = rs.getString("userid");
// recall_nodeid = rs.getString("nodeid");
// recall_receivedate = rs.getString("receivedate");
// recall_receivetime = rs.getString("receivetime");
// }
// bb.writeLog("recall_id:"+recall_id);
// bb.writeLog("recall_userid:"+recall_userid);
// bb.writeLog("recall_receivedate:"+recall_receivedate);
// bb.writeLog("recall_receivetime:"+recall_receivetime);
// bb.writeLog("recall_nodeid:"+recall_nodeid);
//
// String withdrawNodes = "";
// sql = "select distinct nodeid from workflow_currentoperator where requestid = ?";
// rs.executeQuery(sql,requestid);
// bb.writeLog("sql:"+sql);
// while (rs.next()) {
// withdrawNodes += StringUtils.isEmpty(withdrawNodes) ? rs.getString("nodeid") : ","+rs.getString("nodeid");
// }
// bb.writeLog("withdrawNodes:"+withdrawNodes);
// //需要撤回的节点包含本节点比如A-B-C,撤回到A则此值为ABC.
// String sql_temp = "select distinct nodeid from workflow_currentoperator where requestid = ? and nodeid in (" + withdrawNodes + ") and id >= ?";
// withdrawNodes = "";
// rs.executeQuery(sql_temp,new Object[]{requestid, recall_id});
// bb.writeLog("sql_temp:"+sql_temp);
// while(rs.next()){
// withdrawNodes += StringUtils.isEmpty(withdrawNodes) ? rs.getString("nodeid") : ","+rs.getString("nodeid");
// }
// bb.writeLog("withdrawNodes:"+withdrawNodes);
//
//
// sql = " select t2.userid,h1.loginid,h1.email "+
// " from workflow_requestbase t1\n" +
// " inner join workflow_currentoperator t2 on t1.requestid = t2.requestid\n" +
// " left join (select id, lastname,loginid,email from hrmresource where STATUS = 1 union all select id,lastname,loginid,'' as email from hrmresourcemanager ) h1 on h1.id = t2.userid\n" +
// " where (t1.deleted <> 1 or t1.deleted is null or t1.deleted = '')\n" +
// " and t1.requestid = ? " +
// " and t2.nodeid in (" + withdrawNodes + ") " +
// " and t2.nodeid != ? " +
// " and t2.userid != ? " +
// " and t2.receivedate >= ? " +
// " and t2.receivetime >= ? " +
// " and t2.operatetype = 4 " ;
//
// rs.executeQuery(sql, requestid,recall_nodeid , recall_userid, recall_receivedate, recall_receivetime);
// bb.writeLog("sendTodoDataByNode--sql:"+sql);
// while (rs.next()){
//
// String usercode = Util.null2String(rs.getString("loginid")) ;
// String objectCode = usercode ;
// String operatorCode = usercode ;
//
//
// }
requestObject.put("center",center);
requestObject.put("title",requestname);
requestObject.put("creator",workcode);
requestObject.put("taskCode",requestid);
requestObject.put("nodeId",nodeId);
requestObject.put("taskType",taskType);
requestObject.put("actionType",actionType);
requestObject.put("createDate",processTime);
requestObject.put("messageTitle",getShortMessageTitle(requestname));
requestObject.put("messageContent",requestname);
requestObject.put("terminal",terminal);
requestObject.put("urlPc",urlPc);
requestObject.put("urlApp",urlApp);
requestObject.put("urlDing",urlDing);
requestObject.put("nodeName",nodeName);
requestObject.put("ticketType",workflowname);
JSONArray taskObjectList = new JSONArray();
JSONObject taskObject = new JSONObject();
taskObject.put("objectAction",objectAction);
taskObject.put("objectType",objectType);
taskObject.put("objectCode",workcode);
taskObject.put("objectId","");
taskObject.put("operatorCode",workcode);
taskObjectList.add(taskObject);
requestObject.put("taskObjectList",taskObjectList);
String auth = username + ":" + passwd;
bb.writeLog("sendTodoDataByNode---requestObject:"+requestObject.toJSONString());
String msgdata = httpRequestUtil.doPostByAuth(portal_todourl,requestObject.toJSONString(),auth);
bb.writeLog("msgdata:"+msgdata);
if(!"".equals(msgdata)){
JSONObject msgObject = JSONObject.parseObject(msgdata);
//{"resultCode":"1","resultMsg":"No Result"}
if(msgObject.containsKey("resultCode")){
String resultCode = msgObject.getString("resultCode");
if("0".equals(resultCode)){
}else{
sendPortalErrorUtil.doCreateSendPortalTodoErrorInfo();
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
}

@ -0,0 +1,58 @@
package com.customization.dito.sendtodo;
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.RequestWithdrawCmd;
import weaver.general.BaseBean;
import weaver.general.Util;
import weaver.hrm.User;
import javax.servlet.http.HttpServletRequest;
import java.util.Map;
/***
*
*/
@CommandDynamicProxy(target = RequestWithdrawCmd.class, desc="流程撤回后给门户发送代办消息")
public class SendPortalWithdRawCmd extends AbstractCommandProxy<Map<String,Object>> {
@Override
public Map<String, Object> execute(Command<Map<String, Object>> targetCommand) {
//获取到被代理对象
RequestWithdrawCmd requestWithdrawCmd = (RequestWithdrawCmd)targetCommand;
//获取被代理对象的参数
//对参数做预处理
BaseBean bb = new BaseBean();
HttpServletRequest request = requestWithdrawCmd.getRequest();
String requestid = Util.null2String(request.getParameter("requestid")).trim();
String workflowid = Util.null2String(request.getParameter("workflowid")).trim();
String actionType = Util.null2String(request.getParameter("actionType")).trim();
String recallnodeid = Util.null2String(request.getParameter("recallNodeId"));
User user = requestWithdrawCmd.getUser();
bb.writeLog("requestid:"+requestid);
bb.writeLog("workflowid:"+workflowid);
bb.writeLog("actionType:"+actionType);
bb.writeLog("recallnodeid:"+recallnodeid);
//参数回写
//执行标准的业务处理
Map<String, Object> resultMap = nextExecute(targetCommand);
//对返回值做加工处理
String result = Util.null2String(resultMap.get("result"));
if("success".equals(result) && "submit".equals(actionType)){
SendPortalWithRawRunnable sendPortalQithRawRunnable = new SendPortalWithRawRunnable(workflowid,requestid,recallnodeid,user);
new Thread(sendPortalQithRawRunnable).start();
}
return resultMap;
}
}

@ -80,7 +80,7 @@ public class PortalLoginBeforeFilter implements Filter {
{
filterChain.doFilter(request, response);
}else{
String uid = "";
String portal_uid = "";
String cookies = request.getHeader("cookie");
if (StringUtils.isNotEmpty(cookies))
{
@ -88,15 +88,14 @@ public class PortalLoginBeforeFilter implements Filter {
for (int i = 0; i < cookievals.length; i++) {
String cookval = cookievals[i];
if (!"".equals(cookval) && cookval.contains("=")) {
String key = cookval.substring(0, cookval.indexOf("="));
String value = cookval.substring(cookval.indexOf("=") + 1);
bb.writeLog("key:"+key);
bb.writeLog("value:"+value);
if ("SESSION".equalsIgnoreCase(key.trim())) {
uid = value;
bb.writeLog("uid8888:"+uid);
String key = cookval.substring(0, cookval.indexOf("=")).trim();
String value = cookval.substring(cookval.indexOf("=") + 1).trim();
//bb.writeLog("key:"+key);
//bb.writeLog("value:"+value);
if ("SESSION".equalsIgnoreCase(key)) {
portal_uid = value;
//bb.writeLog("portal_uid8888:"+portal_uid);
}
}
}
}
@ -107,23 +106,22 @@ public class PortalLoginBeforeFilter implements Filter {
// CLOUD_APP_NAME=dbeptest7_pot-uportal-core;
// CLOUD_APP_ID=44074
if(StringUtils.isNotEmpty(uid))
if(StringUtils.isNotEmpty(portal_uid))
{
User loginuser = (User) request.getSession(true).getAttribute("weaver_user@bean");
String weaver_uid = String.valueOf(request.getSession(true).getAttribute("weaver_uid"));
String portal_status = String.valueOf(request.getSession(true).getAttribute("portal_status"));
String weaver_uid = Util.null2String(request.getSession(true).getAttribute("weaver_uid"));
//String portal_status = Util.null2String(request.getSession(true).getAttribute("portal_status"));
bb.writeLog("weaver_uid:"+weaver_uid);
bb.writeLog("uid:"+uid);
bb.writeLog("portalUserAuth:"+portalUserAuth);
// bb.writeLog("weaver_uid:"+weaver_uid);
// bb.writeLog("uid:"+portal_uid);
// bb.writeLog("portalUserAuth:"+portalUserAuth);
if(StringUtils.isNotEmpty(weaver_uid))
{
if(!uid.equals(weaver_uid))
if(!portal_uid.equals(weaver_uid))
{
bb.writeLog("weaver_uid <> uid portal_status:"+portal_status);
String msg = httpRequestUtil.doGetHttp(portalUserAuth,uid);
bb.writeLog("msg:"+msg);
bb.writeLog("weaver_uid <> uid portal_status:");
String msg = httpRequestUtil.doGetHttp(portalUserAuth,portal_uid);
// bb.writeLog("msg:"+msg);
if (!"".equals(msg))
{
JSONObject jsonObject = JSONObject.parseObject(msg);
@ -133,22 +131,19 @@ public class PortalLoginBeforeFilter implements Filter {
{
JSONObject resultObject = jsonObject.getJSONObject("resultObject");
String staffCode = resultObject.getString("staffCode");
httpRequestUtil.userSessionFilter(request,response, application, staffCode, uid);
httpRequestUtil.userSessionFilter(request,response, application, staffCode, portal_uid);
}
Util.setCookie(response, "portalStatus", resultCode, -1);
// request.getSession(true).setAttribute("portal_status", resultCode);
// Util.setCookie(response, "portalStatus", resultCode, -1);
}
}
}else{
bb.writeLog("weaver_uid == uid");
User loginuser = (User) request.getSession(true).getAttribute("weaver_user@bean");
if(loginuser == null)
{
bb.writeLog("loginuser is null");
String msg = httpRequestUtil.doGetHttp(portalUserAuth,uid);
if (!"".equals(msg))
String msg = httpRequestUtil.doGetHttp(portalUserAuth,portal_uid);
if (StringUtils.isNotEmpty(msg))
{
JSONObject jsonObject = JSONObject.parseObject(msg);
if(jsonObject.containsKey("resultCode")){
@ -157,18 +152,18 @@ public class PortalLoginBeforeFilter implements Filter {
{
JSONObject resultObject = jsonObject.getJSONObject("resultObject");
String staffCode = resultObject.getString("staffCode");
httpRequestUtil.userSessionFilter(request,response, application, staffCode, uid);
httpRequestUtil.userSessionFilter(request,response, application, staffCode, portal_uid);
}
Util.setCookie(response, "portalStatus", resultCode, -1);
// Util.setCookie(response, "portalStatus", resultCode, -1);
}
}
}
}
}else {
bb.writeLog("weaver_uid is null ");
String msg = httpRequestUtil.doGetHttp(portalUserAuth,uid);
bb.writeLog("msg:"+msg);
if (!"".equals(msg))
String msg = httpRequestUtil.doGetHttp(portalUserAuth,portal_uid);
// bb.writeLog("msg:"+msg);
if (StringUtils.isNotEmpty(msg))
{
JSONObject jsonObject = JSONObject.parseObject(msg);
if(jsonObject.containsKey("resultCode")){
@ -177,28 +172,18 @@ public class PortalLoginBeforeFilter implements Filter {
{
JSONObject resultObject = jsonObject.getJSONObject("resultObject");
String staffCode = resultObject.getString("staffCode");
httpRequestUtil.userSessionFilter(request,response, application, staffCode, uid);
httpRequestUtil.userSessionFilter(request,response, application, staffCode, portal_uid);
}
Util.setCookie(response, "portalStatus", resultCode, -1);
// request.getSession(true).setAttribute("portal_status", resultCode);
// Util.setCookie(response, "portalStatus", resultCode, -1);
}
}
}
// String portalCode = Util.null2String(request.getSession().getAttribute("portal_status"));
// if(StringUtils.isNotEmpty(portalCode)){
// if("0".equals(portalCode)){
// bb.writeLog("portalCode == 0");
// request.getRequestDispatcher("/bpm/spa/custom/static/index.html#/main/cs/app/7177140d879d4c4aa56dc6a3c1b65668_loginOutBom").forward(request,response);
// return;
// }
// }
// bb.writeLog(" portalCode:"+portalCode);
String new_weaver_uid = Util.null2String(request.getSession(true).getAttribute("weaver_uid"));
Util.setCookie(response, "portal_uid", portal_uid, -1);
Util.setCookie(response, "weaver_uid", new_weaver_uid, -1);
}
filterChain.doFilter(request, response);
}
}

@ -28,6 +28,15 @@ public class ESiginsCronJob extends BaseCronJob {
updateHrmSiginData();
}
private String usercode ;
public String getUsercode() {
return usercode;
}
public void setUsercode(String usercode) {
this.usercode = usercode;
}
/***
*
@ -46,6 +55,10 @@ public class ESiginsCronJob extends BaseCronJob {
List<Map<String,String>> list = new ArrayList<Map<String,String>>();
Map<String,String> map = null;
String hrmsql = " select id,loginid,subcompanyid1,workcode from hrmresource where status = 1 " ;
if(StringUtils.isNotEmpty(usercode)){
hrmsql += " and loginid = '"+usercode +"'" ;
}
bb.writeLog("hrmsql:"+hrmsql);
rs.executeQuery(hrmsql);
while (rs.next()){
@ -54,10 +67,10 @@ public class ESiginsCronJob extends BaseCronJob {
String subcompanyid1 = Util.null2String(rs.getString("subcompanyid1"));
String workcode = Util.null2String(rs.getString("workcode"));
bb.writeLog("userid:"+userid);
bb.writeLog("loginid:"+loginid);
bb.writeLog("subcompanyid1:"+subcompanyid1);
bb.writeLog("workcode:"+workcode);
// bb.writeLog("userid:"+userid);
// bb.writeLog("loginid:"+loginid);
// bb.writeLog("subcompanyid1:"+subcompanyid1);
// bb.writeLog("workcode:"+workcode);
if(!"".equals(userid) && !"".equals(loginid)){
map = new HashMap<String,String>();
@ -71,9 +84,6 @@ public class ESiginsCronJob extends BaseCronJob {
bb.writeLog("list:"+list.size());
ImageFileIdUpdate im = new ImageFileIdUpdate();
String esignImage = "" ;
// data:image/gif;base64,base64编码的gif图片数据
// data:image/png;base64,base64编码的png图片数据
// data:image/jpeg;base64,base64编码的图片数据
@ -90,7 +100,7 @@ public class ESiginsCronJob extends BaseCronJob {
String auth = username + ":" + passwd;
try{
String msg = doPostByAuth(url,"",auth);
bb.writeLog("msg2 ==" + msg);
// bb.writeLog("msg2 ==" + msg);
if(StringUtils.isNotEmpty(msg))
{
JSONObject jsonObject = JSONObject.parseObject(msg);
@ -100,9 +110,9 @@ public class ESiginsCronJob extends BaseCronJob {
if(jsonObject.containsKey("resultObject")){
JSONObject resultObject = jsonObject.getJSONObject("resultObject");
if(resultObject.containsKey("esignImage")){
esignImage = resultObject.getString("esignImage");
String esignImage = resultObject.getString("esignImage");
if(!"".equals(esignImage)){
if(StringUtils.isNotEmpty(esignImage)){
String imagetype = "" ;
if(esignImage.contains("image/gif")){
imagetype = "gif";
@ -145,53 +155,55 @@ public class ESiginsCronJob extends BaseCronJob {
bb.writeLog("filesize:"+filesize);
String imagefileid = "" ;
String oldfilerealpath = "" ;
String markid = "" ;
String sql =" select t.markid,t.imagefileid,k.filerealpath\n" +
" from DocSignature t\n" +
" left join imagefile k on k.imagefileid = t.imagefileid\n" +
" where t.isdefault = 1 and t.hrmresid= ?" ;
String sql =" select t.markid,t.imagefileid from DocSignature t\n" +
" where t.isdefault = 1 and t.hrmresid= ?" ;
bb.writeLog("userid:"+userid);
rs.executeQuery(sql,new Object[]{userid});
bb.writeLog("sql:"+sql);
if(rs.next()){
oldfilerealpath = Util.null2String(rs.getString("filerealpath"));
imagefileid = Util.null2String(rs.getString("imagefileid"));
markid = Util.null2String(rs.getString("markid"));
}
bb.writeLog("oldfilerealpath:"+oldfilerealpath);
if(StringUtils.isNotEmpty(markid) && StringUtils.isNotEmpty(imagefileid) && StringUtils.isNotEmpty(oldfilerealpath)){
String markdate = TimeUtil.getCurrentTimeString();
sql = " update DocSignature set MARKDATE = ? where MARKID= ?" ;
bb.writeLog("sql:"+sql);
rs.executeUpdate(sql,new Object[]{markdate,markid});
if(StringUtils.isNotEmpty(markid))
{
if(StringUtils.isNotEmpty(imagefileid))
{
String sealtype = "1" ;
String markdate = TimeUtil.getCurrentTimeString();
sql = " update docsignature set isdefault=1,markname = ?,marktype = ?,markpath = ?,marksize = ?,markdate = ?,subcompanyid=?,sealtype = ? where markid= ?" ;
bb.writeLog("sql:"+sql);
boolean isUp = rs.executeUpdate(sql,new Object[]{sysUserCode,"."+imagetype,image_File_Path,filesize+"",markdate,subcompanyid1,sealtype,markid});
if(isUp){
String imageName = sysUserCode+"."+imagetype;
String imageFileType = "application/octet-stream";
sql = " update imagefile set imagefilename = ?,imagefiletype = ?,filerealpath = ?,filesize = ? where imagefileid = ?" ;
rs.executeUpdate(sql,new Object[]{imageName,imageFileType,image_File_Zip_Path,filesize,imagefileid});
bb.writeLog("sql:"+sql);
}
}else{
updateSignatureImage(sysUserCode,imagetype,image_File_Zip_Path,filesize,subcompanyid1,markid);
}
}else{
updateSignature(sysUserCode,imagetype,image_File_Zip_Path,filesize,image_File_Path,subcompanyid1,userid);
}
// if(StringUtils.isEmpty(oldfilerealpath) || StringUtils.isEmpty(imagefileid))
// {
//// File oldFileZip = new File(oldfilerealpath);
//// if(oldFileZip.exists()){
//// long oldfilesize = oldFileZip.length();
//// bb.writeLog("oldfilesize:"+oldfilesize);
////
//// if(oldfilesize != filesize)
//// {
//// updateSignature(sysUserCode,imagetype,image_File_Zip_Path,filesize,image_File_Path,subcompanyid1,userid);
//// }
//// }else{
//// updateSignature(sysUserCode,imagetype,image_File_Zip_Path,filesize,image_File_Path,subcompanyid1,userid);
//// }
// }
}
}
}
}
}
}
}else if(jsonObject.containsKey("resultMsg")){
bb.writeLog("resultMsg");
bb.writeLog("userid:"+userid);
String sql = " delete from docsignature where hrmresid = ?" ;
bb.writeLog("sql:"+sql);
boolean isTrue = rs.executeUpdate(sql,new Object[]{userid});
bb.writeLog("isTrue:"+isTrue);
}
}
}
}catch (Exception e){
bb.writeLog("e:"+e);
@ -199,23 +211,38 @@ public class ESiginsCronJob extends BaseCronJob {
}
}
// int imagefileid = im.getImageFileNewId();
// sql = " INSERT INTO imagefile (IMAGEFILEID,IMAGEFILENAME, IMAGEFILETYPE, IMAGEFILEUSED, FILEREALPATH, ISZIP, FILESIZE, DOWNLOADS, FTPCONFIGID, ISAESENCRYPT, COMEFROM, mainimagefile, secretLevel) VALUES " +
// " (?,?,?,?,?,?,?,?,?,?,?,?,?)" ;
//
// boolean flag = rs.executeUpdate(sql,new Object[]{imagefileid,imageName,imageFileType,imagefileused,image_File_Zip_Path,iszip,filesize,downloads,ftpconfigid,isaesencrypt,comefrom,mainimagefile,secretLevel});
// bb.writeLog("sql:"+sql);
// if(flag){
// sql = " update DocSignature set isdefault = 0 where hrmresid= ?" ;
// boolean isUp = rs.executeUpdate(sql,new Object[]{userid});
// bb.writeLog("sql:"+sql);
// if(isUp){
// sql = " insert into DocSignature(hrmresid, markname, marktype, markpath, marksize, markdate, subcompanyid, sealtype, isdefault, imagefileid)\n" +
// " values(?,?,?,?,?,?,?,?,?,?)" ;
// rs.executeUpdate(sql,new Object[]{userid,sysUserCode,"."+imagetype,image_File_Path,marksize,markdate,subcompanyid1,sealtype,isdefault,imagefileid});
// bb.writeLog("sql:"+sql);
// }
// }
public String doPostByAuth(String esiginsUrl, String dataJson, String auth){
BaseBean bb = new BaseBean();
String authorization = "Basic "+new String(Base64.encode(auth));
bb.writeLog("authorization:"+authorization);
bb.writeLog("esiginsUrl:"+esiginsUrl);
String msgData = "" ;
OkHttpClient client = new OkHttpClient().newBuilder().build();
MediaType mediaType = MediaType.parse("text/plain");
Request request = new Request.Builder()
.url(esiginsUrl)
.method("GET", null)
.addHeader("Authorization", authorization)
.addHeader("Content-Type", "application/json")
.build();
try {
Response response = client.newCall(request).execute();
bb.writeLog("response.code():"+response.code());
//bb.writeLog("response.body():"+response.body().string());
if(response != null && response.code() == 200){
msgData = response.body().string();
}
} catch (IOException e) {
e.printStackTrace();
bb.writeLog("e2:"+e);
}
return msgData;
}
/***
@ -240,7 +267,7 @@ public class ESiginsCronJob extends BaseCronJob {
String ftpconfigid = "0";
String isaesencrypt = "0";
String comefrom = sysUserCode;
String marksize = "0";
String marksize = filesize+"";
String markdate = TimeUtil.getCurrentTimeString();
String sealtype = "1" ;
String isdefault = "1";
@ -249,25 +276,93 @@ public class ESiginsCronJob extends BaseCronJob {
RecordSet rs = new RecordSet();
BaseBean bb = new BaseBean();
int imagefileid = im.getImageFileNewId();
String sql = " INSERT INTO imagefile (IMAGEFILEID,IMAGEFILENAME, IMAGEFILETYPE, IMAGEFILEUSED, FILEREALPATH, ISZIP, FILESIZE, DOWNLOADS, FTPCONFIGID, ISAESENCRYPT, COMEFROM, mainimagefile, secretLevel) VALUES " +
" (?,?,?,?,?,?,?,?,?,?,?,?,?)" ;
boolean flag = rs.executeUpdate(sql,new Object[]{imagefileid,imageName,imageFileType,imagefileused,image_File_Zip_Path,iszip,filesize,downloads,ftpconfigid,isaesencrypt,comefrom,mainimagefile,secretLevel});
bb.writeLog("sql:"+sql);
if(flag){
sql = " update DocSignature set isdefault = 0 where hrmresid= ?" ;
boolean isUp = rs.executeUpdate(sql,new Object[]{userid});
String imagefileid = "" ;
String sql = " select imagefileid from imagefile where filerealpath = ? ";
rs.executeQuery(sql,new Object[]{image_File_Zip_Path});
if(rs.next()){
imagefileid = Util.null2String(rs.getString("imagefileid"));
}
if(StringUtils.isNotEmpty(imagefileid))
{
sql = " insert into DocSignature(hrmresid, markname, marktype, markpath, marksize, markdate, subcompanyid, sealtype, isdefault, imagefileid)\n" +
" values(?,?,?,?,?,?,?,?,?,?)" ;
rs.executeUpdate(sql,new Object[]{userid,sysUserCode,"."+imagetype,image_File_Path,marksize,markdate,subcompanyid1,sealtype,isdefault,imagefileid});
bb.writeLog("sql:"+sql);
if(isUp){
}else{
int newimagefileid = im.getImageFileNewId();
sql = " INSERT INTO imagefile (IMAGEFILEID,IMAGEFILENAME, IMAGEFILETYPE, IMAGEFILEUSED, FILEREALPATH, ISZIP, FILESIZE, DOWNLOADS, FTPCONFIGID, ISAESENCRYPT, COMEFROM, mainimagefile, secretLevel) VALUES " +
" (?,?,?,?,?,?,?,?,?,?,?,?,?)" ;
boolean flag = rs.executeUpdate(sql,new Object[]{newimagefileid,imageName,imageFileType,imagefileused,image_File_Zip_Path,iszip,filesize,downloads,ftpconfigid,isaesencrypt,comefrom,mainimagefile,secretLevel});
bb.writeLog("sql:"+sql);
if(flag){
sql = " insert into DocSignature(hrmresid, markname, marktype, markpath, marksize, markdate, subcompanyid, sealtype, isdefault, imagefileid)\n" +
" values(?,?,?,?,?,?,?,?,?,?)" ;
rs.executeUpdate(sql,new Object[]{userid,sysUserCode,"."+imagetype,image_File_Path,marksize,markdate,subcompanyid1,sealtype,isdefault,imagefileid});
rs.executeUpdate(sql,new Object[]{userid,sysUserCode,"."+imagetype,image_File_Path,marksize,markdate,subcompanyid1,sealtype,isdefault,newimagefileid});
bb.writeLog("sql:"+sql);
}
}
}
/***
*
* @param sysUserCode
* @param imagetype
* @param image_File_Zip_Path
* @param filesize
* @return
*/
public void updateSignatureImage(String sysUserCode,String imagetype,String image_File_Zip_Path,long filesize,String subcompanyid1,String markid){
RecordSet rs = new RecordSet();
BaseBean bb = new BaseBean();
String imageFileType = "application/octet-stream";
String imageName = sysUserCode+"."+imagetype;
String imagefileused = "1";
String iszip = "1";
String secretLevel = "4";
String mainimagefile = "0";
int downloads = 0;
String ftpconfigid = "0";
String isaesencrypt = "0";
String comefrom = sysUserCode;
String markdate = TimeUtil.getCurrentTimeString();
String sealtype = "1" ;
String imagefileid = "" ;
String sql = " select imagefileid from imagefile where filerealpath = ? ";
rs.executeQuery(sql,new Object[]{image_File_Zip_Path});
if(rs.next()){
imagefileid = Util.null2String(rs.getString("imagefileid"));
}
if(StringUtils.isNotEmpty(imagefileid))
{
sql = " update imagefile set imagefilename = ?,imagefiletype = ?,filerealpath = ?,filesize = ? where imagefileid = ?" ;
boolean isTrue = rs.executeUpdate(sql,new Object[]{imageName,imageFileType,image_File_Zip_Path,filesize,imagefileid});
bb.writeLog("sql:"+sql);
if(isTrue){
sql = " update docsignature set isdefault=1,markname = ?,marktype = ?,markpath = ?,marksize = ?,markdate = ?,subcompanyid=?,sealtype = ?,imagefileid = ? where markid= ?" ;
bb.writeLog("sql:"+sql);
rs.executeUpdate(sql,new Object[]{sysUserCode,"."+imagetype,image_File_Zip_Path,filesize+"",markdate,subcompanyid1,sealtype,imagefileid,markid});
}
}else{
ImageFileIdUpdate im = new ImageFileIdUpdate();
int newimagefileid = im.getImageFileNewId();
sql = " INSERT INTO imagefile (IMAGEFILEID,IMAGEFILENAME, IMAGEFILETYPE, IMAGEFILEUSED, FILEREALPATH, ISZIP, FILESIZE, DOWNLOADS, FTPCONFIGID, ISAESENCRYPT, COMEFROM, mainimagefile, secretLevel) VALUES " +
" (?,?,?,?,?,?,?,?,?,?,?,?,?)" ;
boolean isTrue = rs.executeUpdate(sql,new Object[]{imagefileid,imageName,imageFileType,imagefileused,image_File_Zip_Path,iszip,filesize,downloads,ftpconfigid,isaesencrypt,comefrom,mainimagefile,secretLevel});
bb.writeLog("sql:"+sql);
if(isTrue){
sql = " update docsignature set isdefault=1,markname = ?,marktype = ?,markpath = ?,marksize = ?,markdate = ?,subcompanyid=?,sealtype = ?,imagefileid = ? where markid= ?" ;
bb.writeLog("sql:"+sql);
rs.executeUpdate(sql,new Object[]{sysUserCode,"."+imagetype,image_File_Zip_Path,filesize+"",markdate,subcompanyid1,sealtype,newimagefileid+"",markid});
}
}
}
/***
*
* @param esignImage
@ -382,79 +477,4 @@ public class ESiginsCronJob extends BaseCronJob {
}
/***
*
* @param dataJson
* @return
*/
public String doPostByAuth(String esiginsUrl, String dataJson, String auth){
BaseBean bb = new BaseBean();
String authorization = "Basic "+new String(Base64.encode(auth));
bb.writeLog("authorization:"+authorization);
bb.writeLog("esiginsUrl:"+esiginsUrl);
String msgData = "" ;
OkHttpClient client = new OkHttpClient().newBuilder().build();
MediaType mediaType = MediaType.parse("text/plain");
Request request = new Request.Builder()
.url(esiginsUrl)
.method("GET", null)
.addHeader("Authorization", authorization)
.addHeader("Content-Type", "application/json")
.build();
try {
Response response = client.newCall(request).execute();
bb.writeLog("response.code():"+response.code());
//bb.writeLog("response.body():"+response.body().string());
if(response != null && response.code() == 200){
msgData = response.body().string();
}
} catch (IOException e) {
e.printStackTrace();
bb.writeLog("e2:"+e);
}
// bb.writeLog("msgData:"+msgData);
return msgData;
}
public static void main(String[] args) {
ESiginsCronJob ESiginsCronJob = new ESiginsCronJob();
String username = "admin";
String passwd = "Uportal_123";
String esiginsUrl = "http://172.16.25.133/portal-web/v1/esign/Forest/esigns" ;
String auth = username + ":" + passwd;
String msg = ESiginsCronJob.doPostByAuth(esiginsUrl,"",auth);
System.out.println(msg);
}
public static void ttttt(){
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
.url("http://172.16.25.133/portal-web/v1/esign/Forest/esigns")
.method("GET", body)
.addHeader("Authorization", "Basic YWRtaW46VXBvcnRhbF8xMjM=")
.addHeader("Cookie", "SESSION=27a4896a-dcf7-493b-82fd-91832fc034a3")
.build();
try {
Response response = client.newCall(request).execute();
System.out.println("response.code():"+response.code());
System.out.println("response.body():"+response.body().string());
String msgData = response.body().string();
// System.out.println("msgData:"+msgData);
} catch (IOException e) {
e.printStackTrace();
}
}
}

@ -0,0 +1,206 @@
package weaver.interfaces.dito.portal;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import weaver.general.BaseBean;
import weaver.general.Util;
import weaver.ofs.interfaces.SendRequestStatusDataInterfaces;
import weaver.workflow.request.todo.DataObj;
import weaver.workflow.request.todo.RequestStatusObj;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import java.util.ArrayList;
public class SendRequestData2PortalInterfaces implements SendRequestStatusDataInterfaces {
private static final Log log = LogFactory.getLog(SendRequestData2PortalInterfaces.class);
/**
* id
*/
public String id ;
/**
*
*/
public String syscode ;
/**
* URL
*/
public String serverurl ;
/**
*
*/
public ArrayList<String> workflowwhitelist ;
/**
*
*/
public ArrayList<String> userwhitelist ;
public String getId() {
return id;
}
public String getSyscode() {
return syscode;
}
public String getServerurl() {
return serverurl;
}
public ArrayList<String> getWorkflowwhitelist() {
return workflowwhitelist;
}
public ArrayList<String> getUserwhitelist() {
return userwhitelist;
}
/**
*
* @param datas
*/
public void SendRequestStatusData(ArrayList<DataObj> datas) {
BaseBean bb = new BaseBean();
for(DataObj dobj : datas){
JSONArray jsonArray = new JSONArray();
JSONObject mainboject = new JSONObject();
String requestname = "";
JSONObject todojson = new JSONObject();
JSONObject donejson = new JSONObject();
JSONObject deljson = new JSONObject();
ArrayList<RequestStatusObj> tododatas = dobj.getTododatas();
if(tododatas.size()>0){//处理推送的待办数据
JSONArray todolist = new JSONArray();
for(RequestStatusObj rso : tododatas){//遍历当前发送的待办数据
JSONObject rsojson = new JSONObject();
requestname = rso.getRequstname() ;
bb.writeLog("tododatas-requestname:"+requestname);
rsojson.put("cid",rso.getCid());
rsojson.put("username",rso.getUser().getLastname()+"("+rso.getUser().getUID()+")");
rsojson.put("isremark",rso.getIsremark());
rsojson.put("viewtype",rso.getViewtype());
rsojson.put("receivedatetime",rso.getReceivedate()+" "+rso.getReceivetime()+"/"+rso.getOperatedate()+" "+rso.getOperatetime());
rsojson.put("nodename",rso.getNodename());
todolist.add(rsojson);
}
todojson.put("TodoCount",tododatas.size());
todojson.put("TodoDatas",todolist);
jsonArray.add(todojson);
}
ArrayList<RequestStatusObj> donedatas = dobj.getDonedatas();
if(donedatas.size()>0){//处理推送的已办数据
JSONArray todolist = new JSONArray();
for(RequestStatusObj rso : donedatas){//遍历当前发送的已办数据
JSONObject rsojson = new JSONObject();
requestname = rso.getRequstname() ;
bb.writeLog("donedatas-requestname:"+requestname);
rsojson.put("cid",rso.getCid());
rsojson.put("username",rso.getUser().getLastname()+"("+rso.getUser().getUID()+")");
rsojson.put("isremark",rso.getIsremark());
rsojson.put("viewtype",rso.getViewtype());
rsojson.put("receivedatetime",rso.getReceivedate()+" "+rso.getReceivetime()+"/"+rso.getOperatedate()+" "+rso.getOperatetime());
rsojson.put("nodename",rso.getNodename());
rsojson.put("iscomplete",rso.getIscomplete());
todolist.add(rsojson);
}
donejson.put("DoneCount",donedatas.size());
donejson.put("DoneDatas",todolist);
jsonArray.add(donejson);
}
ArrayList<RequestStatusObj> deldatas = dobj.getDeldatas();
if(deldatas.size()>0){//处理推送的删除数据
JSONArray todolist = new JSONArray();
for(RequestStatusObj rso : deldatas){//遍历当前发送的删除数据
requestname = rso.getRequstname() ;
bb.writeLog("deldatas-requestname:"+requestname);
JSONObject rsojson = new JSONObject();
rsojson.put("cid",rso.getCid());
rsojson.put("username",rso.getUser().getLastname()+"("+rso.getUser().getUID()+")");
todolist.add(rsojson);
}
deljson.put("DelCount",deldatas.size());
deljson.put("DelDatas",todolist);
jsonArray.add(deljson);
}
mainboject.put("syscode",syscode);
mainboject.put("requestid",dobj.getRequestid());
mainboject.put("requestname",requestname);
mainboject.put("sendtimestamp",dobj.getSendtimestamp());
mainboject.put("RequestDatas",jsonArray);
//输入内容信息到日志文件中 /log/ecology
log.error("\n"+formatJson(mainboject.toString()));
}
}
/**
* JSON
*
* @param jsonStr
* @return
*/
public static String formatJson(String jsonStr) {
if (null == jsonStr || "".equals(jsonStr))
return "";
StringBuilder sb = new StringBuilder();
char last = '\0';
char current = '\0';
int indent = 0;
boolean isInQuotationMarks = false;
for (int i = 0; i < jsonStr.length(); i++) {
last = current;
current = jsonStr.charAt(i);
switch (current) {
case '"':
if (last != '\\'){
isInQuotationMarks = !isInQuotationMarks;
}
sb.append(current);
break;
case '{':
case '[':
sb.append(current);
if (!isInQuotationMarks) {
sb.append('\n');
indent++;
addIndentBlank(sb, indent);
}
break;
case '}':
case ']':
if (!isInQuotationMarks) {
sb.append('\n');
indent--;
addIndentBlank(sb, indent);
}
sb.append(current);
break;
case ',':
sb.append(current);
break;
default:
sb.append(current);
}
}
return sb.toString();
}
/**
* space()
* @param sb
* @param indent
*/
private static void addIndentBlank(StringBuilder sb, int indent) {
for (int i = 0; i < indent; i++) {
sb.append('\t');
}
}
}
Loading…
Cancel
Save