代理同步门户
parent
5e60af5715
commit
4e3db3732a
@ -0,0 +1,131 @@
|
||||
package com.customization.dito.sendtodo;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.engine.core.interceptor.CommandContext;
|
||||
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.io.UnsupportedEncodingException;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class SendPortalWithAddDoneCmd {
|
||||
private Map<String,Object> params;
|
||||
|
||||
public SendPortalWithAddDoneCmd(Map<String,Object> params){
|
||||
this.params=params;
|
||||
}
|
||||
|
||||
public Map<String, Object> execute(CommandContext commandContext) {
|
||||
|
||||
List<Map<String,Object>> donelist = (List<Map<String,Object>>)(params.get("doneDatas"));
|
||||
String requestid = Util.null2String(params.get("requestid"));
|
||||
String bpm_app_workflowurl = PropBean.getUfPropValue("bpm_app_workflowurl");
|
||||
String bpm_app_requesturl = PropBean.getUfPropValue("bpm_app_requesturl");
|
||||
String portal_doneurl = PropBean.getUfPropValue("portal_doneurl");
|
||||
String username = PropBean.getUfPropValue("username");
|
||||
String passwd = PropBean.getUfPropValue("passwd");
|
||||
String center = PropBean.getUfPropValue("center");
|
||||
String bpm_workflowurl = PropBean.getUfPropValue("bpm_workflowurl");
|
||||
|
||||
sendPortalDoneData(requestid,donelist,portal_doneurl,bpm_app_workflowurl,username,passwd,bpm_workflowurl,bpm_app_requesturl);
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private String getShortMessageTitle(String messageTitle) {
|
||||
if (messageTitle.length() > 20) {
|
||||
messageTitle = messageTitle.substring(0, 17) + "...";
|
||||
}
|
||||
return messageTitle;
|
||||
}
|
||||
|
||||
public void sendPortalDoneData(String requestid,List<Map<String,Object>> donelist, 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();
|
||||
|
||||
|
||||
String mobileJumpUrl = PropBean.getUfPropValue("mobileJumpUrl");
|
||||
|
||||
try {
|
||||
|
||||
String processTime = DateUtil.getCurrentTime("yyyy-MM-dd HH:mm:ss");
|
||||
String isRecall = "1";
|
||||
String actionType = "0";
|
||||
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
bb.writeLog("done Exception");
|
||||
bb.writeLog(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue