流程发布 多线程推送待阅
发布表单文件附件排序
This commit is contained in:
parent
a98158e9b4
commit
2c4056a284
@ -1739,7 +1739,7 @@ public class ProcessPublishWeb extends ActionWeb {
|
||||
JSONArray js = new JSONArray();
|
||||
UpFileDao upFileDao = new UpFileDao();
|
||||
StringBuilder sqlWhere = new StringBuilder();
|
||||
sqlWhere.append(" and PALREPOSITORYID ='").append(publishId).append("'");
|
||||
sqlWhere.append(" and PALREPOSITORYID ='").append(publishId).append("'").append(" ORDER BY CREATETIME ASC");
|
||||
List<UpfileModel> fileList = upFileDao.search(sqlWhere.toString());
|
||||
if (fileList != null && fileList.size() > 0)
|
||||
for (UpfileModel upfileModel : fileList)
|
||||
@ -1811,12 +1811,12 @@ public class ProcessPublishWeb extends ActionWeb {
|
||||
if (shapeList != null && shapeList.size() > 0)
|
||||
for (Map<String, Object> map : shapeList)
|
||||
shapeIds.add((String) map.get("id"));
|
||||
/******************** 附件 ************************/
|
||||
/******************** 附件 **********************/
|
||||
// 文件或节点自身附件
|
||||
JSONArray js = new JSONArray();
|
||||
UpFileDao upFileDao = new UpFileDao();
|
||||
StringBuilder sqlWhere = new StringBuilder();
|
||||
sqlWhere.append(" and PALREPOSITORYID ='").append(changeId).append("'");
|
||||
sqlWhere.append(" and PALREPOSITORYID ='").append(changeId).append("'").append(" ORDER BY CREATETIME ASC");;
|
||||
List<UpfileModel> fileList = upFileDao.search(sqlWhere.toString());
|
||||
if (fileList != null && fileList.size() > 0)
|
||||
for (UpfileModel upfileModel : fileList)
|
||||
@ -1931,7 +1931,7 @@ public class ProcessPublishWeb extends ActionWeb {
|
||||
JSONArray js = new JSONArray();
|
||||
UpFileDao upFileDao = new UpFileDao();
|
||||
StringBuilder sqlWhere = new StringBuilder();
|
||||
sqlWhere.append(" and PALREPOSITORYID ='").append(publishId).append("'");
|
||||
sqlWhere.append(" and PALREPOSITORYID ='").append(publishId).append("'").append(" ORDER BY CREATETIME ASC");;
|
||||
List<UpfileModel> fileList = upFileDao.search(sqlWhere.toString());
|
||||
if (fileList != null && fileList.size() > 0)
|
||||
for (UpfileModel upfileModel : fileList)
|
||||
@ -2009,7 +2009,7 @@ public class ProcessPublishWeb extends ActionWeb {
|
||||
JSONArray js = new JSONArray();
|
||||
UpFileDao upFileDao = new UpFileDao();
|
||||
StringBuilder sqlWhere = new StringBuilder();
|
||||
sqlWhere.append(" and PALREPOSITORYID ='").append(changeId).append("'");
|
||||
sqlWhere.append(" and PALREPOSITORYID ='").append(changeId).append("'").append(" ORDER BY CREATETIME ASC");;
|
||||
List<UpfileModel> fileList = upFileDao.search(sqlWhere.toString());
|
||||
if (fileList != null && fileList.size() > 0)
|
||||
for (UpfileModel upfileModel : fileList)
|
||||
@ -2962,7 +2962,7 @@ public class ProcessPublishWeb extends ActionWeb {
|
||||
JSONArray js = new JSONArray();
|
||||
UpFileDao upFileDao = new UpFileDao();
|
||||
StringBuilder sqlWhere = new StringBuilder();
|
||||
sqlWhere.append(" and PALREPOSITORYID ='").append(publishId).append("'");
|
||||
sqlWhere.append(" and PALREPOSITORYID ='").append(publishId).append("'").append(" ORDER BY CREATETIME ASC");
|
||||
List<UpfileModel> fileList = upFileDao.search(sqlWhere.toString());
|
||||
if (fileList != null && fileList.size() > 0)
|
||||
for (UpfileModel upfileModel : fileList)
|
||||
@ -3067,7 +3067,7 @@ public class ProcessPublishWeb extends ActionWeb {
|
||||
JSONArray js = new JSONArray();
|
||||
UpFileDao upFileDao = new UpFileDao();
|
||||
StringBuilder sqlWhere = new StringBuilder();
|
||||
sqlWhere.append(" and PALREPOSITORYID ='").append(changeId).append("'");
|
||||
sqlWhere.append(" and PALREPOSITORYID ='").append(changeId).append("'").append(" ORDER BY CREATETIME ASC");
|
||||
List<UpfileModel> fileList = upFileDao.search(sqlWhere.toString());
|
||||
if (fileList != null && fileList.size() > 0)
|
||||
for (UpfileModel upfileModel : fileList)
|
||||
|
||||
@ -103,7 +103,7 @@ public class ProcessEndAfterEvent extends ExecuteListener implements ExecuteList
|
||||
String wsId = "";
|
||||
JSONArray filed = new JSONArray(new LinkedList<>());
|
||||
String portalUrl = SDK.getPortalAPI().getPortalUrl();
|
||||
//System.out.println("portal======>>>>" + portalUrl);
|
||||
// System.out.println("portal======>>>>" + portalUrl);
|
||||
/*
|
||||
* if (portalUrl.equals("http://10.114.11.135:8088/portal")){ portalUrl =
|
||||
* "http://bpm.yili.com:8088/portal/"; }
|
||||
@ -229,8 +229,54 @@ public class ProcessEndAfterEvent extends ExecuteListener implements ExecuteList
|
||||
if (bo_act_coe_publish1 != null && instanceById != null) {
|
||||
System.err.println(instanceById.getTitle() + "推送OA待阅执行开始====>");
|
||||
long startTime = System.currentTimeMillis();
|
||||
ArrayList<String> sendList = getSendList(instanceById, bo_act_coe_publish1, jsonObject);
|
||||
System.err.println(instanceById.getTitle() + "待发送人员数量====>" + sendList.size());
|
||||
ArrayList<String> sendList = new ArrayList<String>();
|
||||
// 发送全集团
|
||||
if ("1".equals(bo_act_coe_publish1.getString("SEND_SCOP"))) {
|
||||
// 系统人员
|
||||
ArrayList<String> userList1 = new ArrayList<String>();
|
||||
try {
|
||||
userList1 = getUser(jsonObject, "5bc3a2dc-3bd2-4376-bcc3-5612e28e55fe", "0",
|
||||
instanceById.getId());
|
||||
} catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
}
|
||||
System.err.println("系统人员=====>" + userList1);
|
||||
// 项目开发人员
|
||||
ArrayList<String> userList2 = new ArrayList<String>();
|
||||
try {
|
||||
userList2 = getUser(jsonObject, "e79281b1-2f81-4895-b30e-9f96e9ad0e2c", "0",
|
||||
instanceById.getId());
|
||||
} catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
}
|
||||
System.err.println("项目开发人员=====>" + userList2);
|
||||
// 离退人员
|
||||
ArrayList<String> userList3 = new ArrayList<String>();
|
||||
try {
|
||||
userList3 = getUser(jsonObject, "65048aee-157f-49f2-a2dc-5903dd26f519", "0",
|
||||
instanceById.getId());
|
||||
} catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
}
|
||||
System.err.println("离退人员=====>" + userList3);
|
||||
List<RowMap> maps = DBSql.getMaps("SELECT * FROM ORGUSER WHERE CLOSED = '0'");
|
||||
for (RowMap rowMap : maps) {
|
||||
String userId = rowMap.getString("USERID");
|
||||
// RowMap map = DBSql.getMap("SELECT ID FROM BO_ACT_DATAID WHERE PROCESSID = '"
|
||||
// + instanceById.getId() + "' AND USER_ID = '" + userId + "'");
|
||||
if (!"10033643".equals(userId) && !userList1.contains(userId)
|
||||
&& !userList2.contains(userId) && !userList3.contains(userId)) {
|
||||
sendList.add(userId);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// 发送组织岗位职级
|
||||
sendList = getSendList(instanceById, bo_act_coe_publish1, jsonObject);
|
||||
|
||||
}
|
||||
long countTime = System.currentTimeMillis();
|
||||
System.err.println(instanceById.getTitle() + "待发送人员数量====>" + sendList.size() + " 计算用时===>"
|
||||
+ (countTime - startTime) + "毫秒");
|
||||
int toIndex = 300;
|
||||
int listSize = sendList.size();
|
||||
boolean shutdown = false;
|
||||
@ -239,31 +285,38 @@ public class ProcessEndAfterEvent extends ExecuteListener implements ExecuteList
|
||||
toIndex = listSize - i;
|
||||
}
|
||||
List<String> idList = sendList.subList(i, i + toIndex);
|
||||
SendOARead(jsonObject, instanceById, idList);
|
||||
/*
|
||||
* ExecutorService service = Executors.newFixedThreadPool(3);
|
||||
* service.execute(new Runnable() {
|
||||
*
|
||||
* @Override public void run() { try { } catch (Exception e) { // TODO
|
||||
* Auto-generated catch block e.printStackTrace(); } } });
|
||||
*/
|
||||
|
||||
|
||||
|
||||
try {
|
||||
// SendOARead(jsonObject, instanceById, idList);
|
||||
} catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
}
|
||||
|
||||
ExecutorService cachedThreadPool = Executors.newFixedThreadPool(3);
|
||||
// 开启一个线程
|
||||
cachedThreadPool.execute(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
SendOARead(jsonObject, instanceById, idList);
|
||||
} 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;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
/*
|
||||
* for (String uid : sendList) { try { SendOARead(jsonObject, instanceById,
|
||||
* uid);
|
||||
*
|
||||
* ExecutorService service = Executors.newFixedThreadPool(5);
|
||||
* service.execute(new Runnable() {
|
||||
*
|
||||
* @Override public void run() { try { } catch (Exception e) { // TODO
|
||||
* Auto-generated catch block e.printStackTrace(); } } });
|
||||
*
|
||||
*
|
||||
* } catch (Exception e) { } }
|
||||
*/
|
||||
|
||||
long endTimes = System.currentTimeMillis();
|
||||
// 存入日志
|
||||
createReadLog(processExecutionContext, jsonObject, sendList, startTime, endTimes);
|
||||
@ -676,7 +729,7 @@ public class ProcessEndAfterEvent extends ExecuteListener implements ExecuteList
|
||||
}
|
||||
} else {
|
||||
JSONArray resultArray = JSONObject.parseArray(datas);
|
||||
System.out.println(processInstance.getTitle() + "待阅推送成功:" + idList);
|
||||
System.out.println(processInstance.getTitle() + "待阅推送成功:" + idList.size()+"人");
|
||||
for (int j = 0; j < resultArray.size(); j++) {
|
||||
JSONObject jsonObject2 = resultArray.getJSONObject(j);
|
||||
String user = jsonObject2.get("user").toString();
|
||||
@ -942,9 +995,10 @@ public class ProcessEndAfterEvent extends ExecuteListener implements ExecuteList
|
||||
if (!userModel.isClosed()) {
|
||||
String uid = userModel.getUID();
|
||||
if (!arr.contains(uid)) {
|
||||
if(!"10033643".equals(uid)) {
|
||||
//arr_test.add(uid);
|
||||
if (!"10033643".equals(uid)) {
|
||||
// System.err.println("发送人员======>" + uid); }
|
||||
arr.add(uid);
|
||||
|
||||
}
|
||||
/*
|
||||
* RowMap map = DBSql.getMap("SELECT ID FROM BO_ACT_DATAID WHERE PROCESSID = '"
|
||||
@ -976,26 +1030,25 @@ public class ProcessEndAfterEvent extends ExecuteListener implements ExecuteList
|
||||
String uid = userModel.getUID();
|
||||
if (!arr.contains(uid)) {
|
||||
if (!"10033643".equals(uid)) {
|
||||
// arr_test.add(uid);
|
||||
// System.err.println("发送人员======>" + uid); }
|
||||
arr.add(uid);
|
||||
}
|
||||
// System.err.println(SDK.getProcessAPI().getInstanceById(processid) +
|
||||
// "_发送人员======>" + uid);
|
||||
|
||||
}
|
||||
|
||||
// System.err.println(SDK.getProcessAPI().getInstanceById(processid) +
|
||||
// "_发送人员======>" + uid);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
// 递归获取子部门下的子部门
|
||||
if (SDK.getORGAPI().isExistSubDepartment(id)) {
|
||||
getSubDepartments(jsonObject, arr_test, arr, SDK.getORGAPI().getDepartmentById(id), processid);
|
||||
// 递归获取子部门下的子部门
|
||||
if (SDK.getORGAPI().isExistSubDepartment(id)) {
|
||||
getSubDepartments(jsonObject, arr_test, arr, SDK.getORGAPI().getDepartmentById(id), processid);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 创建线程发送待阅
|
||||
*
|
||||
|
||||
Loading…
Reference in New Issue
Block a user