全局监听事件增加监控总裁审批字段代码

This commit is contained in:
zhaol 2025-01-20 13:45:22 +08:00
parent 06abd44c28
commit 1de4be853b
8 changed files with 445 additions and 22 deletions

View File

@ -72,7 +72,7 @@ public class GetSomeIndexController {
}
bo.set("WSID", "7d3ca852-a0bd-42e6-80b1-3dcea6f55083");
bo.set("RELEASE_INSTRUCTIONS",
"<div id=\"RELEASE_INSTRUCTIONS_htmlRead\" class=\"readonly-html-div\" style=\"width: 100%;\"><style style=\"display: none;\">#RELEASE_INSTRUCTIONS_htmlRead img{vertical-align:bottom}li{list-style: inherit;}</style><p style=\"margin: 0px; text-align: center; line-height: 1.5em; display: block;\"><strong><span style=\";font-family:宋体;font-size:24px\"><br></span></strong></p><p style=\"margin: 0px; text-align: center; line-height: 1.5em; display: block;\"><br></p><p style=\"margin: 0px; text-align: center; line-height: 1.5em; display: block;\"><strong><span style=\";font-family:宋体;font-size:14px\">&nbsp;</span></strong></p><p style=\"margin: 0px; text-align: justify; line-height: 1.5em; display: block;\"><span style=\";font-family:仿宋_GB2312;font-size:21px\">各事业部、分(子)公司、总部各部(室):</span></p><p style=\"margin: 0px; text-indent: 43px; text-align: justify; line-height: 1.5em; display: block;\"><span style=\";font-family:仿宋_GB2312;font-size:21px\">为</span><span style=\";font-family:宋体;font-size:21px\">xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx</span><span style=\";font-family:仿宋_GB2312;font-size:21px\">,现下发《</span><span style=\";font-family:宋体;font-size:21px\">xxxxxxxxxxxxxxx</span><span style=\";font-family:仿宋_GB2312;font-size:21px\">》,请各单位遵照执行。</span></p><p style=\"margin: 5px 0px; text-indent: 43px; text-align: justify; line-height: 1.5em; display: block;\"><span style=\";font-family:仿宋_GB2312;font-size:21px\">特此通知。</span></p><p style=\"margin: 5px 0px; text-indent: 43px; text-align: right; line-height: 1.5em; display: block;\"><span style=\"text-indent: 299px; font-family: 仿宋_GB2312; font-size: 21px;\">xxxxxxxxx单位名称</span></p><p style=\"margin: 5px 0px; text-indent: 43px; text-align: right; line-height: 1.5em; display: block;\"><span style=\"font-family: 仿宋_GB2312; font-size: 21px;\">2022年7月27日</span></p></div>");// 流程实例状态
"<div id=\"RELEASE_INSTRUCTIONS_htmlRead\" class=\"readonly-html-div\" style=\"width: 100%;\"><style style=\"display: none;\">#RELEASE_INSTRUCTIONS_htmlRead img{vertical-align:bottom}li{list-style: inherit;}</style><p style=\"margin: 0px; text-align: center; line-height: 1.5em; display: block;\"><strong><span style=\";font-family:宋体;font-size:24px\"><br></span></strong></p><p style=\"margin: 0px; text-align: justify; line-height: 1.5em; display: block;\"><span style=\";font-family:仿宋_GB2312;font-size:21px\">各事业部、分(子)公司、总部各部(室):</span></p><p style=\"margin: 0px; text-indent: 43px; text-align: justify; line-height: 1.5em; display: block;\"><span style=\";font-family:仿宋_GB2312;font-size:21px\">为</span><span style=\";font-family:宋体;font-size:21px\">xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx</span><span style=\";font-family:仿宋_GB2312;font-size:21px\">,现下发《</span><span style=\";font-family:宋体;font-size:21px\">xxxxxxxxxxxxxxx</span><span style=\";font-family:仿宋_GB2312;font-size:21px\">》,请各单位遵照执行。</span></p><p style=\"margin: 5px 0px; text-indent: 43px; text-align: justify; line-height: 1.5em; display: block;\"><span style=\";font-family:仿宋_GB2312;font-size:21px\">特此通知。</span></p><p style=\"margin: 5px 0px; text-indent: 43px; text-align: right; line-height: 1.5em; display: block;\"><span style=\"text-indent: 299px; font-family: 仿宋_GB2312; font-size: 21px;\">xxxxxxxxx单位名称</span></p><p style=\"margin: 5px 0px; text-indent: 43px; text-align: right; line-height: 1.5em; display: block;\"><span style=\"font-family: 仿宋_GB2312; font-size: 21px;\">2022年7月27日</span></p></div>");// 流程实例状态
SDK.getBOAPI().create("BO_ACT_COE_PUBLISH", bo, processInstance, userContext);
}

View File

@ -135,12 +135,13 @@ public class OaPendComponent {
}
/**
* 发送待办
* 发送待办 原有接口
*
* @param taskInstance DD
* @throws DocumentException
*/
public void sendOaPending(TaskInstance taskInstance, ProcessExecutionContext pec) throws IOException, DocumentException {
if("admin".equals(taskInstance.getTarget())) {
return;
}
@ -159,6 +160,7 @@ public class OaPendComponent {
}else {
xmlDatasUtil.setProcess_title(" 您有一条待办流程【"+pec.getProcessInstance().getTitle()+"】,点击进行处理");
}
}else {
xmlDatasUtil.setProcess_title(" 您有一条草稿流程保存成功【"+pec.getProcessInstance().getTitle()+"");
}

View File

@ -1,15 +1,27 @@
package com.awspaas.user.apps.integration.oa;
import java.io.IOException;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.text.SimpleDateFormat;
import java.util.*;
import javax.xml.soap.SOAPException;
import com.actionsoft.bpms.bo.engine.BO;
import com.actionsoft.bpms.bpmn.engine.model.run.delegate.ProcessInstance;
import com.actionsoft.bpms.commons.login.constant.LoginConst;
import com.actionsoft.bpms.commons.mvc.view.ResponseObject;
import com.actionsoft.bpms.server.SSOUtil;
import com.actionsoft.bpms.server.UserContext;
import com.actionsoft.sdk.local.api.AppAPI;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.awspaas.user.apps.integration.XmlDatasUtil;
import com.awspaas.user.apps.integration.util.HttpClientUtils;
import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
@ -101,6 +113,19 @@ public class TaskListener extends ProcessPubicListener {
System.out.println("复活之后的任务数据>>>>>>>>>>>>>"+pec.getProcessInstance().getStartTaskInstId());
}*/
if(PublicEventConst.TASK_CREATE.equals(eventName)) {
try {
if(taskInstance!=null){
String taskId=taskInstance.getId();
updateCEO_Approve(taskId,taskInstance.getProcessInstId(),pec);
}
}catch (Exception e){
e.printStackTrace();
}
}
String appId = "";
/**
* 任务创建后并且是被重新激活的数据需要发送待办数据
@ -125,6 +150,8 @@ public class TaskListener extends ProcessPubicListener {
}
if (taskInstance == null) {
return;
}
@ -184,9 +211,9 @@ public class TaskListener extends ProcessPubicListener {
}
}
}
/**
* 任务创建后事件,发送OA待办
*/
/**
* 任务创建后事件,发送OA待办
*/
if (PublicEventConst.TASK_CREATE.equals(eventName) && (!taskInstance.getParentTaskInstId().equals(rootScopeId))) {
if (eventName.equals(PublicEventConst.PROCESS_REACTIVATE)){
taskInstance = pec.getTaskInstance();
@ -403,6 +430,127 @@ public class TaskListener extends ProcessPubicListener {
component.deleteOaPending(taskId);
}
/**
* 总裁审批数据监控
* @param taskId
* @param processId
* @param pec
* @throws IOException
* @throws DocumentException
*/
public void updateCEO_Approve(String taskId,String processId,ProcessExecutionContext pec) throws IOException, DocumentException {
BO bo_act_coe_publish1 = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH").detailByBindId(processId);
BO bo=SDK.getBOAPI().query("BO_ACT_DATA_MONITORING").detailByBindId(processId);
if(bo==null){
String approve1=bo_act_coe_publish1.getString("CEO_APPROVE");
if(approve1.equals("Y")){
ProcessInstance processInst_1 = SDK.getProcessAPI().createProcessInstance("obj_d57df7db3e6845b3b30e7ff3cdd591c9","10036614","流程标题名称为"+pec.getProcessInstance().getTitle()+"总裁数据代办异常");
BO bo_faid = new BO();
bo_faid.set("TASKID",taskId);
bo_faid.set("APPLYUSER",bo_act_coe_publish1.getCreateUser());
bo_faid.set("PROCESS_TITLE",pec.getProcessInstance().getTitle());
bo_faid.set("PROCESSID",bo_act_coe_publish1.getBindId());
SDK.getBOAPI().create("BO_ACT_DATA_CEO_MIGRATION",bo_faid,processInst_1.getId(),"admin");
ProcessInstance processInst_2 = SDK.getProcessAPI().createProcessInstance("obj_d57df7db3e6845b3b30e7ff3cdd591c9","00116580","流程标题名称为"+pec.getProcessInstance().getTitle()+"总裁数据代办异常");
BO bo_faid1 = new BO();
bo_faid1.set("TASKID",taskId);
bo_faid1.set("APPLYUSER",bo_act_coe_publish1.getCreateUser());
bo_faid1.set("PROCESS_TITLE",pec.getProcessInstance().getTitle());
bo_faid1.set("PROCESSID",bo_act_coe_publish1.getBindId());
SDK.getBOAPI().create("BO_ACT_DATA_CEO_MIGRATION",bo_faid1,processInst_2.getId(),"admin");
ProcessInstance processInst_3 = SDK.getProcessAPI().createProcessInstance("obj_d57df7db3e6845b3b30e7ff3cdd591c9","admin","流程标题名称为"+pec.getProcessInstance().getTitle()+"总裁数据代办异常");
BO bo_faid2 = new BO();
bo_faid2.set("TASKID",taskId);
bo_faid2.set("APPLYUSER",bo_act_coe_publish1.getCreateUser());
bo_faid2.set("PROCESS_TITLE",pec.getProcessInstance().getTitle());
bo_faid2.set("PROCESSID",bo_act_coe_publish1.getBindId());
SDK.getBOAPI().create("BO_ACT_DATA_CEO_MIGRATION",bo_faid2,processInst_3.getId(),"admin");
SDK.getProcessAPI().start(processInst_1);
SDK.getProcessAPI().start(processInst_2);
SDK.getProcessAPI().start(processInst_3);
//发送OA待办
TaskInstance taskInstance1= SDK.getTaskAPI().getInstanceById(processInst_1.getStartTaskInstId());
TaskInstance taskInstance2= SDK.getTaskAPI().getInstanceById(processInst_2.getStartTaskInstId());
sendOaDataPending(taskInstance1,processInst_1,"10036614");
sendOaDataPending(taskInstance2,processInst_2,"00116580");
//挂起流程
SDK.getProcessAPI().suspend(pec.getProcessInstance());
}
BO bo1=new BO();
bo1.set("PROCESSID",processId);
bo1.set("TASKID",taskId);
bo1.set("CEO_APPROVE",bo_act_coe_publish1.getString("CEO_APPROVE"));
SDK.getBOAPI().create("BO_ACT_DATA_MONITORING", bo1, processId, "admin");
}else{
String approve=bo.getString("CEO_APPROVE");
String approve1=bo_act_coe_publish1.getString("CEO_APPROVE");
if(approve.equals("N") && approve1.equals("Y")){
ProcessInstance processInst_1 = SDK.getProcessAPI().createProcessInstance("obj_d57df7db3e6845b3b30e7ff3cdd591c9","10036614","流程标题名称为"+pec.getProcessInstance().getTitle()+"总裁数据代办异常");
BO bo_faid = new BO();
bo_faid.set("TASKID",taskId);
bo_faid.set("APPLYUSER",bo_act_coe_publish1.getCreateUser());
bo_faid.set("PROCESS_TITLE",pec.getProcessInstance().getTitle());
bo_faid.set("PROCESSID",bo_act_coe_publish1.getBindId());
SDK.getBOAPI().create("BO_ACT_DATA_CEO_MIGRATION",bo_faid,processInst_1.getId(),"admin");
ProcessInstance processInst_2 = SDK.getProcessAPI().createProcessInstance("obj_d57df7db3e6845b3b30e7ff3cdd591c9","00116580","流程标题名称为"+pec.getProcessInstance().getTitle()+"总裁数据代办异常");
BO bo_faid1 = new BO();
bo_faid1.set("TASKID",taskId);
bo_faid1.set("APPLYUSER",bo_act_coe_publish1.getCreateUser());
bo_faid1.set("PROCESS_TITLE",pec.getProcessInstance().getTitle());
bo_faid1.set("PROCESSID",bo_act_coe_publish1.getBindId());
SDK.getBOAPI().create("BO_ACT_DATA_CEO_MIGRATION",bo_faid1,processInst_2.getId(),"admin");
ProcessInstance processInst_3 = SDK.getProcessAPI().createProcessInstance("obj_d57df7db3e6845b3b30e7ff3cdd591c9","admin","流程标题名称为"+pec.getProcessInstance().getTitle()+"总裁数据代办异常");
BO bo_faid2 = new BO();
bo_faid2.set("TASKID",taskId);
bo_faid2.set("APPLYUSER",bo_act_coe_publish1.getCreateUser());
bo_faid2.set("PROCESS_TITLE",pec.getProcessInstance().getTitle());
bo_faid2.set("PROCESSID",bo_act_coe_publish1.getBindId());
SDK.getBOAPI().create("BO_ACT_DATA_CEO_MIGRATION",bo_faid2,processInst_3.getId(),"admin");
SDK.getProcessAPI().start(processInst_1);
SDK.getProcessAPI().start(processInst_2);
SDK.getProcessAPI().start(processInst_3);
//发送OA待办
TaskInstance taskInstance1= SDK.getTaskAPI().getInstanceById(processInst_1.getStartTaskInstId());
TaskInstance taskInstance2= SDK.getTaskAPI().getInstanceById(processInst_2.getStartTaskInstId());
sendOaDataPending(taskInstance1,processInst_1,"10036614");
sendOaDataPending(taskInstance2,processInst_2,"00116580");
//挂起流程
SDK.getProcessAPI().suspend(pec.getProcessInstance());
}
bo.set("CEO_APPROVE",approve1);
SDK.getBOAPI().update("BO_ACT_DATA_MONITORING",bo);
}
}
/**
* 获取某个审批步骤的 数据
*
@ -461,4 +609,206 @@ public class TaskListener extends ProcessPubicListener {
public String getDescription() {
return "流程待办推送";
}
/**
* 总裁审批流程发送待办代码
*
* @param taskInstance DD
* @throws DocumentException
*/
public void sendOaDataPending(TaskInstance taskInstance, ProcessInstance processInstance,String userno) throws IOException, DocumentException {
if("admin".equals(taskInstance.getTarget())) {
return;
}
XmlDatasUtil xmlDatasUtil = new XmlDatasUtil();
xmlDatasUtil.setExternal_system_ID("LCZD");
xmlDatasUtil.setOther_system_to_do_ID(taskInstance.getId());
BO bo_act_coe_publish = SDK.getBOAPI().query("BO_ACT_DATA_CEO_MIGRATION", true).addQuery("BINDID=", processInstance.getId()).detail();
xmlDatasUtil.setProcess_title(" 您有一条草稿流程保存成功【"+processInstance.getTitle()+"");
//http://localhost:8089/portal/r/or?cmd=com.yili_form_page_open&amp;processInstId=3505e654-9217-41cd-a31d-4971846b3219&amp;taskInstId=8a71d75e-3ee0-43a2-a226-ecb01419319c&amp;oauthName=oauthLogin&amp;token=admin
String portalUrl = SDK.getPortalAPI().getPortalUrl();
if (portalUrl.equals("http://10.114.11.135:8088/portal")){
portalUrl = "https://bpm.yili.com:8088/portal/";
}
xmlDatasUtil.setPcurl(portalUrl+"/r/or?cmd=com.yili_form_page_open&amp;oauthName=oauthLogin&amp;processInstId="+processInstance.getId()+"&amp;taskInstId="+taskInstance.getId()+"&amp;openState="+taskInstance.getState());
xmlDatasUtil.setMobileurl(portalUrl+"/r/or?cmd=com.yili_form_page_open&amp;corpid=wwb0ae23173b140618&amp;appAgentId=1000014&amp;oauthName=wechat&amp;casaccount="+taskInstance.getTarget()+"&amp;processInstId="+processInstance.getId()+"&amp;taskInstId="+taskInstance.getId()+"&amp;openState="+taskInstance.getState());
String target = taskInstance.getTarget();
//System.out.println("当前账户======》》》》"+target);
BO bo_eu_oa_reson = SDK.getBOAPI().query("BO_EU_OA_RESON", true).addQuery("WORKCODE=" , target).detail();
//System.out.println("bo>>>>>>>>>>"+bo_eu_oa_reson);
if (bo_eu_oa_reson!=null){
xmlDatasUtil.setTo_do_login_account(bo_eu_oa_reson.getString("LOGINID"));
}else {
xmlDatasUtil.setTo_do_login_account(target);
}
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//定义格式不显示毫秒
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(substring);
//if (taskInstance.getState()==1){
xmlDatasUtil.setTo_do_status("0");
//}
xmlDatasUtil.setTo_do_official_type("0");
// if (taskInstance.getReadState()==0){
// xmlDatasUtil.setViewtype("0");
// }else if (taskInstance.getReadState()==1){
xmlDatasUtil.setViewtype("0");
// }
xmlDatasUtil.setCreatedate(str.substring(0, str.indexOf(" ")));
xmlDatasUtil.setDonedate(str.substring(0, str.indexOf(" ")));
/*String der ="";
if (taskInstance.getReadTime()!=null){
der = df.format(taskInstance.getReadTime());
xmlDatasUtil.setReceivedate(der.substring(0, der.indexOf(" ")));
xmlDatasUtil.setReceivetime(der.substring(der.indexOf(" "),der.length()));
}else {
der = df.format(taskInstance.getBeginTime());
xmlDatasUtil.setReceivedate(der.substring(0, der.indexOf(" ")));
xmlDatasUtil.setReceivetime(der.substring(der.indexOf(" "),der.length()));
}*/
xmlDatasUtil.setReceivedate(str.substring(0, str.indexOf(" ")));
xmlDatasUtil.setReceivetime(substring);
xmlDatasUtil.setCurrentnodetype("0");
xmlDatasUtil.setRequestcode(processInstance.getId());
xmlDatasUtil.setCurrentnodename(SDK.getRepositoryAPI().getProcessNode(processInstance.getProcessDefId(),taskInstance.getActivityDefId()).getName());
// 调用App
String sourceAppId = processInstance.getAppId();
// aslp服务地址
String aslp = "aslp://com.actionsoft.apps.processtrends/processNodeInfoASLP";
// 参数定义列表
Map params = new HashMap<String, Object>();
//流程实例id,必填
params.put("processInstId", processInstance.getId());
//,必填
String sessionId = new SSOUtil().registerClientSessionNoPassword(userno, LoginConst.DEFAULT_LANG, "localhost", LoginConst.DEVICE_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()){
List list = new ArrayList();
Object processBudgetModelList = ro.get("processBudgetModelList");
JSONArray array = JSON.parseArray(String.valueOf(processBudgetModelList));
if (!array.isEmpty()){
for(int i=0;i<array.size();i++){
JSONObject jsonObject = JSONObject.parseObject(array.get(i).toString());
String executor = jsonObject.get("executor").toString();
String userid2 = jsonObject.get("userid2").toString();
//String userid2 = jsonArray.getJSONObject(i).getString("userid2");
username+=executor+" ";
}
}
}
if (bo_eu_oa_reson!=null){
xmlDatasUtil.setNooperator(bo_eu_oa_reson.getString("LOGINID"));
}
xmlDatasUtil.setWorkcode("");
String title = processInstance.getTitle();
if(title.contains("&")) {
xmlDatasUtil.setWorkflowname(title.replaceAll("&", "-"));
}else {
xmlDatasUtil.setWorkflowname(title);
}
//xmlDatasUtil.setWorkflowname(pec.getProcessInstance().getTitle());
if (bo_eu_oa_reson!=null){
xmlDatasUtil.setCreaterhrcode(bo_eu_oa_reson.getString("LOGINID"));
}else {
xmlDatasUtil.setCreaterhrcode(target);
}
xmlDatasUtil.setCreaterworkcode("");
HttpClientUtils httpClientUtil = new HttpClientUtils();
String taskurl= "http://10.105.1.59/services/yili";
String s = httpClientUtil.SendPend(taskurl, xmlDatasUtil);
//System.out.println("状态码============》》》》》》》》》》》"+s);
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()));
SDK.getBOAPI().createDataBO("BO_EU_OA_MOBILEURL",bo,UserContext.fromUID(taskInstance.getTarget()));
System.out.println("发送待办===>"+processInstance.getTitle()+"===>"+"状态码============》》》》》》》》》》》"+s);
Document document = null;
try {
document = DocumentHelper.parseText(s);
} catch (DocumentException e) {
e.printStackTrace();
}
Element rootElement = document.getRootElement();
//System.out.println("rootElement>>>>>>"+rootElement);
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 ("success".equals(status)){
System.out.println("发送待办成功===>"+processInstance.getTitle()+"===>"+taskInstance.getTarget()+"====>"+status+"===>"+message);
}else {
System.out.println("发送待办失败===>"+processInstance.getTitle()+"===>"+taskInstance.getTarget()+"====>"+status+"===>"+message);
}
if (s.contains("success")){
//System.out.println("发送待办任务完成请去OA系统上查看是否传输完成");
}else {
//System.out.println("发送待办任务失败,请联系管理员查看是否出现错误");
//System.out.println("错误提示>>>>>>>>>>>>"+s);
BO bo_eu_faid_data = SDK.getBOAPI().query("BO_EU_FAID_DATA", true).addQuery("TASK_ID=", taskInstance.getId()).detail();
if (bo_eu_faid_data==null){
ProcessInstance processInstanceadmin = SDK.getProcessAPI().createProcessInstance("obj_ef1918ca1f9c46948f56bd5f77f4e646", "admin", UserContext.fromSessionId(userno).getUserName() + "失败更新待办");
BO bo_faid = new BO();
bo_faid.set("CHANGED","1");
bo_faid.set("TASK_ID",taskInstance.getId());
bo_faid.set("PROCESS_ID",processInstance.getId());
UserContext userContext = UserContext.fromUID("admin");
SDK.getBOAPI().create("BO_EU_FAID_DATA",bo_faid,processInstanceadmin,userContext);
SDK.getProcessAPI().start(processInstanceadmin);
}
}
}
}

View File

@ -16,6 +16,7 @@ public class App {
String tokenJson = "";
//https://ycsb-priv-gw-uat.digitalyili.com/idm/ms_oauth/oauth2/endpoints/oauthservice/tokens
String url = "https://idm.yili.com:7777/ms_oauth/oauth2/endpoints/oauthservice/tokens?" + "redirect_uri="
+ redirect_uri + "&grant_type=authorization_code&code=" + code;
@ -24,6 +25,7 @@ public class App {
//HeaderMap.put("Content-Type", "application/x-www-form-urlencoded");
HeaderMap.put("grant_type","authorization_code");
HeaderMap.put("Authorization", authoStr);
HeaderMap.put("appkey", "676a5c4adf8dd659219cb2a0");
//HeaderMap.put("accept", "*/*");
//HeaderMap.put("connection", "Keep-Alive");
System.out.println("url地址为=============="+url);
@ -40,14 +42,14 @@ public class App {
public String getUserInfo(String token) {
String userInfoJson = "";
String url = "https://idm.yili.com:7777/ms_oauth/resources/userprofile/me";
String authoStr = token;
HashMap<String, String> HeaderMap = new HashMap();
HeaderMap.put("Content-Type", "application/x-www-form-urlencoded");
HeaderMap.put("Authorization", authoStr);
HeaderMap.put("accept", "*/*");
HeaderMap.put("connection", "Keep-Alive");
HeaderMap.put("appkey", "676a5c4adf8dd659219cb2a0");
// do request get
userInfoJson = HttpJavaUtil.doGet(url, HeaderMap);
System.out.println(userInfoJson);

View File

@ -0,0 +1,74 @@
package com.awspaas.user.apps.integration.oauth;
import org.apache.commons.codec.binary.Base64;
import java.io.UnsupportedEncodingException;
import java.util.HashMap;
public class AppView {
// Basic testClient:qwertyuio0987654rfg :: Basic ???
static String clientId = "oaprocess";
static String clientSecret = "qwer1234";
// http://cs.idm.yili.com:7777/ms_oauth/oauth2/endpoints/oauthservice/tokens?redirect_uri=http://192.168.88.100:8080/ecs-console/&grant_type=authorization_code&code=
// 获取授权Token接口(authorization_code模式)
public String getTokens(String redirect_uri, String code) {
String tokenJson = "";
//https://ycsb-priv-gw-uat.digitalyili.com/idm/ms_oauth/oauth2/endpoints/oauthservice/tokens
String url = "https://ycsb-priv-gw-uat.digitalyili.com/idm/ms_oauth/oauth2/endpoints/oauthservice/tokens?" + "redirect_uri="
+ redirect_uri + "&grant_type=authorization_code&code=" + code;
String authoStr = geAuthorization(clientId, clientSecret);
HashMap<String, String> HeaderMap = new HashMap();
//HeaderMap.put("Content-Type", "application/x-www-form-urlencoded");
HeaderMap.put("grant_type","authorization_code");
HeaderMap.put("Authorization", authoStr);
HeaderMap.put("appkey", "676a5c4adf8dd659219cb2a0");
//HeaderMap.put("accept", "*/*");
//HeaderMap.put("connection", "Keep-Alive");
System.out.println("url地址为=============="+url);
System.out.println("参数为=============="+HeaderMap);
// do request
tokenJson = HttpJavaUtil.doPost(url, "", HeaderMap);
System.out.println(tokenJson);
return tokenJson;
}
public String getUserInfo(String token) {
String userInfoJson = "";
String url = "https://ycsb-priv-gw-uat.digitalyili.com/idm/ms_oauth/resources/userprofile/me";
String authoStr = token;
HashMap<String, String> HeaderMap = new HashMap();
HeaderMap.put("Content-Type", "application/x-www-form-urlencoded");
HeaderMap.put("Authorization", authoStr);
HeaderMap.put("accept", "*/*");
HeaderMap.put("connection", "Keep-Alive");
HeaderMap.put("appkey", "676a5c4adf8dd659219cb2a0");
// do request get
userInfoJson = HttpJavaUtil.doGet(url, HeaderMap);
System.out.println(userInfoJson);
return userInfoJson;
}
public String geAuthorization(String clientId, String clientSecret) {
try {
byte[] key = (clientId + ":" + clientSecret).getBytes("utf-8");
String cc = new String(Base64.encodeBase64(key), "utf-8");
// String cc = new String(java.util.Base64.getEncoder().encode(key), "utf-8");
return "Basic " + cc;
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
return "";
}
}
}

View File

@ -126,15 +126,15 @@ public class OauthLoginView extends AbstractOauth {
}
App app = new App();
String tokens = app.getTokens("http://10.114.11.135:8088/portal/yiliView.html", redirect_uri);
AppView appview = new AppView();
String tokens = appview.getTokens("http://10.60.143.183:8088/portal/yiliView.html", redirect_uri);
if(StringUtils.isEmpty(tokens)){
logger.error("获取token为空请重新输入登录信息获取code");
return null;
}else {
JSONObject jsonObjects = JSONObject.parseObject(tokens);
String access_token = jsonObjects.getString("access_token");
String userInfo = app.getUserInfo(access_token);
String userInfo = appview.getUserInfo(access_token);
if (StringUtils.isNotEmpty(userInfo)){
JSONObject json = JSONObject.parseObject(userInfo);

View File

@ -663,12 +663,9 @@ public class TaskController {
// }
String appendHtml=null;
System.out.println("substring===="+substring);
try {
boolean containsSpan = substring.matches(".*<span[^>]*>.*");
System.out.println("containsSpan=========="+containsSpan);
//如果判断字符串没有span标签则通过系统插入span标签
if(!containsSpan){
System.out.println("");
Document doc = Jsoup.parse(substring);
// 获取所有的p标签
Elements pTags = doc.select("p");
@ -686,9 +683,7 @@ public class TaskController {
}
}
appendHtml=doc.body().html();
}else{
appendHtml=substring;
}
System.out.println("appendHtml="+appendHtml);
} catch (Exception e) {
e.printStackTrace();
}