增加监控代码,修改线程全局变量

This commit is contained in:
Mr-wang 2023-09-01 18:14:34 +08:00
parent 7943b46859
commit 0b84c043a0

View File

@ -273,9 +273,26 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute
for (BO uid:bo_eu_oa_read_test) { for (BO uid:bo_eu_oa_read_test) {
sendLists.add(uid.getString("USER_ID")); sendLists.add(uid.getString("USER_ID"));
}*/ }*/
String sql = "SELECT ID FROM WFH_TASK WHERE PROCESSINSTID = '" + processExecutionContext.getProcessInstance().getId()
+ "' AND ACTIVITYDEFID = 'obj_c9e5a3144b200001b68cffa01ed0153e' ";
String taskInd = DBSql.getString(sql);
TaskInstance ta = SDK.getTaskAPI().getInstanceById(taskInd);
new_uid = new_uid.join(",", sendList); new_uid = new_uid.join(",", sendList);
long startTimes = System.currentTimeMillis(); long startTimes = System.currentTimeMillis();
String[] users = new_uid.split(","); String[] users = new_uid.split(",");
for (String uid:
users) {
BO bo = new BO();
bo.set("USER_ID",uid);
bo.set("PROCESSID",processExecutionContext.getProcessInstance().getId());
bo.set("USERID",ta.getTarget());
bo.set("DEPARTMENT",UserContext.fromUID(ta.getTarget()).getDepartmentModel().getId());
bo.set("PROCESS_TITLE",bo_act_coe_publish1.getString("PROCESS_TITLE"));
bo.set("PUBLISH_DATE",sdf.format(endTime));
SDK.getBOAPI().createDataBO("BO_EU__OA_MONITOR",bo,UserContext.fromUID(ta.getTarget()));
}
System.out.println("new_uid>>>>>>>>>>>>>>"+users.length); System.out.println("new_uid>>>>>>>>>>>>>>"+users.length);
int length = 100; int length = 100;
int ys = users.length%length; int ys = users.length%length;
@ -553,7 +570,7 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute
userIds = StringUtils.join(resrt, ","); userIds = StringUtils.join(resrt, ",");
System.out.println("userIDs>>>>>>>>>>>>>>>"+userIds); System.out.println("userIDs>>>>>>>>>>>>>>>"+userIds);
try { try {
SendOARead(jsonObject, processExecutionContext.getProcessInstance(), userIds,"批量推送"); SendOARead( processExecutionContext.getProcessInstance(), userIds,"批量推送");
countDownLatch.countDown(); countDownLatch.countDown();
} catch (DocumentException e) { } catch (DocumentException e) {
e.printStackTrace(); e.printStackTrace();
@ -961,26 +978,69 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute
* @param results * @param results
* @throws DocumentException * @throws DocumentException
*/ */
public void SendOARead(JSONObject jsonObject, ProcessInstance processInstance, String userIds,String type) public void SendOARead( ProcessInstance processInstance, String userIds,String type)
throws DocumentException { throws DocumentException {
String processInstId = processInstance.getId(); String processInstId = processInstance.getId();
// System.err.println(processInstance.getTitle() + "开始发送:" + userId); // System.err.println(processInstance.getTitle() + "开始发送:" + userId);
/* /*
* if ("".equals(userId) || UtilString.isEmpty(userId)) { return; } * 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=0014&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[] resrt = userIds.split(","); String[] resrt = userIds.split(",");
long start_time = System.currentTimeMillis(); long start_time = System.currentTimeMillis();
System.out.println("待阅推送开始时间>>>>>>>>>>>>"+start_time); System.out.println("待阅推送开始时间>>>>>>>>>>>>"+start_time);
BO bo_OA_read = new BO(); BO bo_OA_read = new BO();
bo_OA_read.set("FIR_NUMS",resrt.length); bo_OA_read.set("FIR_NUMS",resrt.length);
bo_OA_read.set("START_TIME",start_time); bo_OA_read.set("START_TIME",start_time);
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" 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>" + " <soapenv:Header/>" + " <soapenv:Body>" + " <web:service>" + " <web:in0>"
+ "<![CDATA[" + jsonObject + "]]>" + " </web:in0>" + " </web:service>" + "<![CDATA[" + jsonObjects + "]]>" + " </web:in0>" + " </web:service>"
+ " </soapenv:Body>" + "</soapenv:Envelope>"; + " </soapenv:Body>" + "</soapenv:Envelope>";
// System.out.println("xmlStr>>>>>>>>" + xmlStr); // System.out.println("xmlStr>>>>>>>>" + xmlStr);
String readurl = SDK.getAppAPI().getProperty("com.awspaas.user.apps.yili.integration", "readurl"); String readurl = SDK.getAppAPI().getProperty("com.awspaas.user.apps.yili.integration", "readurl");