跳转至

设计时脚本调试器(DebugController)

设计时脚本调试器接口:提供 iScript 脚本调试会话的开启/关闭、调试端口查询、当前调试应用查询,以及供调试器选择调试对象(应用、模块、表单、视图、流程、统计图、任务、API、菜单、小工具、Excel 导入配置)的列表查询;同时管理调试器监控标签(watch label)的增删查与脚本标签字典获取。

  • 接口类型:REST 资源
  • 基址${myapps.context-path.designer:}/api/debug(类级 @RequestMappingproduces = APPLICATION_JSON_VALUE
  • Tag:设计时-脚本调试

公共说明

  • 鉴权:是(需 designerToken)。DebugController 标注为 @Component 并继承 AbstractDesignTimeController(基类为 @RestController),通过 Security.getDesignerIdFromToken(request) 从 designerToken JWT 中解析设计器用户。鉴权机制详见 index.md「鉴权说明」。
  • 路径变量{applicationId}{moduleId} 均为**明文设计时 ID**(与 designer 其他控制器一致)。
  • 响应:统一 Resource(见 ../index.md「统一响应结构」)。成功 errcode=0;列表/查询类接口在异常时通常返回 errcode=500errmsg 为异常信息。
  • HTTP 方法:受 CommonSecurityFilter 限制,仅允许 GET/POST/HEAD/OPTIONS
  • 调试会话状态setDebuggetDebugerPortkillDebugRunnercurrentDebugAppaddWatchLabelremoveWatchLabelcleanWatchLabelgetAllWatchLabel 等接口在结束时会调用 JavaScriptFactory.cleanupDebugThreadLock(),以避免调试器被标记为当前线程占用。

1. 终止所有调试运行器

清理所有应用的调试会话并向各调试应用发送关闭调试消息,最后终止调试运行器并清理线程锁。

  • 接口类型:REST 资源
  • 请求方式POST
  • 请求路径/killDebugRunner(完整:{designer-context}/api/debug/killDebugRunner
  • 鉴权:是(需 designerToken)
  • Tag:设计时-脚本调试

请求参数

无。

请求示例

POST /api/debug/killDebugRunner HTTP/1.1

响应

结构:统一 Resource(见 ../index.md「统一响应结构」)。 datanull

{ "errcode": 0, "errmsg": "ok", "data": null, "errors": null }

2. 设置调试模式

为指定应用开启或关闭调试模式,返回调试器监听端口,并通过 JMS 通知运行时(QUEUE_MESSAGE_DEBUG)。

  • 接口类型:REST 资源
  • 请求方式POST
  • 请求路径/setDebug(完整:{designer-context}/api/debug/setDebug
  • 鉴权:是(需 designerToken)
  • Tag:设计时-脚本调试

请求参数

参数名 位置 类型 必填 说明
mode query boolean true=开启调试;false=关闭调试
appid query string 调试应用Id

请求示例

POST /api/debug/setDebug?mode=true&appid=<applicationId> HTTP/1.1

响应

dataint,调试器监听端口。

{ "errcode": 0, "errmsg": "ok", "data": 18888, "errors": null }

3. 获取调试器端口

按应用Id查询当前调试器监听端口。

  • 接口类型:REST 资源
  • 请求方式GET
  • 请求路径/getDebugerPort(完整:{designer-context}/api/debug/getDebugerPort
  • 鉴权:是(需 designerToken)
  • Tag:设计时-脚本调试

请求参数

参数名 位置 类型 必填 说明
appid query string 调试应用Id

请求示例

GET /api/debug/getDebugerPort?appid=<applicationId> HTTP/1.1

响应

dataint,调试器监听端口。

{ "errcode": 0, "errmsg": "ok", "data": 18888, "errors": null }

4. 获取应用列表(调试器简版)

查询全部应用(不区分类型/激活状态),用于调试器选择调试应用,返回结构包装在 applications 字段下。与 ### 15 不同的接口(### 15 会按 type=0activated=true 过滤,且不包装字段名)。

  • 接口类型:REST 资源
  • 请求方式GET
  • 请求路径/getApplications(完整:{designer-context}/api/debug/getApplications
  • 鉴权:是(需 designerToken)
  • Tag:设计时-脚本调试

请求参数

无。

请求示例

GET /api/debug/getApplications HTTP/1.1

响应

dataJSONObject,结构 { "applications": List<Application> }

{
  "errcode": 0,
  "errmsg": "ok",
  "data": {
    "applications": [
      { "id": "...", "name": "应用名称", "...": "..." }
    ]
  },
  "errors": null
}

5. 获取 Excel 导入配置列表

按应用分页查询 Excel 导入映射配置列表(可按名字查询),供调试器选择。

  • 接口类型:REST 资源
  • 请求方式GET
  • 请求路径/applications/{applicationId}/excelconfigs(完整:{designer-context}/api/debug/applications/{applicationId}/excelconfigs
  • 鉴权:是(需 designerToken)
  • Tag:设计时-脚本调试

请求参数

参数名 位置 类型 必填 说明
applicationId path string 软件Id
name query string 按名称查询关键字
pageNo query string 当前页数(缺省 1
linesPerPage query string 每页行数(缺省 10

说明:pageNo/linesPerPage 形参未标注 @RequestParam,由 Spring MVC 按请求参数绑定,故可缺省。

请求示例

GET /api/debug/applications/{applicationId}/excelconfigs?name=&pageNo=1&linesPerPage=10 HTTP/1.1

响应

dataCollection<IMPMappingConfigVO>(来自 DataPackage.getDatas(),仅返回当前页数据,无分页元字段)。

{
  "errcode": 0,
  "errmsg": "ok",
  "data": [
    { "id": "...", "name": "导入配置名称", "...": "..." }
  ],
  "errors": null
}
失败示例
{ "errcode": 500, "errmsg": "<异常信息>", "data": null, "errors": null }


6. 获取菜单列表

按应用与是否移动端递归获取菜单树,仅返回 linkType="07"(脚本类型)的菜单,供调试器选择。

  • 接口类型:REST 资源
  • 请求方式GET
  • 请求路径/applications/{applicationId}/menus(完整:{designer-context}/api/debug/applications/{applicationId}/menus
  • 鉴权:是(需 designerToken)
  • Tag:设计时-脚本调试

请求参数

参数名 位置 类型 必填 说明
applicationId path string 软件Id
isMobile query boolean 是否移动端菜单(true=移动端,false=PC 端)
parentId query string 父级Id(缺省以 applicationId 作为根)

请求示例

GET /api/debug/applications/{applicationId}/menus?isMobile=false HTTP/1.1

响应

dataList<ResourceVO>(仅含脚本类菜单,递归扁平化后的全部层级)。

{
  "errcode": 0,
  "errmsg": "ok",
  "data": [
    { "id": "...", "name": "菜单名称", "linkType": "07", "...": "..." }
  ],
  "errors": null
}
失败示例
{ "errcode": 500, "errmsg": "<异常信息>", "data": null, "errors": null }


7. 获取小工具列表

查询指定应用下的全部小工具(PageWidget),供调试器选择。

  • 接口类型:REST 资源
  • 请求方式GET
  • 请求路径/applications/{applicationId}/widgets(完整:{designer-context}/api/debug/applications/{applicationId}/widgets
  • 鉴权:是(需 designerToken)
  • Tag:设计时-脚本调试

请求参数

参数名 位置 类型 必填 说明
applicationId path string 软件Id

请求示例

GET /api/debug/applications/{applicationId}/widgets HTTP/1.1

响应

dataCollection<PageWidget>(一次性返回全部,未分页)。

{
  "errcode": 0,
  "errmsg": "ok",
  "data": [
    { "id": "...", "name": "小工具名称", "...": "..." }
  ],
  "errors": null
}
失败示例
{ "errcode": 500, "errmsg": "<异常信息>", "data": null, "errors": null }


8. 根据上级获取模块列表

按应用与父级Id查询其直接子模块列表(含 hasChild 标记,便于前端树渲染)。

  • 接口类型:REST 资源
  • 请求方式GET
  • 请求路径/applications/{applicationId}/modules(完整:{designer-context}/api/debug/applications/{applicationId}/modules
  • 鉴权:是(需 designerToken)
  • Tag:设计时-脚本调试

请求参数

参数名 位置 类型 必填 说明
applicationId path string 软件Id
parentId query string 上级Id(缺省以 applicationId 作为根)

请求示例

GET /api/debug/applications/{applicationId}/modules?parentId=<parentId> HTTP/1.1

响应

dataList<Map>,每项 {id, name, superior, uri, applicationId, hasChild}

注:hasChild 字段语义反向:有子集时为 false,无子集时为 true(源码注释:配合前端渲染数据)。

{
  "errcode": 0,
  "errmsg": "ok",
  "data": [
    { "id": "...", "name": "模块名称", "superior": "...", "uri": "...", "applicationId": "...", "hasChild": false }
  ],
  "errors": null
}
失败示例
{ "errcode": 500, "errmsg": "<异常信息>", "data": null, "errors": null }


9. 获取定时任务列表

查询指定应用下的全部定时任务,供调试器选择。

  • 接口类型:REST 资源
  • 请求方式GET
  • 请求路径/applications/{applicationId}/tasks(完整:{designer-context}/api/debug/applications/{applicationId}/tasks
  • 鉴权:是(需 designerToken)
  • Tag:设计时-脚本调试

请求参数

参数名 位置 类型 必填 说明
applicationId path string 软件Id

请求示例

GET /api/debug/applications/{applicationId}/tasks HTTP/1.1

响应

dataCollection<Task>(一次性返回全部,未分页)。

{
  "errcode": 0,
  "errmsg": "ok",
  "data": [
    { "id": "...", "name": "任务名称", "...": "..." }
  ],
  "errors": null
}
失败示例
{ "errcode": 500, "errmsg": "<异常信息>", "data": null, "errors": null }


10. 获取 API 列表

查询指定应用下的全部 API 配置,供调试器选择。

  • 接口类型:REST 资源
  • 请求方式GET
  • 请求路径/applications/{applicationId}/apis(完整:{designer-context}/api/debug/applications/{applicationId}/apis
  • 鉴权:是(需 designerToken)
  • Tag:设计时-脚本调试

请求参数

参数名 位置 类型 必填 说明
applicationId path string 软件Id

请求示例

GET /api/debug/applications/{applicationId}/apis HTTP/1.1

响应

dataCollection<ApiConfig>(一次性返回全部,未分页)。

{
  "errcode": 0,
  "errmsg": "ok",
  "data": [
    { "id": "...", "name": "API名称", "...": "..." }
  ],
  "errors": null
}
失败示例
{ "errcode": 500, "errmsg": "<异常信息>", "data": null, "errors": null }


11. 获取表单列表

按应用与模块查询其下的全部表单,供调试器选择。

  • 接口类型:REST 资源
  • 请求方式GET
  • 请求路径/applications/{applicationId}/modules/{moduleId}/forms(完整:{designer-context}/api/debug/applications/{applicationId}/modules/{moduleId}/forms
  • 鉴权:是(需 designerToken)
  • Tag:设计时-脚本调试

请求参数

参数名 位置 类型 必填 说明
applicationId path string 软件Id
moduleId path string 模块Id

请求示例

GET /api/debug/applications/{applicationId}/modules/{moduleId}/forms HTTP/1.1

响应

dataCollection<Form>(一次性返回全部,未分页)。

{
  "errcode": 0,
  "errmsg": "ok",
  "data": [
    { "id": "...", "name": "表单名称", "...": "..." }
  ],
  "errors": null
}
失败示例
{ "errcode": 500, "errmsg": "<异常信息>", "data": null, "errors": null }


12. 获取视图列表

按应用与模块查询其下的全部视图,供调试器选择。

  • 接口类型:REST 资源
  • 请求方式GET
  • 请求路径/applications/{applicationId}/modules/{moduleId}/views(完整:{designer-context}/api/debug/applications/{applicationId}/modules/{moduleId}/views
  • 鉴权:是(需 designerToken)
  • Tag:设计时-脚本调试

请求参数

参数名 位置 类型 必填 说明
applicationId path string 软件Id
moduleId path string 模块Id

请求示例

GET /api/debug/applications/{applicationId}/modules/{moduleId}/views HTTP/1.1

响应

dataCollection<AbstractView>(一次性返回全部,未分页)。

{
  "errcode": 0,
  "errmsg": "ok",
  "data": [
    { "id": "...", "name": "视图名称", "...": "..." }
  ],
  "errors": null
}
失败示例
{ "errcode": 500, "errmsg": "<异常信息>", "data": null, "errors": null }


13. 获取流程列表

按应用与模块查询其下的全部流程(BillDefi),供调试器选择。

  • 接口类型:REST 资源
  • 请求方式GET
  • 请求路径/applications/{applicationId}/modules/{moduleId}/workflows(完整:{designer-context}/api/debug/applications/{applicationId}/modules/{moduleId}/workflows
  • 鉴权:是(需 designerToken)
  • Tag:设计时-脚本调试

请求参数

参数名 位置 类型 必填 说明
applicationId path string 软件Id
moduleId path string 模块Id

请求示例

GET /api/debug/applications/{applicationId}/modules/{moduleId}/workflows HTTP/1.1

响应

dataCollection<BillDefiVO>(一次性返回全部,未分页)。

{
  "errcode": 0,
  "errmsg": "ok",
  "data": [
    { "id": "...", "name": "流程名称", "...": "..." }
  ],
  "errors": null
}
失败示例
{ "errcode": 500, "errmsg": "<异常信息>", "data": null, "errors": null }


14. 获取统计图列表

按应用与模块查询其下的全部统计图,供调试器选择。

  • 接口类型:REST 资源
  • 请求方式GET
  • 请求路径/applications/{applicationId}/modules/{moduleId}/charts(完整:{designer-context}/api/debug/applications/{applicationId}/modules/{moduleId}/charts
  • 鉴权:是(需 designerToken)
  • Tag:设计时-脚本调试

请求参数

参数名 位置 类型 必填 说明
applicationId path string 软件Id
moduleId path string 模块Id

请求示例

GET /api/debug/applications/{applicationId}/modules/{moduleId}/charts HTTP/1.1

响应

dataCollection<Chart>(一次性返回全部,未分页)。

{
  "errcode": 0,
  "errmsg": "ok",
  "data": [
    { "id": "...", "name": "统计图名称", "...": "..." }
  ],
  "errors": null
}
失败示例
{ "errcode": 500, "errmsg": "<异常信息>", "data": null, "errors": null }


15. 获取软件列表

查询全部应用并按 type=0activated=true 过滤,返回**已激活的正式软件**列表。

该端点与 ### 4(/getApplications)不同:### 4 不做过滤并包装在 applications 字段下;本端点按条件过滤并直接返回数组,且支持 searchword/type/pageNo/linesPerPage 形参(但当前实现未实际使用这些参数,仅按上述固定条件过滤)。

  • 接口类型:REST 资源
  • 请求方式GET
  • 请求路径/applications(完整:{designer-context}/api/debug/applications
  • 鉴权:是(需 designerToken)
  • Tag:设计时-脚本调试

请求参数

参数名 位置 类型 必填 说明
searchword query string 查询关键字(声明但未实际使用)
type query int 类型(声明但未实际使用,缺省 0
pageNo query int 当前页数(声明但未实际使用,缺省 1
linesPerPage query int 每页行数(声明但未实际使用,缺省 10

请求示例

GET /api/debug/applications?searchword=&type=0&pageNo=1&linesPerPage=10 HTTP/1.1

响应

dataList<Application>(已过滤:type=0activated=true)。

{
  "errcode": 0,
  "errmsg": "ok",
  "data": [
    { "id": "...", "name": "软件名称", "type": 0, "activated": true, "...": "..." }
  ],
  "errors": null
}
失败示例
{ "errcode": 500, "errmsg": "<异常信息>", "data": null, "errors": null }


16. 获取当前调试应用

查询当前处于调试会话中的应用对象(取调试应用Id列表的第一项)。若无调试会话则返回 data: null

  • 接口类型:REST 资源
  • 请求方式GET
  • 请求路径/currentDebugApp(完整:{designer-context}/api/debug/currentDebugApp
  • 鉴权:是(需 designerToken)
  • Tag:设计时-脚本调试

请求参数

无。

请求示例

GET /api/debug/currentDebugApp HTTP/1.1

响应

dataApplication 完整对象;无调试会话时为 null

{ "errcode": 0, "errmsg": "ok", "data": { "id": "...", "name": "...", "...": "..." }, "errors": null }
失败示例
{ "errcode": 500, "errmsg": "<异常信息>", "data": null, "errors": null }


17. 添加监控标签

向脚本调试器添加一个监控标签(watch label),用于在调试会话中追踪特定变量/表达式。

  • 接口类型:REST 资源
  • 请求方式POST
  • 请求路径/addWatchLabel(完整:{designer-context}/api/debug/addWatchLabel
  • 鉴权:是(需 designerToken)
  • Tag:设计时-脚本调试

请求参数

参数名 位置 类型 必填 说明
label body string 监控标签内容(原始字符串,非 JSON)

请求体

<监控标签字符串>

响应

datanull(成功;入参为空时不执行添加,仍返回成功)。

{ "errcode": 0, "errmsg": "ok", "data": null, "errors": null }

18. 移除监控标签

从脚本调试器移除一个监控标签。

  • 接口类型:REST 资源
  • 请求方式POST
  • 请求路径/removeWatchLabel(完整:{designer-context}/api/debug/removeWatchLabel
  • 鉴权:是(需 designerToken)
  • Tag:设计时-脚本调试

请求参数

参数名 位置 类型 必填 说明
label body string 监控标签内容(原始字符串,非 JSON)

请求体

<监控标签字符串>

响应

datanull(成功;入参为空时不执行移除,仍返回成功)。

{ "errcode": 0, "errmsg": "ok", "data": null, "errors": null }

19. 获取脚本标签字典

返回脚本标签(ScriptLabel.TYPE)的字典结构:按标签类别(内部子类)分组,每类下为 字段名 → 字段值 映射,供调试器展示可选标签。

  • 接口类型:REST 资源
  • 请求方式GET
  • 请求路径/watchTags(完整:{designer-context}/api/debug/watchTags
  • 鉴权:是(需 designerToken)
  • Tag:设计时-脚本调试

请求参数

无。

请求示例

GET /api/debug/watchTags HTTP/1.1

响应

dataMap<String, Map<String, String>>(类别名 → 字段名 → 字段值)。

{
  "errcode": 0,
  "errmsg": "ok",
  "data": {
    "<类别名>": {
      "<字段名>": "<字段值>"
    }
  },
  "errors": null
}

20. 清空监控标签

清空脚本调试器的全部监控标签。

  • 接口类型:REST 资源
  • 请求方式POST
  • 请求路径/cleanWatchLabel(完整:{designer-context}/api/debug/cleanWatchLabel
  • 鉴权:是(需 designerToken)
  • Tag:设计时-脚本调试

请求参数

无。

请求示例

POST /api/debug/cleanWatchLabel HTTP/1.1

响应

datanull

{ "errcode": 0, "errmsg": "ok", "data": null, "errors": null }

21. 获取全部监控标签

查询脚本调试器当前的全部监控标签,可按关键字过滤(包含匹配)。

  • 接口类型:REST 资源
  • 请求方式GET
  • 请求路径/getAllWatchLabel(完整:{designer-context}/api/debug/getAllWatchLabel
  • 鉴权:是(需 designerToken)
  • Tag:设计时-脚本调试

请求参数

参数名 位置 类型 必填 说明
label query string 过滤关键字(按 contains 匹配;缺省返回全部)

请求示例

GET /api/debug/getAllWatchLabel?label= HTTP/1.1

响应

data:未传 label 时为 HashSet<String>(全部监控标签);传 label 时为 List<String>(按包含匹配过滤后的列表)。

{
  "errcode": 0,
  "errmsg": "ok",
  "data": [ "<监控标签1>", "<监控标签2>" ],
  "errors": null
}