From 0b84c043a00d0168e2bf6c4a7623de720d8225bd Mon Sep 17 00:00:00 2001 From: Mr-wang Date: Fri, 1 Sep 2023 18:14:34 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=9B=91=E6=8E=A7=E4=BB=A3?= =?UTF-8?q?=E7=A0=81,=E4=BF=AE=E6=94=B9=E7=BA=BF=E7=A8=8B=E5=85=A8?= =?UTF-8?q?=E5=B1=80=E5=8F=98=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pubEvent/ProcessEndAfterEvent_new.java | 68 +++++++++++++++++-- 1 file changed, 64 insertions(+), 4 deletions(-) diff --git a/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/pubEvent/ProcessEndAfterEvent_new.java b/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/pubEvent/ProcessEndAfterEvent_new.java index b982d264..e0e79b0d 100644 --- a/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/pubEvent/ProcessEndAfterEvent_new.java +++ b/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/pubEvent/ProcessEndAfterEvent_new.java @@ -273,9 +273,26 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute for (BO uid:bo_eu_oa_read_test) { sendLists.add(uid.getString("USER_ID")); }*/ + String sql = "SELECT ID FROM WFH_TASK WHERE PROCESSINSTID = '" + processExecutionContext.getProcessInstance().getId() + + "' AND ACTIVITYDEFID = 'obj_c9e5a3144b200001b68cffa01ed0153e' "; + String taskInd = DBSql.getString(sql); + + + TaskInstance ta = SDK.getTaskAPI().getInstanceById(taskInd); new_uid = new_uid.join(",", sendList); long startTimes = System.currentTimeMillis(); String[] users = new_uid.split(","); + for (String uid: + users) { + BO bo = new BO(); + bo.set("USER_ID",uid); + bo.set("PROCESSID",processExecutionContext.getProcessInstance().getId()); + bo.set("USERID",ta.getTarget()); + bo.set("DEPARTMENT",UserContext.fromUID(ta.getTarget()).getDepartmentModel().getId()); + bo.set("PROCESS_TITLE",bo_act_coe_publish1.getString("PROCESS_TITLE")); + bo.set("PUBLISH_DATE",sdf.format(endTime)); + SDK.getBOAPI().createDataBO("BO_EU__OA_MONITOR",bo,UserContext.fromUID(ta.getTarget())); + } System.out.println("new_uid>>>>>>>>>>>>>>"+users.length); int length = 100; int ys = users.length%length; @@ -553,7 +570,7 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute userIds = StringUtils.join(resrt, ","); System.out.println("userIDs>>>>>>>>>>>>>>>"+userIds); try { - SendOARead(jsonObject, processExecutionContext.getProcessInstance(), userIds,"批量推送"); + SendOARead( processExecutionContext.getProcessInstance(), userIds,"批量推送"); countDownLatch.countDown(); } catch (DocumentException e) { e.printStackTrace(); @@ -961,26 +978,69 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute * @param results * @throws DocumentException */ - public void SendOARead(JSONObject jsonObject, ProcessInstance processInstance, String userIds,String type) + public void SendOARead( ProcessInstance processInstance, String userIds,String type) throws DocumentException { + String processInstId = processInstance.getId(); // System.err.println(processInstance.getTitle() + "开始发送:" + userId); /* * if ("".equals(userId) || UtilString.isEmpty(userId)) { return; } */ + + + BO bo_act_coe_publish1 = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH", true) + .addQuery("BINDID=", processInstance.getId()) + .addQuery("OPTIONTYPE IS NOT NULL", null).detail(); + + String sql = "SELECT ID FROM WFH_TASK WHERE PROCESSINSTID = '" + processInstance.getId() + + "' AND ACTIVITYDEFID = 'obj_c9e5a3144b200001b68cffa01ed0153e' "; + String taskInd = DBSql.getString(sql); + + TaskInstance ta = SDK.getTaskAPI().getInstanceById(taskInd); + String portalUrl = SDK.getPortalAPI().getPortalUrl(); + + String url = portalUrl + "/r/or?cmd=com.yili_process_page&oauthName=oauthLogin&processInstId=" + + processInstance.getId() + "&taskInstId=" + + taskInd; + String mobileurl = "https://bpm.yili.com:8088/portal" + + "/r/or?cmd=com.yili_process_page_phone&corpid=wwb0ae23173b140618&appAgentId=0014&oauthName=wechat&processInstId=" + + processInstance.getId() + "&taskInstId=" + + taskInd; + + + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + //Timestamp endTime = processExecutionContext.getTaskInstance().getBeginTime(); + Timestamp endTime = new Timestamp(System.currentTimeMillis()); + + JSONObject jsonObjects = new JSONObject(new LinkedHashMap()); + jsonObjects.put("action", "read"); + jsonObjects.put("title", " " + "" + bo_act_coe_publish1.getString("PROCESS_TITLE") + ""); + jsonObjects.put("dept", SDK.getORGAPI() + .getDepartmentByUser(ta.getTarget()).getNo());// SDK.getORGAPI().getDepartmentByUser(processExecutionContext.getProcessInstance().getCreateUser()).getNo() + String target = ta.getTarget(); + + jsonObjects.put("user", target); + // jsonObject.put("user",);//processExecutionContext.getProcessInstance().getCreateUser() + jsonObjects.put("date", sdf.format(endTime)); + jsonObjects.put("remark", bo_act_coe_publish1.getString("PROCESS_TITLE")); + jsonObjects.put("status", "0"); + jsonObjects.put("dataid", processInstance.getId()); + jsonObjects.put("pcurl", url); + jsonObjects.put("mobileurl", mobileurl); + String[] resrt = userIds.split(","); long start_time = System.currentTimeMillis(); System.out.println("待阅推送开始时间>>>>>>>>>>>>"+start_time); BO bo_OA_read = new BO(); bo_OA_read.set("FIR_NUMS",resrt.length); bo_OA_read.set("START_TIME",start_time); - jsonObject.put("userList", userIds); + jsonObjects.put("userList", userIds); String xmlStr = "\n" + " " + " " + " " + " " - + "" + " " + " " + + "" + " " + " " + " " + ""; // System.out.println("xmlStr>>>>>>>>" + xmlStr); String readurl = SDK.getAppAPI().getProperty("com.awspaas.user.apps.yili.integration", "readurl");