@ -28,8 +28,9 @@ public class SendPortalToReadUtil {
* /
public void sendToReadDataByCreateNode ( String requestid , User user , String portal_todourl , String bpm_app_workflowurl , String username , String passwd , String bpm_workflowurl , String center , String bpm_app_requesturl ) {
String zhjkbs = "com.customization.dito.sendtodo.SendPortalToReadUtil.sendToReadDataByCreateNode" ;
HttpRequestUtil httpRequestUtil = new HttpRequestUtil ( ) ;
SendMailUtil sendMailUtil = new SendMailUtil ( ) ;
SendPortalErrorUtil sendPortalErrorUtil = new SendPortalErrorUtil ( ) ;
RecordSet rs = new RecordSet ( ) ;
@ -43,6 +44,8 @@ public class SendPortalToReadUtil {
JSONObject requestObject = new JSONObject ( ) ;
Pattern regex = Pattern . compile ( EMAIL_REGEX_DEFAULT ) ;
String currentUserId = user . getUID ( ) + "" ;
String terminal = "1" ;
String actionType = "0" ;
String taskType = "1" ;
@ -53,25 +56,14 @@ public class SendPortalToReadUtil {
try {
String processTime = DateUtil . getCurrentTime ( "yyyy-MM-dd HH:mm:ss" ) ;
JSONArray taskObjectList = new JSONArray ( ) ;
// int u_userid = user.getUID();
String lastname = "" ;
String loginid = "" ;
// 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 createrLastname = "" ;
String createrLoginid = "" ;
String requestname = "" ;
String 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 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 ;
String urlApp = replace + bpm_app_requesturl + requestid ;
if ( StringUtils . isNotEmpty ( mobileJumpUrl ) ) {
@ -79,15 +71,6 @@ public class SendPortalToReadUtil {
urlApp + = "&returnUrl=" + URLEncoder . encode ( mobileJumpUrl , "UTF-8" ) ;
}
String requestname = "" ;
String workflowname = "" ;
// 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 "+
// " where (t1.deleted <> 1 or t1.deleted is null or t1.deleted = '')\n" +
// " and t1.requestid = "+requestid ;
String sql = " select t1.requestname,t1.currentnodeid as nodeid,d1.nodename,t3.workflowname,h2.lastname,h2.loginid " +
" from workflow_requestbase t1\n" +
" inner join workflow_base t3 on t1.workflowid = t3.id\n" +
@ -101,9 +84,10 @@ public class SendPortalToReadUtil {
if ( rs . next ( ) ) {
workflowname = Util . null2String ( rs . getString ( "workflowname" ) ) ;
requestname = Util . null2String ( rs . getString ( "requestname" ) ) ;
l astname = Util . null2String ( rs . getString ( "lastname" ) ) ;
l oginid = Util . null2String ( rs . getString ( "loginid" ) ) ;
createrL astname = Util . null2String ( rs . getString ( "lastname" ) ) ;
createrL oginid = Util . null2String ( rs . getString ( "loginid" ) ) ;
}
requestObject . put ( "center" , center ) ;
requestObject . put ( "title" , requestname ) ;
requestObject . put ( "taskType" , taskType ) ;
@ -116,7 +100,7 @@ public class SendPortalToReadUtil {
requestObject . put ( "urlDing" , urlDing ) ;
requestObject . put ( "ticketType" , workflowname ) ;
requestObject . put ( "urlApp" , urlApp ) ;
requestObject . put ( "creator" , l oginid) ;
requestObject . put ( "creator" , createrL oginid) ;
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" +
@ -183,7 +167,6 @@ public class SendPortalToReadUtil {
requestObject . put ( "nodeName" , nodename ) ;
requestObject . put ( "nodeId" , nodeid ) ;
//requestObject.put("taskCode",lcid+"_cs_"+nodeid+"_"+userid);
requestObject . put ( "taskCode" , lcid + "_cs_" + userid ) ;
requestObject . put ( "taskObjectList" , taskArray ) ;
@ -196,27 +179,23 @@ public class SendPortalToReadUtil {
if ( msgObject . containsKey ( "resultCode" ) ) {
String resultCode = msgObject . getString ( "resultCode" ) ;
if ( "0" . equals ( resultCode ) ) {
Matcher matcher = regex . matcher ( email ) ;
if ( matcher . matches ( ) ) {
emailArray + = StringUtils . isEmpty ( emailArray ) ? email : "," + email ;
}
bb . writeLog ( "emailArray:" + emailArray ) ;
if ( StringUtils . isNotEmpty ( emailArray ) )
{
Map < String , String > templateMap = getEmailTemplate ( requestname , lastname , processTime ) ;
String notificationSubject = templateMap . get ( "notificationSubject" ) ;
String notificationContent = templateMap . get ( "notificationContent" ) ;
//sendMailUtil.sendMail(requestid,emailArray,notificationSubject,notificationContent);
}
sendPortalErrorUtil . doRecordPortalErrorInfo ( requestid , nodeid , nodename , userid , requestObject . toJSONString ( ) , resultCode , "" ) ;
// Matcher matcher = regex.matcher(email);
// if(matcher.matches()){
// emailArray += StringUtils.isEmpty(emailArray) ? email : ","+email ;
// }
// bb.writeLog("emailArray:"+emailArray);
// if(StringUtils.isNotEmpty(emailArray))
// {
// Map<String,String> templateMap = getEmailTemplate(requestname,lastname,processTime);
// String notificationSubject = templateMap.get("notificationSubject");
// String notificationContent = templateMap.get("notificationContent");
// //sendMailUtil.sendMail(requestid,emailArray,notificationSubject,notificationContent);
// }
sendPortalErrorUtil . doRecordPortalErrorInfo4Phase2 ( requestid , nodeid , nodename , currentUserId , requestObject . toJSONString ( ) , resultCode , "" , zhjkbs , userid ) ;
} else {
String resultmsg = msgObject . getString ( "resultMsg" ) ;
sendPortalErrorUtil . doRecordPortalErrorInfo ( requestid , nodeid , nodename , useri d, requestObject . toJSONString ( ) , resultCode , resultmsg ) ;
sendPortalErrorUtil . doRecordPortalErrorInfo4Phase2 ( requestid , nodeid , nodename , currentUserId , requestObject . toJSONString ( ) , resultCode , resultmsg , zhjkbs , userid ) ;
}
}
@ -237,6 +216,9 @@ public class SendPortalToReadUtil {
* @param user
* /
public void sendToReadDataByNode ( String requestid , User user , String noideid , String portal_todourl , String bpm_app_workflowurl , String username , String passwd , String bpm_workflowurl , String center , String bpm_app_requesturl ) {
String zhjkbs = "com.customization.dito.sendtodo.SendPortalToReadUtil.sendToReadDataByNode" ;
HttpRequestUtil httpRequestUtil = new HttpRequestUtil ( ) ;
SendMailUtil sendMailUtil = new SendMailUtil ( ) ;
SendPortalErrorUtil sendPortalErrorUtil = new SendPortalErrorUtil ( ) ;
@ -248,6 +230,8 @@ public class SendPortalToReadUtil {
BaseBean bb = new BaseBean ( ) ;
bb . writeLog ( "SendPortalToReadUtil-sendToReadDataByNode" ) ;
String currentUserId = user . getUID ( ) + "" ;
String cus_staff = PropBean . getUfPropValue ( "cus_staff" ) ;
String scopeid = "-1" ;
String scope = "HrmCustomFieldByInfoType" ;
@ -263,15 +247,16 @@ public class SendPortalToReadUtil {
try {
// int u_userid = user.getUID();
String lastname = "" ;
//
// 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 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" ) ;
}
bb . writeLog ( "urlDing" , urlDing ) ;
int count = 0 ;
String countSql = " select t2.userid \n" +
@ -293,35 +278,13 @@ public class SendPortalToReadUtil {
if ( count = = 0 )
{
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 = 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 ;
String urlApp = replace + bpm_app_requesturl + requestid ;
if ( StringUtils . isNotEmpty ( mobileJumpUrl ) ) {
urlDing + = "&returnUrl=" + URLEncoder . encode ( mobileJumpUrl , "UTF-8" ) ;
urlApp + = "&returnUrl=" + URLEncoder . encode ( mobileJumpUrl , "UTF-8" ) ;
}
bb . writeLog ( "urlDing" , urlDing ) ;
String workflowname = "" ;
String requestname = "" ;
String loginid = "" ;
String createrLastname = "" ;
String createrLoginid = "" ;
JSONArray taskObjectList = new JSONArray ( ) ;
// 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" +
// " and t1.requestid = " + requestid;
String sql = " select t1.requestname,t1.currentnodeid as nodeid,d1.nodename,t3.workflowname,h2.lastname,h2.loginid " +
" from workflow_requestbase t1\n" +
" inner join workflow_base t3 on t1.workflowid = t3.id\n" +
@ -335,8 +298,8 @@ public class SendPortalToReadUtil {
if ( rs . next ( ) ) {
workflowname = Util . null2String ( rs . getString ( "workflowname" ) ) ;
requestname = Util . null2String ( rs . getString ( "requestname" ) ) ;
l astname = Util . null2String ( rs . getString ( "lastname" ) ) ;
l oginid = Util . null2String ( rs . getString ( "loginid" ) ) ;
createrL astname = Util . null2String ( rs . getString ( "lastname" ) ) ;
createrL oginid = Util . null2String ( rs . getString ( "loginid" ) ) ;
}
requestObject . put ( "center" , center ) ;
@ -351,7 +314,7 @@ public class SendPortalToReadUtil {
requestObject . put ( "urlPc" , urlPc ) ;
requestObject . put ( "urlDing" , urlDing ) ;
requestObject . put ( "ticketType" , workflowname ) ;
requestObject . put ( "creator" , l oginid) ;
requestObject . put ( "creator" , createrL oginid) ;
requestObject . put ( "urlApp" , urlApp ) ;
sql = " select t2.userid,h1.loginid,h1.email,t2.isremark,t1.requestid,t2.nodeid,d1.nodename,c1." + cus_staff + " as staffid " +
@ -417,7 +380,6 @@ public class SendPortalToReadUtil {
requestObject . put ( "nodeName" , nodename ) ;
requestObject . put ( "nodeId" , nodeid ) ;
//requestObject.put("taskCode",lcid+"_cs_"+nodeid+"_"+userid);
requestObject . put ( "taskCode" , lcid + "_cs_" + userid ) ;
requestObject . put ( "taskObjectList" , taskArray ) ;
@ -427,26 +389,24 @@ public class SendPortalToReadUtil {
bb . writeLog ( "SendPortalToReadUtil-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 ) ) {
Matcher matcher = regex . matcher ( email ) ;
if ( matcher . matches ( ) ) {
emailArray + = StringUtils . isEmpty ( emailArray ) ? email : "," + email ;
}
bb . writeLog ( "emailArray:" + emailArray ) ;
if ( StringUtils . isNotEmpty ( emailArray ) ) {
Map < String , String > templateMap = getEmailTemplate ( requestname , lastname , processTime ) ;
String notificationSubject = templateMap . get ( "notificationSubject" ) ;
String notificationContent = templateMap . get ( "notificationContent" ) ;
//sendMailUtil.sendMail(requestid, emailArray, notificationSubject, notificationContent);
}
sendPortalErrorUtil . doRecordPortalErrorInfo ( requestid , nodeid , nodename , userid , requestObject . toJSONString ( ) , resultCode , "" ) ;
// Matcher matcher = regex.matcher(email);
// if (matcher.matches()) {
// emailArray += StringUtils.isEmpty(emailArray) ? email : "," + email;
// }
//
// bb.writeLog("emailArray:" + emailArray);
// if (StringUtils.isNotEmpty(emailArray)) {
//
// Map<String,String> templateMap = getEmailTemplate(requestname,createrLastname,processTime);
// String notificationSubject = templateMap.get("notificationSubject");
// String notificationContent = templateMap.get("notificationContent");
// //sendMailUtil.sendMail(requestid, emailArray, notificationSubject, notificationContent);
// }
sendPortalErrorUtil . doRecordPortalErrorInfo4Phase2 ( requestid , nodeid , nodename , currentUserId , requestObject . toJSONString ( ) , resultCode , "" , zhjkbs , userid ) ;
} else if ( "TODO-FAIL-002" . equals ( resultCode ) ) {
//The task does not exist.任务不存在,则新增
@ -455,7 +415,7 @@ public class SendPortalToReadUtil {
} else {
String resultmsg = msgObject . getString ( "resultMsg" ) ;
sendPortalErrorUtil . doRecordPortalErrorInfo ( requestid , nodeid , nodename , useri d, requestObject . toJSONString ( ) , resultCode , resultmsg ) ;
sendPortalErrorUtil . doRecordPortalErrorInfo 4Phase2 ( requestid , nodeid , nodename , currentUserI d, requestObject . toJSONString ( ) , resultCode , resultmsg , zhjkbs , userid ) ;
}
}