流程发布结束时,同步文件状态标识

This commit is contained in:
lihongyu 2022-12-15 09:18:13 +08:00
parent 000b1ab5ac
commit f4a12e158e
2 changed files with 52 additions and 48 deletions

View File

@ -211,7 +211,41 @@ public class ProcessEndAfterEvent extends ExecuteListener implements ExecuteList
// TODO: handle exception
}
}
/**
* 同步PAL文件表文件版本标识用于部门视图
*/
if(bo_act_coe_publish_n.size()>0) {
for (BO bo : bo_act_coe_publish_n) {
try {
String fileId = bo.getString("PUBLISHFILEID");
DBSql.update("UPDATE APP_ACT_COE_PAL_REPOSITORY SET EXT5 = '1' WHERE ID = '"+fileId+"'");
} catch (Exception e) {
}
}
}
if(bo_act_coe_publish_c.size()>0) {
for (BO bo : bo_act_coe_publish_c) {
try {
String changefileId = bo.getString("CHANGEFILEID");
String changefileIdNew = bo.getString("CHANGEDFILEIDNEW");
DBSql.update("UPDATE APP_ACT_COE_PAL_REPOSITORY SET EXT5 = '0' WHERE ID = '"+changefileId+"'");
DBSql.update("UPDATE APP_ACT_COE_PAL_REPOSITORY SET EXT5 = '1' WHERE ID = '"+changefileIdNew+"'");
} catch (Exception e) {
}
}
}
if(bo_act_coe_publish_s.size()>0) {
for (BO bo : bo_act_coe_publish_s) {
try {
String fileId = bo.getString("STOPFILEID");
DBSql.update("UPDATE APP_ACT_COE_PAL_REPOSITORY SET EXT5 = '0' WHERE ID = '"+fileId+"'");
} catch (Exception e) {
}
}
}
/**
* 推送待阅文件到OA
*/
@ -268,37 +302,12 @@ public class ProcessEndAfterEvent extends ExecuteListener implements ExecuteList
long countTime = System.currentTimeMillis();
System.err.println(instanceById.getTitle() + "待发送人员数量====>" + sendList.size() + " 计算用时===>"
+ (countTime - startTime) + "毫秒");
int toIndex = 300;
int listSize = sendList.size();
boolean shutdown = false;
for (int i = 0; i < sendList.size(); i += 300) {
if (i + 300 > listSize) {
toIndex = listSize - i;
}
List<String> idList = sendList.subList(i, i + toIndex);
for (String user : sendList) {
try {
SendOARead(jsonObject, instanceById, idList, "批量推送");
} catch (Exception e) {
// TODO: handle exception
SendOARead(jsonObject, instanceById, user, "批量推送");
} catch (Exception e) { // TODO: handle exception
}
/*
* ExecutorService cachedThreadPool = Executors.newFixedThreadPool(3); // 开启一个线程
* cachedThreadPool.execute(new Runnable() {
*
* @Override public void run() { try { } catch (DocumentException e) { // TODO
* Auto-generated catch block e.printStackTrace(); }
*
* } });
*/
// 以下是等线程池的全部线程执行结束后会自动执行
/*
* cachedThreadPool.shutdown(); while (true) { if
* (cachedThreadPool.isTerminated()) { long time = System.currentTimeMillis() -
* startTime; //System.out.println("程序结束了,总耗时:" + time + " ms(毫秒)\n"+toIndex);
* break; } }
*/
}
// 二次推送
@ -310,9 +319,9 @@ public class ProcessEndAfterEvent extends ExecuteListener implements ExecuteList
for (RowMap rowMap : List) {
try {
ArrayList<String> userList3 = new ArrayList<String>();
userList3.add(rowMap.getString("NAME"));
String userIds = rowMap.getString("NAME");
System.err.println(instanceById.getTitle() + "二次推送账号=======>" + userList3);
SendOARead(jsonObject, instanceById, userList3, "单个账号推送");
SendOARead(jsonObject, instanceById, userIds, "单个账号推送");
} catch (Exception e) { // TODO: handle exception
}
}
@ -697,19 +706,15 @@ public class ProcessEndAfterEvent extends ExecuteListener implements ExecuteList
* @param results
* @throws DocumentException
*/
public void SendOARead(JSONObject jsonObject, ProcessInstance processInstance, List<String> idList,String type)
public void SendOARead(JSONObject jsonObject, 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; }
*/
if (idList.size() == 0) {
return;
}
String userIds = StringUtils.join(idList, ",");
if ("".equals(userIds) || UtilString.isEmpty(userIds)) { return; }
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>"
@ -728,21 +733,20 @@ public class ProcessEndAfterEvent extends ExecuteListener implements ExecuteList
String status = jsonObject1.getString("status");
// System.out.println("推送》》》》》》》》》》》" + status);
if ("false".equals(status)) {
for (String userId : idList) {
System.out.println(processInstance.getTitle() + "待阅推送失败:" + userId);
System.out.println(processInstance.getTitle() + "待阅推送失败:" + userIds);
try {
BO bo = new BO();
bo.set("TITLE", processInstance.getTitle());
bo.set("NAME", userId);
bo.set("NAME", userIds);
bo.set("TYPE", type);
bo.set("RESULT", "待处理");
bo.set("PROCESSID", processInstId);
bo.set("DEPNAME", SDK.getORGAPI().getUser(userId).getDepartmentId());
bo.set("DEPNAME", SDK.getORGAPI().getUser(userIds).getDepartmentId());
SDK.getBOAPI().create("BO_EU_READ_COUNT", bo, processInstance.getId(), processInstance.getCreateUser());
} catch (Exception e) {
// TODO: handle exception
}
}
} else {
JSONArray resultArray = JSONObject.parseArray(datas);
//System.out.println(processInstance.getTitle() + "待阅推送成功:" + idList.size()+"");

View File

@ -13,7 +13,7 @@ import java.nio.charset.Charset;
/**
* @PackageName: com.awspaas.user.apps.yili.integration.util
* @ClassName: UtilUrl
* @author: yujh
* @author: lihongyu
* @date: 2022/5/18 21:41
*/
public class UtilUrl {
@ -27,8 +27,8 @@ public class UtilUrl {
CloseableHttpClient closeableHttpClient = httpClientBuilder.build();
HttpPost httpPost = new HttpPost(postUrl);
// 设置请求和传输超时时间
RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(600000)
.setConnectTimeout(600000).build();
RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(900000)
.setConnectTimeout(900000).build();
httpPost.setConfig(requestConfig);
try {
httpPost.setHeader("Content-Type", "text/xml;charset=UTF-8");