增加宣贯任务触发调用oa待办,增加根据发布人部门获取角色账号@公式

This commit is contained in:
zhal 2024-04-05 21:17:44 +08:00
parent 7e939be346
commit 4e313c2257
7 changed files with 636 additions and 6 deletions

View File

@ -6,6 +6,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import com.actionsoft.apps.coe.pal.publisher.at.SendPublisherMessageAt; import com.actionsoft.apps.coe.pal.publisher.at.SendPublisherMessageAt;
import com.actionsoft.apps.coe.pal.publisher.at.getRoleAt;
import com.actionsoft.apps.coe.pal.publisher.client.web.ProcessPublishClientWeb; import com.actionsoft.apps.coe.pal.publisher.client.web.ProcessPublishClientWeb;
import com.actionsoft.apps.coe.pal.publisher.client.web.ProcessPublishWeb; import com.actionsoft.apps.coe.pal.publisher.client.web.ProcessPublishWeb;
import com.actionsoft.apps.coe.pal.publisher.conf.PublisherConf; import com.actionsoft.apps.coe.pal.publisher.conf.PublisherConf;
@ -150,6 +151,9 @@ public class Plugins implements PluginListener {
// 注册AT公式 // 注册AT公式
list.add(new AtFormulaPluginProfile("根据发布部门返回应发送发布人员账号", "@SendPublishMessage(*depName)", SendPublisherMessageAt.class.getName(), "返回发送发布人员账号", "返回发送发布人员账号")); list.add(new AtFormulaPluginProfile("根据发布部门返回应发送发布人员账号", "@SendPublishMessage(*depName)", SendPublisherMessageAt.class.getName(), "返回发送发布人员账号", "返回发送发布人员账号"));
list.add(new AtFormulaPluginProfile("根据发布人部门获取角色账号", "@getRole(*orgdepart)", getRoleAt.class.getName(), "根据发布人部门获取角色账号", "根据发布人部门获取角色账号"));
return list; return list;
} }

View File

@ -0,0 +1,28 @@
package com.actionsoft.apps.coe.pal.publisher.at;
import com.actionsoft.bpms.bo.engine.BO;
import com.actionsoft.bpms.commons.at.AbstExpression;
import com.actionsoft.bpms.commons.at.ExpressionContext;
import com.actionsoft.sdk.local.SDK;
public class getRoleAt extends AbstExpression {
public getRoleAt(ExpressionContext atContext, String expressionValue) {
super(atContext, expressionValue);
}
public String execute(String expression) {
String incentivecountersignature = null;
//获取发布人部门
String orgdepart = getParameter(expression, 1);
BO act_processmanager= SDK.getBOAPI().query("BO_ACT_PROCESSMANAGER").addQuery("ORGDEPART=",orgdepart).detail();
if(act_processmanager!=null){
incentivecountersignature=act_processmanager.getString("INCENTIVECOUNTERSIGNATURE");
}
return incentivecountersignature;
}
}

View File

@ -4327,7 +4327,7 @@ public class ProcessPublishWeb extends ActionWeb {
public String getApproveInfos(UserContext me, String level1, String level2, String level3, String level4, String company, String region, String product, String bindid) { public String getApproveInfos(UserContext me, String level1, String level2, String level3, String level4, String company, String region, String product, String bindid) {
ProcessInstance processInstance = SDK.getProcessAPI().getInstanceById(bindid); ProcessInstance processInstance = SDK.getProcessAPI().getInstanceById(bindid);
if (processInstance.getProcessDefId().equals("obj_fb1c7a54b98b412187388c8bab407362") || processInstance.getProcessDefId().equals("obj_5609e1d265dc4e7094c617f20be353dd") || processInstance.getProcessDefId().equals("obj_114e76f691c14beb902e9904f4be26f8")) { if (processInstance.getProcessDefId().equals("obj_fb1c7a54b98b412187388c8bab407362") || processInstance.getProcessDefId().equals("obj_5609e1d265dc4e7094c617f20be353dd") ) {
//l1 l2 l3 l4 保存到表里 //l1 l2 l3 l4 保存到表里
DBSql.update(String.format("update BO_ACT_COE_PUBLISH set LEVEL_1_PROCESS_NAME='%s',LEVEL_2_PROCESS_NAME='%s',LEVEL_3_PROCESS_NAME='%s' where BINDID='%s'", level1, level2, level3, bindid)); DBSql.update(String.format("update BO_ACT_COE_PUBLISH set LEVEL_1_PROCESS_NAME='%s',LEVEL_2_PROCESS_NAME='%s',LEVEL_3_PROCESS_NAME='%s' where BINDID='%s'", level1, level2, level3, bindid));
String sql = "select AUDITOR1,AUDITOR_NO_1,L1_SP,AUDITOR2,AUDITOR_NO_2,L2_SP,AUDITOR3,AUDITOR_NO_3,L3_SP from BO_ACT_AUTH_INFO where LEVEL_1_PROCESS_NAME='%s' and LEVEL_2_PROCESS_NAME='%s' and LEVEL_3_PROCESS_NAME='%s' and ORGNAME='%s' and ADAPT_REGION_NAME='%s' and APPLICABLE_PRODUCT='%s'"; String sql = "select AUDITOR1,AUDITOR_NO_1,L1_SP,AUDITOR2,AUDITOR_NO_2,L2_SP,AUDITOR3,AUDITOR_NO_3,L3_SP from BO_ACT_AUTH_INFO where LEVEL_1_PROCESS_NAME='%s' and LEVEL_2_PROCESS_NAME='%s' and LEVEL_3_PROCESS_NAME='%s' and ORGNAME='%s' and ADAPT_REGION_NAME='%s' and APPLICABLE_PRODUCT='%s'";
@ -4337,13 +4337,13 @@ public class ProcessPublishWeb extends ActionWeb {
//查询区域流程 //查询区域流程
RowMap adaptRowMap = DBSql.getMap("select ADAPT_REGION_NAME from BO_ACT_AUTH_INFO where LEVEL_1_PROCESS_NAME=? and LEVEL_2_PROCESS_NAME=? AND LEVEL_3_PROCESS_NAME=? AND LEVEL_4_PROCESS_NAME=? AND ADAPT_NAME_THE_COMPANY=?", level1, level2, level3,level4,company); RowMap adaptRowMap = DBSql.getMap("select ADAPT_REGION_NAME from BO_ACT_AUTH_INFO where LEVEL_1_PROCESS_NAME=? AND LEVEL_2_PROCESS_NAME=? AND LEVEL_3_PROCESS_NAME=? ", level1, level2, level3);
if(adaptRowMap.size()==1){ if(adaptRowMap.size()==1){
ro.put("ADAPT_REGION_NAME",adaptRowMap.getString("ADAPT_REGION_NAME")); ro.put("ADAPT_REGION_NAME",adaptRowMap.getString("ADAPT_REGION_NAME"));
} }
//查询产品流程 //查询产品流程
RowMap applicableRowMap = DBSql.getMap("select APPLICABLE_PRODUCT from BO_ACT_AUTH_INFO where LEVEL_1_PROCESS_NAME=? and LEVEL_2_PROCESS_NAME=? AND LEVEL_3_PROCESS_NAME=? AND LEVEL_4_PROCESS_NAME=? AND ADAPT_NAME_THE_COMPANY=?", level1, level2, level3,level4,company); RowMap applicableRowMap = DBSql.getMap("select APPLICABLE_PRODUCT from BO_ACT_AUTH_INFO where LEVEL_1_PROCESS_NAME=? AND LEVEL_2_PROCESS_NAME=? AND LEVEL_3_PROCESS_NAME=? ", level1, level2, level3);
if(adaptRowMap.size()==1){ if(adaptRowMap.size()==1){
ro.put("APPLICABLE_PRODUCT",applicableRowMap.getString("APPLICABLE_PRODUCT")); ro.put("APPLICABLE_PRODUCT",applicableRowMap.getString("APPLICABLE_PRODUCT"));
} }
@ -4358,13 +4358,13 @@ public class ProcessPublishWeb extends ActionWeb {
ro.put("data", result == null ? "" : result); ro.put("data", result == null ? "" : result);
//查询区域流程 //查询区域流程
RowMap adaptRowMap = DBSql.getMap("select ADAPT_REGION_NAME from BO_ACT_AUTH_INFO where LEVEL_1_PROCESS_NAME=? and LEVEL_2_PROCESS_NAME=? AND LEVEL_3_PROCESS_NAME=? LEVEL_4_PROCESS_NAME=?", level1, level2, level3,company); RowMap adaptRowMap = DBSql.getMap("select ADAPT_REGION_NAME from BO_ACT_AUTH_INFO where LEVEL_1_PROCESS_NAME=? AND LEVEL_2_PROCESS_NAME=? AND LEVEL_3_PROCESS_NAME=? AND LEVEL_4_PROCESS_NAME=? ", level1, level2, level3,level4);
if(adaptRowMap.size()==1){ if(adaptRowMap.size()==1){
ro.put("ADAPT_REGION_NAME",adaptRowMap.getString("ADAPT_REGION_NAME")); ro.put("ADAPT_REGION_NAME",adaptRowMap.getString("ADAPT_REGION_NAME"));
} }
//查询产品流程 //查询产品流程
RowMap applicableRowMap = DBSql.getMap("select APPLICABLE_PRODUCT from BO_ACT_AUTH_INFO where LEVEL_1_PROCESS_NAME=? and LEVEL_2_PROCESS_NAME=? AND LEVEL_3_PROCESS_NAME=? LEVEL_4_PROCESS_NAME=?", level1, level2, level3,company); RowMap applicableRowMap = DBSql.getMap("select APPLICABLE_PRODUCT from BO_ACT_AUTH_INFO where LEVEL_1_PROCESS_NAME=? AND LEVEL_2_PROCESS_NAME=? AND LEVEL_3_PROCESS_NAME=? AND LEVEL_4_PROCESS_NAME=? ", level1, level2, level3,level4);
if(adaptRowMap.size()==1){ if(adaptRowMap.size()==1){
ro.put("APPLICABLE_PRODUCT",applicableRowMap.getString("APPLICABLE_PRODUCT")); ro.put("APPLICABLE_PRODUCT",applicableRowMap.getString("APPLICABLE_PRODUCT"));
} }
@ -4606,7 +4606,7 @@ public class ProcessPublishWeb extends ActionWeb {
ResponseObject ro = ResponseObject.newOkResponse(); ResponseObject ro = ResponseObject.newOkResponse();
try { try {
ProcessInstance processInstance = SDK.getProcessAPI().getInstanceById(processInstId); ProcessInstance processInstance = SDK.getProcessAPI().getInstanceById(processInstId);
if (processInstance.getProcessDefId().equals("obj_fb1c7a54b98b412187388c8bab407362") || processInstance.getProcessDefId().equals("obj_5609e1d265dc4e7094c617f20be353dd") || processInstance.getProcessDefId().equals("obj_114e76f691c14beb902e9904f4be26f8")) { if (processInstance.getProcessDefId().equals("obj_fb1c7a54b98b412187388c8bab407362") || processInstance.getProcessDefId().equals("obj_5609e1d265dc4e7094c617f20be353dd") ) {
//ID获取L1 L2 L3 的值 //ID获取L1 L2 L3 的值
List<RowMap> resulttmp = DBSql.getMaps(String.format("select PROPERTYID,PROPERTYVALUE from APP_ACT_COE_PAL_PROP where PROPERTYID in ('Process_Architecture_L1','Process_Architecture_L2','Process_Architecture_L3') AND PLID='%s'", uuid)); List<RowMap> resulttmp = DBSql.getMaps(String.format("select PROPERTYID,PROPERTYVALUE from APP_ACT_COE_PAL_PROP where PROPERTYID in ('Process_Architecture_L1','Process_Architecture_L2','Process_Architecture_L3') AND PLID='%s'", uuid));
for (RowMap tmp : resulttmp) { for (RowMap tmp : resulttmp) {

View File

@ -0,0 +1,126 @@
package com.actionsoft.apps.coe.pal.publisher.pubEvent;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.methods.InputStreamRequestEntity;
import org.apache.commons.httpclient.methods.PostMethod;
import org.apache.commons.httpclient.methods.RequestEntity;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
public class HttpClientUtils {
public String SendPend(String url, XmlDatasUtil xmlDatasUtil) throws IOException {
String result = "true";
StringBuffer sendSoapString = new StringBuffer();
String xmlStr = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:com=\"com.synctooa.webservices\">\n" +
" <soapenv:Header/>\n" +
" <soapenv:Body>\n" +
" <com:InsertTodoCominfo>\n" +
" <com:in0>\n" +
"<![CDATA[ \n" +
"<?xml version='1.0' encoding='UTF-8'?>\n" +
"<root>\n" +
" <Todo>\n" +
" <outsysid>"+ xmlDatasUtil.getExternal_system_ID() +"</outsysid>\n" +
" <todoid>"+ xmlDatasUtil.getOther_system_to_do_ID() +"</todoid>\n" +
" <content>"+ xmlDatasUtil.getProcess_title() +"</content>\n" +
" <pcurl>"+ xmlDatasUtil.getPcurl() + "</pcurl>\n" +
" <mobileurl>"+ xmlDatasUtil.getMobileurl() +"</mobileurl>\n" +
" <hrcode>"+ xmlDatasUtil.getTo_do_login_account() +"</hrcode>\n" +
" <createtime>"+ xmlDatasUtil.getTo_do_creation_time() +"</createtime>\n" +
" <donetime>"+ xmlDatasUtil.getTo_do_completion_time() +"</donetime>\n" +
" <status>"+ xmlDatasUtil.getTo_do_status() +"</status>\n" +
" <wftype>"+ xmlDatasUtil.getTo_do_official_type() +"</wftype>\n" +
" <viewtype>"+ xmlDatasUtil.getViewtype() +"</viewtype>\n" +
" <createdate>"+ xmlDatasUtil.getCreatedate() +"</createdate>\n" +
" <donedate>"+ xmlDatasUtil.getDonedate() +"</donedate>\n" +
" <receivedate>"+ xmlDatasUtil.getReceivedate() +"</receivedate>\n" +
" <receivetime>" + xmlDatasUtil.getReceivetime() +"</receivetime>\n" +
" <currentnodetype>"+ xmlDatasUtil.getCurrentnodetype() +"</currentnodetype>\n" +
" <requestcode>"+ xmlDatasUtil.getRequestcode() +"</requestcode>\n" +
" <currentnodename>"+ xmlDatasUtil.getCurrentnodename() +"</currentnodename>\n" +
" <nooperator>"+ xmlDatasUtil.getNooperator() +"</nooperator>\n" +
" <workcode>"+ xmlDatasUtil.getWorkcode() +"</workcode>\n" +
" <workflowname>"+ xmlDatasUtil.getWorkflowname() +"</workflowname>\n" +
" <createrhrcode>"+ xmlDatasUtil.getCreaterhrcode() +"</createrhrcode>\n" +
" <createrworkcode>"+ xmlDatasUtil.getCreaterworkcode() +"</createrworkcode>\n" +
" </Todo>\n" +
"</root>\n" +
"]]>\n" +
"</com:in0>\n" +
" </com:InsertTodoCominfo>\n" +
" </soapenv:Body>\n" +
"</soapenv:Envelope>";
System.out.println("xmlstr================"+xmlStr);
UtilUrl uc=new UtilUrl();
String postSoap = uc.doPostSoap(url, xmlStr, "");
return postSoap;
}
public String readOa(String url, String taskid) throws IOException {
String result = "true";
StringBuffer sendSoapString = new StringBuffer();
String xmlStr = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:com=\"com.synctooa.webservices\">\n" +
" <soapenv:Header/>\n" +
" <soapenv:Body>\n" +
" <com:updateRead>\n" +
" <com:in0>LCZD</com:in0>\n" +
" <com:in1>"+taskid+"</com:in1>\n" +
" </com:updateRead>\n" +
" </soapenv:Body>\n" +
"</soapenv:Envelope>";
System.out.println("xmlstr================"+xmlStr);
UtilUrl uc=new UtilUrl();
String postSoap = uc.doPostSoap(url, xmlStr, "");
return postSoap;
}
public String SendPreview(String url, String xmlStr) {
String result = "true";
PostMethod postMethod = new PostMethod(url);
StringBuffer soapRequestData = new StringBuffer(xmlStr);
byte[] b = (byte[])null;
try {
b = soapRequestData.toString().getBytes("utf-8");
} catch (UnsupportedEncodingException var16) {
var16.printStackTrace();
}
InputStream is = new ByteArrayInputStream(b, 0, b.length);
RequestEntity re = new InputStreamRequestEntity(is, (long)b.length, "text/xml; charset=utf-8");
postMethod.setRequestEntity(re);
HttpClient httpClient = new HttpClient();
httpClient.setConnectionTimeout(500000000);
httpClient.setTimeout(500000000);
try {
int statusCode = httpClient.executeMethod(postMethod);
if (statusCode == 200) {
String soapResponseData = postMethod.getResponseBodyAsString();
return soapResponseData.indexOf("Success") == -1 ? "fail" : result;
} else {
return "error[" + statusCode + "]";
}
} catch (Exception var15) {
var15.printStackTrace();
return "Exception[" + var15 + "]";
}
}
}

View File

@ -1,5 +1,6 @@
package com.actionsoft.apps.coe.pal.publisher.pubEvent; package com.actionsoft.apps.coe.pal.publisher.pubEvent;
import java.io.IOException;
import java.io.StringReader; import java.io.StringReader;
import java.sql.Connection; import java.sql.Connection;
import java.sql.Timestamp; import java.sql.Timestamp;
@ -127,6 +128,33 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute
int r1 = DBSql.update("UPDATE BO_ACT_EXECUTIVE_TASK SET ISTASKEND='2' WHERE TASKID='" + ext.getProcessInstance().getId() + "'"); int r1 = DBSql.update("UPDATE BO_ACT_EXECUTIVE_TASK SET ISTASKEND='2' WHERE TASKID='" + ext.getProcessInstance().getId() + "'");
BO bo_act_coe_publish=SDK.getBOAPI().query("BO_ACT_COE_PUBLISH").addQuery("BINDID=",ext.getProcessInstance().getId()).detail();
String whether_propaganda_plan=bo_act_coe_publish.getString("WHETHER_PROPAGANDA_PLAN");
if(whether_propaganda_plan.equals("1")){
ProcessInstance processInstance = SDK.getProcessAPI().createProcessInstance("obj_11aeee27b9a54a428aa42a05376ee81d", ext.getUserContext().getUID(), "关于" + bo_act_coe_publish.getString("PROCESS_TITLE") + "文件的宣贯任务");
SDK.getProcessAPI().start(processInstance);
//发送OA待办
TaskInstance taskInstance= SDK.getTaskAPI().getInstanceById(processInstance.getStartTaskInstId());
sendOaPending(taskInstance,processInstance,ext);
String url="https://bpm.yili.com:8088/portal/r/w?sid="+ext.getUserContext().getSessionId()+"&cmd=CLIENT_BPM_FORM_MAIN_PAGE_OPEN&processInstId="+processInstance.getId()+"&openState=1&taskInstId="+processInstance.getStartTaskInstId()+"&displayToolbar=true";
int update = DBSql.update("update BO_ACT_COE_PUBLISH set XGRWLJ = '" + url + "' where BINDID = '" + ext.getProcessInstance().getId() + "'");
}
} }
public void ProcessData(ProcessExecutionContext processExecutionContext,Connection open) throws Exception { public void ProcessData(ProcessExecutionContext processExecutionContext,Connection open) throws Exception {
@ -2474,4 +2502,208 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute
} }
} }
/**
* 发送待办
*
* @param taskInstance DD
* @throws DocumentException
*/
public void sendOaPending(TaskInstance taskInstance, ProcessInstance processInstance, ProcessExecutionContext pe) throws IOException, DocumentException {
if("admin".equals(taskInstance.getTarget())) {
return;
}
XmlDatasUtil xmlDatasUtil = new XmlDatasUtil();
xmlDatasUtil.setExternal_system_ID("LCZD");
xmlDatasUtil.setOther_system_to_do_ID(taskInstance.getId());
BO bo_act_coe_publish = SDK.getBOAPI().query("BO_ACT_DOCUMENT_PUBLICITY_TASK", true).addQuery("BINDID=", processInstance.getId()).addQuery("PROCESS_NAME is not null",null).detail();
if (!processInstance.getParentTaskInstId().equals("00000000-0000-0000-0000-000000000000")){
if (bo_act_coe_publish!=null){
String title = bo_act_coe_publish.getString("PROCESS_NAME");
if(title.contains("&")) {
xmlDatasUtil.setProcess_title(" 您有一条待办流程【"+title.replace("&", "-")+"】,点击进行处理");
}else {
xmlDatasUtil.setProcess_title(" 您有一条待办流程【"+title+"】,点击进行处理");
}
}else {
xmlDatasUtil.setProcess_title(" 您有一条待办流程【"+processInstance.getTitle()+"】,点击进行处理");
}
}else {
xmlDatasUtil.setProcess_title(" 您有一条草稿流程保存成功【"+processInstance.getTitle()+"");
}
//http://localhost:8089/portal/r/or?cmd=com.yili_form_page_open&amp;processInstId=3505e654-9217-41cd-a31d-4971846b3219&amp;taskInstId=8a71d75e-3ee0-43a2-a226-ecb01419319c&amp;oauthName=oauthLogin&amp;token=admin
String portalUrl = SDK.getPortalAPI().getPortalUrl();
if (portalUrl.equals("http://10.114.11.135:8088/portal")){
portalUrl = "https://bpm.yili.com:8088/portal/";
}
xmlDatasUtil.setPcurl(portalUrl+"/r/or?cmd=com.yili_form_page_open&amp;oauthName=oauthLogin&amp;processInstId="+processInstance.getId()+"&amp;taskInstId="+taskInstance.getId()+"&amp;openState="+taskInstance.getState());
xmlDatasUtil.setMobileurl(portalUrl+"/r/or?cmd=com.yili_form_page_open&amp;corpid=wwb0ae23173b140618&amp;appAgentId=1000014&amp;oauthName=wechat&amp;casaccount="+taskInstance.getTarget()+"&amp;processInstId="+processInstance.getId()+"&amp;taskInstId="+taskInstance.getId()+"&amp;openState="+taskInstance.getState());
String target = taskInstance.getTarget();
//System.out.println("当前账户======》》》》"+target);
BO bo_eu_oa_reson = SDK.getBOAPI().query("BO_EU_OA_RESON", true).addQuery("WORKCODE=" , target).detail();
//System.out.println("bo>>>>>>>>>>"+bo_eu_oa_reson);
if (bo_eu_oa_reson!=null){
xmlDatasUtil.setTo_do_login_account(bo_eu_oa_reson.getString("LOGINID"));
}else {
xmlDatasUtil.setTo_do_login_account(target);
}
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//定义格式不显示毫秒
String str = df.format(taskInstance.getBeginTime());
String substring = str.substring(str.indexOf(" "), str.length());
xmlDatasUtil.setTo_do_creation_time(substring);
xmlDatasUtil.setTo_do_completion_time(substring);
//if (taskInstance.getState()==1){
xmlDatasUtil.setTo_do_status("0");
//}
xmlDatasUtil.setTo_do_official_type("0");
// if (taskInstance.getReadState()==0){
// xmlDatasUtil.setViewtype("0");
// }else if (taskInstance.getReadState()==1){
xmlDatasUtil.setViewtype("0");
// }
xmlDatasUtil.setCreatedate(str.substring(0, str.indexOf(" ")));
xmlDatasUtil.setDonedate(str.substring(0, str.indexOf(" ")));
/*String der ="";
if (taskInstance.getReadTime()!=null){
der = df.format(taskInstance.getReadTime());
xmlDatasUtil.setReceivedate(der.substring(0, der.indexOf(" ")));
xmlDatasUtil.setReceivetime(der.substring(der.indexOf(" "),der.length()));
}else {
der = df.format(taskInstance.getBeginTime());
xmlDatasUtil.setReceivedate(der.substring(0, der.indexOf(" ")));
xmlDatasUtil.setReceivetime(der.substring(der.indexOf(" "),der.length()));
}*/
xmlDatasUtil.setReceivedate(str.substring(0, str.indexOf(" ")));
xmlDatasUtil.setReceivetime(substring);
xmlDatasUtil.setCurrentnodetype("0");
xmlDatasUtil.setRequestcode(processInstance.getId());
xmlDatasUtil.setCurrentnodename(SDK.getRepositoryAPI().getProcessNode(processInstance.getProcessDefId(),taskInstance.getActivityDefId()).getName());
// 调用App
String sourceAppId = processInstance.getAppId();
// aslp服务地址
String aslp = "aslp://com.actionsoft.apps.processtrends/processNodeInfoASLP";
// 参数定义列表
Map params = new HashMap<String, Object>();
//流程实例id,必填
params.put("processInstId", processInstance.getId());
//,必填
params.put("sid", pe.getUserContext().getSessionId());
AppAPI appAPI = SDK.getAppAPI();
//流程节点数据
ResponseObject ro = appAPI.callASLP(appAPI.getAppContext(sourceAppId), aslp, params);
String username = "";
String userid = "";
if (ro.isOk()){
List list = new ArrayList();
Object processBudgetModelList = ro.get("processBudgetModelList");
JSONArray array = JSON.parseArray(String.valueOf(processBudgetModelList));
if (!array.isEmpty()){
for(int i=0;i<array.size();i++){
JSONObject jsonObject = JSONObject.parseObject(array.get(i).toString());
String executor = jsonObject.get("executor").toString();
String userid2 = jsonObject.get("userid2").toString();
//String userid2 = jsonArray.getJSONObject(i).getString("userid2");
username+=executor+" ";
}
}
}
if (bo_eu_oa_reson!=null){
xmlDatasUtil.setNooperator(bo_eu_oa_reson.getString("LOGINID"));
}
xmlDatasUtil.setWorkcode("");
String title = processInstance.getTitle();
if(title.contains("&")) {
xmlDatasUtil.setWorkflowname(title.replaceAll("&", "-"));
}else {
xmlDatasUtil.setWorkflowname(title);
}
//xmlDatasUtil.setWorkflowname(pec.getProcessInstance().getTitle());
if (bo_eu_oa_reson!=null){
xmlDatasUtil.setCreaterhrcode(bo_eu_oa_reson.getString("LOGINID"));
}else {
xmlDatasUtil.setCreaterhrcode(target);
}
xmlDatasUtil.setCreaterworkcode("");
HttpClientUtils httpClientUtil = new HttpClientUtils();
String taskurl= SDK.getAppAPI().getProperty("com.awspaas.user.apps.yili.integration", "taskurl");
String s = httpClientUtil.SendPend(taskurl, xmlDatasUtil);
//System.out.println("状态码============》》》》》》》》》》》"+s);
BO bo = new BO();
bo.set("OUTSYSID",xmlDatasUtil.getExternal_system_ID());
bo.set("TODOID",xmlDatasUtil.getOther_system_to_do_ID());
bo.set("CONTENT",xmlDatasUtil.getProcess_title());
bo.set("PCURL",xmlDatasUtil.getPcurl());
bo.set("MOBILEURL",xmlDatasUtil.getMobileurl());
bo.set("HRCODE",xmlDatasUtil.getTo_do_login_account());
bo.set("STATUS",xmlDatasUtil.getTo_do_status());
bo.set("WFTYPE",xmlDatasUtil.getTo_do_official_type());
bo.set("VIEWTYPE",xmlDatasUtil.getViewtype());
bo.set("CREATEDATES",xmlDatasUtil.getCreatedate());
bo.set("NEWCREATETIME",xmlDatasUtil.getTo_do_creation_time());
bo.set("DONEDATE",xmlDatasUtil.getDonedate());
bo.set("NEWDONETIME",xmlDatasUtil.getTo_do_status());
bo.set("RECEIVEDATE",xmlDatasUtil.getReceivedate());
bo.set("RECEIVETIME",xmlDatasUtil.getReceivetime());
bo.set("CURRENTNODETYPE",xmlDatasUtil.getCurrentnodetype());
bo.set("REQUESTCODE",xmlDatasUtil.getRequestcode());
bo.set("CURRENTNODENAME",xmlDatasUtil.getCurrentnodename());
bo.set("NOOPERATOR",xmlDatasUtil.getNooperator());
bo.set("CREATERHRCODE",xmlDatasUtil.getCreaterhrcode());
bo.set("WORKFLOWNAME",xmlDatasUtil.getWorkflowname());
bo.set("OA_RESULT",s);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
bo.set("OA_DATE",sdf.format(new Date()));
SDK.getBOAPI().createDataBO("BO_EU_OA_MOBILEURL",bo,UserContext.fromUID(taskInstance.getTarget()));
System.out.println("发送待办===>"+processInstance.getTitle()+"===>"+"状态码============》》》》》》》》》》》"+s);
Document document = null;
try {
document = DocumentHelper.parseText(s);
} catch (DocumentException e) {
e.printStackTrace();
}
Element rootElement = document.getRootElement();
//System.out.println("rootElement>>>>>>"+rootElement);
Element result = rootElement.element("Body").element("InsertTodoCominfoResponse").element("out");
String text = result.getText();
document = DocumentHelper.parseText(text);
Element rootElement2 = document.getRootElement();
Element statusElement = rootElement2.element("result");
Element messageElement = rootElement2.element("message");
String status = statusElement.getData().toString();
String message = messageElement.getData().toString();
if ("success".equals(status)){
System.out.println("发送待办成功===>"+processInstance.getTitle()+"===>"+taskInstance.getTarget()+"====>"+status+"===>"+message);
}else {
System.out.println("发送待办失败===>"+processInstance.getTitle()+"===>"+taskInstance.getTarget()+"====>"+status+"===>"+message);
}
if (s.contains("success")){
//System.out.println("发送待办任务完成请去OA系统上查看是否传输完成");
}else {
//System.out.println("发送待办任务失败,请联系管理员查看是否出现错误");
//System.out.println("错误提示>>>>>>>>>>>>"+s);
BO bo_eu_faid_data = SDK.getBOAPI().query("BO_EU_FAID_DATA", true).addQuery("TASK_ID=", taskInstance.getId()).detail();
if (bo_eu_faid_data==null){
ProcessInstance processInstanceadmin = SDK.getProcessAPI().createProcessInstance("obj_ef1918ca1f9c46948f56bd5f77f4e646", "admin", pe.getUserContext().getUserName() + "失败更新待办");
BO bo_faid = new BO();
bo_faid.set("CHANGED","1");
bo_faid.set("TASK_ID",taskInstance.getId());
bo_faid.set("PROCESS_ID",processInstance.getId());
UserContext userContext = UserContext.fromUID("admin");
SDK.getBOAPI().create("BO_EU_FAID_DATA",bo_faid,processInstanceadmin,userContext);
SDK.getProcessAPI().start(processInstanceadmin);
}
}
}
} }

View File

@ -0,0 +1,240 @@
package com.actionsoft.apps.coe.pal.publisher.pubEvent;
/**
* @author wangchengye
* @description
* @createtime 2022-07-09 15:54
* @updateAndOther
*/
public class XmlDatasUtil {
// 外部系统ID
private String External_system_ID;
// 其他系统待办ID
private String Other_system_to_do_ID;
// 流程标题
private String Process_title;
//// pc端的url地址
private String pcurl;
// s手机端的url地址
private String mobileurl;
// 待办人的登录账号
private String To_do_login_account;
//待办创建时间
private String To_do_creation_time;
//// 待办办结时间
private String To_do_completion_time;
// 待办状态
private String To_do_status;
//公文类型的待办
private String To_do_official_type;
// 已读类型
private String viewtype;
// 创建日期
private String createdate;
// 待办办结日期
private String donedate;
// 待办接收日期
private String receivedate;
// 待办接收时间
private String receivetime;
// 当前节点是否已经归档
private String currentnodetype;
// 流程编号
private String requestcode;
// 当前节点
private String currentnodename;
// 未操作者
private String nooperator;
// 待办人员工作工号
private String workcode;
// 工作流程编号
private String workflowname;
// 流程创建人员登录账号
private String createrhrcode;
// 流程创建人员工号
private String createrworkcode;
public String getExternal_system_ID() {
return External_system_ID;
}
public void setExternal_system_ID(String external_system_ID) {
External_system_ID = external_system_ID;
}
public String getOther_system_to_do_ID() {
return Other_system_to_do_ID;
}
public void setOther_system_to_do_ID(String other_system_to_do_ID) {
Other_system_to_do_ID = other_system_to_do_ID;
}
public String getProcess_title() {
return Process_title;
}
public void setProcess_title(String process_title) {
Process_title = process_title;
}
public String getPcurl() {
return pcurl;
}
public void setPcurl(String pcurl) {
this.pcurl = pcurl;
}
public String getMobileurl() {
return mobileurl;
}
public void setMobileurl(String mobileurl) {
this.mobileurl = mobileurl;
}
public String getTo_do_login_account() {
return To_do_login_account;
}
public void setTo_do_login_account(String to_do_login_account) {
To_do_login_account = to_do_login_account;
}
public String getTo_do_creation_time() {
return To_do_creation_time;
}
public void setTo_do_creation_time(String to_do_creation_time) {
To_do_creation_time = to_do_creation_time;
}
public String getTo_do_completion_time() {
return To_do_completion_time;
}
public void setTo_do_completion_time(String to_do_completion_time) {
To_do_completion_time = to_do_completion_time;
}
public String getTo_do_status() {
return To_do_status;
}
public void setTo_do_status(String to_do_status) {
To_do_status = to_do_status;
}
public String getTo_do_official_type() {
return To_do_official_type;
}
public void setTo_do_official_type(String to_do_official_type) {
To_do_official_type = to_do_official_type;
}
public String getViewtype() {
return viewtype;
}
public void setViewtype(String viewtype) {
this.viewtype = viewtype;
}
public String getCreatedate() {
return createdate;
}
public void setCreatedate(String createdate) {
this.createdate = createdate;
}
public String getDonedate() {
return donedate;
}
public void setDonedate(String donedate) {
this.donedate = donedate;
}
public String getReceivedate() {
return receivedate;
}
public void setReceivedate(String receivedate) {
this.receivedate = receivedate;
}
public String getReceivetime() {
return receivetime;
}
public void setReceivetime(String receivetime) {
this.receivetime = receivetime;
}
public String getCurrentnodetype() {
return currentnodetype;
}
public void setCurrentnodetype(String currentnodetype) {
this.currentnodetype = currentnodetype;
}
public String getRequestcode() {
return requestcode;
}
public void setRequestcode(String requestcode) {
this.requestcode = requestcode;
}
public String getCurrentnodename() {
return currentnodename;
}
public void setCurrentnodename(String currentnodename) {
this.currentnodename = currentnodename;
}
public String getNooperator() {
return nooperator;
}
public void setNooperator(String nooperator) {
this.nooperator = nooperator;
}
public String getWorkcode() {
return workcode;
}
public void setWorkcode(String workcode) {
this.workcode = workcode;
}
public String getWorkflowname() {
return workflowname;
}
public void setWorkflowname(String workflowname) {
this.workflowname = workflowname;
}
public String getCreaterhrcode() {
return createrhrcode;
}
public void setCreaterhrcode(String createrhrcode) {
this.createrhrcode = createrhrcode;
}
public String getCreaterworkcode() {
return createrworkcode;
}
public void setCreaterworkcode(String createrworkcode) {
this.createrworkcode = createrworkcode;
}
}