流程监控(FlowMonitorController)¶
流程监控(后台管理视角)接口:流程实例列表查询(分页+多条件过滤)、流程实例历史+当前节点合并查询、单个流程实例详情(含干预信息)。是流程监控页面的查询入口。
- 接口类型:REST 资源(
@Controller继承AbstractRuntimeController;类级无produces声明,但方法返回类型为Resource/ResponseEntity<Resource>,由 Spring Jackson 序列化为 JSON,实际接口类型按返回类型判定为 REST 资源,而非 HTML 页面视图,据源码) - 基址:
${myapps.context-path.runtime:}/api/runtime/{applicationId}/monitors/workflows - Tag:流程监控模块
公共说明¶
- 鉴权(据源码):类级基址位于
/api/runtime/**,在RestSecurityHandlerInterceptor覆盖范围内,且不在豁免名单(豁免仅覆盖/api/runtime/login.*、/api/runtime/dingding/authlogin、/api/runtime/synchronization.*等,详见 login.md「公共说明 · 鉴权」)。拦截器走Security.getUserIdFromToken(request),未取到再尝试Security.getDebugUserIdFromToken(request),两者皆无则拒绝。故需 accessToken(或 debugToken),可通过 Cookie / 请求头 / query 参数任一方式传递。控制器内getUser()(继承自AbstractRuntimeController)必须能取到非空WebUser,否则在DesUtil.decryptTextByUserId(applicationId, getUser().getId())时即抛 NPE。 - 路径变量
{applicationId}:必填,经 DES 加密(按当前执行用户密钥),服务端在方法入口处DesUtil.decryptTextByUserId(applicationId, getUser().getId())解密。 - 响应结构:本控制器的响应**非**统一
Resource直接返回—— #1 doList返回ResponseEntity<Resource>,但body由服务层IFlowMonitorService.getFlowList(...)提供(结构由服务层决定,通常为分页 JSON),失败走new Resource(500,"server innernal error")+ HTTP 500。#2 getHistorys/#3 getInstanceInfo返回Resource(success(...)/error(500, ...)),结构与统一Resource一致(见 ../index.md「统一响应结构」)。- HTTP 状态码:方法级
@ResponseStatus(HttpStatus.OK)。#1 doList失败时显式返回HttpStatus.INTERNAL_SERVER_ERROR;#2/#3失败时业务错误码errcode=500由控制器内 try/catch 包装,HTTP 仍为 200(@ResponseStatus生效)。AbstractRuntimeController的全局异常处理亦覆盖本控制器。
1. 获取流程实例列表¶
按企业域、流程名、状态、发起人、首次处理时间区间、摘要、发起人部门、流程分类索引等多条件分页查询流程实例。
- 接口类型:REST 资源
- 请求方式:
GET - 请求路径:
/instances(完整:{runtime-context}/api/runtime/{applicationId}/monitors/workflows/instances) - 鉴权:是(需 accessToken,据源码)
- Tag:流程监控模块
请求参数¶
| 参数名 | 位置 | 类型 | 必填 | 说明 |
|---|---|---|---|---|
| applicationId | path | string | 是 | 应用Id(DES 加密密文) |
| domainId | query | string | 是 | 企业域Id |
| _currpage | query | string | 是 | 当前页 |
| _pagelines | query | string | 是 | 每页显示条数 |
| _orderby | query | string | 否 | 排序字段,默认空 |
| _flowName | query | string | 否 | 流程名称,默认空 |
| _status | query | string | 是 | 流程状态 |
| _flowIndex | query | string | 是 | 流程分类索引 |
| _initiator | query | string | 否 | 发起人Id,默认空 |
| _firstProcessTimeBegin | query | string | 否 | 首次处理时间起(含),默认空 |
| _firstProcessTimeEnd | query | string | 否 | 首次处理时间止(含),默认空 |
| _summary | query | string | 否 | 摘要关键字,默认空 |
| _initiatorDeptId | query | string | 否 | 发起人部门Id,默认空 |
请求示例¶
GET /api/runtime/__APPID__/monitors/workflows/instances?domainId=__DOMAINID__&_currpage=1&_pagelines=20&_status=running&_flowIndex=0 HTTP/1.1
Cookie: accessToken=eyJhbGciOiJIUzI1NiJ9...
响应¶
结构:ResponseEntity<Resource>,body 由服务层 IFlowMonitorService.getFlowList(applicationId, json) 返回(结构由服务层决定,通常为分页 JSON:含 datas/pageCount/rowCount 等)。
成功示例:
{
"errcode": 0,
"errmsg": "ok",
"data": {
"datas": [
{ "id": "__INSTANCEID__", "flowName": "请假流程", "status": "running", "initiatorName": "张三" }
],
"pageCount": 5,
"rowCount": 100
},
"errors": null
}
失败示例(HTTP 500):
说明:源码文案为
"server innernal error"(含拼写错误),据源码如实记录。
2. 获取流程历史¶
按流程实例 Id 查询流程审批历史(合并历史节点 + 当前节点)。
- 接口类型:REST 资源
- 请求方式:
GET - 请求路径:
/instances/{instanceId}/historys(完整:{runtime-context}/api/runtime/{applicationId}/monitors/workflows/instances/{instanceId}/historys) - 鉴权:是(需 accessToken,据源码)
- Tag:流程监控模块
请求参数¶
| 参数名 | 位置 | 类型 | 必填 | 说明 |
|---|---|---|---|---|
| applicationId | path | string | 是 | 应用Id(DES 加密密文) |
| instanceId | path | string | 是 | 流程实例Id |
请求示例¶
GET /api/runtime/__APPID__/monitors/workflows/instances/__INSTANCEID__/historys HTTP/1.1
Cookie: accessToken=eyJhbGciOiJIUzI1NiJ9...
响应¶
结构:统一 Resource(见 ../index.md「统一响应结构」)。
data:List<FlowHistoryVO>,历史节点与当前节点的合并集合(his.addAll(cur)),每条记录含 startNodeName/targetNodeName/auditorName/agentAuditorName/attitude 等。
成功示例:
{
"errcode": 0,
"errmsg": "success",
"data": [
{
"startNodeName": "发起",
"targetNodeName": "部门经理审批",
"auditorName": "张三",
"agentAuditorName": null,
"attitude": "同意"
}
],
"errors": null
}
失败示例:
3. 获取流程实例信息¶
按流程实例 Id 查询单个流程实例详情(含干预信息字段,供监控/干预页面渲染)。
- 接口类型:REST 资源
- 请求方式:
GET - 请求路径:
/instances/{id}(完整:{runtime-context}/api/runtime/{applicationId}/monitors/workflows/instances/{id}) - 鉴权:是(需 accessToken,据源码)
- Tag:流程监控模块
请求参数¶
| 参数名 | 位置 | 类型 | 必填 | 说明 |
|---|---|---|---|---|
| applicationId | path | string | 是 | 应用Id(DES 加密密文) |
| id | path | string | 是 | 流程实例Id |
请求示例¶
GET /api/runtime/__APPID__/monitors/workflows/instances/__INSTANCEID__ HTTP/1.1
Cookie: accessToken=eyJhbGciOiJIUzI1NiJ9...
响应¶
结构:统一 Resource。
data:FlowInterventionVO,流程实例干预视图对象(含实例基本信息、当前节点、审批人、可干预操作等,由 IFlowMonitorService.getInstance 返回)。
成功示例:
{
"errcode": 0,
"errmsg": "success",
"data": {
"id": "__INSTANCEID__",
"flowName": "请假流程",
"status": "running",
"currentNodeName": "部门经理审批",
"auditorName": "张三"
},
"errors": null
}
失败示例: