OA待阅代码提交
This commit is contained in:
parent
7d1966d204
commit
8a11e03ca0
Binary file not shown.
@ -214,7 +214,7 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute
|
||||
ProcessInstance instanceById = processExecutionContext.getProcessInstance();
|
||||
if (bo_act_coe_publish1 != null && instanceById != null) {
|
||||
System.err.println(instanceById.getTitle() + "推送OA待阅执行开始====>");
|
||||
long startTime = System.currentTimeMillis();
|
||||
long sendUserstartTime = System.currentTimeMillis();
|
||||
ArrayList<String> sendList = new ArrayList<String>();
|
||||
// 发送全集团
|
||||
if ("1".equals(bo_act_coe_publish1.getString("SEND_SCOP"))) {
|
||||
@ -263,7 +263,7 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute
|
||||
|
||||
long countTime = System.currentTimeMillis();
|
||||
System.err.println(instanceById.getTitle() + "待发送人员数量====>" + sendList.size() + " 计算用时===>"
|
||||
+ (countTime - startTime) + "毫秒");
|
||||
+ (countTime - sendUserstartTime) + "毫秒");
|
||||
/*
|
||||
* for (String user : sendList) { try { SendOARead(jsonObject, instanceById,
|
||||
* user, "批量推送"); } catch (Exception e) { // TODO: handle exception } }
|
||||
@ -294,7 +294,10 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute
|
||||
SDK.getBOAPI().createDataBO("BO_EU__OA_MONITOR",bo,UserContext.fromUID(ta.getTarget()));
|
||||
}
|
||||
System.out.println("new_uid>>>>>>>>>>>>>>"+users.length);
|
||||
int length = 100;
|
||||
|
||||
long startTime = System.currentTimeMillis();
|
||||
|
||||
int length = 200;
|
||||
int ys = users.length%length;
|
||||
/**
|
||||
* 这个是以300人作为一个发送单位去放到list中并发送待阅数据
|
||||
@ -307,9 +310,9 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute
|
||||
|
||||
for (int i=0;i<size;i++){
|
||||
String[] results;
|
||||
results = Arrays.copyOfRange(users, flag, flag+100);
|
||||
results = Arrays.copyOfRange(users, flag, flag+200);
|
||||
list.add(results);
|
||||
flag = flag+100;
|
||||
flag = flag+200;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -323,9 +326,9 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute
|
||||
List<String[]> list = new LinkedList();
|
||||
for (int i=0;i<size;i++){
|
||||
String[] results;
|
||||
results = Arrays.copyOfRange(users, flag, flag+100);
|
||||
results = Arrays.copyOfRange(users, flag, flag+200);
|
||||
list.add(results);
|
||||
flag = flag+100;
|
||||
flag = flag+200;
|
||||
}
|
||||
String[] redata;
|
||||
redata = Arrays.copyOfRange(users, flag, flag+ys);
|
||||
@ -556,7 +559,7 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute
|
||||
// 创建线程来实现为每100人为一个的线程跑待阅
|
||||
ProcessInstance instanceById = processExecutionContext.getProcessInstance();
|
||||
CountDownLatch countDownLatch = new CountDownLatch(list.size());
|
||||
ExecutorService service = Executors.newFixedThreadPool(5);
|
||||
ExecutorService service = Executors.newFixedThreadPool(8);
|
||||
int m = 0;
|
||||
for (String[] resrt:list
|
||||
) {
|
||||
@ -612,7 +615,7 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute
|
||||
return;
|
||||
}
|
||||
|
||||
secondSendOARead(jsonObject, instanceById, secondUserList, "单个账号推送");
|
||||
secondSendOARead(processExecutionContext.getProcessInstance(), secondUserList, "单个账号推送");
|
||||
} catch (Exception e) { // TODO: handle exception
|
||||
}
|
||||
}
|
||||
@ -1010,7 +1013,6 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute
|
||||
+ processInstance.getId() + "&taskInstId="
|
||||
+ taskInd;
|
||||
|
||||
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
//Timestamp endTime = processExecutionContext.getTaskInstance().getBeginTime();
|
||||
Timestamp endTime = new Timestamp(System.currentTimeMillis());
|
||||
@ -1101,8 +1103,8 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute
|
||||
|
||||
BO oa_real_time=SDK.getBOAPI().query("BO_ACT_OA_REAL_TIME").addQuery("PROCESSID=",processInstance.getId()).detail();
|
||||
|
||||
String sqly = "SELECT COUNT(1) FROM BO_ACT_DATAID WHERE PROCESSID =? AND SENDTYPE = '1'";
|
||||
int mapsy = DBSql.getInt(sqly,processInstId);
|
||||
String sqly = "SELECT COUNT(1) FROM BO_ACT_DATAID WHERE PROCESSID=? AND SENDTYPE='1'";
|
||||
int mapsy = DBSql.getInt(sqly, new Object[]{processInstance.getId()});
|
||||
|
||||
if(oa_real_time!=null){
|
||||
int r1 = DBSql.update("UPDATE BO_ACT_OA_REAL_TIME SET SENDNUMSJ='" +mapsy + "'WHERE PROCESSID ='" + processInstance.getId() + "'");
|
||||
@ -1113,7 +1115,7 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute
|
||||
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("BUNAME","");
|
||||
realTimeBO.set("TITLE", processInstance.getTitle());
|
||||
realTimeBO.set("PROCESSID", processInstance.getId());
|
||||
realTimeBO.set("SENDNUMSJ", 1);
|
||||
@ -1181,7 +1183,7 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute
|
||||
* @param results
|
||||
* @throws DocumentException
|
||||
*/
|
||||
public void secondSendOARead(JSONObject jsonObject, ProcessInstance processInstance, List<String> idList,String type)
|
||||
public void secondSendOARead(ProcessInstance processInstance, List<String> idList,String type)
|
||||
throws DocumentException {
|
||||
|
||||
|
||||
@ -1196,11 +1198,57 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute
|
||||
return;
|
||||
}
|
||||
|
||||
// System.err.println(processInstance.getTitle() + "开始发送:" + userId);
|
||||
|
||||
/*
|
||||
* if ("".equals(userId) || UtilString.isEmpty(userId)) { return; }
|
||||
*/
|
||||
|
||||
|
||||
BO bo_act_coe_publish1 = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH", true)
|
||||
.addQuery("BINDID=", processInstance.getId())
|
||||
.addQuery("OPTIONTYPE IS NOT NULL", null).detail();
|
||||
|
||||
String sql = "SELECT ID FROM WFH_TASK WHERE PROCESSINSTID = '" + processInstance.getId()
|
||||
+ "' AND ACTIVITYDEFID = 'obj_c9e5a3144b200001b68cffa01ed0153e' ";
|
||||
String taskInd = DBSql.getString(sql);
|
||||
|
||||
TaskInstance ta = SDK.getTaskAPI().getInstanceById(taskInd);
|
||||
String portalUrl = SDK.getPortalAPI().getPortalUrl();
|
||||
|
||||
String url = portalUrl + "/r/or?cmd=com.yili_process_page&oauthName=oauthLogin&processInstId="
|
||||
+ processInstance.getId() + "&taskInstId="
|
||||
+ taskInd;
|
||||
String mobileurl = "https://bpm.yili.com:8088/portal"
|
||||
+ "/r/or?cmd=com.yili_process_page_phone&corpid=wwb0ae23173b140618&appAgentId=1000014&oauthName=wechat&processInstId="
|
||||
+ processInstance.getId() + "&taskInstId="
|
||||
+ taskInd;
|
||||
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
//Timestamp endTime = processExecutionContext.getTaskInstance().getBeginTime();
|
||||
Timestamp endTime = new Timestamp(System.currentTimeMillis());
|
||||
|
||||
JSONObject jsonObjects = new JSONObject(new LinkedHashMap());
|
||||
jsonObjects.put("action", "read");
|
||||
jsonObjects.put("title", " " + "" + bo_act_coe_publish1.getString("PROCESS_TITLE") + "");
|
||||
jsonObjects.put("dept", SDK.getORGAPI()
|
||||
.getDepartmentByUser(ta.getTarget()).getNo());// SDK.getORGAPI().getDepartmentByUser(processExecutionContext.getProcessInstance().getCreateUser()).getNo()
|
||||
String target = ta.getTarget();
|
||||
|
||||
jsonObjects.put("user", target);
|
||||
// jsonObject.put("user",);//processExecutionContext.getProcessInstance().getCreateUser()
|
||||
jsonObjects.put("date", sdf.format(endTime));
|
||||
jsonObjects.put("remark", bo_act_coe_publish1.getString("PROCESS_TITLE"));
|
||||
jsonObjects.put("status", "0");
|
||||
jsonObjects.put("dataid", processInstance.getId());
|
||||
jsonObjects.put("pcurl", url);
|
||||
jsonObjects.put("mobileurl", mobileurl);
|
||||
|
||||
String userIds = StringUtils.join(idList, ",");
|
||||
jsonObject.put("userList", userIds);
|
||||
jsonObjects.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>"
|
||||
+ "<![CDATA[" + jsonObjects + "]]>" + " </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");
|
||||
@ -1255,8 +1303,8 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute
|
||||
|
||||
BO oa_real_time=SDK.getBOAPI().query("BO_ACT_OA_REAL_TIME").addQuery("PROCESSID=",processInstance.getId()).detail();
|
||||
|
||||
String sqly = "SELECT COUNT(1) FROM BO_ACT_DATAID WHERE PROCESSID =? AND SENDTYPE = '1'";
|
||||
int mapsy = DBSql.getInt(sqly,processInstId);
|
||||
String sqly = "SELECT COUNT(1) FROM BO_ACT_DATAID WHERE PROCESSID=? AND SENDTYPE='1'";
|
||||
int mapsy = DBSql.getInt(sqly, new Object[]{processInstance.getId()});
|
||||
|
||||
if(oa_real_time!=null){
|
||||
int r1 = DBSql.update("UPDATE BO_ACT_OA_REAL_TIME SET SENDNUMSJ='" +mapsy + "'WHERE PROCESSID ='" + processInstance.getId() + "'");
|
||||
|
||||
Loading…
Reference in New Issue
Block a user