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 0bcceb02..f980310e 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 @@ -383,28 +383,67 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute long countTime = System.currentTimeMillis(); System.err.println(instanceById.getTitle() + "待发送人员数量====>" + sendList.size() + " 计算用时===>" + (countTime - startTime) + "毫秒"); - sendTotal=sendList.size(); /* * for (String user : sendList) { try { SendOARead(jsonObject, instanceById, * user, "批量推送"); } catch (Exception e) { // TODO: handle exception } } */ - int toIndex = 300; + int toIndex = 200; int listSize = sendList.size(); boolean shutdown = false; - for (int i = 0; i < sendList.size(); i += 300) { + for (int i = 0; i < sendList.size(); i += 200) { long startTime1 = System.currentTimeMillis(); - if (i + 300 > listSize) { + if (i + 200 > listSize) { toIndex = listSize - i; } List idList = sendList.subList(i, i + toIndex); try { + + BO executiveTaskBO=SDK.getBOAPI().query("BO_ACT_EXECUTIVE_TASK").addQuery("TASKID=",processExecutionContext.getProcessInstance().getId()).addQuery("TASKSTATUS=",2).detail(); + if(executiveTaskBO!=null){ + List recordFailLists = new ArrayList(); + String userIds = StringUtils.join(idList, ","); + String[] userIdsArray=userIds.split(","); + for(String oneuserId:userIdsArray){ + BO bo = new BO(); + bo.set("TITLE", processExecutionContext.getProcessInstance().getTitle()); + bo.set("NAME", oneuserId); + bo.set("TYPE", "批量推送"); + bo.set("RESULT", "待处理"); + bo.set("PROCESSID", processExecutionContext.getProcessInstance().getId()); + bo.set("DEPNAME", SDK.getORGAPI().getUser(oneuserId).getDepartmentId()); + recordFailLists.add(bo); + //SDK.getBOAPI().create("BO_EU_READ_COUNT", bo, processExecutionContext.getProcessInstance().getId(), processExecutionContext.getProcessInstance().getCreateUser()); + } + SDK.getBOAPI().create("BO_EU_READ_COUNT", recordFailLists, processExecutionContext.getProcessInstance().getId(), processExecutionContext.getProcessInstance().getCreateUser()); + return; + } + + SendOARead(jsonObject, instanceById, idList, "批量推送"); } catch (Exception e) { System.out.println("OA待阅推送exception======"+e); + + if(idList.size()>0){ + List recordFailLists = new ArrayList(); + for (String userId : idList) { + BO bo= new BO(); + bo.set("TITLE", processExecutionContext.getProcessInstance().getTitle()); + bo.set("NAME", userId); + bo.set("TYPE", "批量推送"); + bo.set("RESULT", "待处理"); + bo.set("PROCESSID", processExecutionContext.getProcessInstance().getId()); + bo.set("DEPNAME", SDK.getORGAPI().getUser(userId).getDepartmentId()); + //SDK.getBOAPI().create("BO_EU_READ_COUNT", bo, processInstance.getId(), processInstance.getCreateUser()); + recordFailLists.add(bo); + } + System.out.println("OA待阅推送exception===============recordFailLists========="+recordFailLists.size()); + SDK.getBOAPI().create("BO_EU_READ_COUNT", recordFailLists, processExecutionContext.getProcessInstance().getId(), processExecutionContext.getProcessInstance().getCreateUser()); + } + // TODO: handle exception } long endTimes1 = System.currentTimeMillis(); @@ -459,6 +498,24 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute ArrayList secondUserList = new ArrayList(); secondUserList.add(rowMap.getString("NAME")); System.err.println(instanceById.getTitle() + "二次推送账号=======>" + secondUserList); + + BO executiveTaskBO=SDK.getBOAPI().query("BO_ACT_EXECUTIVE_TASK").addQuery("TASKID=",processExecutionContext.getProcessInstance().getId()).addQuery("TASKSTATUS=",2).detail(); + if(executiveTaskBO!=null){ + List recordFailLists = new ArrayList(); + for(RowMap oneuserId:List){ + BO bo = new BO(); + bo.set("TITLE", processExecutionContext.getProcessInstance().getTitle()); + bo.set("NAME", oneuserId.getString("NAME")); + bo.set("TYPE", "批量推送"); + bo.set("RESULT", "待处理"); + bo.set("PROCESSID", processExecutionContext.getProcessInstance().getId()); + bo.set("DEPNAME", SDK.getORGAPI().getUser(oneuserId.getString("NAME")).getDepartmentId()); + recordFailLists.add(bo); + } + SDK.getBOAPI().create("BO_EU_READ_COUNT", recordFailLists, processExecutionContext.getProcessInstance().getId(), processExecutionContext.getProcessInstance().getCreateUser()); + return; + } + secondSendOARead(jsonObject, instanceById, secondUserList, "单个账号推送"); } catch (Exception e) { // TODO: handle exception } @@ -834,22 +891,7 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute public void SendOARead(JSONObject jsonObject, ProcessInstance processInstance, List idList,String type) throws DocumentException { - /*BO executiveTaskBO=SDK.getBOAPI().query("BO_ACT_EXECUTIVE_TASK").addQuery("TASKID=",processInstance.getId()).addQuery("TASKSTATUS=",2).detail(); - if(executiveTaskBO!=null){ - String userIds = StringUtils.join(idList, ","); - String[] userIdsArray=userIds.split(","); - for(String oneuserId:userIdsArray){ - BO bo = new BO(); - bo.set("TITLE", processInstance.getTitle()); - bo.set("NAME", oneuserId); - bo.set("TYPE", "批量推送"); - bo.set("RESULT", "待处理"); - bo.set("PROCESSID", processInstance.getId()); - bo.set("DEPNAME", SDK.getORGAPI().getUser(oneuserId).getDepartmentId()); - SDK.getBOAPI().create("BO_EU_READ_COUNT", bo, processInstance.getId(), processInstance.getCreateUser()); - } - return; - }*/ + System.out.println("idList========="+idList.toString()); String processInstId = processInstance.getId(); @@ -942,32 +984,35 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute } else { BO bo = null; List recordFailLists = new ArrayList(); - for (String userId : idList) { - System.out.println(processInstance.getTitle() + "待阅推送失败:" + userId); - try { - bo= new BO(); - bo.set("TITLE", processInstance.getTitle()); - bo.set("NAME", userId); - bo.set("TYPE", type); - bo.set("RESULT", "待处理"); - bo.set("PROCESSID", processInstId); - bo.set("DEPNAME", SDK.getORGAPI().getUser(userId).getDepartmentId()); - //SDK.getBOAPI().create("BO_EU_READ_COUNT", bo, processInstance.getId(), processInstance.getCreateUser()); - recordFailLists.add(bo); - } catch (Exception e) { - bo= new BO(); - bo.set("TITLE", processInstance.getTitle()); - bo.set("NAME", userIds); - bo.set("TYPE", type); - bo.set("RESULT", "待处理"); - bo.set("PROCESSID", processInstId); - bo.set("DEPNAME", SDK.getORGAPI().getUser(userIds).getDepartmentId()); - //SDK.getBOAPI().create("BO_EU_READ_COUNT", bo, processInstance.getId(), processInstance.getCreateUser()); - recordFailLists.add(bo); + if(idList.size()>0){ + for (String userId : idList) { + System.out.println(processInstance.getTitle() + "待阅推送失败:" + userId); + try { + bo= new BO(); + bo.set("TITLE", processInstance.getTitle()); + bo.set("NAME", userId); + bo.set("TYPE", type); + bo.set("RESULT", "待处理"); + bo.set("PROCESSID", processInstId); + bo.set("DEPNAME", SDK.getORGAPI().getUser(userId).getDepartmentId()); + //SDK.getBOAPI().create("BO_EU_READ_COUNT", bo, processInstance.getId(), processInstance.getCreateUser()); + recordFailLists.add(bo); + } catch (Exception e) { + bo= new BO(); + bo.set("TITLE", processInstance.getTitle()); + bo.set("NAME", userIds); + bo.set("TYPE", type); + bo.set("RESULT", "待处理"); + bo.set("PROCESSID", processInstId); + bo.set("DEPNAME", SDK.getORGAPI().getUser(userIds).getDepartmentId()); + //SDK.getBOAPI().create("BO_EU_READ_COUNT", bo, processInstance.getId(), processInstance.getCreateUser()); + recordFailLists.add(bo); + } } + System.out.println("recordFailLists========="+recordFailLists.size()); + SDK.getBOAPI().create("BO_EU_READ_COUNT", recordFailLists, processInstance.getId(), processInstance.getCreateUser()); } - System.out.println("recordFailLists========="+recordFailLists.size()); - SDK.getBOAPI().create("BO_EU_READ_COUNT", recordFailLists, processInstance.getId(), processInstance.getCreateUser()); + @@ -990,22 +1035,6 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute public void secondSendOARead(JSONObject jsonObject, ProcessInstance processInstance, List idList,String type) throws DocumentException { - /*BO executiveTaskBO=SDK.getBOAPI().query("BO_ACT_EXECUTIVE_TASK").addQuery("TASKID=",processInstance.getId()).addQuery("TASKSTATUS=",2).detail(); - if(executiveTaskBO!=null){ - String userIds = StringUtils.join(idList, ","); - String[] userIdsArray=userIds.split(","); - for(String oneuserId:userIdsArray){ - BO bo = new BO(); - bo.set("TITLE", processInstance.getTitle()); - bo.set("NAME", oneuserId); - bo.set("TYPE", "批量推送"); - bo.set("RESULT", "待处理"); - bo.set("PROCESSID", processInstance.getId()); - bo.set("DEPNAME", SDK.getORGAPI().getUser(oneuserId).getDepartmentId()); - SDK.getBOAPI().create("BO_EU_READ_COUNT", bo, processInstance.getId(), processInstance.getCreateUser()); - } - return; - }*/ System.out.println("idList========="+idList.toString()); String processInstId = processInstance.getId(); @@ -1088,7 +1117,7 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute SDK.getBOAPI().create("BO_ACT_DATAID",recordLists, processInstance.getId(), processInstance.getCreateUser()); long endTime2 = System.currentTimeMillis(); - System.err.println(processInstance.getTitle() + "批量插入OA待阅数据====>" + "用时:" + System.err.println(processInstance.getTitle() + "二次批量插入OA待阅数据====>" + "用时:" + (endTime2 - startTime2) / 1000 + "秒"); } @@ -1464,7 +1493,7 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute String sqly = "SELECT ID FROM BO_ACT_DATAID WHERE PROCESSID = '" + processInstId + "' AND SENDTYPE = '1'"; List mapsy = DBSql.getMaps(sqly); String alsqly = "SELECT ID FROM BO_ACT_ALREADY_DATAID WHERE PROCESSID = '" + processInstId + "' AND SENDTYPE = '1'"; - List almapsy = DBSql.getMaps(sqly); + List almapsy = DBSql.getMaps(alsqly); bo_Read_log.set("SENDNUMSJ", mapsy.size()+almapsy.size()); BO bo_act_coe_publishs = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH", true).addQuery("BINDID=", processInstId) .addQuery("OPTIONTYPE IS NOT NULL", null).detail();