OA待阅提交

This commit is contained in:
zhal 2023-06-30 17:51:48 +08:00
parent 28ffdedb99
commit 030e6488ea

View File

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