页面树结构
转至元数据结尾
转至元数据起始


获取smartbi流程待办数据

package cn.com.smartbi.workflow;

import smartbi.net.sf.json.JSONArray;
import smartbi.net.sf.json.JSONObject;
import smartbi.sdk.ClientConnector;
import smartbi.sdk.InvokeResult;
import smartbi.sdk.RemoteException;

public class WorkflowAPITest {

	public static void main(String[] args) {

		String Smartbi_URL = "http://10.10.202.17:19700/smartbi";
		ClientConnector conn = new ClientConnector(Smartbi_URL);
		InvokeResult result = null;
		try {
			// 先以指定用户登录smartbi
			boolean ret = conn.open("admin", "admin");
			if (ret) {
				// 获取待办数量
				// {"retCode":0,"result":{"startCount":31,"doneCount":11,"todoCount":14},"duration":10}
				result = conn.remoteInvoke("WorkflowModule", "allCount", new Object[] { null });
				if ("0".equals(result.getOriginalResult().optString("retCode"))) {
					JSONObject json = (JSONObject) result.getResult();
					System.out.println("待办数:" + json.optInt("todoCount"));
					System.out.println("已办数:" + json.optInt("doneCount"));
					System.out.println("我的发起数:" + json.optInt("startCount"));
				}

				// 搜索关键字
				String keyword = "";
				// 开始页码
				int pageNo = 0;
				// 每页记录数
				int pageSize = Integer.MAX_VALUE;

				// 获取待办列表
				result = conn.remoteInvoke("WorkflowModule", "todoList", new Object[] { keyword, pageNo, pageSize });
				if ("0".equals(result.getOriginalResult().optString("retCode"))) {
					JSONArray json = (JSONArray) result.getResult();
					if (json.length() > 0) {
						System.out.println("待办:" + json.get(0).toString());
					}
				}

				// 获取已办
				result = conn.remoteInvoke("WorkflowModule", "doneList", new Object[] { keyword, pageNo, pageSize });
				if ("0".equals(result.getOriginalResult().optString("retCode"))) {
					JSONArray json = (JSONArray) result.getResult();
					if (json.length() > 0) {
						System.out.println("已办:" + json.get(0).toString());
					}
				}

				// 获取我的发起
				result = conn.remoteInvoke("WorkflowModule", "startList", new Object[] { keyword, pageNo, pageSize });
				if ("0".equals(result.getOriginalResult().optString("retCode"))) {
					JSONArray json = (JSONArray) result.getResult();
					if (json.length() > 0) {
						System.out.println("我的发起办:" + json.get(0).toString());
					}
				}
			}
		} catch (RemoteException e) {
			e.printStackTrace();
		} finally {
			conn.close();
		}
	}

}

// 待办数据返回结果说明
{
    "activity": "节点名称",
    "endDate": "结束时间",
    "subject": "标题",
    "instanceId": "流程实例ID",
    "processKey": "流程模板ID",
    "createDate": "创建时间",
    "owner": "拥有者",
    "assignee": "处理人",
    "nextTask": "下一节点",
    "taskId": "任务ID",
    "status": "节点状态"
}

注意事项

外部URL打开待办处理界面

注意事项

  • 注意跨域问题。


  • 无标签