跳转至

企业域(DomainController)

提供企业域相关的运行时查询:获取当前用户所属企业域、获取全部企业域列表、按企业域 Id 获取企业域详情(含 Logo 路径处理)。

  • 接口类型:REST 资源(@Component + 类级 @RequestMapping(produces = APPLICATION_JSON_VALUE),继承自 @RestControllerAbstractRuntimeController
  • 基址${myapps.context-path.runtime:}/api/runtime(同时映射 ${myapps.context-path.runtime:}/api/portal${myapps.context-path.runtime:}/api/authtime,三个基址下的同名端点等价;本页路径示例以 /api/runtime 为准)
  • Tag:企业域执行模块

公共说明

  • 鉴权(据源码 RuntimeMvcConfig + RestSecurityHandlerInterceptor:基址 /api/runtime/**RestSecurityHandlerInterceptor 覆盖范围内(注册到 /api/runtime/**/api/rest/bpm/**),不在豁免名单(豁免规则详见 login.md「公共说明 · 鉴权」)。拦截器走 Security.getUserIdFromToken(request),未取到再尝试 Security.getDebugUserIdFromToken(request),两者皆无则拒绝访问。所有端点均需 accessToken(或 debugToken),可通过 Cookie / 请求头 / query 参数任一方式传递。

    说明:当请求改走 /api/portal/**/api/authtime/** 同位基址时,不在 RestSecurityHandlerInterceptor 覆盖范围(仅由通用过滤器链处理);接口行为一致。

  • 响应结构
  • 端点 1、2:统一 Resource(见 ../index.md「统一响应结构」)。
  • 端点 3(按 Id 取详情):非统一 Resource,控制器直接返回 DomainVO,由 Spring 序列化为 JSON 对象,errcode/errmsg 包装
  • HTTP 状态码:所有端点类级标注 @ResponseStatus(HttpStatus.OK),成功统一返回 200。

1. 获取用户所属企业域

获取当前登录用户所属的企业域对象。

  • 接口类型:REST 资源
  • 请求方式GET
  • 请求路径/domains(完整:{runtime-context}/api/runtime/domains
  • 鉴权:是(需 accessToken,据源码)
  • Tag:企业域执行模块

请求参数

无(用户身份从令牌还原)。

请求示例

GET /api/runtime/domains HTTP/1.1
Cookie: accessToken=eyJhbGciOiJIUzI1NiJ9...

响应

结构:统一 ResourcedataList<Map<String, String>>,仅含当前用户企业域一项,元素结构 { "id", "name" }

{
  "errcode": 0,
  "errmsg": "ok",
  "data": [ { "id": "...", "name": "我的公司" } ],
  "errors": null
}

2. 获取企业域列表

获取系统中全部企业域的精简列表。

  • 接口类型:REST 资源
  • 请求方式GET
  • 请求路径/alldomains(完整:{runtime-context}/api/runtime/alldomains
  • 鉴权:是(需 accessToken,据源码)
  • Tag:企业域执行模块

请求参数

无。

请求示例

GET /api/runtime/alldomains HTTP/1.1
Cookie: accessToken=eyJhbGciOiJIUzI1NiJ9...

响应

结构:统一 ResourcedataList<Map<String, String>>,每个元素 { "id", "name" }

{
  "errcode": 0,
  "errmsg": "ok",
  "data": [
    { "id": "...", "name": "我的公司" },
    { "id": "...", "name": "demo" }
  ],
  "errors": null
}

3. 根据企业域id获取企业域信息

按企业域 Id 获取企业域详情;返回前对 logoUrl 做截断处理,仅保留文件名段。

  • 接口类型:REST 资源
  • 请求方式GET
  • 请求路径/domain/{domainId}(完整:{runtime-context}/api/runtime/domain/{domainId}
  • 鉴权:是(需 accessToken,据源码)
  • Tag:企业域执行模块

请求参数

参数名 位置 类型 必填 说明
domainId path string 企业域Id

请求示例

GET /api/runtime/domain/__DOMAINID__ HTTP/1.1
Cookie: accessToken=eyJhbGciOiJIUzI1NiJ9...

响应

结构非统一 Resource。控制器直接返回 DomainVO,由 Spring 序列化为 JSON 对象,errcode/errmsg 包装。其中 logoUrl 已被服务端处理:原始路径含 /upload/ 时截为 /upload/<文件名>,否则截为 <文件名>(保留 lastIndexOf("/") 起的段)。

{
  "id": "...",
  "name": "我的公司",
  "logoUrl": "/upload/logo.png",
  "...": "其余 DomainVO 字段"
}