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

正在查看旧版本。 查看 当前版本.

与当前比较 查看页面历史

版本 1 下一个 »

获取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();
		}
	}

}

// 待办数据返回结果
{
    "allAssignee": "",
    "activity": "用户任务",
    "endDate": "2021-06-08 10:35:45",
    "subject": "填报流程测试-管理员-2021-06-08 10:35:08",
    "modifyReport": false,
    "currentTask": null,
    "reportType": "",
    "path": "",
    "instanceId": "277727",
    "operations": null,
    "pageType": "",
    "ownerName": "管理员",
    "jumpNode": null,
    "processId": "",
    "processName": "",
    "draft": false,
    "define": "",
    "processKey": "Process1623119005447",
    "recallName": "",
    "reportInfo": null,
    "state": "",
    "createDate": "2021-06-08 10:35:08",
    "owner": "ADMIN",
    "currentUserName": "",
    "reportId": "",
    "canSave": false,
    "nodesState": null,
    "processDesc": "",
    "history": false,
    "nextTaskNeedToChooseHandle": false,
    "url": false,
    "currentUser": "",
    "subProcess": false,
    "hasRecallOperation": false,
    "commentRequired": false,
    "comment": "",
    "taskName": "",
    "assignee": "管理员",
    "nextTask": null,
    "taskId": "277816",
    "status": "用户任务"
}

注意事项:


  • 无标签