多线程批量发送制度待阅问题修改

This commit is contained in:
Mr-wang 2023-07-21 13:39:57 +08:00
parent 172d2220d2
commit 8057a06476

View File

@ -120,22 +120,29 @@ public class CopyJob implements IJob {
ArrayList<String> list = new ArrayList<>();
for (String user_id:sendList){
/* 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();
BO bo_eu_require_data = SDK.getBOAPI().query("BO_ACT_DATAID", true).addQuery("PROCESSID = ", cc).addQuery("USER_ID=",user_id).detail();
if (bo_eu_require_data!=null){
}else {
list.add(user_id);
BO bo_eu_Read = SDK.getBOAPI().query("BO_ACT_ALREADY_DATAID", true).addQuery("PROCESSID = ", cc).addQuery("USER_ID=",user_id).detail();
if (bo_eu_Read!=null){
}else {
list.add(user_id);
}
}
}
}*/
list.add("10036614");
list.add("10056870");
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 length = 1;
int ys = users.length%length;
/**
* 这个是以300人作为一个发送单位去放到list中并发送待阅数据
@ -148,9 +155,9 @@ public class CopyJob implements IJob {
for (int i=0;i<size;i++){
String[] results;
results = Arrays.copyOfRange(users, flag, flag+100);
results = Arrays.copyOfRange(users, flag, flag+1);
lists.add(results);
flag = flag+100;
flag = flag+1;
}
/**
@ -162,11 +169,12 @@ public class CopyJob implements IJob {
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);
results = Arrays.copyOfRange(users, flag, flag+1);
lists.add(results);
flag = flag+100;
flag = flag+1;
}
String[] redata;
redata = Arrays.copyOfRange(users, flag, flag+ys);
@ -212,8 +220,16 @@ public class CopyJob implements IJob {
public void run() {
System.out.println("最后一个数组是什么>>>>>>>"+Arrays.asList(resrt).size());
String userIds = "";
userIds = StringUtils.join(resrt, ",");
System.out.println("userIDs>>>>>>>>>>>>>>>"+userIds);
/*try {
SendOARead(jsonObject, processInstance, userIds,"批量推送");
} catch (DocumentException e) {
e.printStackTrace();
}*/
try {
SendOARead(jsonObject, processInstance, resrt,"批量推送");
SendOARead(jsonObject, processInstance, userIds,"批量推送");
} catch (DocumentException e) {
e.printStackTrace();
}finally {
@ -502,11 +518,9 @@ public class CopyJob implements IJob {
* @param results
* @throws DocumentException
*/
public void SendOARead(JSONObject jsonObject, ProcessInstance processInstance, String[] resrt,String type)
public void SendOARead(JSONObject jsonObject, ProcessInstance processInstance, String userIds,String type)
throws DocumentException {
String userIds = "";
userIds = StringUtils.join(resrt, ",");
String processInstId = processInstance.getId();
// System.err.println(processInstance.getTitle() + "开始发送:" + userId);
@ -514,12 +528,10 @@ public class CopyJob implements IJob {
/*
* 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();
String[] resrt = userIds.split(",");
bo_OA_read.set("FIR_NUMS",resrt.length);
bo_OA_read.set("START_TIME",start_time);
jsonObject.put("userList", userIds);
@ -529,6 +541,7 @@ public class CopyJob implements IJob {
+ " </soapenv:Body>" + "</soapenv:Envelope>";
// System.out.println("xmlStr>>>>>>>>" + xmlStr);
String readurl = SDK.getAppAPI().getProperty("com.awspaas.user.apps.yili.integration", "readurl");
SDK.getLogAPI().consoleInfo(xmlStr);
String postSoap = UtilUrl.doPostSoap(readurl, xmlStr, "");
Document document = DocumentHelper.parseText(postSoap);
Element rootElement = document.getRootElement();