单人发送制度文件
This commit is contained in:
parent
6da81a90b7
commit
172d2220d2
@ -2,7 +2,6 @@ package com.actionsoft.apps.coe.pal.datamigration;
|
||||
|
||||
import com.actionsoft.apps.coe.pal.datamigration.Utils.UtilUrl;
|
||||
import com.actionsoft.bpms.bo.engine.BO;
|
||||
import com.actionsoft.bpms.bpmn.engine.core.delegate.ProcessExecutionContext;
|
||||
import com.actionsoft.bpms.bpmn.engine.model.run.delegate.ProcessInstance;
|
||||
import com.actionsoft.bpms.bpmn.engine.model.run.delegate.TaskInstance;
|
||||
import com.actionsoft.bpms.commons.database.RowMap;
|
||||
@ -26,13 +25,16 @@ import org.quartz.JobExecutionException;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
public class ijob implements IJob {
|
||||
|
||||
private int sendTotal;
|
||||
|
||||
private int sucount = 1;
|
||||
|
||||
@Override
|
||||
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
|
||||
|
||||
@ -40,7 +42,7 @@ public class ijob implements IJob {
|
||||
System.err.println("推送OA待阅执行开始====>");
|
||||
long startTime = System.currentTimeMillis();
|
||||
ArrayList<String> sendList = new ArrayList<String>();
|
||||
String new_uid = "";
|
||||
|
||||
ProcessInstance pc = SDK.getProcessAPI().getInstanceById(cc);
|
||||
BO bo_act_coe_publish1 = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH", true)
|
||||
.addQuery("BINDID=", pc.getId())
|
||||
@ -118,70 +120,29 @@ public class ijob implements IJob {
|
||||
*//*}*//*
|
||||
}*/
|
||||
|
||||
ArrayList<String> list = new ArrayList<>();
|
||||
|
||||
for (String user_id:sendList){
|
||||
|
||||
BO bo_eu_require_data = SDK.getBOAPI().query("BO_EU_HAS_BEEN_SEND", true).addQuery("PROCESS_ID = ", cc).addQuery("USER_ID=",user_id).detail();
|
||||
if (bo_eu_require_data!=null){
|
||||
|
||||
List<String> list = new LinkedList<>();
|
||||
for (String user_id:
|
||||
sendList) {
|
||||
System.out.println("user_id================"+user_id);
|
||||
List<BO> bo_eu_require_data = SDK.getBOAPI().query("BO_ACT_DATAID", true).addQuery("PROCESSID=", cc).addQuery("USER_ID=",user_id).list();
|
||||
System.out.println("bbbbbbbbbbbbbbbbb"+bo_eu_require_data);
|
||||
if (bo_eu_require_data==null||bo_eu_require_data.size()==0){
|
||||
List<RowMap> maps = DBSql.getMaps("select * from BO_ACT_ALREADY_DATAID where PROCESSID= '" + cc + "' AND USER_ID='" + user_id + "'");
|
||||
System.out.println("已读列表是否为空>>>>>>>>>>>"+maps);
|
||||
if (maps==null||maps.size()==0){
|
||||
list.add(user_id);
|
||||
}else {
|
||||
continue;
|
||||
}
|
||||
}else {
|
||||
list.add(user_id);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
new_uid = new_uid.join(",", list);
|
||||
long startTimes = System.currentTimeMillis();
|
||||
String[] users = new_uid.split(",");
|
||||
System.out.println("new_uid>>>>>>>>>>>>>>"+users.length);
|
||||
int length = 100;
|
||||
int ys = users.length%length;
|
||||
/**
|
||||
* 这个是以300人作为一个发送单位去放到list中并发送待阅数据
|
||||
*/
|
||||
if (ys==0) {
|
||||
int size = users.length/length;
|
||||
int flag = 0;
|
||||
|
||||
List<String[]> lists = new LinkedList();
|
||||
|
||||
for (int i=0;i<size;i++){
|
||||
String[] results;
|
||||
results = Arrays.copyOfRange(users, flag, flag+100);
|
||||
lists.add(results);
|
||||
flag = flag+100;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建线程发送待阅数据
|
||||
*/
|
||||
course(lists,startTime,jsonObject,pc,list);
|
||||
//System.out.println("发送人员数据>>>>>>>>>>>>>>"+list);
|
||||
}else {
|
||||
int size = users.length/length;
|
||||
int flag = 0;
|
||||
List<String[]> lists = new LinkedList();
|
||||
for (int i=0;i<size;i++){
|
||||
String[] results;
|
||||
results = Arrays.copyOfRange(users, flag, flag+100);
|
||||
lists.add(results);
|
||||
flag = flag+100;
|
||||
}
|
||||
String[] redata;
|
||||
redata = Arrays.copyOfRange(users, flag, flag+ys);
|
||||
lists.add(redata);
|
||||
// 创建线程来实现为每300人为一个的线程跑待阅
|
||||
/**
|
||||
* 创建线程发送待阅数据
|
||||
*/
|
||||
course(lists,startTime,jsonObject,pc,list);
|
||||
//System.out.println("发送人员数据>>>>>>>>>>>>>>"+list);
|
||||
}
|
||||
|
||||
|
||||
/*System.out.println("新list>>>>>>"+list.size());
|
||||
for (String user : lists) {
|
||||
System.out.println("新list>>>>>>"+list.size());
|
||||
System.out.println("剩余需要发送的人员清单>>>>>>>>>>>"+list.toString());
|
||||
for (String user : list) {
|
||||
try {
|
||||
SendOARead(jsonObject, pc, user, "批量推送");
|
||||
} catch (Exception e) { // TODO: handle exception
|
||||
@ -192,189 +153,9 @@ public class ijob implements IJob {
|
||||
|
||||
long endTimes = System.currentTimeMillis();
|
||||
// 存入日志
|
||||
createReadLog(pc, jsonObject, sendList, startTime, endTimes);
|
||||
// createReadLog(pc, jsonObject, sendList, startTime, endTimes);
|
||||
System.err.println(pc.getTitle() + "推送OA待阅执行完毕====>" + "用时:"
|
||||
+ (endTimes - startTime) / 1000 / 60 + "分钟");*/
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void course(List<String[]> list, long startTime, JSONObject jsonObject, ProcessInstance processInstance,ArrayList<String> sendList){
|
||||
// 创建线程来实现为每100人为一个的线程跑待阅
|
||||
ExecutorService service = Executors.newFixedThreadPool(5);
|
||||
int m = 0;
|
||||
for (String[] resrt:list
|
||||
) {
|
||||
int finalM = m;
|
||||
service.execute(new Runnable() {
|
||||
@Override
|
||||
|
||||
public void run() {
|
||||
System.out.println("最后一个数组是什么>>>>>>>"+Arrays.asList(resrt).size());
|
||||
try {
|
||||
SendOARead(jsonObject, processInstance, resrt,"批量推送");
|
||||
} catch (DocumentException e) {
|
||||
e.printStackTrace();
|
||||
}finally {
|
||||
if (finalM == list.size()-1){
|
||||
List<RowMap> List = DBSql.getMaps("SELECT NAME FROM BO_EU_READ_COUNT WHERE PROCESSID = '"
|
||||
+ processInstance.getId() + "' AND RESULT = '待处理'");
|
||||
if (List.size() != 0) {
|
||||
System.err.println(processInstance.getTitle() + "批量推送失败后执行二次推送=======>" + List.size());
|
||||
for (RowMap rowMap : List) {
|
||||
try {
|
||||
ArrayList<String> secondUserList = new ArrayList<String>();
|
||||
secondUserList.add(rowMap.getString("NAME"));
|
||||
System.err.println(processInstance.getTitle() + "二次推送账号=======>" + secondUserList);
|
||||
|
||||
BO executiveTaskBO=SDK.getBOAPI().query("BO_ACT_EXECUTIVE_TASK").addQuery("TASKID=",processInstance.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", processInstance.getTitle());
|
||||
bo.set("NAME", oneuserId.getString("NAME"));
|
||||
bo.set("TYPE", "批量推送");
|
||||
bo.set("RESULT", "待处理");
|
||||
bo.set("PROCESSID", processInstance.getId());
|
||||
bo.set("DEPNAME", SDK.getORGAPI().getUser(oneuserId.getString("NAME")).getDepartmentId());
|
||||
recordFailLists.add(bo);
|
||||
}
|
||||
SDK.getBOAPI().create("BO_EU_READ_COUNT", recordFailLists, processInstance.getId(), processInstance.getCreateUser());
|
||||
return;
|
||||
}
|
||||
|
||||
secondSendOARead(jsonObject, processInstance, secondUserList, "单个账号推送");
|
||||
} catch (Exception e) { // TODO: handle exception
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
long endTimes = System.currentTimeMillis();
|
||||
// 存入日志
|
||||
createReadLog(processInstance, jsonObject, sendList, startTime, endTimes);
|
||||
System.err.println(processInstance.getTitle() + "推送OA待阅执行完毕====>" + "用时:"
|
||||
+ (endTimes - startTime) / 1000 / 60 + "分钟");
|
||||
|
||||
|
||||
|
||||
//发送消息通知
|
||||
List<BO> readCountBO=SDK.getBOAPI().query("BO_EU_READ_COUNT").addQuery("PROCESSID=",processInstance.getId()).list();
|
||||
if(readCountBO.size()>0){
|
||||
SDK.getNotificationAPI().sendMessage("admin", "admin", "文件名称:"+processInstance.getTitle()+"文件有失败记录,请及时处理!!!");
|
||||
}
|
||||
|
||||
//更新任务状态
|
||||
int r1 = DBSql.update("UPDATE BO_ACT_EXECUTIVE_TASK SET ISTASKEND='2' WHERE TASKID ='" + processInstance.getId() + "'");
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
m++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void secondSendOARead(JSONObject jsonObject, ProcessInstance processInstance, List<String> idList,String type)
|
||||
throws DocumentException {
|
||||
|
||||
|
||||
System.out.println("idList========="+idList.toString());
|
||||
String processInstId = processInstance.getId();
|
||||
// System.err.println(processInstance.getTitle() + "开始发送:" + userId);
|
||||
|
||||
/*
|
||||
* if ("".equals(userId) || UtilString.isEmpty(userId)) { return; }
|
||||
*/
|
||||
if (idList.size() == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
String userIds = StringUtils.join(idList, ",");
|
||||
jsonObject.put("userList", userIds);
|
||||
String xmlStr = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:web=\"webservices.yili.weaver.com.cn\">\n"
|
||||
+ " <soapenv:Header/>" + " <soapenv:Body>" + " <web:service>" + " <web:in0>"
|
||||
+ "<![CDATA[" + jsonObject + "]]>" + " </web:in0>" + " </web:service>"
|
||||
+ " </soapenv:Body>" + "</soapenv:Envelope>";
|
||||
// System.out.println("xmlStr>>>>>>>>" + xmlStr);
|
||||
String readurl = SDK.getAppAPI().getProperty("com.awspaas.user.apps.yili.integration", "readurl");
|
||||
String postSoap = UtilUrl.doPostSoap(readurl, xmlStr, "");
|
||||
Document document = DocumentHelper.parseText(postSoap);
|
||||
Element rootElement = document.getRootElement();
|
||||
Element result = rootElement.element("Body").element("serviceResponse").element("out");
|
||||
String resultString = result.getData().toString();
|
||||
JSONObject jsonObject1 = JSON.parseObject(resultString);
|
||||
System.out.println("jsonObject1==============="+jsonObject1);
|
||||
String datas = jsonObject1.getString("data");
|
||||
System.out.println("data================="+datas);
|
||||
String status = jsonObject1.getString("status");
|
||||
System.out.println("推送》》》》》》》》》》》" + status);
|
||||
|
||||
|
||||
if ("true".equals(status)) {
|
||||
JSONArray resultArray = JSONObject.parseArray(datas);
|
||||
System.out.println(processInstance.getTitle() + "待阅推送成功:" + idList.size()+"人");
|
||||
//批量入库操作
|
||||
//加入时间戳
|
||||
if(resultArray.size()>0){
|
||||
List<BO> recordLists = new ArrayList<BO>();
|
||||
long startTime2 = System.currentTimeMillis();
|
||||
for (int j = 0; j < resultArray.size(); j++) {
|
||||
|
||||
JSONObject jsonObject2 = resultArray.getJSONObject(j);
|
||||
String user = jsonObject2.get("user").toString();
|
||||
String dataid = jsonObject2.get("dataid").toString();
|
||||
BO bo = new BO();
|
||||
bo.set("TITLE", processInstance.getTitle());
|
||||
bo.set("PROCESSID", processInstance.getId());
|
||||
bo.set("USER_ID", user);
|
||||
bo.set("USERDEP", SDK.getORGAPI().getUser(user).getDepartmentId());
|
||||
bo.set("DATAID", dataid);
|
||||
bo.set("RESULT", status);
|
||||
bo.set("SENDTYPE", "1");
|
||||
bo.set("READSTATE", "未读");
|
||||
bo.set("TYPE", type);
|
||||
recordLists.add(bo);
|
||||
|
||||
BO oa_real_time=SDK.getBOAPI().query("BO_ACT_OA_REAL_TIME").addQuery("PROCESSID=",processInstance.getId()).detail();
|
||||
|
||||
String sqly = "SELECT ID FROM BO_ACT_DATAID WHERE PROCESSID = '" + processInstId + "' AND SENDTYPE = '1'";
|
||||
List<RowMap> mapsy = DBSql.getMaps(sqly);
|
||||
|
||||
if(oa_real_time!=null){
|
||||
int r1 = DBSql.update("UPDATE BO_ACT_OA_REAL_TIME SET SENDNUMSJ='" + mapsy.size() + "'WHERE PROCESSID ='" + processInstance.getId() + "'");
|
||||
}else{
|
||||
//插入实时更新人数表
|
||||
BO realTimeBO=new BO();
|
||||
realTimeBO.set("USREID", user);
|
||||
realTimeBO.set("DEPID", SDK.getORGAPI().getUser(user).getDepartmentId());
|
||||
realTimeBO.set("BUNAME",SDK.getORGAPI().getUser(user).getExt4());
|
||||
realTimeBO.set("TITLE", processInstance.getTitle());
|
||||
realTimeBO.set("PROCESSID", processInstance.getId());
|
||||
realTimeBO.set("SENDNUMSJ", 1);
|
||||
realTimeBO.set("SENDNUM",sendTotal);
|
||||
SDK.getBOAPI().create("BO_ACT_OA_REAL_TIME", bo, processInstance.getId(), processInstance.getCreateUser());
|
||||
}
|
||||
|
||||
}
|
||||
SDK.getBOAPI().create("BO_ACT_DATAID",recordLists, processInstance.getId(), processInstance.getCreateUser());
|
||||
|
||||
long endTime2 = System.currentTimeMillis();
|
||||
System.err.println(processInstance.getTitle() + "二次批量插入OA待阅数据====>" + "用时:"
|
||||
+ (endTime2 - startTime2) / 1000 + "秒");
|
||||
}
|
||||
|
||||
if("单个账号推送".equals(type)) {
|
||||
DBSql.update("UPDATE BO_EU_READ_COUNT SET RESULT = '已重新推送' WHERE PROCESSID = '"+processInstId+"' AND NAME = '"+userIds+"'");
|
||||
}
|
||||
}
|
||||
+ (endTimes - startTime) / 1000 / 60 + "分钟");
|
||||
|
||||
}
|
||||
|
||||
@ -386,7 +167,7 @@ public class ijob implements IJob {
|
||||
* @param processInstance
|
||||
* @throws DocumentException
|
||||
*/
|
||||
/* public void SendOARead(JSONObject jsonObject, ProcessInstance processInstance, String userIds, String type)
|
||||
public void SendOARead(JSONObject jsonObject, ProcessInstance processInstance, String userIds, String type)
|
||||
throws DocumentException {
|
||||
|
||||
String processInstId = processInstance.getId();
|
||||
@ -439,7 +220,7 @@ public class ijob implements IJob {
|
||||
SDK.getBOAPI().create("BO_ACT_DATAID", bo, processInstance.getId(), processInstance.getCreateUser());
|
||||
|
||||
|
||||
*//*BO oa_real_time = SDK.getBOAPI().query("BO_ACT_OA_REAL_TIME").addQuery("PROCESSID=", processInstance.getId()).detail();
|
||||
/*BO oa_real_time = SDK.getBOAPI().query("BO_ACT_OA_REAL_TIME").addQuery("PROCESSID=", processInstance.getId()).detail();
|
||||
if (oa_real_time != null) {
|
||||
int r1 = DBSql.update("UPDATE BO_ACT_OA_REAL_TIME SET SENDNUMSJ='" + sucount + "'WHERE PROCESSID ='" + processInstId + "'");
|
||||
} else {
|
||||
@ -454,7 +235,7 @@ public class ijob implements IJob {
|
||||
|
||||
SDK.getBOAPI().create("BO_ACT_OA_REAL_TIME", bo, processInstance.getId(), processInstance.getCreateUser());
|
||||
}
|
||||
sucount++;*//*
|
||||
sucount++;*/
|
||||
|
||||
}
|
||||
if ("单个账号推送".equals(type)) {
|
||||
@ -489,168 +270,8 @@ public class ijob implements IJob {
|
||||
}
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 发送OA待阅数据
|
||||
*
|
||||
* @param jsonObject
|
||||
* @param processInstance
|
||||
* @param results
|
||||
* @throws DocumentException
|
||||
*/
|
||||
public void SendOARead(JSONObject jsonObject, ProcessInstance processInstance, String[] resrt,String type)
|
||||
throws DocumentException {
|
||||
|
||||
String userIds = "";
|
||||
userIds = StringUtils.join(resrt, ",");
|
||||
|
||||
String processInstId = processInstance.getId();
|
||||
// System.err.println(processInstance.getTitle() + "开始发送:" + userId);
|
||||
|
||||
/*
|
||||
* if ("".equals(userId) || UtilString.isEmpty(userId)) { return; }
|
||||
*/
|
||||
if (resrt.length == 0) {
|
||||
return;
|
||||
}
|
||||
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);
|
||||
String xmlStr = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:web=\"webservices.yili.weaver.com.cn\">\n"
|
||||
+ " <soapenv:Header/>" + " <soapenv:Body>" + " <web:service>" + " <web:in0>"
|
||||
+ "<![CDATA[" + jsonObject + "]]>" + " </web:in0>" + " </web:service>"
|
||||
+ " </soapenv:Body>" + "</soapenv:Envelope>";
|
||||
// System.out.println("xmlStr>>>>>>>>" + xmlStr);
|
||||
String readurl = SDK.getAppAPI().getProperty("com.awspaas.user.apps.yili.integration", "readurl");
|
||||
String postSoap = UtilUrl.doPostSoap(readurl, xmlStr, "");
|
||||
Document document = DocumentHelper.parseText(postSoap);
|
||||
Element rootElement = document.getRootElement();
|
||||
Element result = rootElement.element("Body").element("serviceResponse").element("out");
|
||||
String resultString = result.getData().toString();
|
||||
JSONObject jsonObject1 = JSON.parseObject(resultString);
|
||||
System.out.println("jsonObject1==============="+jsonObject1);
|
||||
String datas = jsonObject1.getString("data");
|
||||
long have_time = System.currentTimeMillis();
|
||||
System.out.println("接收到返回的待阅ID时间>>>>>>>>>>>>>>>>"+have_time);
|
||||
bo_OA_read.set("HAVE_TIME",have_time);
|
||||
System.out.println("接收到返回的待阅耗时时间>>>>>>>>>>>>"+(have_time-start_time));
|
||||
bo_OA_read.set("SUM_TIME",(have_time-start_time));
|
||||
System.out.println("data================="+datas);
|
||||
String status = jsonObject1.getString("status");
|
||||
System.out.println("推送》》》》》》》》》》》" + status);
|
||||
|
||||
|
||||
if ("true".equals(status)) {
|
||||
JSONArray resultArray = JSONObject.parseArray(datas);
|
||||
//System.out.println(processInstance.getTitle() + "待阅推送成功:" + idList.size()+"人");
|
||||
//批量入库操作
|
||||
//加入时间戳
|
||||
long set_start_time = System.currentTimeMillis();
|
||||
bo_OA_read.set("SET_TIME",set_start_time);
|
||||
if(resultArray.size()>0){
|
||||
List<BO> recordLists = new ArrayList<BO>();
|
||||
long startTime2 = System.currentTimeMillis();
|
||||
for (int j = 0; j < resultArray.size(); j++) {
|
||||
|
||||
JSONObject jsonObject2 = resultArray.getJSONObject(j);
|
||||
String user = jsonObject2.get("user").toString();
|
||||
String dataid = jsonObject2.get("dataid").toString();
|
||||
BO bo = new BO();
|
||||
bo.set("TITLE", processInstance.getTitle());
|
||||
bo.set("PROCESSID", processInstance.getId());
|
||||
bo.set("USER_ID", user);
|
||||
//bo.set("USERDEP", SDK.getORGAPI().getUser(user).getDepartmentId());
|
||||
bo.set("DATAID", dataid);
|
||||
bo.set("RESULT", status);
|
||||
bo.set("SENDTYPE", "1");
|
||||
bo.set("READSTATE", "未读");
|
||||
bo.set("TYPE", type);
|
||||
recordLists.add(bo);
|
||||
|
||||
BO oa_real_time=SDK.getBOAPI().query("BO_ACT_OA_REAL_TIME").addQuery("PROCESSID=",processInstance.getId()).detail();
|
||||
|
||||
String sqly = "SELECT ID FROM BO_ACT_DATAID WHERE PROCESSID = '" + processInstId + "' AND SENDTYPE = '1'";
|
||||
List<RowMap> mapsy = DBSql.getMaps(sqly);
|
||||
|
||||
if(oa_real_time!=null){
|
||||
int r1 = DBSql.update("UPDATE BO_ACT_OA_REAL_TIME SET SENDNUMSJ='" + mapsy.size() + "'WHERE PROCESSID ='" + processInstance.getId() + "'");
|
||||
}else{
|
||||
//插入实时更新人数表
|
||||
BO realTimeBO=new BO();
|
||||
realTimeBO.set("USREID", user);
|
||||
realTimeBO.set("DEPID", SDK.getORGAPI().getUser(user).getDepartmentId());
|
||||
realTimeBO.set("BUNAME",SDK.getORGAPI().getUser(user).getExt4());
|
||||
realTimeBO.set("TITLE", processInstance.getTitle());
|
||||
realTimeBO.set("PROCESSID", processInstance.getId());
|
||||
realTimeBO.set("SENDNUMSJ", 1);
|
||||
realTimeBO.set("SENDNUM",sendTotal);
|
||||
SDK.getBOAPI().create("BO_ACT_OA_REAL_TIME", bo, processInstance, UserContext.fromUID(processInstance.getCreateUser()));
|
||||
}
|
||||
|
||||
}
|
||||
SDK.getBOAPI().create("BO_ACT_DATAID",recordLists, processInstance, UserContext.fromUID(processInstance.getCreateUser()));
|
||||
|
||||
long endTime2 = System.currentTimeMillis();
|
||||
System.err.println(processInstance.getTitle() + "批量插入OA待阅数据====>" + "用时:"
|
||||
+ (endTime2 - startTime2) / 1000 + "秒");
|
||||
}
|
||||
long set_end_time = System.currentTimeMillis();
|
||||
bo_OA_read.set("SET_END_TIME",set_end_time);
|
||||
bo_OA_read.set("SET_SUM_TIME",(set_end_time-set_start_time));
|
||||
bo_OA_read.set("PROCESS_ID",processInstance.getId());
|
||||
SDK.getBOAPI().create("BO_EU_OA_READ_LOG", bo_OA_read, processInstance, UserContext.fromUID(processInstance.getCreateUser()));
|
||||
if("单个账号推送".equals(type)) {
|
||||
DBSql.update("UPDATE BO_EU_READ_COUNT SET RESULT = '已重新推送' WHERE PROCESSID = '"+processInstId+"' AND NAME = '"+resrt+"'");
|
||||
}
|
||||
} else {
|
||||
List<String> idList = Arrays.asList(resrt);
|
||||
BO bo = null;
|
||||
List<BO> recordFailLists = new ArrayList<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, UserContext.fromUID(processInstance.getCreateUser()));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public ArrayList<String> getSendList(ProcessInstance instanceById, BO bo_act_coe_publish1, JSONObject jsonObject) {
|
||||
String sendType = bo_act_coe_publish1.getString("SEND_SCOP");
|
||||
String org = bo_act_coe_publish1.getString("SEND_SCOPE_ORG");
|
||||
|
||||
Loading…
Reference in New Issue
Block a user