验证功能补充代码提交

This commit is contained in:
zhaol 2025-06-03 11:37:59 +08:00
parent 4894088647
commit 3ac8502545
6 changed files with 415 additions and 2 deletions

View File

@ -4,7 +4,7 @@
<createUser>admin</createUser>
<createTime>2025-02-05 11:03:45</createTime>
<updateUser></updateUser>
<updateTime>2025-02-05 11:03:45</updateTime>
<updateTime>2025-03-11 13:50:13</updateTime>
<signature>tGOmxiTgjT/77UoYpSlq8Vc+hHPRoJWHdZexXc7zEpYuMNdhvSICeJnlc/RzRHGrH8w8haPGp7RAkqtcYW2GzTXyNR08wE6kIF/vLVQlyPXlmd9pcwhdN7GNnE6B1VCD</signature>
<managed>false</managed>
<name>测试</name>
@ -12,7 +12,7 @@
<desc></desc>
<disabled>false</disabled>
<system>false</system>
<classz>com.awspaas.user.apps.app20250109170254.job.Test1</classz>
<classz>com.awspaas.user.apps.app20250109170254.job.TestDepJob</classz>
<createDate>2025-02-05T11:03:45+08:00</createDate>
<triggerRule>6::0</triggerRule>
<userParam></userParam>

View File

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<awsScheduleModel>
<id>19817c0f-0ec9-4485-a3ec-1429521739ac</id>
<createUser>admin</createUser>
<createTime>2025-02-05 11:03:45</createTime>
<updateUser></updateUser>
<updateTime>2025-02-05 11:03:45</updateTime>
<signature>tGOmxiTgjT/77UoYpSlq8Vc+hHPRoJWHdZexXc7zEpYuMNdhvSICeJnlc/RzRHGrH8w8haPGp7RAkqtcYW2GzTXyNR08wE6kIF/vLVQlyPXlmd9pcwhdN7GNnE6B1VCD</signature>
<managed>false</managed>
<name>测试</name>
<group>DEFAULT</group>
<desc></desc>
<disabled>false</disabled>
<system>false</system>
<classz>com.awspaas.user.apps.app20250109170254.job.Test1</classz>
<createDate>2025-02-05T11:03:45+08:00</createDate>
<triggerRule>6::0</triggerRule>
<userParam></userParam>
<lastToken></lastToken>
<concurrent>false</concurrent>
<categoryName>未分类</categoryName>
<stateful>false</stateful>
<notificationEvent></notificationEvent>
<notificationList></notificationList>
<notificationTemplate></notificationTemplate>
</awsScheduleModel>

View File

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<awsScheduleModel>
<id>72e4ca6a-6ad9-4ded-a6c4-8819c38736c8</id>
<createUser>admin</createUser>
<createTime>2025-05-30 10:53:35</createTime>
<updateUser></updateUser>
<updateTime>2025-05-30 11:06:50</updateTime>
<signature>tGOmxiTgjT/77UoYpSlq8Vc+hHPRoJWHdZexXc7zEpYuMNdhvSICeJnlc/RzRHGrqurvg4GCTl7KwV2YAH51a/3Jl5TwS6FI/nyZM0yMCGWNPV86K/smVfaFhwuOPGqV</signature>
<managed>false</managed>
<name>补充发送OA待阅</name>
<group>DEFAULT</group>
<desc></desc>
<disabled>false</disabled>
<system>false</system>
<classz>com.awspaas.user.apps.app20250109170254.job.SendOaRead</classz>
<createDate>2025-05-30T10:53:35+08:00</createDate>
<triggerRule>6::0</triggerRule>
<userParam>67ba930e-0983-4521-8e3e-599b6032b589</userParam>
<lastToken></lastToken>
<concurrent>false</concurrent>
<categoryName>未分类</categoryName>
<stateful>false</stateful>
<notificationEvent></notificationEvent>
<notificationList></notificationList>
<notificationTemplate></notificationTemplate>
</awsScheduleModel>

View File

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<awsScheduleModel>
<id>c2f58bbd-520d-4c47-b4a0-47f22556661c</id>
<createUser>admin</createUser>
<createTime>2025-05-23 10:04:57</createTime>
<updateUser></updateUser>
<updateTime>2025-05-23 10:11:08</updateTime>
<signature>tGOmxiTgjT/77UoYpSlq8Vc+hHPRoJWHdZexXc7zEpYuMNdhvSICeJnlc/RzRHGrYYtsa/deefnw1DhjlYIs/reKKeJi54adQoISMvV5Nxb1QD7a2W1m00CD6qvwEaOI</signature>
<managed>false</managed>
<name>刷新权限阅览创建人字段</name>
<group>DEFAULT</group>
<desc></desc>
<disabled>false</disabled>
<system>false</system>
<classz>com.awspaas.user.apps.app20250109170254.job.UpdateCreateUser</classz>
<createDate>2025-05-23T10:04:57+08:00</createDate>
<triggerRule>6::0</triggerRule>
<userParam></userParam>
<lastToken></lastToken>
<concurrent>false</concurrent>
<categoryName>未分类</categoryName>
<stateful>false</stateful>
<notificationEvent></notificationEvent>
<notificationList></notificationList>
<notificationTemplate></notificationTemplate>
</awsScheduleModel>

View File

@ -0,0 +1,335 @@
package com.actionsoft.apps.coe.pal.datamigration;
import com.actionsoft.bpms.bo.engine.BO;
import com.actionsoft.bpms.bpmn.engine.ProcessAPIManager;
import com.actionsoft.bpms.bpmn.engine.model.run.TaskCommentModel;
import com.actionsoft.bpms.bpmn.engine.model.run.delegate.HistoryTaskInstance;
import com.actionsoft.bpms.bpmn.engine.model.run.delegate.ProcessInstance;
import com.actionsoft.bpms.bpmn.engine.model.run.delegate.TaskInstance;
import com.actionsoft.bpms.commons.mvc.view.ResponseObject;
import com.actionsoft.bpms.org.model.UserModel;
import com.actionsoft.bpms.schedule.IJob;
import com.actionsoft.bpms.server.SSOUtil;
import com.actionsoft.bpms.server.UserContext;
import com.actionsoft.sdk.local.SDK;
import com.actionsoft.sdk.local.api.AppAPI;
import com.actionsoft.sdk.local.api.BOQueryAPI;
import com.actionsoft.sdk.local.api.ProcessQueryAPI;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import javax.xml.soap.SOAPException;
import com.awspaas.user.apps.app20250109170254.utils.HttpClientUtils;
import com.awspaas.user.apps.app20250109170254.utils.XmlDatasUtil;
import org.apache.commons.lang3.StringUtils;
import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
public class SendZXJob implements IJob {
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
List<ProcessInstance> list = ((ProcessQueryAPI)SDK.getProcessAPI().query().addQuery("PROCESSDEFID IN ('obj_af62bb56ded84df88ae5cd42472ff7d7')", null)).list();
for (ProcessInstance processInstance : list) {
List<HistoryTaskInstance> list_history = SDK.getHistoryTaskQueryAPI().processInstId(processInstance.getId()).list();
for (HistoryTaskInstance historyTaskInstance : list_history) {
try {
updatePending2((TaskInstance)historyTaskInstance, processInstance);
} catch (IOException e) {
e.printStackTrace();
} catch (SOAPException e) {
e.printStackTrace();
} catch (DocumentException e) {
e.printStackTrace();
}
}
}
}
public void updatePending2(TaskInstance taskInstance, ProcessInstance pec) throws IOException, SOAPException, DocumentException {
if ("admin".equals(taskInstance.getTarget())) {
return;
}
XmlDatasUtil xmlDatasUtil = new XmlDatasUtil();
xmlDatasUtil.setExternal_system_ID("LCZD");
xmlDatasUtil.setOther_system_to_do_ID(taskInstance.getId());
if (pec != null) {
String actionName = getActionName(taskInstance);
if (actionName.equals("传阅")) {
BO bo_act_coe_publish = (BO)((BOQueryAPI)((BOQueryAPI)SDK.getBOAPI().query("BO_ACT_COE_PUBLISH", true).addQuery("BINDID=", pec.getId())).addQuery("PROCESS_TITLE is not null", null)).detail();
if (bo_act_coe_publish != null) {
String title = bo_act_coe_publish.getString("PROCESS_TITLE");
if (title.contains("&")) {
xmlDatasUtil.setProcess_title(" 您有一条传阅流程【" + title.replace("&", "-") + "】,点击进行处理");
} else {
xmlDatasUtil.setProcess_title(" 您有一条传阅流程【" + title + "】,点击进行处理");
}
} else {
xmlDatasUtil.setProcess_title(" 您有一条传阅流程【" + pec.getTitle() + "】,点击进行处理");
}
} else {
BO bo_act_coe_publish = (BO)((BOQueryAPI)((BOQueryAPI)SDK.getBOAPI().query("BO_ACT_COE_PUBLISH", true).addQuery("BINDID=", pec.getId())).addQuery("PROCESS_TITLE is not null", null)).detail();
if (bo_act_coe_publish != null) {
String title = bo_act_coe_publish.getString("PROCESS_TITLE");
if (title.contains("&")) {
xmlDatasUtil.setProcess_title(" 您有一条待办流程【" + title.replace("&", "-") + "】,点击进行处理");
} else {
xmlDatasUtil.setProcess_title(" 您有一条待办流程【" + title + "】,点击进行处理");
}
} else {
xmlDatasUtil.setProcess_title(" 您有一条待办流程【" + pec.getTitle() + "】,点击进行处理");
}
}
} else {
xmlDatasUtil.setProcess_title(" 您有一条发布流程被作废,点击进行处理");
}
String portalUrl = SDK.getPortalAPI().getPortalUrl();
if (portalUrl.equals("http://10.114.11.135:8088/portal")) {
portalUrl = "https://bpm.yili.com:8088/portal/";
}
if (pec != null) {
xmlDatasUtil.setPcurl("https://bpm.yili.com:8088/portal/r/or?cmd=com.yili_form_page_open&amp;oauthName=oauthLogin&amp;processInstId=" + pec.getId() + "&amp;taskInstId=" + taskInstance.getId() + "&amp;openState=" + taskInstance.getState());
xmlDatasUtil.setMobileurl("https://bpm.yili.com:8088/portal/r/or?cmd=com.yili_form_page_open&amp;corpid=wwb0ae23173b140618&amp;appAgentId=1000014&amp;oauthName=wechat&amp;processInstId=" + pec.getId() + "&amp;taskInstId=" + taskInstance.getId() + "&amp;openState=" + taskInstance.getState());
} else {
xmlDatasUtil.setPcurl("https://bpm.yili.com:8088/portal/r/or?cmd=CLIENT_BPM_FORM_TRACK_OPEN&amp;oauthName=oauthLogin&amp;processInstId=" + taskInstance.getProcessInstId() + "&amp;sourceApp=prm");
xmlDatasUtil.setMobileurl("https://bpm.yili.com:8088/portal/r/or?cmd=CLIENT_BPM_FORM_TRACK_OPEN&amp;corpid=wwb0ae23173b140618&amp;appAgentId=1000014&amp;oauthName=wechat&amp;processInstId=" + taskInstance.getProcessInstId() + "&amp;sourceApp=prm");
}
String target = taskInstance.getTarget();
BO bo_eu_oa_reson = (BO)((BOQueryAPI)SDK.getBOAPI().query("BO_EU_OA_RESON", true).addQuery("WORKCODE=", target)).detail();
if (bo_eu_oa_reson != null) {
xmlDatasUtil.setTo_do_login_account(bo_eu_oa_reson.getString("LOGINID"));
}
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
if (taskInstance.getBeginTime() != null) {
String str = df.format(taskInstance.getBeginTime());
String substring = str.substring(str.indexOf(" "), str.length());
xmlDatasUtil.setTo_do_creation_time(substring);
xmlDatasUtil.setTo_do_completion_time(df.format(taskInstance.getBeginTime()).substring(df.format(taskInstance.getBeginTime()).indexOf(" "), df.format(taskInstance.getBeginTime()).length()));
xmlDatasUtil.setCreatedate(str.substring(0, str.indexOf(" ")));
xmlDatasUtil.setDonedate(df.format(taskInstance.getBeginTime()).substring(0, df.format(taskInstance.getBeginTime()).indexOf(" ")));
} else {
String str = df.format(new Date());
String substring = str.substring(str.indexOf(" "), str.length());
xmlDatasUtil.setTo_do_creation_time(substring);
xmlDatasUtil.setTo_do_completion_time(df.format(new Date()).substring(df.format(new Date()).indexOf(" "), df.format(new Date()).length()));
xmlDatasUtil.setCreatedate(str.substring(0, str.indexOf(" ")));
xmlDatasUtil.setDonedate(df.format(new Date()).substring(0, df.format(new Date()).indexOf(" ")));
}
xmlDatasUtil.setTo_do_status("1");
xmlDatasUtil.setViewtype("-2");
xmlDatasUtil.setCurrentnodetype("1");
xmlDatasUtil.setTo_do_official_type("0");
String der = "";
if (taskInstance.getReadTime() == null) {
der = df.format(new Date());
} else {
der = df.format(taskInstance.getReadTime());
}
xmlDatasUtil.setReceivedate(der.substring(0, der.indexOf(" ")));
xmlDatasUtil.setReceivetime(der.substring(der.indexOf(" "), der.length()));
xmlDatasUtil.setCurrentnodetype("1");
if (pec != null) {
xmlDatasUtil.setRequestcode(pec.getId());
xmlDatasUtil.setCurrentnodename(SDK.getRepositoryAPI().getProcessNode(pec.getProcessDefId(), taskInstance.getActivityDefId()).getName());
String sourceAppId = pec.getAppId();
String aslp = "aslp://com.actionsoft.apps.processtrends/processNodeInfoASLP";
Map params = new HashMap<String, Object>();
params.put("processInstId", pec.getId());
if (pec != null) {
UserModel us = SDK.getORGAPI().getUser(pec.getCreateUser());
if (!us.isClosed()) {
String sessionId = (new SSOUtil()).registerClientSessionNoPassword(pec.getCreateUser(), "cn", "localhost", "pc");
params.put("sid", sessionId);
}
} else {
UserModel usc = SDK.getORGAPI().getUser(taskInstance.getTarget());
if (!usc.isClosed()) {
String sessionId = (new SSOUtil()).registerClientSessionNoPassword(taskInstance.getTarget(), "cn", "127.0.0.1", "pc");
params.put("sid", sessionId);
}
}
AppAPI appAPI = SDK.getAppAPI();
ResponseObject ro = appAPI.callASLP(appAPI.getAppContext(sourceAppId), aslp, params);
String username = "";
String userid = "";
if (ro.isOk()) {
String data = ro.getData().toString();
JSONObject jsonObject = JSONObject.parseObject(data);
JSONArray jsonArray = JSONArray.parseArray(jsonObject.getString("processBudgetModelList"));
if (!jsonArray.isEmpty()) {
for (int i = 0; i < jsonArray.size(); i++) {
String filename = jsonArray.getJSONObject(i).getString("executor");
String userid2 = jsonArray.getJSONObject(i).getString("userid2");
username = username + filename + " ";
userid = userid + userid2 + " ";
}
}
}
xmlDatasUtil.setNooperator(username);
} else {
xmlDatasUtil.setRequestcode("");
}
xmlDatasUtil.setWorkcode("");
xmlDatasUtil.setWorkflowname("流程发布");
if (bo_eu_oa_reson != null) {
xmlDatasUtil.setCreaterhrcode(bo_eu_oa_reson.getString("LOGINID"));
}
xmlDatasUtil.setCreaterworkcode("");
HttpClientUtils httpClientUtil = new HttpClientUtils();
String taskurl = SDK.getAppAPI().getProperty("com.awspaas.user.apps.yili.integration", "taskurl");
String s = httpClientUtil.SendPend(taskurl, xmlDatasUtil);
BO bo = new BO();
bo.set("OUTSYSID", xmlDatasUtil.getExternal_system_ID());
bo.set("TODOID", xmlDatasUtil.getOther_system_to_do_ID());
bo.set("CONTENT", xmlDatasUtil.getProcess_title());
bo.set("PCURL", xmlDatasUtil.getPcurl());
bo.set("MOBILEURL", xmlDatasUtil.getMobileurl());
bo.set("HRCODE", xmlDatasUtil.getTo_do_login_account());
bo.set("STATUS", xmlDatasUtil.getTo_do_status());
bo.set("WFTYPE", xmlDatasUtil.getTo_do_official_type());
bo.set("VIEWTYPE", xmlDatasUtil.getViewtype());
bo.set("CREATEDATES", xmlDatasUtil.getCreatedate());
bo.set("NEWCREATETIME", xmlDatasUtil.getTo_do_creation_time());
bo.set("DONEDATE", xmlDatasUtil.getDonedate());
bo.set("NEWDONETIME", xmlDatasUtil.getTo_do_status());
bo.set("RECEIVEDATE", xmlDatasUtil.getReceivedate());
bo.set("RECEIVETIME", xmlDatasUtil.getReceivetime());
bo.set("CURRENTNODETYPE", xmlDatasUtil.getCurrentnodetype());
bo.set("REQUESTCODE", xmlDatasUtil.getRequestcode());
bo.set("CURRENTNODENAME", xmlDatasUtil.getCurrentnodename());
bo.set("NOOPERATOR", xmlDatasUtil.getNooperator());
bo.set("CREATERHRCODE", xmlDatasUtil.getCreaterhrcode());
bo.set("WORKFLOWNAME", xmlDatasUtil.getWorkflowname());
bo.set("OA_RESULT", s);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
bo.set("OA_DATE", sdf.format(new Date()));
if (taskInstance != null && StringUtils.isNotEmpty(taskInstance.getTarget())) {
SDK.getBOAPI().createDataBO("BO_EU_OA_MOBILEURL", bo, UserContext.fromUID(taskInstance.getTarget()));
} else {
SDK.getBOAPI().createDataBO("BO_EU_OA_MOBILEURL", bo, UserContext.fromUID("admin"));
}
System.out.println("更新待办===>" + pec.getTitle() + "===>状态码============》》》》》》》》》》》" + s);
Document document = null;
try {
document = DocumentHelper.parseText(s);
} catch (DocumentException e) {
e.printStackTrace();
}
Element rootElement = document.getRootElement();
Element result = rootElement.element("Body").element("InsertTodoCominfoResponse").element("out");
String text = result.getText();
document = DocumentHelper.parseText(text);
Element rootElement2 = document.getRootElement();
Element statusElement = rootElement2.element("result");
Element messageElement = rootElement2.element("message");
String status = statusElement.getData().toString();
String message = messageElement.getData().toString();
if (status.equals("success")) {
System.out.println("更新待办成功===>" + pec.getTitle() + "===>" + taskInstance.getTarget() + "====>" + status + "===>" + message);
} else {
System.out.println("更新待办失败===>" + pec.getTitle() + "===>" + taskInstance.getTarget() + "====>" + status + "===>" + message);
}
if (!s.contains("success")) {
BO bo_eu_faid_data = (BO)((BOQueryAPI)SDK.getBOAPI().query("BO_EU_FAID_DATA").addQuery("TASK_ID=", taskInstance.getId())).detail();
if (bo_eu_faid_data == null) {
ProcessInstance processInstance = SDK.getProcessAPI().createProcessInstance("obj_ef1918ca1f9c46948f56bd5f77f4e646", "admin", "admin失败更新待办");
BO bo_faid = new BO();
bo_faid.set("CHANGED", "2");
bo_faid.set("TASK_ID", taskInstance.getId());
if (pec != null) {
bo_faid.set("PROCESS_ID", pec.getId());
}
UserContext userContext = UserContext.fromUID("admin");
SDK.getBOAPI().create("BO_EU_FAID_DATA", bo_faid, processInstance, userContext);
SDK.getProcessAPI().start(processInstance);
}
}
}
private String getActionName(TaskInstance taskInstance) {
if (null == taskInstance) {
return "";
}
String actionName = "";
Iterator<TaskCommentModel> iterator = null;
if (StringUtils.isNotEmpty(taskInstance.getProcessInstId())) {
iterator = ProcessAPIManager.getInstance().getComments(taskInstance.getProcessInstId()).iterator();
while (iterator.hasNext()) {
TaskCommentModel next; if ((next = iterator.next()).getTaskInstId().equals(taskInstance.getId())) {
actionName = next.getActionName();
}
}
}
return actionName;
}
}