修改抄送等bug

feature-LeeD-20221025
liuliang 2 years ago
parent 208942e0b7
commit 86112e6511

@ -4,6 +4,7 @@
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
@ -38,5 +39,25 @@
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="file://$MODULE_DIR$/WEB-INF/libmq" />
</CLASSES>
<JAVADOC />
<SOURCES />
<jarDirectory url="file://$MODULE_DIR$/WEB-INF/libmq" recursive="false" />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="file://$MODULE_DIR$/WEB-INF/libctg" />
</CLASSES>
<JAVADOC />
<SOURCES />
<jarDirectory url="file://$MODULE_DIR$/WEB-INF/libctg" recursive="false" />
</library>
</orderEntry>
</component>
</module>

@ -0,0 +1,141 @@
<%@ page import="weaver.hrm.User" %>
<%@ page import="weaver.general.BaseBean" %>
<%@ page import="com.customization.dito.sendtodo.SendPortalErrorUtil" %>
<%@ page import="com.customization.dito.sendtodo.HttpRequestUtil" %>
<%@ page import="weaver.conn.RecordSet" %>
<%@ page import="weaver.interfaces.dito.comInfo.PropBean" %>
<%@ page import="com.time.util.DateUtil" %>
<%@ page import="weaver.general.Util" %>
<%@ page import="org.apache.commons.lang.StringUtils" %>
<%@ page import="java.net.URLEncoder" %>
<%@ page import="java.io.UnsupportedEncodingException" %>
<%@ page import="com.alibaba.fastjson.JSONObject" %>
<%@ page import="weaver.hrm.HrmUserVarify" %>
<%@ page import="java.util.Map" %>
<%@ page import="java.util.List" %>
<%@ page import="com.alibaba.fastjson.JSONArray" %>
<%@ page import="java.util.HashMap" %>
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%
String bpm_app_workflowurl = PropBean.getUfPropValue("bpm_app_workflowurl");
String bpm_app_requesturl = PropBean.getUfPropValue("bpm_app_requesturl");
String username = PropBean.getUfPropValue("username");
String passwd = PropBean.getUfPropValue("passwd");
String bpm_workflowurl = PropBean.getUfPropValue("bpm_workflowurl");
String requestid = request.getParameter("requestId");
String nodeid = request.getParameter("nodeid");
String userId = request.getParameter("userId");
String portal_doneurl = PropBean.getUfPropValue("portal_doneurl");
sendPortalDoneData(requestid,nodeid,userId,portal_doneurl,bpm_app_workflowurl,username,passwd,bpm_workflowurl,bpm_app_requesturl);
%>
<%!
public void sendPortalDoneData(String requestid, String nodeid, String userId, 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");
SendPortalErrorUtil sendPortalErrorUtil = new SendPortalErrorUtil();
HttpRequestUtil httpRequestUtil = new HttpRequestUtil();
RecordSet rs = new RecordSet();
String mobileJumpUrl = PropBean.getUfPropValue("mobileJumpUrl");
try {
String processTime = DateUtil.getCurrentTime("yyyy-MM-dd HH:mm:ss");
String isRecall = "1";
String actionType = "0";
String userid = userId;
String workcode = "";
String sql = "select loginid from hrmresource where id = '" + userid + "'";
rs.execute(sql);
while (rs.next()) {
workcode = Util.null2String(rs.getString("loginid"));
}
String center = PropBean.getUfPropValue("center");
String urlPc = "[newtab]" + bpm_workflowurl + "/workflow/request/ViewRequestForwardSPA.jsp?requestid=" + requestid;
// String urlApp = "[newtab]" + bpm_app_workflowurl + "/interface/mobilelogin/loginsso.jsp?em_auth_usercode=" + workcode + "&forwardurl=" + app_requestUrl;
String replace = bpm_app_workflowurl.replace("/bpm", "");
String urlDing = replace+bpm_app_requesturl+requestid;
String urlApp = replace+bpm_app_requesturl+requestid;
if(StringUtils.isNotEmpty(mobileJumpUrl)){
try {
urlApp += "&returnUrl="+URLEncoder.encode(mobileJumpUrl,"UTF-8");
urlDing += "&returnUrl="+URLEncoder.encode(mobileJumpUrl,"UTF-8");
} catch (UnsupportedEncodingException unsupportedEncodingException) {
unsupportedEncodingException.printStackTrace();
}
}
String requestname = "";
String workflowname = "";
String nodeName = "" ;
sql = " select t1.requestname,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;
rs.execute(sql);
if (rs.next()) {
requestname = Util.null2String(rs.getString("requestname"));
workflowname = Util.null2String(rs.getString("workflowname"));
}
sql = " select nodename from workflow_nodebase wn where wn.id = "+nodeid ;
rs.execute(sql);
if (rs.next()) {
nodeName = Util.null2String(rs.getString("nodename"));
}
JSONObject requestObject = new JSONObject();
requestObject.put("center", center);
requestObject.put("taskCode", requestid);
requestObject.put("nodeId", nodeid+userid);
requestObject.put("ticketType", workflowname);
requestObject.put("title", requestname);
requestObject.put("creator", workcode);
requestObject.put("processStaff", workcode);
requestObject.put("processTime", processTime);
requestObject.put("isRecall", isRecall);
requestObject.put("actionType", actionType);
requestObject.put("urlPC", urlPc);
requestObject.put("urlApp", urlApp);
requestObject.put("urlDing",urlDing);
String userids = userid+"" ;
String auth = username + ":" + passwd;
bb.writeLog("done requestObject:" + requestObject.toJSONString());
String msgdata = httpRequestUtil.doPostByAuth(portal_doneurl, requestObject.toJSONString(), auth);
bb.writeLog("done msgdata:" + msgdata);
if(StringUtils.isNotEmpty(msgdata))
{
JSONObject msgObject = JSONObject.parseObject(msgdata);
//{"resultCode":"1","resultMsg":"No Result"}
if(msgObject.containsKey("resultCode")){
String resultCode = msgObject.getString("resultCode");
if(!"0".equals(resultCode)){
String resultmsg = msgObject.getString("resultMsg");
sendPortalErrorUtil.doRecordPortalErrorInfo(requestid,nodeid,nodeName,userids,requestObject.toJSONString(),resultCode,resultmsg);
}
}
}
} catch (Exception e) {
bb.writeLog("done Exception");
bb.writeLog(e.getMessage());
}
}
%>

@ -22,7 +22,7 @@
// my.onMessage = function(e) {
// console.log(e); //{'sendToWebView': '1'}
// }
alert(1)
// 判断是否运行在小程序环境里
my.getEnv(function(res) {
if(res.miniprogram){

@ -0,0 +1,177 @@
<%@ page import="weaver.hrm.User" %>
<%@ page import="weaver.general.BaseBean" %>
<%@ page import="com.customization.dito.sendtodo.SendPortalErrorUtil" %>
<%@ page import="com.customization.dito.sendtodo.HttpRequestUtil" %>
<%@ page import="weaver.conn.RecordSet" %>
<%@ page import="weaver.interfaces.dito.comInfo.PropBean" %>
<%@ page import="com.time.util.DateUtil" %>
<%@ page import="weaver.general.Util" %>
<%@ page import="org.apache.commons.lang.StringUtils" %>
<%@ page import="java.net.URLEncoder" %>
<%@ page import="java.io.UnsupportedEncodingException" %>
<%@ page import="com.alibaba.fastjson.JSONObject" %>
<%@ page import="weaver.hrm.HrmUserVarify" %>
<%@ page import="java.util.Map" %>
<%@ page import="java.util.List" %>
<%@ page import="com.alibaba.fastjson.JSONArray" %>
<%@ page import="java.util.HashMap" %>
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%
String bpm_app_workflowurl = PropBean.getUfPropValue("bpm_app_workflowurl");
String portal_todourl = PropBean.getUfPropValue("portal_todourl");
String bpm_app_requesturl = PropBean.getUfPropValue("bpm_app_requesturl");
String username = PropBean.getUfPropValue("username");
String passwd = PropBean.getUfPropValue("passwd");
String bpm_workflowurl = PropBean.getUfPropValue("bpm_workflowurl");
String requestid = request.getParameter("requestId");
String userId = request.getParameter("userId");
String center = PropBean.getUfPropValue("center");
sendTodoDataByNode(requestid,userId,username,passwd,center,portal_todourl,bpm_workflowurl,bpm_app_workflowurl,bpm_app_requesturl);
%>
<%!
public void sendTodoDataByNode(String requestid, String userId, 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");
JSONObject requestObject = new JSONObject();
RecordSet rs = new RecordSet();
BaseBean bb = new BaseBean();
bb.writeLog("SendPortalQithRawRunnable--sendTodoDataByNode");
String terminal = "1" ;
String taskType = "0";
String actionType = "1" ;
String objectAction = "1" ;
String objectType = "0";
try {
String sql = "";
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);
String requestname = "" ;
String workflowname = "" ;
String nodeId = "" ;
String nodeName = "" ;
String lastName = "";
sql =" select t1.requestname,t1.currentnodeid as nodeid,d1.nodename,t3.workflowname,h2.lastname"+
" 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 ) h2 on h2.id = t1.creater \n" +
" 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")) ;
lastName = Util.null2String(rs.getString("lastname")) ;
}
requestObject.put("center",center);
requestObject.put("title",requestname);
requestObject.put("creator",lastName);
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();
String cus_staff = PropBean.getUfPropValue("cus_staff") ;
String scopeid = "-1";
String scope = "HrmCustomFieldByInfoType" ;
String userSql = "select a."+cus_staff+" as staffid,b.loginid from cus_fielddata a,hrmresource b where a.scopeid=-1 and a.scope='HrmCustomFieldByInfoType' and a.id=b.id and a.id=?";
rs.executeQuery(userSql,userId);
requestObject.put("nodeId",requestObject.getString("nodeId")+userId);
if (rs.next()){
String staffid = Util.null2String(rs.getString("staffid"));
String loginid = Util.null2String(rs.getString("loginid"));
if("sysadmin".equals(loginid)){
loginid = "Admin";
}
JSONObject taskObject = new JSONObject();
taskObject.put("objectAction",objectAction);
taskObject.put("objectType",objectType);
taskObject.put("objectCode",loginid);
taskObject.put("objectId",staffid);
taskObject.put("operatorCode",loginid);
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);
Map<String,Object> map = new HashMap<>();
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)){
map.put("resultCode","0");
}else{
bb.writeLog(msgObject.get("resultMsg"));
// sendPortalErrorUtil.doCreateSendPortalTodoErrorInfo();
map.put("resultCode",resultCode);
map.put("resultMsg",msgObject.get("resultMsg"));
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
private String getShortMessageTitle(String messageTitle) {
if (messageTitle.length() > 20) {
messageTitle = messageTitle.substring(0, 17) + "...";
}
return messageTitle;
}
%>

@ -5,8 +5,11 @@ import okhttp3.*;
import weaver.general.BaseBean;
import java.io.IOException;
import java.util.concurrent.TimeUnit;
public class HttpRequestUtil extends BaseBean{
private int retryTimes = 2;
private BaseBean bb = new BaseBean();
/***
*
@ -16,6 +19,7 @@ public class HttpRequestUtil extends BaseBean{
public String doPostByAuth(String portal_todourl,String dataJson,String auth){
//"http://172.16.25.133/portal-web/centerTodo/sync"
BaseBean bb = new BaseBean();
SendPortalErrorUtil sendPortalErrorUtil = new SendPortalErrorUtil();
String authorization = "Basic "+new String(Base64.encode(auth));
bb.writeLog("authorization:"+authorization);
@ -26,7 +30,9 @@ public class HttpRequestUtil extends BaseBean{
String msgData = "" ;
try {
OkHttpClient client = new OkHttpClient().newBuilder().build();
OkHttpClient client = new OkHttpClient().newBuilder()
.addInterceptor(new HttpRequestUtil.OkhttpInterceptor(retryTimes,dataJson))
.retryOnConnectionFailure(false).build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, dataJson);
Request request = new Request.Builder()
@ -44,6 +50,21 @@ public class HttpRequestUtil extends BaseBean{
bb.writeLog("response.body():"+bodyMsg);
if(code == 200){
msgData = bodyMsg;
return msgData;
}else {
for (int i =0;i<retryTimes;i++){
bb.writeLog("HttpRequestUtil--e:"+bodyMsg);
sendPortalErrorUtil.doRecordPortalErrorInfo("1","","","1",dataJson,String.valueOf(code),bodyMsg);
response = client.newCall(request).execute();
code = response.code();
bodyMsg = response.body().string();
bb.writeLog("response.code()"+i+":"+code);
bb.writeLog("response.body()"+i+":"+bodyMsg);
if(code == 200){
msgData = bodyMsg;
return msgData;
}
}
}
} catch (IOException e) {
e.printStackTrace();
@ -53,4 +74,45 @@ public class HttpRequestUtil extends BaseBean{
return msgData;
}
public static class OkhttpInterceptor implements Interceptor {
// 最大重试次数
private int maxRentry;
private String dataJson;
private SendPortalErrorUtil sendPortalErrorUtil = new SendPortalErrorUtil();
public OkhttpInterceptor(int maxRentry,String dataJson) {
this.maxRentry = maxRentry;
this.dataJson = dataJson;
}
@Override
public Response intercept(Chain chain) throws IOException {
/* 2 null , intercept must not return null.
* null IllegalStateException
* */
return retry(chain, 0);//这个递归真的很舒服
}
Response retry(Chain chain, int retryCent) {
Request request = chain.request();
Response response = null;
BaseBean bb = new BaseBean();
try {
// System.out.println("第" + (retryCent + 1) + "次执行发http请求.");
response = chain.proceed(request);
} catch (Exception e) {
bb.writeLog("OkhttpInterceptor--e:"+e);
sendPortalErrorUtil.doRecordPortalErrorInfo("1","","","1",dataJson,"500",e.getMessage());
if (maxRentry > retryCent) {
return retry(chain, retryCent + 1);
}
} finally {
return response;
}
}
}
}

@ -528,7 +528,7 @@ public class SendPortalDoneUtil {
JSONObject requestObject = new JSONObject();
requestObject.put("center", center);
requestObject.put("taskCode", requestid);
requestObject.put("taskCode", "weaver"+requestid);
requestObject.put("nodeId", nodeid);
requestObject.put("ticketType", workflowname);
requestObject.put("title", requestname);
@ -610,7 +610,7 @@ public class SendPortalDoneUtil {
{
JSONObject requestObject = new JSONObject();
requestObject.put("center", center);
requestObject.put("taskCode", requestid);
requestObject.put("taskCode", "weaver"+requestid);
requestObject.put("ticketType", workflowname);
requestObject.put("title", requestname);
requestObject.put("processTime", processTime);

@ -183,7 +183,8 @@ public class SendPortalToReadUtil {
requestObject.put("nodeName",nodename);
requestObject.put("nodeId",nodeid);
requestObject.put("taskCode",lcid+"_cs_"+nodeid+"_"+userid);
//requestObject.put("taskCode",lcid+"_cs_"+nodeid+"_"+userid);
requestObject.put("taskCode", lcid+"_cs_"+userid);
requestObject.put("taskObjectList",taskArray);
String auth = username + ":" + passwd;
@ -416,7 +417,8 @@ public class SendPortalToReadUtil {
requestObject.put("nodeName",nodename);
requestObject.put("nodeId",nodeid);
requestObject.put("taskCode",lcid+"_cs_"+nodeid+"_"+userid);
//requestObject.put("taskCode",lcid+"_cs_"+nodeid+"_"+userid);
requestObject.put("taskCode", lcid+"_cs_"+userid);
requestObject.put("taskObjectList",taskArray);
String auth = username + ":" + passwd;
@ -446,7 +448,11 @@ public class SendPortalToReadUtil {
sendPortalErrorUtil.doRecordPortalErrorInfo(requestid,nodeid,nodename,userid,requestObject.toJSONString(),resultCode,"");
}else{
}else if ("TODO-FAIL-002".equals(resultCode)){
//The task does not exist.任务不存在,则新增
sendToReadDataByCreateNode(requestid,user,portal_todourl,bpm_app_workflowurl,username,passwd,bpm_workflowurl,center,bpm_app_requesturl);
} else{
String resultmsg = msgObject.getString("resultMsg");
sendPortalErrorUtil.doRecordPortalErrorInfo(requestid,nodeid,nodename,userid,requestObject.toJSONString(),resultCode,resultmsg);

@ -116,7 +116,7 @@ public class SendPortalTodoUtil {
requestObject.put("center",center);
requestObject.put("title",requestname);
requestObject.put("creator",loginid);
requestObject.put("taskCode",requestid);
requestObject.put("taskCode","weaver"+requestid);
requestObject.put("nodeId",nodeId);
requestObject.put("taskType",taskType);
requestObject.put("actionType",actionType);
@ -279,7 +279,7 @@ public class SendPortalTodoUtil {
requestObject.put("center",center);
requestObject.put("title",requestname);
requestObject.put("creator",loginid);
requestObject.put("taskCode",requestid);
requestObject.put("taskCode","weaver"+requestid);
requestObject.put("nodeId",nodeId);
requestObject.put("taskType",taskType);
requestObject.put("actionType",actionType);
@ -469,7 +469,7 @@ public class SendPortalTodoUtil {
if (rs.next()){
requestname = Util.null2String(rs.getString("requestname")) ;
workflowname = Util.null2String(rs.getString("workflowname")) ;
nodeId = Util.null2String(rs.getString("nodeid")) ;
nodeId = Util.null2String(rs.getString("nodeid")+user.getUID()) ;
nodeName = Util.null2String(rs.getString("nodeName")) ;
lastname = Util.null2String(rs.getString("lastname")) ;
loginid = Util.null2String(rs.getString("loginid")) ;
@ -494,7 +494,7 @@ public class SendPortalTodoUtil {
requestObject.put("center",center);
requestObject.put("title",requestname);
requestObject.put("creator",loginid);
requestObject.put("taskCode",requestid);
requestObject.put("taskCode","weaver"+requestid);
requestObject.put("nodeId",nodeId);
requestObject.put("taskType",taskType);
requestObject.put("actionType",actionType);
@ -513,14 +513,20 @@ public class SendPortalTodoUtil {
usercode = "Admin";
}
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);
String userSql = "select "+cus_staff+" as staffid from cus_fielddata where scopeid=-1 and scope='HrmCustomFieldByInfoType' and id=?";
rs.executeQuery(userSql,user.getUID());
if (rs.next()){
taskObject.put("objectId",Util.null2String(rs.getString("staffid")));
}
taskObjectList.add(taskObject);
requestObject.put("taskObjectList",taskObjectList);
@ -557,7 +563,7 @@ public class SendPortalTodoUtil {
if (rs.next()){
requestname = Util.null2String(rs.getString("requestname")) ;
workflowname = Util.null2String(rs.getString("workflowname")) ;
nodeId = Util.null2String(rs.getString("nodeid")) ;
nodeId = Util.null2String(rs.getString("nodeid")+user.getUID()) ;
nodeName = Util.null2String(rs.getString("nodeName")) ;
lastname = Util.null2String(rs.getString("lastname")) ;
loginid = Util.null2String(rs.getString("loginid")) ;
@ -578,7 +584,7 @@ public class SendPortalTodoUtil {
requestObject.put("center",center);
requestObject.put("title",requestname);
requestObject.put("creator",loginid);
requestObject.put("taskCode",requestid);
requestObject.put("taskCode","weaver"+requestid);
requestObject.put("nodeId",nodeId);
requestObject.put("taskType",taskType);
requestObject.put("actionType",actionType);
@ -592,13 +598,23 @@ public class SendPortalTodoUtil {
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;
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.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;
@ -772,7 +788,7 @@ public class SendPortalTodoUtil {
requestObject.put("center",center);
requestObject.put("title",requestname);
requestObject.put("creator",loginid);
requestObject.put("taskCode",requestid);
requestObject.put("taskCode","weaver"+requestid);
requestObject.put("nodeId",nodeId);
requestObject.put("taskType",taskType);
requestObject.put("actionType",actionType);

@ -2,8 +2,10 @@ package com.customization.dito.sendtodo;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.constant.Constants;
import com.engine.core.interceptor.CommandContext;
import com.time.util.DateUtil;
import org.apache.bcel.classfile.Constant;
import org.apache.commons.lang.StringUtils;
import weaver.conn.RecordSet;
import weaver.general.BaseBean;
@ -16,9 +18,12 @@ import java.net.URLEncoder;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class SendPortalWithAddDoneCmd {
private Map<String,Object> params;
public static String EMAIL_REGEX_DEFAULT = "^\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*$";
public SendPortalWithAddDoneCmd(Map<String,Object> params){
this.params=params;
@ -54,6 +59,7 @@ public class SendPortalWithAddDoneCmd {
bb.writeLog("sendPortalDoneData");
SendPortalErrorUtil sendPortalErrorUtil = new SendPortalErrorUtil();
HttpRequestUtil httpRequestUtil = new HttpRequestUtil();
RecordSet rs = new RecordSet();
String mobileJumpUrl = PropBean.getUfPropValue("mobileJumpUrl");
@ -83,42 +89,71 @@ public class SendPortalWithAddDoneCmd {
}
}
for (Map<String,Object> doneMap:donelist){
String nodeid = Util.null2String(doneMap.get("noedid"));
String workflowname = Util.null2String(doneMap.get("workflowname"));
String requestname = Util.null2String(doneMap.get("requestname"));
String loginid = Util.null2String(doneMap.get("loginid"));
String nodeName = Util.null2String(doneMap.get("nodename"));
JSONObject requestObject = new JSONObject();
requestObject.put("center", center);
requestObject.put("taskCode", requestid);
requestObject.put("nodeId", nodeid);
requestObject.put("ticketType", workflowname);
requestObject.put("title", requestname);
requestObject.put("creator", loginid);
requestObject.put("processStaff", loginid);
requestObject.put("processTime", processTime);
requestObject.put("isRecall", isRecall);
requestObject.put("actionType", actionType);
requestObject.put("urlPC", urlPc);
requestObject.put("urlApp", urlApp);
requestObject.put("urlDing",urlDing);
String userids = Util.null2String(doneMap.get("id")) ;
String auth = username + ":" + passwd;
bb.writeLog("done requestObject:" + requestObject.toJSONString());
String msgdata = httpRequestUtil.doPostByAuth(portal_doneurl, requestObject.toJSONString(), auth);
bb.writeLog("done msgdata:" + msgdata);
if(StringUtils.isNotEmpty(msgdata)) {
JSONObject msgObject = JSONObject.parseObject(msgdata);
//{"resultCode":"1","resultMsg":"No Result"}
if(msgObject.containsKey("resultCode")){
String resultCode = msgObject.getString("resultCode");
if(!"0".equals(resultCode)){
String resultmsg = msgObject.getString("resultMsg");
sendPortalErrorUtil.doRecordPortalErrorInfo(requestid,nodeid,nodeName,userids,requestObject.toJSONString(),resultCode,resultmsg);
//判断是否是抄送流程
// String cus_staff = PropBean.getUfPropValue("cus_staff") ;
String scopeid = "-1";
String scope = "HrmCustomFieldByInfoType" ;
String sql = " select count(0) num "+
" 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 t1.currentnodetype <> 3"+
" and t2.isremark in ('2','9')\n" +
" and t2.preisremark in ('8','9')\n" +
" and t2.islasttimes = 1\n" +
" and (t2.isprocessing = '' or t2.isprocessing is null)\n" +
" and t2.requestid = "+requestid + " and t2.userid = "+doneMap.get("id");
rs.executeQuery(sql);
int num = 0;
//过滤非归档节点,抄送待阅流程
if(rs.next()){
num = rs.getInt("num");
}
if (num == 0){
bb.writeLog("num :"+num+",userid"+doneMap.get("id"));
String nodeid = requestid+doneMap.get("id");
String workflowname = Util.null2String(doneMap.get("workflowname"));
String requestname = Util.null2String(doneMap.get("requestname"));
String loginid = Util.null2String(doneMap.get("loginid"));
String nodeName = Util.null2String(doneMap.get("nodename"));
JSONObject requestObject = new JSONObject();
requestObject.put("center", center);
requestObject.put("taskCode", "weaver"+requestid);
requestObject.put("nodeId", nodeid);
requestObject.put("ticketType", workflowname);
requestObject.put("title", requestname);
requestObject.put("creator", loginid);
requestObject.put("processStaff", loginid);
requestObject.put("processTime", processTime);
requestObject.put("isRecall", isRecall);
requestObject.put("actionType", actionType);
requestObject.put("urlPC", urlPc);
requestObject.put("urlApp", urlApp);
requestObject.put("urlDing",urlDing);
String userids = Util.null2String(doneMap.get("id")) ;
String auth = username + ":" + passwd;
bb.writeLog("done requestObject:" + requestObject.toJSONString());
String msgdata = httpRequestUtil.doPostByAuth(portal_doneurl, requestObject.toJSONString(), auth);
bb.writeLog("done msgdata:" + msgdata);
if(StringUtils.isNotEmpty(msgdata)) {
JSONObject msgObject = JSONObject.parseObject(msgdata);
//{"resultCode":"1","resultMsg":"No Result"}
if(msgObject.containsKey("resultCode")){
String resultCode = msgObject.getString("resultCode");
if(!"0".equals(resultCode)){
String resultmsg = msgObject.getString("resultMsg");
sendPortalErrorUtil.doRecordPortalErrorInfo(requestid,nodeid,nodeName,userids,requestObject.toJSONString(),resultCode,resultmsg);
}
}
}
}
}
@ -128,4 +163,23 @@ public class SendPortalWithAddDoneCmd {
}
}
/***
*
* @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;
}
}

@ -2,6 +2,7 @@ package com.customization.dito.sendtodo;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.constant.Constants;
import com.engine.core.interceptor.CommandContext;
import com.time.util.DateUtil;
import org.apache.commons.lang.StringUtils;
@ -15,12 +16,15 @@ import java.net.URLEncoder;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
*
*/
public class SendPortalWithAddTodoCmd {
private Map<String,Object> params;
public static String EMAIL_REGEX_DEFAULT = "^\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*$";
public SendPortalWithAddTodoCmd(Map<String,Object> params){
this.params=params;
@ -121,7 +125,7 @@ public class SendPortalWithAddTodoCmd {
requestObject.put("center",center);
requestObject.put("title",requestname);
requestObject.put("creator",lastName);
requestObject.put("taskCode",requestid);
requestObject.put("taskCode","weaver"+requestid);
requestObject.put("nodeId",nodeId);
requestObject.put("taskType",taskType);
requestObject.put("actionType",actionType);
@ -136,58 +140,198 @@ public class SendPortalWithAddTodoCmd {
requestObject.put("ticketType",workflowname);
JSONArray taskObjectList = new JSONArray();
String cus_staff = PropBean.getUfPropValue("cus_staff") ;
String scopeid = "-1";
String scope = "HrmCustomFieldByInfoType" ;
for (Map<String,Object> todoMap: todolist){
String userSql = "select "+cus_staff+" as staffid from cus_fielddata where scopeid=-1 and scope='HrmCustomFieldByInfoType' and id=?";
rs.executeQuery(userSql,todoMap.get("id"));
String loginid = Util.null2String(todoMap.get("loginid"));
if("sysadmin".equals(loginid)){
loginid = "Admin";
JSONArray taskObjectList = new JSONArray();
sql = " select count(0) num "+
" 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 t1.currentnodetype <> 3"+
" and t2.isremark in ('2','9','8')\n" +
" and t2.preisremark in ('8','9')\n" +
" and t2.islasttimes = 1\n" +
" and (t2.isprocessing = '' or t2.isprocessing is null)\n" +
" and t2.requestid = "+requestid + " and t2.userid = "+todoMap.get("id");
rs.executeQuery(sql);
int num = 0;
if(rs.next()){
num = rs.getInt("num");
}
if (num > 0){
continue;
}
bb.writeLog("num :"+num+",userid:"+todoMap.get("id"));
sql = " select t2.userid,h1.loginid,h1.lastname,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" +
" and t1.currentnodetype = 3"+
" and ((t2.isremark = '8' and t2.preisremark='8') or (t2.isremark = '9' and t2.preisremark='9'))\n" +
" and t2.islasttimes = 1\n" +
" and (t2.isprocessing = '' or t2.isprocessing is null)\n" +
" and t2.requestid = "+requestid+ " and t2.userid = "+todoMap.get("id");
rs.executeQuery(sql);
boolean hasData = true;
if (rs.next()){
String staffid = Util.null2String(rs.getString("staffid"));
hasData = false;
JSONArray list = new JSONArray();
JSONObject requestObject2 = new JSONObject();
requestObject2.putAll(requestObject);
SendPortalErrorUtil sendPortalErrorUtil = new SendPortalErrorUtil();
//归档节点抄送
String email = Util.null2String(rs.getString("email"));
requestObject2.put("nodeName",rs.getString("nodename"));
requestObject2.put("nodeId",rs.getString("nodeid"));
//requestObject2.put("taskCode",rs.getString("requestid")+"_cs_"+nodeId+"_"+rs.getString("userid"));
requestObject2.put("taskCode",rs.getString("requestid")+"_cs_"+rs.getString("userid"));
JSONObject taskObject = new JSONObject();
String creator = rs.getString("loginid");
if("sysadmin".equals(creator)){
creator = "Admin";
}
taskObject.put("objectAction","0");
taskObject.put("objectType","0");
taskObject.put("objectCode",creator);
taskObject.put("objectId",rs.getString("staffid"));
taskObject.put("operatorCode",creator);
list.add(taskObject);
//归档节点抄送
String emailArray = "";
Pattern regex = Pattern.compile(EMAIL_REGEX_DEFAULT);
requestObject2.put("messageTitle",getShortMessageTitle(requestname));
requestObject2.put("messageContent", requestname);
requestObject2.put("terminal", "1");
requestObject2.put("taskType", "1");
requestObject2.put("actionType", "2");
requestObject2.put("taskObjectList",list);
String auth = username + ":" + passwd;
bb.writeLog("SendPortalToReadUtil--requestObject:" + requestObject2.toJSONString());
String msgdata = httpRequestUtil.doPostByAuth(Constants.portal_todourl, requestObject2.toJSONString(), auth);
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,rs.getString("lastname"),processTime);
String notificationSubject = templateMap.get("notificationSubject");
String notificationContent = templateMap.get("notificationContent");
//sendMailUtil.sendMail(requestid, emailArray, notificationSubject, notificationContent);
}
sendPortalErrorUtil.doRecordPortalErrorInfo(requestid,nodeId,rs.getString("nodename"),rs.getString("userid"),requestObject.toJSONString(),resultCode,"");
}else if ("TODO-FAIL-002".equals(resultCode)){
//The task does not exist.任务不存在,则新增
User user = new User();
user.setUid(Integer.valueOf(todoMap.get("id").toString()));
SendPortalToReadUtil sendPortalToReadUtil = new SendPortalToReadUtil();
sendPortalToReadUtil.sendToReadDataByCreateNode(requestid,user,portal_todourl,bpm_app_workflowurl,username,passwd,bpm_workflowurl,center,bpm_app_requesturl);
}else{
String resultmsg = msgObject.getString("resultMsg");
sendPortalErrorUtil.doRecordPortalErrorInfo(requestid,nodeId,rs.getString("nodename"),rs.getString("userid"),requestObject.toJSONString(),resultCode,resultmsg);
}
}
}
}
if (hasData){
SendPortalErrorUtil sendPortalErrorUtil = new SendPortalErrorUtil();
String userSql = "select "+cus_staff+" as staffid from cus_fielddata where scopeid=-1 and scope='HrmCustomFieldByInfoType' and id=?";
rs.executeQuery(userSql,todoMap.get("id"));
requestObject.put("nodeId",requestObject.getString("nodeId")+todoMap.get("id"));
String loginid = Util.null2String(todoMap.get("loginid"));
if("sysadmin".equals(loginid)){
loginid = "Admin";
}
JSONObject taskObject = new JSONObject();
if (rs.next()){
String staffid = Util.null2String(rs.getString("staffid"));
taskObject.put("objectId",staffid);
}
taskObject.put("objectAction",objectAction);
taskObject.put("objectType",objectType);
taskObject.put("objectCode",loginid);
taskObject.put("objectId",staffid);
taskObject.put("operatorCode",loginid);
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);
Map<String,Object> map = new HashMap<>();
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)){
map.put("resultCode","0");
}else{
bb.writeLog(msgObject.get("resultMsg"));
// sendPortalErrorUtil.doCreateSendPortalTodoErrorInfo();
map.put("resultCode",resultCode);
map.put("resultMsg",msgObject.get("resultMsg"));
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);
Map<String,Object> map = new HashMap<>();
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)){
map.put("resultCode","0");
}else{
bb.writeLog(msgObject.get("resultMsg"));
sendPortalErrorUtil.doRecordPortalErrorInfo(requestid,nodeId,rs.getString("nodename"),rs.getString("userid"),requestObject.toJSONString(),resultCode,msgObject.getString("resultMsg"));
map.put("resultCode",resultCode);
map.put("resultMsg",msgObject.get("resultMsg"));
}
}
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
/***
*
* @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;
}
}

@ -128,7 +128,7 @@ public class SendPortalWithDeleteCmd {
requestObject.put("center",center);
requestObject.put("title",requestname);
//requestObject.put("creator",workcode);
requestObject.put("taskCode",requestid);
requestObject.put("taskCode","weaver"+requestid);
requestObject.put("nodeId",nodeId);
requestObject.put("taskType",taskType);
requestObject.put("actionType",actionType);

@ -352,7 +352,7 @@ public class SendPortalWithRawRunnable implements Runnable{
requestObject.put("center",center);
requestObject.put("title",requestname);
requestObject.put("creator",loginid);
requestObject.put("taskCode",requestid);
requestObject.put("taskCode","weaver"+requestid);
requestObject.put("nodeId",nodeId);
requestObject.put("taskType",taskType);
requestObject.put("actionType",actionType);

@ -400,7 +400,7 @@ public class SendRemarkOperateTodoCmd extends AbstractCommandProxy<Map<String, O
requestObject.put("center",center);
requestObject.put("title",title);
requestObject.put("creator",creator);
requestObject.put("taskCode",taskCode);
requestObject.put("taskCode","weaver"+taskCode);
requestObject.put("nodeId",nodeId);
requestObject.put("taskType",taskType);
requestObject.put("actionType",actionType);

@ -38,11 +38,13 @@ public class RequestRemarkCmd extends AbstractCommonCommand<Map<String,Object>>
@Override
public Map<String, Object> execute(CommandContext commandContext) {
int userid = user.getUID();
BaseBean bb = new BaseBean();
String requestid = Util.null2String(params.get("requestid"));
String nodeid = Util.null2String(params.get("nodeid"));
Map<String,Object> map = new HashMap<String,Object>();
String resultCode = sendPortalDoneData(requestid,nodeid,userid+"");
if("0".equals(resultCode)){
bb.writeLog("RequestRemarkCmd -------resultCode:"+resultCode);
if("0".equals(resultCode) || "DONE-FAIL-001".equals(resultCode)){
resultCode = completePortalReadData(requestid, nodeid,userid+"");
}
map.put("resultcode",resultCode);
@ -232,7 +234,8 @@ public class RequestRemarkCmd extends AbstractCommonCommand<Map<String,Object>>
requestObject.put("center",center);
requestObject.put("title",requestname);
requestObject.put("creator",workcode);
requestObject.put("taskCode",requestid+"_cs_"+nodeid+"_"+userid);
//requestObject.put("taskCode",requestid+"_cs_"+nodeid+"_"+userid);
requestObject.put("taskCode", requestid+"_cs_"+userid);
requestObject.put("nodeId",nodeid);
requestObject.put("taskType",taskType);
requestObject.put("actionType",actionType);
@ -333,14 +336,23 @@ public class RequestRemarkCmd extends AbstractCommonCommand<Map<String,Object>>
}
int count = 0;
// sql = " select t2.userid,h1.loginid,h1.email,t2.isremark,t1.requestid,t2.nodeid\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 in ('2','9','4')\n" +
// " and t2.preisremark in ('8','9')\n" +
// " and t2.requestid = "+requestid +" and t2.userid in ("+userid+") and t2.nodeid = "+nodeid;
sql = " select t2.userid,h1.loginid,h1.email,t2.isremark,t1.requestid,t2.nodeid\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 in ('2','9')\n" +
" and t2.isremark in ('2','9','4')\n" +
" and t2.preisremark in ('8','9')\n" +
" and t2.requestid = "+requestid +" and t2.userid in ("+userid+") and t2.nodeid = "+nodeid;
" and t2.requestid = "+requestid +" and t2.userid in ("+userid+")";
rs.execute(sql);
if (rs.next()) {
@ -367,8 +379,9 @@ public class RequestRemarkCmd extends AbstractCommonCommand<Map<String,Object>>
JSONObject requestObject = new JSONObject();
requestObject.put("center", center);
requestObject.put("taskCode", requestid+"_cs_"+nodeid+"_"+userid);
requestObject.put("nodeId", nodeid);
// requestObject.put("taskCode", requestid+"_cs_"+nodeid+"_"+userid);
requestObject.put("taskCode", "weaver"+requestid);
requestObject.put("nodeId", requestid+userid);
requestObject.put("title", requestname);
requestObject.put("creator", workcode);
requestObject.put("processStaff", workcode);

@ -89,6 +89,7 @@ public class SendRequestData2PortalInterfaces implements SendRequestStatusDataIn
rsojson.put("requestid",rso.getRequestid());
rsojson.put("username",rso.getUser().getLastname()+"("+rso.getUser().getUID()+")");
rsojson.put("id",rso.getUser().getUID());
rsojson.put("isremark",rso.getIsremark());
rsojson.put("loginid",rso.getUser().getLoginid());
// rsojson.put("isremark",rso.getIsremark());
// rsojson.put("viewtype",rso.getViewtype());
@ -118,6 +119,7 @@ public class SendRequestData2PortalInterfaces implements SendRequestStatusDataIn
rsojson.put("requestname",rso.getRequstname());
rsojson.put("workflowname",rso.getWorkflowname());
rsojson.put("username",rso.getUser().getLastname());
rsojson.put("isremark",rso.getIsremark());
rsojson.put("id",rso.getUser().getUID());
rsojson.put("loginid",rso.getUser().getLoginid());
rsojson.put("noedid",rso.getNodeid());

@ -0,0 +1,132 @@
import com.alibaba.rocketmq.client.consumer.DefaultMQPushConsumer;
import com.alibaba.rocketmq.client.consumer.listener.ConsumeConcurrentlyContext;
import com.alibaba.rocketmq.client.consumer.listener.ConsumeConcurrentlyStatus;
import com.alibaba.rocketmq.client.consumer.listener.MessageListenerConcurrently;
import com.alibaba.rocketmq.client.exception.MQClientException;
import com.alibaba.rocketmq.common.consumer.ConsumeFromWhere;
import com.alibaba.rocketmq.common.message.MessageExt;
import com.alibaba.rocketmq.common.protocol.heartbeat.MessageModel;
import java.io.*;
import java.util.List;
public class Consumer {
/**
* 使PullMetaQListener<br>
*/
public static void main(String[] args) throws InterruptedException,
MQClientException {
/**
* Consumer<br>
* ConsumerGroupName
*consumer groupconsumer便topicqueue
*consumer groupconsumer
*
*/
// mq.datasync.topic=dataSync_topic_nj
// ctgmq.producer.common.producerGroupName=portal-producer-group_nj
// ctgmq.producer.common.instanceName=dataSync_topic_nj
// ctgmq.producer.common.namesrvAddr=172.16.84.183:9001;172.16.84.187:9001
// ctgmq.producer.common.authId=rul
// ctgmq.producer.common.authPwd=rul
// ctgmq.producer.common.clusterName=CtgMQ_01
// ctgmq.producer.common.tenantID=100000
DefaultMQPushConsumer consumer = new DefaultMQPushConsumer(
"cbec-consumer-group_nj_133");
consumer.setNamesrvAddr("172.16.84.183:9001;172.16.84.187:9001");
//consumer.setInstanceName("dataSync_topic_nj");
consumer.setConsumeFromWhere(ConsumeFromWhere.CONSUME_FROM_FIRST_OFFSET);
//广播消费是指一个consumer只要订阅了某个topic的消息那它就会收到该topic下的所有queue里的消息
//而不管这个consumer的group是什么。所以对于广播消费来说consumer group没什么实际意义。consumer可以在实例化时我们可以指定是集群消费还是广播消费。
//consumer.setMessageModel(MessageModel.BROADCASTING);
consumer.setMessageModel(MessageModel.BROADCASTING);
/**
* topictagsTagATagCTagD
*/
//consumer.subscribe("dataSync_topic_nj", "TagA || TagC || TagD");
/**
* topic<br>
* consumertopic
*/
consumer.setConsumeMessageBatchMaxSize(1);
//关闭VIP通道避免接收不了消息
consumer.subscribe("dataSync_topic_pto", "BPM");
int i = 0;
String path = "C:\\Users\\liuliang\\Desktop\\Demo3-liuliang\\demo21.txt";
consumer.registerMessageListener(new MessageListenerConcurrently() {
/**
* msgsconsumeMessageBatchMaxSize
*/
@Override
public ConsumeConcurrentlyStatus consumeMessage(List<MessageExt> msgs, ConsumeConcurrentlyContext context) {
// System.out.println(Thread.currentThread().getName()
// + " Receive New Messages: " + msgs.size());
MessageExt msg = msgs.get(0);
try {
// System.out.println("11----"+new String(msg.getBody(), StandardCharsets.UTF_8));
// System.out.println("11----"+new String(msg.toString()));
// System.out.println("1----"+new String(msg.getBody(),"UTF-8"));
// System.out.println("2----"+new String(msg.getBody(),"GBK"));
System.out.println("3----"+new String(msg.getBody()));
String msgdata = new String(msg.getBody(),"UTF-8");
// System.out.println("5----"+msgdata.substring(msgdata.indexOf("{")));
if(!"".equals(msgdata)){
String data = msgdata.substring(msgdata.indexOf("{"));
//SymOrgUserData.updasteSysOrgData(data);
System.out.println(data);
System.out.println(context.getMessageQueue().toString());
BufferedWriter out = null;
try {
out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(path,true)));
out.write(data+"\r\n");
out.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
System.out.println(e);
} catch (IOException e) {
e.printStackTrace();
System.out.println(e);
}
}
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
System.out.println(e);
}
return ConsumeConcurrentlyStatus.CONSUME_SUCCESS;
}
});
/**
* Consumer使start<br>
*/
consumer.start();
System.out.println("Consumer Started.");
}
}

@ -0,0 +1,18 @@
import com.google.common.collect.Lists;
import java.util.List;
public class TestMain {
public static void main(String[] args) {
List<String> list = Lists.newArrayList();
list.add("11");
list.add("22");
list.add("11");
for (String str : list){
if ("22".equals(str)){
return;
}
System.out.println(str);
}
}
}
Loading…
Cancel
Save