Runtime 模块 API¶
Runtime 模块是 MyApps 平台的**生产运行时**,负责流程实例的执行、查询与历史记录管理。该模块默认运行在 8083 端口,对外提供 REST 集成 API,基址为 /api/rest 和 /rest。
本索引列出 Runtime 模块已文档化的 REST 控制器,合计 315 个端点(36 个 /rest/ 集成 API + 22 个登录/监控域 + 19 个文档/评论域 + 28 个表单/视图域 + 42 个用户域 + 14 个组织/详情/字段域 + 33 个工作流执行域 + 22 个操作(Activity)执行域 + 24 个流程监控/统计域 + 29 个杂项小控制器域 + 29 个非 /api/runtime 与文件上传域 + 17 个移动端 /runtime/app 域)。
已文档化控制器¶
| 文件 | 中文名 | 基址 | 端点数 |
|---|---|---|---|
access-token.md |
AccessTokenController | /api/rest、/rest |
1 |
workflow-execute.md |
WorkflowExecuteController | /api/rest/bpm/runtime |
19 |
workflow-query.md |
WorkflowQueryController | /api/rest/bpm/query |
10 |
workflow-history.md |
WorkflowHistoryController | /api/rest/bpm |
6 |
login.md |
LoginController(登录模块) | ${myapps.context-path.runtime:}(根) |
18 |
jamon.md |
JamonController(性能监控 JAMon) | ${myapps.context-path.runtime:}/api/authtime |
2 |
script-log-sse.md |
ScriptLogSseController(脚本日志 SSE) | ${myapps.context-path.runtime:}/console |
2 |
document.md |
DocumentController(文档/表单数据) | ${myapps.context-path.runtime:}/api/runtime/{applicationId} |
12 |
comment.md |
CommentController(文档评论/意见) | ${myapps.context-path.runtime:}/api/runtime/{applicationId} |
7 |
form.md |
FormController(表单执行) | ${myapps.context-path.runtime:}/api/runtime/{applicationId} |
7 |
form-helper.md |
FormHelperController(表单辅助) | ${myapps.context-path.runtime:}/api/runtime |
5 |
view.md |
ViewController(视图执行) | ${myapps.context-path.runtime:}/api/runtime/{applicationId} |
9 |
view-helper.md |
ViewHelperController(视图辅助) | ${myapps.context-path.runtime:}/api/runtime |
7 |
user.md |
UserController(用户/签章/常用意见) | ${myapps.context-path.runtime:}/api/runtime/users |
18 |
user-selectbox.md |
UserSelectboxController(用户选择框) | ${myapps.context-path.runtime:}/api/runtime |
15 |
user-setup.md |
UserSetupController(个人设置) | ${myapps.context-path.runtime:}/api/runtime |
9 |
department.md |
DepartmentController(部门) | ${myapps.context-path.runtime:}/api/runtime/department |
1 |
department-selectbox.md |
DepartmentSelectboxController(部门选择框) | ${myapps.context-path.runtime:}/api/runtime/{applicationId}/departments/selectbox |
4 |
domain.md |
DomainController(企业域) | ${myapps.context-path.runtime:}/api/runtime(同位 /api/portal、/api/authtime) |
3 |
detail.md |
DetailController(系统辅助) | ${myapps.context-path.runtime:}/api |
3 |
suggest-field.md |
SuggestFieldController(智能搜索提示框) | ${myapps.context-path.runtime:}/api |
1 |
word-field.md |
WordFieldController(Word 文档字段) | ${myapps.context-path.runtime:}/api/runtime/forms/wordfield |
2 |
workflow-runtime.md |
WorkflowController(工作流执行) | ${myapps.context-path.runtime:}/api/runtime/{applicationId}(同位 /api/authtime/{applicationId}) |
33 |
activity.md |
ActivityController(操作/Activity 执行) | ${myapps.context-path.runtime:}/api/runtime |
22 |
flow-center-runtime.md |
FlowCenterRunTimeController(流程中心运行时) | ${myapps.context-path.runtime:}/api/runtime |
12 |
flow-statistics.md |
FlowStatisticsController(流程统计) | ${myapps.context-path.runtime:}/api/runtime/{applicationId}/monitors/workflows/statistics |
8 |
flow-monitor.md |
FlowMonitorController(流程监控) | ${myapps.context-path.runtime:}/api/runtime/{applicationId}/monitors/workflows |
3 |
node-monitor.md |
NodeMonitorController(节点监控) | ${myapps.context-path.runtime:}/api/runtime/{applicationId}/monitors/workflows |
1 |
page-widget.md |
PageWidgetController(页面小工具/首页 Widget) | ${myapps.context-path.runtime:}/api/runtime |
7 |
report.md |
ReportController(报表执行) | ${myapps.context-path.runtime:}/api/runtime |
9 |
application.md |
ApplicationController(应用执行,REST 版) | ${myapps.context-path.runtime:}/api/runtime |
2 |
big-screen-runtime.md |
BigScreenRuntimeController(大屏运行时) | ${myapps.context-path.runtime:}/api/runtime/{applicationId} |
2 |
chart.md |
ChartController(统计图执行) | ${myapps.context-path.runtime:}/api/runtime |
2 |
analyzer.md |
AnalyzerController(流程仪表) | ${myapps.context-path.runtime:}/api/runtime/{applicationId} |
1 |
download.md |
DownloadController(文件下载运行时) | ${myapps.context-path.runtime:}/api/runtime |
3 |
excel-import-runtime.md |
ExcelImportRuntimeController(Excel 导入运行时) | ${myapps.context-path.runtime:}/api/runtime |
1 |
menu.md |
MenuController(菜单执行) | ${myapps.context-path.runtime:}/api/runtime/{applicationId} |
1 |
print-runtime.md |
PrintRuntimeController(打印运行时) | ${myapps.context-path.runtime:}/api/runtime |
1 |
file-upload.md |
FileUploadController(表单文件上传执行) | ${myapps.context-path.runtime:}/api/runtime |
7 |
html-edit-upload.md |
HtmlEditUploadController(HTML 编辑器文件上传) | ${myapps.context-path.runtime:}/api/runtime |
1 |
contacts.md |
ContactsController(通讯录) | ${myapps.context-path.runtime:}/api/contacts |
13 |
magic-api.md |
MagicApiController(自定义 API 执行) | ${myapps.context-path.runtime:}(/magic-api/{appName}/**) |
1 |
magic-static.md |
MagicStaticController(应用静态资源) | ${myapps.context-path.runtime:}(/html/{appName}/**、/resources/{appName}/**) |
2 |
tray-service.md |
TrayServiceController(托盘文件下载) | ${myapps.context-path.runtime:}/api/tray/service |
1 |
weixin-service.md |
WeixinServiceController(微信公众号 JSAPI) | ${myapps.context-path.runtime:}/api/portal/weixin/jsapi |
2 |
system-monitor.md |
SystemMonitorController(系统监控) | ${myapps.context-path.runtime:}/api |
2 |
mobile-application.md |
mobile.ApplicationController(移动端应用列表,REST 版) | ${myapps.context-path.runtime:}/runtime/app/applications |
1 |
mobile-contacts.md |
mobile.ContactsController(移动端通讯录) | ${myapps.context-path.runtime:}/runtime/app/contacts |
7 |
mobile-domain.md |
mobile.DomainController(移动端企业域) | ${myapps.context-path.runtime:}/runtime/app |
2 |
mobile-notice.md |
mobile.NoticeController(移动端通知) | ${myapps.context-path.runtime:}/runtime/app/notice |
3 |
mobile-login.md |
mobile.LoginController(移动端登录) | ${myapps.context-path.runtime:}/runtime/app/security |
1 |
mobile-user.md |
mobile.UserController(移动端用户资料) | ${myapps.context-path.runtime:}/runtime/app/users |
3 |
鉴权说明¶
Runtime 模块存在三类鉴权模型,按控制器基址区分:
/rest/集成 API(AccessTokenController、Workflow*Controller):除GET /accessToken端点外,所有端点均需在 query 参数**中携带accessToken进行访问令牌验证。执行用户通过 **query 参数userCode指定(由AbstractRESTController.getUser()解析)。- 登录/监控域控制器(LoginController、JamonController、ScriptLogSseController):基址不在
/rest/下,鉴权方式不同—— LoginController:登录相关端点(/api/runtime/login/**、/api/runtime/dingding/authlogin、/api/debuglogin/**、GET /、GET /api/login)据源码豁免(详见 login.md「公共说明 · 鉴权」);POST /api/runtime/logout需 accessToken。JamonController、ScriptLogSseController:据源码依赖前置 Servlet 过滤器链与控制器内Security.getUserIdFromToken(request)完成登录态校验,需 accessToken(query / header / Cookie 任一)。- 文档/评论/表单/视图域控制器(DocumentController、CommentController、FormController、FormHelperController、ViewController、ViewHelperController、WorkflowController):基址
/api/runtime/**在拦截器覆盖范围内,且不在豁免名单(详见各控制器文档「公共说明 · 鉴权」)。拦截器走Security.getUserIdFromToken(request),所有端点均需 accessToken(或 debugToken),可通过 Cookie / 请求头 / query 参数任一方式传递;执行用户从令牌还原,无userCode参数。表单/视图域的{applicationId}、{viewId}、{docid}等路径变量为 DES 加密密文,服务端按当前用户解密。例外:WorkflowController同时声明/api/runtime/{applicationId}与/api/authtime/{applicationId}两个等价基址(同一路由可经两个前缀访问);经/api/authtime/...访问时不在RestSecurityHandlerInterceptor覆盖范围,登录态校验依赖前置过滤器链与控制器内getUser()(与 JamonController 同机制)。 - 用户域控制器(UserController、UserSelectboxController、UserSetupController):同样基址
/api/runtime/**,鉴权方式与上述文档/表单/视图域一致(accessToken,cookie/header/query 任一),Security.getUserIdFromToken(request)校验。其中带{applicationId}路径变量的端点(UserSelectboxController的部门/角色选择框、UserSetupController的代理系列)该变量为 DES 加密密文;其余端点(个人信息、签章、常用意见、密码、通讯录分组、企业域切换等)无{applicationId}。 - 组织/详情/字段域控制器(DepartmentController、DepartmentSelectboxController、DomainController、DetailController、SuggestFieldController、WordFieldController):基址
/api/runtime/**(或类级/api+ 方法级/runtime/...拼得),鉴权方式同上——accessToken,cookie/header/query 任一,Security.getUserIdFromToken(request)校验;{applicationId}路径变量为 DES 加密密文。例外:DetailController的GET /api/runtime/secrets/{secret}/accessToken(URI 含/accessToken)与GET /api/runtime/{module}/clear(URI 以/clear结尾)据拦截器豁免规则**无需 accessToken**;DomainController另有/api/portal、/api/authtime两个同位基址,不在RestSecurityHandlerInterceptor覆盖范围(仅由通用过滤器链处理)。 - 操作(Activity)执行域控制器(ActivityController):类级基址
${myapps.context-path.runtime:}/api/runtime,所有端点位于/api/runtime/**,鉴权方式同文档/表单/视图域——accessToken,cookie/header/query 任一,Security.getUserIdFromToken(request)校验。{applicationId}、{docId}、{viewId}路径变量经服务端DesUtil.decryptTextByUserId(..., getUser().getId())解密;例外:{formId}与少数端点的{docId}(#5 archive、#9 sign、#16 exportPdf、#17 print)源码未单独 DES 解密,按原值传入服务层;actId/filename在 #11exportExcel中为无注解的 query 参数(Spring 默认必填)。exportExcel(#11)直接写回HttpServletResponse输出流为 Excel 文件下载,不返回 JSONResource。注:DELETE /api/runtime/{applicationId}/forms/{formId}/activities/clear(#8)URI 虽以/clear结尾,但**不在**/api/runtime/{module}/clear豁免模板内,仍需 accessToken(据源码,详见 activity.md)。 - 流程监控/统计域控制器(FlowCenterRunTimeController、FlowMonitorController、FlowStatisticsController、NodeMonitorController):基址
/api/runtime/**(流程中心/api/runtime;流程监控/节点监控/api/runtime/{applicationId}/monitors/workflows;流程统计/api/runtime/{applicationId}/monitors/workflows/statistics),鉴权方式同文档/表单/视图域——accessToken,cookie/header/query 任一,Security.getUserIdFromToken(request)校验。注意:FlowMonitorController/FlowStatisticsController/NodeMonitorController 虽标注为@Controller(非@RestController),但方法返回类型为Resource/ResponseEntity<?>(body 为Resource),实际响应为 JSON 而非 HTML 页面视图,接口类型按 REST 资源记录。{applicationId}路径变量为 DES 加密密文;例外:FlowStatisticsController 的GET /photo(#2)路径无{applicationId}占位段读取但类级@RequestMapping仍含该变量,调用方需在 URL 中填入任意合法 DES 密文以通过路径绑定,服务端不解析;FlowCenterRunTimeController 的 #2/#3/#4(导航类)applicationId通过 query 参数(required=false)传入并按当前用户密钥解密,#6allRead无applicationId入参(由服务端按用户企业域遍历)。FlowStatisticsController 未继承AbstractRuntimeController,自带getUser()。 - 杂项小控制器域(PageWidgetController、ReportController、ApplicationController、BigScreenRuntimeController、ChartController、AnalyzerController、DownloadController、ExcelImportRuntimeController、MenuController、PrintRuntimeController):基址
/api/runtime/**(其中 BigScreenRuntimeController / AnalyzerController / MenuController 类级即${myapps.context-path.runtime:}/api/runtime/{applicationId},其余为${myapps.context-path.runtime:}/api/runtime),鉴权方式同文档/表单/视图域——accessToken,cookie/header/query 任一,Security.getUserIdFromToken(request)校验;{applicationId}路径变量为 DES 加密密文。例外与注意: - ReportController
#3 showJrxmlReport(/api/runtime/{applicationId}/reports/{reportId}/showjrxml)据拦截器uri.endsWith("/showjrxml")豁免,无需 accessToken;控制器内getUser()容忍null(fallback body.userid)。 - ReportController
#9 getCustomColumnsInfos(/api/runtime/getCustomColumnsInfos)据拦截器uri.indexOf("/getCustomColumnsInfos") >= 0豁免,无需 accessToken;但控制器内getUser()不容忍null,实际仍需登录态。 - ReportController 标注
@Controller(非@RestController),类级无produces;方法返回类型多样(String/Resource/void写回HttpServletResponse/List<QueryColumnInfo>直接数组),按各端点返回类型判定 REST 资源;#5 exportExcel、#6 exportPdf为二进制文件下载,非 JSON。 - ApplicationController(REST 版,基址
/api/runtime/applications)未对{applicationId}做 DES 解密(按原值传service.findById);返回前对id/applicationid字段 DES 加密。注意:另有同名移动端 REST 版cn.myapps.runtime.mobile.application.controller.ApplicationController(基址/runtime/app/applications,移动端list.action,返回{status, message, data}JSON),见 mobile-application.md。 - DownloadController
#1 isFileExisted用new Resource(code, msg, null)直接构造,errcode取200/500,与统一响应结构(errcode=0表成功)约定不一致;#2 doFileDownload标注@RequestMapping未限定 method(支持 GET/POST 等所有方法),返回void,二进制文件下载,非 JSON。 - BigScreenRuntimeController
#2 getPageChartData异常时显式error(4001, "配置错误!", null),错误码4001。 - PrintRuntimeController 类级
getUser()允许null(仅当null时跳过 DES 解密),但服务层期望非空WebUser,实际请求仍需 accessToken。 - MenuController 对菜单链接类型为视图/统计图/报表/大屏/OLAP 的
actionContent字段在返回前 DES 加密。 - 文件上传域控制器(FileUploadController、HtmlEditUploadController):方法级路径
/runtime/upload、/runtime/files/*、/runtime/{applicationId}/files/*、/runtime/html/edit/upload拼接类级/api后均位于/api/runtime/**下,鉴权方式同文档/表单/视图域——accessToken,cookie/header/query 任一,Security.getUserIdFromToken(request)校验;{applicationId}路径变量为 DES 加密密文。响应:FileUploadController返回统一Resource;HtmlEditUploadController由控制器直接写回HttpServletResponseJSON 字符串(Content-Type: text/json),非Resource,与 UEditor 编辑器前端协议对接(state=SUCCESS)。 - 非
/api/runtime/**域控制器(ContactsController、MagicApiController、MagicStaticController、TrayServiceController、WeixinServiceController、SystemMonitorController):基址不在/api/runtime/**与/api/rest/bpm/**下,不在RestSecurityHandlerInterceptor覆盖范围;鉴权由RuntimeMvcConfig注册的全局过滤器RuntimeSecurityFilter(URL 模式/*)统一执行——过滤器解析AuthTimeServiceManager.getWebUser(request),取不到登录用户则返回 HTTP401(SSO 模式下重定向到/signon)。所有端点均需 accessToken,可通过 Cookie / 请求头 / query 参数任一方式传递。响应:均**非统一Resource**—— - ContactsController、WeixinServiceController 返回
Map<String, Object>,结构为{ status: 1/0, message: "ok"/"error", data: <数据> }(WeixinServiceController的data经ESAPI.encodeXSS 编码); - MagicApiController 由控制器按
ApiConfig.responseType(json/xml/binary/其他)写回HttpServletResponse,正文为 JSON / XML / 二进制文件下载 / 纯文本之一;控制器内getUser()容忍null,当ApiConfig.status != "public"时响应401,为public时允许匿名执行; - MagicStaticController、TrayServiceController 写回二进制字节流(
application/x-download),文件不存在时返回404; - SystemMonitorController 返回
Map或拼装好的 JSON 字符串(#2为String,需客户端自行JSON.parse)。 - WeixinServiceController 控制器内
getUser()在无登录态且请求来自微信浏览器(User-Agent 含MicroMessenger)时 fallback 到 CookieWEB_USER_COOKIE_KEY,为微信网页内置登录态续接逻辑。 - 移动端
/runtime/app域控制器(mobile.ApplicationController、mobile.ContactsController、mobile.DomainController、mobile.NoticeController、mobile.LoginController、mobile.UserController):基址/runtime/app/**不在RestSecurityHandlerInterceptor覆盖范围,鉴权由RuntimeMvcConfig注册的全局过滤器RuntimeSecurityFilter(URL 模式/*)统一执行——过滤器解析AuthTimeServiceManager.getWebUser(request),取不到登录用户则返回 HTTP401(SSO 模式下重定向到/signon)。除登录端点外,所有端点均需 accessToken,可通过 Cookie / 请求头 / query 参数任一方式传递;控制器内getUserId()通过Security.getUserIdFromToken(request)还原用户 id。例外:mobile.LoginController的/login.action(登录入口,调用方尚无令牌)据源码不读accessToken,按提交的企业域/账号/密码完成认证。响应:均**非统一Resource——所有端点返回Map<String, Object>,结构为{ status: 0/1, message: "ok"/"error", data: <数据> }(0成功、1失败),由mobile.common.controller.BaseController.addActionResult构造,写入前对data做ESAPI.encodeXSS 编码。**注意:mobile.LoginController.login()源码未声明@ResponseBody(与同包其他端点不一致),但据 BaseController 与运行时视图解析配置实际响应仍为 JSON。 - 完整鉴权机制与错误码说明见:顶层 index.md。
待补控制器¶
Runtime 模块下基址 /api/runtime/** 的有端点 REST 控制器已基本覆盖完整;本批另补齐了 6 个非 /api/runtime/** 域(通讯录、自定义 API、应用静态资源、托盘下载、微信 JSAPI、系统监控)、2 个文件上传域控制器,以及 6 个移动端 /runtime/app 域控制器(应用列表、通讯录、企业域、通知、登录、用户资料,均为返回 {status, message, data} JSON 的 REST 资源)。剩余未文档化的为页面视图控制器(@Controller 返回 HTML 视图名,如部分表单/视图渲染入口),将按需在页面视图接口文档中收录。