diff --git a/com.actionsoft.apps.coe.pal.publisher/lib/com.actionsoft.apps.coe.pal.publisher.jar b/com.actionsoft.apps.coe.pal.publisher/lib/com.actionsoft.apps.coe.pal.publisher.jar index 43f5ea4f..204745ca 100644 Binary files a/com.actionsoft.apps.coe.pal.publisher/lib/com.actionsoft.apps.coe.pal.publisher.jar and b/com.actionsoft.apps.coe.pal.publisher/lib/com.actionsoft.apps.coe.pal.publisher.jar differ diff --git a/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/event/SubFormAfterSave.java b/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/event/SubFormAfterSave.java index e9f4bfb1..b5b9484f 100644 --- a/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/event/SubFormAfterSave.java +++ b/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/event/SubFormAfterSave.java @@ -1,18 +1,31 @@ package com.actionsoft.apps.coe.pal.publisher.event; +import java.io.IOException; +import java.text.SimpleDateFormat; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; +import java.util.Map; import com.actionsoft.apps.coe.pal.pal.repository.cache.PALRepositoryCache; import com.actionsoft.apps.coe.pal.pal.repository.model.PALRepositoryModel; -import com.actionsoft.apps.coe.pal.publisher.client.util.ProcesNumberUtil; import com.actionsoft.bpms.bo.engine.BO; import com.actionsoft.bpms.bpmn.engine.core.delegate.ProcessExecutionContext; import com.actionsoft.bpms.bpmn.engine.listener.ExecuteListener; import com.actionsoft.bpms.bpmn.engine.listener.ListenerConst; +import com.actionsoft.bpms.bpmn.engine.model.run.delegate.TaskInstance; +import com.actionsoft.bpms.commons.mvc.view.ResponseObject; +import com.actionsoft.bpms.org.cache.UserCache; +import com.actionsoft.bpms.org.model.UserModel; import com.actionsoft.bpms.util.UUIDGener; import com.actionsoft.sdk.local.SDK; +import com.actionsoft.sdk.local.api.AppAPI; import com.actionsoft.sdk.local.api.BOQueryAPI; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.awspaas.user.apps.integrates.XmlDatasUtil; +import com.awspaas.user.apps.integrates.util.HttpClientUtil; public class SubFormAfterSave extends ExecuteListener { @@ -36,6 +49,7 @@ public class SubFormAfterSave extends ExecuteListener { //BO表名 String boName = param.getParameterOfString(ListenerConst.FORM_EVENT_PARAM_BONAME); BO formData = (BO) param.getParameter(ListenerConst.FORM_EVENT_PARAM_FORMDATA); + TaskInstance taskInstance = param.getTaskInstance(); String bindId = formData.getBindId(); String uid = formData.getCreateUser(); if (boName.equals("BO_ACT_COE_PUBLISH_N")) { @@ -117,7 +131,144 @@ public class SubFormAfterSave extends ExecuteListener { } } } - + sendOaPending(taskInstance,param); } - + + + + + + /** + * 发送待办 + * + * @param taskInstance DD + */ + public void sendOaPending(TaskInstance taskInstance, ProcessExecutionContext pec) throws IOException { + + XmlDatasUtil xmlDatasUtil = new XmlDatasUtil(); + xmlDatasUtil.setExternal_system_ID("CL"); + xmlDatasUtil.setOther_system_to_do_ID(taskInstance.getId()); + BO bo_act_coe_publish = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH", true).addQuery("BINDID=", pec.getProcessInstance().getId()).detail(); + if (bo_act_coe_publish!=null){ + xmlDatasUtil.setProcess_title(" 您有一条待办流程【"+bo_act_coe_publish.getString("PROCESS_TITLE")+"】,点击进行处理"); + }else { + xmlDatasUtil.setProcess_title(" 您有一条待办流程【"+pec.getProcessInstance().getTitle()+"】,点击进行处理"); + } + + //http://localhost:8089/portal/r/or?cmd=com.yili_form_page_open&processInstId=3505e654-9217-41cd-a31d-4971846b3219&taskInstId=8a71d75e-3ee0-43a2-a226-ecb01419319c&oauthName=oauthLogin&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&oauthName=oauthLogin&processInstId="+pec.getProcessInstance().getId()+"&taskInstId="+taskInstance.getId()); + xmlDatasUtil.setMobileurl(portalUrl+"/r/or?cmd=com.yili_form_page_open&oauthName=WechatOauthLogin&casaccount="+pec.getTaskInstance().getTarget()+"&processInstId="+pec.getProcessInstance().getId()+"&taskInstId="+taskInstance.getId()); + String target = taskInstance.getTarget(); + if (target.length()==8&&"00".equals(target.substring(0,2))){ + target = target.substring(2); + } + 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")); + } + 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(pec.getProcessInstance().getId()); + xmlDatasUtil.setCurrentnodename(SDK.getRepositoryAPI().getProcessNode(pec.getProcessInstance().getProcessDefId(),pec.getTaskInstance().getActivityDefId()).getName()); + + // 调用App + String sourceAppId = pec.getProcessInstance().getAppId(); + // aslp服务地址 + String aslp = "aslp://com.actionsoft.apps.processtrends/processNodeInfoASLP"; + // 参数定义列表 + Map params = new HashMap(); + //流程实例id,必填 + params.put("processInstId", pec.getProcessInstance().getId()); + //,必填 + params.put("sid", pec.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