定时任务修改全局变量代码

This commit is contained in:
Mr-wang 2023-09-01 18:17:47 +08:00
parent 0b84c043a0
commit cd7a231da8

View File

@ -50,41 +50,9 @@ public class CopyJob implements IJob {
.addQuery("BINDID=", pc.getId())
.addQuery("OPTIONTYPE IS NOT NULL", null).detail();
String sql = "SELECT ID FROM WFH_TASK WHERE PROCESSINSTID = '" + pc.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="
+ pc.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="
+ pc.getId() + "&taskInstId="
+ taskInd;
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
//Timestamp endTime = processExecutionContext.getTaskInstance().getBeginTime();
Timestamp endTime = new Timestamp(System.currentTimeMillis());
JSONObject jsonObject = new JSONObject(new LinkedHashMap());
jsonObject.put("action", "read");
jsonObject.put("title", " " + "" + bo_act_coe_publish1.getString("PROCESS_TITLE") + "");
jsonObject.put("dept", SDK.getORGAPI()
.getDepartmentByUser(ta.getTarget()).getNo());// SDK.getORGAPI().getDepartmentByUser(processExecutionContext.getProcessInstance().getCreateUser()).getNo()
String target = ta.getTarget();
jsonObject.put("user", target);
// jsonObject.put("user",);//processExecutionContext.getProcessInstance().getCreateUser()
jsonObject.put("date", sdf.format(endTime));
jsonObject.put("remark", bo_act_coe_publish1.getString("PROCESS_TITLE"));
jsonObject.put("status", "0");
jsonObject.put("dataid", pc.getId());
jsonObject.put("pcurl", url);
jsonObject.put("mobileurl", mobileurl);
int count = 1;
int count2 = 1;
@ -235,7 +203,7 @@ public class CopyJob implements IJob {
e.printStackTrace();
}*/
try {
SendOARead(jsonObject, processInstance, userIds,"批量推送");
SendOARead( processInstance, userIds,"批量推送");
countDownLatch.countDown();
} catch (DocumentException e) {
e.printStackTrace();
@ -432,7 +400,7 @@ public class CopyJob implements IJob {
* @param results
* @throws DocumentException
*/
public void SendOARead(JSONObject jsonObject, ProcessInstance processInstance, String userIds,String type)
public void SendOARead( ProcessInstance processInstance, String userIds,String type)
throws DocumentException {
@ -442,16 +410,57 @@ public class CopyJob implements IJob {
/*
* 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);
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);
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");