You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
haojing/src/weaver/interfaces/dito/form/SendPortalFormLoadUtil.java

792 lines
36 KiB
Java

package weaver.interfaces.dito.form;
import com.alibaba.fastjson.JSONObject;
import com.customization.dito.sendtodo.HttpRequestUtil;
import com.customization.dito.sendtodo.RequestBaseInfoUtil;
import com.customization.dito.sendtodo.SendPortalErrorUtil;
import com.time.util.DateUtil;
import org.apache.commons.lang3.StringUtils;
import weaver.conn.RecordSet;
import weaver.general.BaseBean;
import weaver.general.Util;
import weaver.interfaces.dito.comInfo.PropBean;
import weaver.interfaces.dito.constant.Constants;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class SendPortalFormLoadUtil {
private RequestBaseInfoUtil requestBaseInfoUtil = new RequestBaseInfoUtil();
public Map<String, Integer> queryWorkflowRemark9ByLoadForm(String requestid,String current_userid){
RecordSet rs = new RecordSet();
BaseBean bb = new BaseBean();
bb.writeLog("LoadForm-requestid:"+requestid);
Map<String, Integer> remark9Map = new HashMap<String, Integer>();
try{
if(StringUtils.isNotBlank(requestid)){
String[] lcids = requestid.split(",");
for(int i=0;i<lcids.length;i++){
int count = 0;
String lcid = lcids[i];
if(StringUtils.isNotBlank(lcid)){
String sql =" select t.id,t.userid,t.nodeid,t.requestid,t.preisremark\n" +
" from workflow_currentoperator t\n" +
" inner join workflow_requestbase t1 on t.requestid = t1.requestid\n" +
" where (t1.deleted <> 1 or t1.deleted is null or t1.deleted = '')\n" +
" and t.isremark in (9) \n" +
" and t.preisremark in (9)\n" +
" and t.requestid ="+lcid+" and t.userid ="+current_userid+"" ;
rs.executeQuery(sql);
bb.writeLog("queryWorkflowRemark8AtByLoadForm-sql:"+sql);
while (rs.next()){
count++;
}
remark9Map.put(lcid,count);
}
}
}
}catch (Exception e){
e.printStackTrace();
bb.writeLog("queryWorkflowRemark8AtByLoadForm-e:"+e);
}
return remark9Map;
}
/**
* @
*
* @param requestid
*/
public List<Map<String,String>> queryWorkflowRemarkAtByLoadForm(String requestid,String current_userid){
RecordSet rs = new RecordSet();
BaseBean bb = new BaseBean();
bb.writeLog("queryWorkflowRemarkAtByLoadForm-requestid:"+requestid);
List<Map<String,String>> atList = new ArrayList<Map<String,String>>();
try{
if(StringUtils.isNotBlank(requestid)){
String sql =" select t.id,t.userid,t.nodeid,t.requestid,t2.nodename,t1.requestname,t3.workflowname,t.preisremark\n" +
" from workflow_currentoperator t\n" +
" inner join workflow_requestbase t1 on t.requestid = t1.requestid\n" +
" left join workflow_nodebase t2 on t2.id = t.nodeid \n" +
" left join workflow_base t3 on t3.id = t1.workflowid\n" +
" where (t1.deleted <> 1 or t1.deleted is null or t1.deleted = '')\n" +
" and t.isremark in (8) \n" +
" and t.preisremark in (18)\n" +
" and t.requestid in("+requestid +") and t.userid in("+current_userid+")" ;
rs.executeQuery(sql);
bb.writeLog("queryWorkflowRemark8AtByLoadForm-sql:"+sql);
while (rs.next()){
String currentid = Util.null2String(rs.getString("id"));
String nodeid = Util.null2String(rs.getString("nodeid"));
String userid = Util.null2String(rs.getString("userid"));
String nodename = Util.null2String(rs.getString("nodename"));
String workflowname = Util.null2String(rs.getString("workflowname")) ;
String requestname = Util.null2String(rs.getString("requestname")) ;
String lcid = Util.null2String(rs.getString("requestid")) ;
Map<String,String> map = new HashMap<String, String>();
map.put("requestid",requestid);
map.put("userid",userid);
map.put("nodeid",nodeid);
map.put("nodename",nodename);
map.put("workflowname",workflowname);
map.put("requestname",requestname);
map.put("lcid",lcid);
map.put("currentid",currentid);
atList.add(map);
}
bb.writeLog("queryWorkflowRemark8AtByLoadForm-atList:"+atList.size());
}
}catch (Exception e){
e.printStackTrace();
bb.writeLog("queryWorkflowRemark8AtByLoadForm-e:"+e);
}
return atList;
}
/***
* @@
*/
// public void completeReamrk8AtByLoadForm(User user, String requestid){
//
// BaseBean bb = new BaseBean();
// try{
// String userid = user.getUID()+"";
// bb.writeLog("completeReamrk8AtByLoadForm--remark8List777:"+remark8List.size());
// if(remark8List.size() >0){
// String notes = "打开流程表单详情页面,完成抄送不需提交的数据";
// finishedWorkflowCopyToByRequestid(remark8List,userid,notes);
// }
// }catch (Exception e){
// e.printStackTrace();
// bb.writeLog("completeReamrk8AtByLoadForm-e:"+e);
// }
//
// try{
// bb.writeLog("completeReamrk8AtByLoadForm--atList777:"+atList.size());
// if(atList.size() >0){
// String notes = "打开流程表单详情页面,完成@的数据门户调用";
// String userid = user.getUID()+"";
// finishedWorkflowAtByRequestid(atList,userid,notes);
//
// String loginid = user.getLoginid()+"";
// completePortalAtDoneByRequestid(atList,loginid);
// }
// }catch (Exception e){
// e.printStackTrace();
// bb.writeLog("completeReamrk8AtByLoadForm-e:"+e);
// }
// }
// public void finishedWorkflowCopyToByRequestid(List<Map<String,String>> list,String currentuserid,String notes){
// BaseBean bb = new BaseBean();
// bb.writeLog("finishedWorkflowCopyToByRequestid-currentuserid:"+currentuserid);
// for(int i=0;i<list.size();i++){
// Map<String,String> dataMap = list.get(i);
// String requestid = Util.null2String(dataMap.get("lcid"));
// String userid = Util.null2String(dataMap.get("userid"));
// String nodeid = Util.null2String(dataMap.get("nodeid"));
// String nodename = Util.null2String(dataMap.get("nodename"));
// String requestname = Util.null2String(dataMap.get("requestname"));
// String workflowname = Util.null2String(dataMap.get("workflowname"));
//
// bb.writeLog("finishedWorkflowCopyToByRequestid-userid:"+userid);
// bb.writeLog("finishedWorkflowCopyToByRequestid-nodeid:"+nodeid);
// bb.writeLog("finishedWorkflowCopyToByRequestid-requestid:"+requestid);
// if(StringUtils.isNotBlank(userid) && StringUtils.isNotBlank(nodeid)){
// finishedWorkflowCopyToByUserid(requestid,userid,nodeid,currentuserid,workflowname,requestname,nodename,notes);
// }
// }
// }
/***
*
* @return
*/
// public void completePortalAtDoneByRequestid(List<Map<String,String>> atList,String loginid){
// BaseBean bb = new BaseBean();
// try{
// bb.writeLog("completePortalAtDoneByRequestid-atList:"+atList.size());
// if(atList.size() >0){
// String notes = "打开流程表单详情页面,@的数据生成已办";
// for(int i=0;i<atList.size();i++){
// Map<String,String> dataMap = atList.get(i);
// String requestid = Util.null2String(dataMap.get("lcid"));
// String userid = Util.null2String(dataMap.get("userid"));
// String nodeid = Util.null2String(dataMap.get("nodeid"));
// String nodename = Util.null2String(dataMap.get("nodename"));
// String requestname = Util.null2String(dataMap.get("requestname"));
// String workflowname = Util.null2String(dataMap.get("workflowname"));
//
// bb.writeLog("completePortalAtDoneByRequestid-userid:"+userid);
// bb.writeLog("completePortalAtDoneByRequestid-nodeid:"+nodeid);
// bb.writeLog("completePortalAtDoneByRequestid-requestid:"+requestid);
// if(StringUtils.isNotBlank(userid) && StringUtils.isNotBlank(nodeid)){
// completePortalAtDoneData(requestid,userid,nodeid,loginid,workflowname,requestname,nodename,notes);
// }
// }
// }
// }catch (Exception e){
// e.printStackTrace();
// bb.writeLog("completePortalAtDoneByRequestid-e:"+e);
// }
// }
// public void finishedWorkflowAtByRequestid(List<Map<String,String>> list,String loginid,String notes){
//
// BaseBean bb = new BaseBean();
// bb.writeLog("finishedWorkflowAtByRequestid-loginid:" + loginid);
// for(int i=0;i<list.size();i++){
//
// Map<String,String> dataMap = list.get(i);
// String requestid = Util.null2String(dataMap.get("lcid"));
// String userid = Util.null2String(dataMap.get("userid"));
// String nodeid = Util.null2String(dataMap.get("nodeid"));
// String nodename = Util.null2String(dataMap.get("nodename"));
// String requestname = Util.null2String(dataMap.get("requestname"));
// String workflowname = Util.null2String(dataMap.get("workflowname"));
//
// bb.writeLog("finishedWorkflowAtByRequestid-userid:"+userid);
// bb.writeLog("finishedWorkflowAtByRequestid-nodeid:"+nodeid);
// bb.writeLog("finishedWorkflowAtByRequestid-requestid:"+requestid);
// if(StringUtils.isNotBlank(userid) && StringUtils.isNotBlank(nodeid)){
// finishedWorkflowAtByUserId(requestid,userid,nodeid,loginid,workflowname,requestname,nodename,notes);
// }
// }
// }
// public void completeReamrk8ByLoadForm(User user, String requestid){
//
// BaseBean bb = new BaseBean();
//
// try{
//
//
//
//
// String userid = user.getUID()+"";
// finishedWorkflowAtByRequestid(atList,userid,notes);
//
// String loginid = user.getLoginid()+"";
// completePortalAtDoneByRequestid(atList,loginid);
//
//
// }catch (Exception e){
// e.printStackTrace();
// bb.writeLog("completeReamrk8AtByLoadForm-e:"+e);
// }
//
// }
// public void completeReamrkAtByLoadForm(String requestid,String userid){
//
// BaseBean bb = new BaseBean();
// try{
// bb.writeLog("completeReamrkAtByLoadForm--requestid:"+requestid);
// if(remark8List.size() >0){
// String notes = "打开流程表单详情页面,完成抄送不需提交的数据";
// finishedWorkflowCopyToByRequestid(remark8List,userid,notes);
// }
// }catch (Exception e){
// e.printStackTrace();
// bb.writeLog("completeReamrk8AtByLoadForm-e:"+e);
// }
//
// try{
// bb.writeLog("completeReamrk8AtByLoadForm--atList777:"+atList.size());
// if(atList.size() >0){
// String notes = "打开流程表单详情页面,完成@的数据门户调用";
// String userid = user.getUID()+"";
// finishedWorkflowAtByRequestid(atList,userid,notes);
//
// String loginid = user.getLoginid()+"";
// completePortalAtDoneByRequestid(atList,loginid);
// }
// }catch (Exception e){
// e.printStackTrace();
// bb.writeLog("completeReamrk8AtByLoadForm-e:"+e);
// }
//
// }
// public void queryWorkflowRemark8ByLoadForm(String requestid,String current_userid){
// RecordSet rs = new RecordSet();
// BaseBean bb = new BaseBean();
// bb.writeLog("queryWorkflowRemark8AtByLoadForm-requestid:"+requestid);
// try{
// Map<String,String> map = null ;
// if(StringUtils.isNotBlank(requestid)){
// String sql =" select t.id,t.userid,t.nodeid,t.requestid,t2.nodename,t1.requestname,t3.workflowname,t.preisremark\n" +
// " from workflow_currentoperator t\n" +
// " inner join workflow_requestbase t1 on t.requestid = t1.requestid\n" +
// " left join workflow_nodebase t2 on t2.id = t.nodeid \n" +
// " left join workflow_base t3 on t3.id = t1.workflowid\n" +
// " where (t1.deleted <> 1 or t1.deleted is null or t1.deleted = '')\n" +
// " and t.isremark in (8,9) \n" +
// " and t.preisremark in (8,9,18)\n" +
// " and t.requestid in("+requestid +") and t.userid in("+current_userid+")" ;
//
// rs.executeQuery(sql);
// bb.writeLog("queryWorkflowRemark8AtByLoadForm-sql:"+sql);
//
// while (rs.next()){
// String currentid = Util.null2String(rs.getString("id"));
// String nodeid = Util.null2String(rs.getString("nodeid"));
// String userid = Util.null2String(rs.getString("userid"));
// String nodename = Util.null2String(rs.getString("nodename"));
// String workflowname = Util.null2String(rs.getString("workflowname")) ;
// String requestname = Util.null2String(rs.getString("requestname")) ;
// String lcid = Util.null2String(rs.getString("requestid")) ;
// String preisremark = Util.null2String(rs.getString("preisremark")) ;
//
// map = new HashMap<String, String>();
// map.put("requestid",requestid);
// map.put("userid",userid);
// map.put("nodeid",nodeid);
// map.put("nodename",nodename);
// map.put("workflowname",workflowname);
// map.put("requestname",requestname);
// map.put("lcid",lcid);
// map.put("currentid",currentid);
//
// if("8".equals(preisremark)){
// remark8List.add(map);
// }else if("18".equals(preisremark)){
// atList.add(map);
// }else if("9".equals(preisremark)){
// remark9List.add(map);
// }
// }
// bb.writeLog("queryWorkflowRemark8AtByLoadForm-remark8List:"+remark8List.size());
// bb.writeLog("queryWorkflowRemark8AtByLoadForm-atList:"+atList.size());
// bb.writeLog("queryWorkflowRemark8AtByLoadForm-remark9List:"+remark9List.size());
// }
// }catch (Exception e){
// e.printStackTrace();
// bb.writeLog("queryWorkflowRemark8AtByLoadForm-e:"+e);
// }
// }
/***
*
* @param requestid
* @param current_userid
* @param remark9Map
*/
public void completeRequestByLoadForm(String requestid,String current_userid,Map<String,Integer> remark9Map,String logind,List<Map<String,String>> atList){
BaseBean bb = new BaseBean();
try{
if(StringUtils.isNotBlank(requestid)){
String[] lcids = requestid.split(",");
for(int i=0;i<lcids.length;i++){
String lcid = lcids[i];
if(StringUtils.isNotBlank(lcid)){
int count = remark9Map.get(lcid);
bb.writeLog("LoadForm-count:"+count);
if(count > 0){
completeRequestAtByLoadForm(lcid,current_userid,logind,atList);
}else{
completeReamrk8AtByLoadForm(lcid,current_userid);
completeRequestAtByLoadForm(lcid,current_userid,logind,atList);
}
}
}
}
}catch (Exception e){
e.printStackTrace();
bb.writeLog("queryWorkflowRemark8AtByLoadForm-e:"+e);
}
}
public void completeReamrk8AtByLoadForm(String lcid,String current_userid){
BaseBean bb = new BaseBean();
RecordSet rs = new RecordSet();
bb.writeLog("completeReamrk8AtByLoadForm");
try{
int count0 = 0;
int count1 = 0;
String sql =" select t.id,t.userid,t.nodeid,t.requestid,t.preisremark,t.viewtype \n" +
" from workflow_currentoperator t\n" +
" inner join workflow_requestbase t1 on t.requestid = t1.requestid\n" +
" where (t1.deleted <> 1 or t1.deleted is null or t1.deleted = '')\n" +
" and t.preisremark in (8)" +
" and t.requestid ="+lcid+" and t.userid ="+current_userid+"" ;
rs.executeQuery(sql);
bb.writeLog("LoadForm-8-sql:"+sql);
while (rs.next()){
count0++;
String viewtype = Util.null2String(rs.getString("viewtype"));
bb.writeLog("LoadForm-8-viewtype:"+viewtype);
// if("0".equals(viewtype)){
// count1++;
// }
}
if(count0 > 0){
String notes = "打开流程表单详情页面,完成抄送不需提交的数据";
String code = finishedWorkflowReamrk8ByUserId(lcid,current_userid,notes);
if("0".equals(code)){
updateCurrentoperatorRemark(lcid,current_userid,"8");
}
}
}catch (Exception e){
e.printStackTrace();
bb.writeLog("LoadForm-e:"+e);
}
}
/***
*
* @param lcid
* @param current_userid
*/
public void completeRequestAtByLoadForm(String lcid,String current_userid,String loginid,List<Map<String,String>> atList){
BaseBean bb = new BaseBean();
RecordSet rs = new RecordSet();
bb.writeLog("completeRequestAtByLoadForm");
try{
int count0 = 0;
int count1 = 0;
String sql =" select t.id,t.userid,t.nodeid,t.requestid,t.preisremark,t.viewtype \n" +
" from workflow_currentoperator t\n" +
" inner join workflow_requestbase t1 on t.requestid = t1.requestid\n" +
" where (t1.deleted <> 1 or t1.deleted is null or t1.deleted = '')\n" +
" and t.preisremark in (18) " +
" and t.requestid ="+lcid+" and t.userid ="+current_userid+"" ;
rs.executeQuery(sql);
bb.writeLog("LoadForm-at-sql:"+sql);
while (rs.next()){
count0++;
String viewtype = Util.null2String(rs.getString("viewtype"));
bb.writeLog("LoadForm-at-viewtype:"+viewtype);
// if("0".equals(viewtype)){
// count1++;
// }
}
if(count0 >0){
String notes = "打开流程表单详情页面,完成@的数据门户调用";
String code = finishedWorkflowAtByUserId(lcid,current_userid,notes);
if("0".equals(code)){
notes = "打开流程表单详情页面,完成@的已办数据门户调用";
if(atList.size()>0){
completePortalAtDoneData(lcid,current_userid,notes,loginid);
updateCurrentoperatorRemark(lcid,current_userid,"18");
}
}
}
}catch (Exception e){
e.printStackTrace();
bb.writeLog("LoadForm-e:"+e);
}
}
/***
*
* @param requestid
* @param userid
* @return
*/
private String finishedWorkflowAtByUserId(String requestid,String userid,String notes){
BaseBean bb = new BaseBean();
bb.writeLog("finishedWorkflowAtByUserId-requestid:"+requestid);
String resultCode = "";
String portal_todourl = Constants.portal_todourl;
String bpm_app_workflowurl = Constants.bpm_app_workflowurl;
String username = Constants.username;
String passwd = Constants.passwd;
String bpm_workflowurl = Constants.bpm_workflowurl;
String center = Constants.center;
String bpm_app_requesturl = Constants.bpm_app_requesturl;
String zhjkbs = "weaver.interfaces.dito.form.SendPortalFormLoadUtil.finishedWorkflowAtByUserId" ;
HttpRequestUtil httpRequestUtil = new HttpRequestUtil();
SendPortalErrorUtil sendPortalErrorUtil = new SendPortalErrorUtil();
String mobileJumpUrl = PropBean.getUfPropValue("mobileJumpUrl");
String actionType = "3";
String terminal = "1" ;
String taskType = "1";
try {
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(org.apache.commons.lang.StringUtils.isNotEmpty(mobileJumpUrl)){
urlDing += "&returnUrl="+ URLEncoder.encode(mobileJumpUrl,"UTF-8");
urlApp += "&returnUrl="+URLEncoder.encode(mobileJumpUrl,"UTF-8");
}
Map<String,String> baseMap = requestBaseInfoUtil.queryRequestBaseByRequestid(requestid);
String currentNodeId = baseMap.get("currentnodeid");
String currentNodeName = baseMap.get("currentnodeid");
String workflowname = baseMap.get("workflowname");
String createrLoginId = baseMap.get("createrloginid");
String createrLastName = baseMap.get("createrusername");
String requestname = baseMap.get("requestname");
JSONObject requestObject = new JSONObject();
requestObject.put("creator",createrLoginId);
requestObject.put("title",requestname);
requestObject.put("messageContent",requestname);
requestObject.put("nodeId",currentNodeId);
requestObject.put("nodeName",currentNodeName);
requestObject.put("ticketType",workflowname);
requestObject.put("center", center);
requestObject.put("taskType", taskType);
requestObject.put("actionType", actionType);
requestObject.put("createDate", processTime);
requestObject.put("messageTitle",requestname);
requestObject.put("terminal", terminal);
requestObject.put("urlPc", urlPc);
requestObject.put("urlDing", urlDing);
requestObject.put("urlApp",urlApp);
requestObject.put("taskCode", "weaver"+requestid+"_at_"+userid);
String auth = username + ":" + passwd;
bb.writeLog("finishedWorkflowAtByUserId--requestObject:" + requestObject.toJSONString());
String msgdata = httpRequestUtil.doPostByAuth(portal_todourl, requestObject.toJSONString(), auth);
bb.writeLog("finishedWorkflowAtByUserId-msgdata:" + msgdata);
if (!"".equals(msgdata)) {
JSONObject msgObject = JSONObject.parseObject(msgdata);
if (msgObject.containsKey("resultCode")) {
resultCode = msgObject.getString("resultCode");
if ("0".equals(resultCode)) {
sendPortalErrorUtil.doRecordPortalErrorInfo4Phase2Optimize(requestid,currentNodeId,currentNodeName,userid,requestObject.toJSONString(),resultCode,"",zhjkbs,userid,notes);
}else{
String resultmsg = msgObject.getString("resultMsg");
sendPortalErrorUtil.doRecordPortalErrorInfo4Phase2Optimize(requestid,currentNodeId,currentNodeName,userid,requestObject.toJSONString(),resultCode,resultmsg,zhjkbs,userid,notes);
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
return resultCode;
}
/**
*
* @param requestid
* @param userid
* @param notes
* @return
*/
public String completePortalAtDoneData(String requestid,String userid,String notes,String loginid){
String zhjkbs = "weaver.interfaces.dito.form.SendPortalFormLoadUtil.completePortalAtDoneData";
String resultCode = "" ;
HttpRequestUtil httpRequestUtil = new HttpRequestUtil();
SendPortalErrorUtil sendPortalErrorUtil = new SendPortalErrorUtil();
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 center = PropBean.getUfPropValue("center");
String bpm_workflowurl = PropBean.getUfPropValue("bpm_workflowurl");
String mobileJumpUrl = PropBean.getUfPropValue("mobileJumpUrl");
String portal_doneurl = PropBean.getUfPropValue("portal_doneurl");
String processTime = DateUtil.getCurrentTime("yyyy-MM-dd HH:mm:ss");
BaseBean bb = new BaseBean();
bb.writeLog("completePortalAtDoneData");
String actionType = "0" ;
try {
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(org.apache.commons.lang.StringUtils.isNotEmpty(mobileJumpUrl)){
urlDing += "&returnUrl="+ URLEncoder.encode(mobileJumpUrl,"UTF-8");
urlApp += "&returnUrl="+URLEncoder.encode(mobileJumpUrl,"UTF-8");
}
Map<String,String> baseMap = requestBaseInfoUtil.queryRequestBaseByRequestid(requestid);
String currentNodeId = baseMap.get("currentnodeid");
String currentNodeName = baseMap.get("currentnodeid");
String workflowname = baseMap.get("workflowname");
String createrLoginId = baseMap.get("createrloginid");
String createrLastName = baseMap.get("createrusername");
String requestname = baseMap.get("requestname");
String newNodeId = requestid+userid+"_"+System.currentTimeMillis();
bb.writeLog("completePortalAtDoneData--createrLoginId:"+createrLoginId);
JSONObject requestObject = new JSONObject();
requestObject.put("creator",createrLoginId);
requestObject.put("title",requestname);
requestObject.put("nodeId",newNodeId);
requestObject.put("ticketType",workflowname);
requestObject.put("center", center);
requestObject.put("taskCode", "weaver" + requestid);
requestObject.put("processStaff", loginid);
requestObject.put("processTime", processTime);
requestObject.put("isRecall", "1");
requestObject.put("actionType", actionType);
requestObject.put("urlPC", urlPc);
requestObject.put("urlApp", urlApp);
requestObject.put("urlDing", urlDing);
String auth = username + ":" + passwd;
bb.writeLog("completePortalAtDoneData done requestObject:" + requestObject.toJSONString());
String msgdata = httpRequestUtil.doPostByAuth(portal_doneurl, requestObject.toJSONString(), auth);
bb.writeLog("completePortalAtDoneData done msgdata:" + msgdata);
if (org.apache.commons.lang.StringUtils.isNotEmpty(msgdata)) {
JSONObject msgObject = JSONObject.parseObject(msgdata);
bb.writeLog("completePortalAtDoneData--msgObject:" + msgObject.toJSONString());
if (msgObject.containsKey("resultCode")) {
resultCode = msgObject.getString("resultCode");
if (!"0".equals(resultCode)) {
String resultmsg = msgObject.getString("resultMsg");
sendPortalErrorUtil.doRecordPortalErrorInfo4Phase2Optimize(requestid, currentNodeId, newNodeId, userid+ "", requestObject.toJSONString(), resultCode, resultmsg, zhjkbs,"",notes);
}else{
sendPortalErrorUtil.doRecordPortalErrorInfo4Phase2Optimize(requestid, currentNodeId, newNodeId, userid + "", requestObject.toJSONString(), resultCode, "", zhjkbs,"",notes);
}
}
}
} catch (Exception e) {
e.printStackTrace();
bb.writeLog(e);
}
return resultCode;
}
private String finishedWorkflowReamrk8ByUserId(String requestid,String userid,String notes){
BaseBean bb = new BaseBean();
bb.writeLog("finishedWorkflowCopyToByUserid-requestid:"+requestid);
String zhjkbs = "weaver.interfaces.dito.form.SendPortalFormLoadUtil.finishedWorkflowCopyToByUserid" ;
String resultCode = "" ;
HttpRequestUtil httpRequestUtil = new HttpRequestUtil();
SendPortalErrorUtil sendPortalErrorUtil = new SendPortalErrorUtil();
String bpm_app_workflowurl = Constants.bpm_app_workflowurl;
String bpm_app_requesturl = Constants.bpm_app_requesturl;
String portal_todourl = Constants.portal_todourl;
String username = Constants.username;
String passwd = Constants.passwd;
String center = Constants.center;
String bpm_workflowurl = Constants.bpm_workflowurl;
String mobileJumpUrl = PropBean.getUfPropValue("mobileJumpUrl");
String actionType = "3" ;
String terminal = "1" ;
String taskType = "1"; //0 待办 1 –待阅
try {
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(org.apache.commons.lang.StringUtils.isNotEmpty(mobileJumpUrl)){
urlDing += "&returnUrl="+URLEncoder.encode(mobileJumpUrl,"UTF-8");
urlApp += "&returnUrl="+URLEncoder.encode(mobileJumpUrl,"UTF-8");
}
Map<String,String> baseMap = requestBaseInfoUtil.queryRequestBaseByRequestid(requestid);
String currentNodeId = baseMap.get("currentnodeid");
String currentNodeName = baseMap.get("currentnodeid");
String workflowname = baseMap.get("workflowname");
String createrLoginId = baseMap.get("createrloginid");
String createrLastName = baseMap.get("createrusername");
String requestname = baseMap.get("requestname");
JSONObject requestObject = new JSONObject();
requestObject.put("creator",createrLoginId);
requestObject.put("title",requestname);
requestObject.put("messageContent",requestname);
requestObject.put("nodeId",currentNodeId);
requestObject.put("nodeName",currentNodeName);
requestObject.put("ticketType",workflowname);
requestObject.put("center",center);
requestObject.put("taskCode", requestid+"_cs_"+userid);
requestObject.put("taskType",taskType);
requestObject.put("actionType",actionType);
requestObject.put("createDate",processTime);
requestObject.put("messageTitle",requestname);
requestObject.put("terminal",terminal);
requestObject.put("urlPc",urlPc);
requestObject.put("urlApp",urlApp);
requestObject.put("urlDing",urlDing);
bb.writeLog("finishedWorkflowCopyToByUserid-requestObject:"+requestObject.toJSONString());
String auth = username + ":" + passwd;
String msgdata = httpRequestUtil.doPostByAuth(portal_todourl,requestObject.toJSONString(),auth);
bb.writeLog("monitorFinishedWorkflowCopyToByUserid-msgdata:"+msgdata);
if(StringUtils.isNotEmpty(msgdata)){
JSONObject msgObject = JSONObject.parseObject(msgdata);
if(msgObject.containsKey("resultCode")){
resultCode = msgObject.getString("resultCode");
if("0".equals(resultCode)){
sendPortalErrorUtil.doRecordPortalErrorInfo4Phase2Optimize(requestid,currentNodeId,currentNodeName,userid,requestObject.toJSONString(),resultCode,"",zhjkbs,"",notes);
}else{
String resultmsg = msgObject.getString("resultMsg");
sendPortalErrorUtil.doRecordPortalErrorInfo4Phase2Optimize(requestid,currentNodeId,currentNodeName,userid,requestObject.toJSONString(),resultCode,resultmsg,zhjkbs,"",notes);
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
return resultCode;
}
public void updateCurrentoperatorRemark(String requestid,String currentUserid,String preisremark){
RecordSet rs = new RecordSet();
BaseBean bb = new BaseBean();
try{
String viewDate = DateUtil.getCurrentTime("yyyy-MM-dd");
String viewTime = DateUtil.getCurrentTime("HH:mm:ss");
bb.writeLog("updateCurrentoperatorRemark-requestid:"+requestid);
if(StringUtils.isNotBlank(requestid)){
if("8".equals(preisremark)){
String sql = " update workflow_currentoperator set isremark=2,viewtype=-2,viewdate=(case when viewdate is not null then viewdate else '"+viewDate+"' end),viewtime=(case when viewtime is not null then viewtime else '"+viewTime+"' end) where requestid = "+requestid +" and preisremark in ("+preisremark+") and userid="+currentUserid;
boolean isTrue = rs.executeUpdate(sql);
bb.writeLog("updateCurrentoperatorRemark-sql:"+sql +" isTrue:"+isTrue);
}else if("18".equals(preisremark)){
String sql = " update workflow_currentoperator set isremark=2,viewtype=-2,viewdate=(case when viewdate is not null then viewdate else '"+viewDate+"' end),viewtime=(case when viewtime is not null then viewtime else '"+viewTime+"' end),operatedate=(case when operatedate is not null then operatedate else '"+viewDate+"' end),operatetime=(case when operatetime is not null then operatetime else '"+viewTime+"' end) where requestid = "+requestid +" and preisremark in ("+preisremark+") and userid="+currentUserid;
boolean isTrue = rs.executeUpdate(sql);
bb.writeLog("updateCurrentoperatorRemark-sql:"+sql +" isTrue:"+isTrue);
}
}
}catch (Exception e){
bb.writeLog("updateCurrentoperatorRemark-e:"+e);
}
}
}