# CENTER API - v1.1.0
Revision | Date | Author/Owner | Description of Charge |
---|---|---|---|
1.0.0 | 20200820 | 王梦杰 | initial proposal |
1.0.1 | 20200826 | 王梦杰 | 新增“用户管理”模块接口 |
1.0.2 | 20200828 | 王梦杰 | 新增“用户名密码登录”接口 |
1.0.3 | 20200901 | 张现超 | 新增“批量导出”接口 |
1.0.4 | 20200904 | 张现超 | 1. 审批管理接口中返回时间统一为 string 类型(例:2020-08-18 16:23:20) 2. 审批列表、我的审批待处理、我的审批已处理、我的发起列表删除 createUserName 字段,增加 startUserId 字段 |
1.0.5 | 20200906 | 张现超 | 新增发起人“重新提交申请”接口; 审批列表、我的审批待处理、我的审批已处理、我的发起列表统一返回 reStart 参数 |
1.0.6 | 20200907 | 张现超 | 我的发起列表 processDefinitionId 参数删除,审批-待处理接口遗漏补充 processInstanceId 参数字段 |
1.0.7 | 20200908 | 张现超 | 审批接口的错误码说明 |
1.0.8 | 20200911 | 朱文诚 | 1、修改 user/list 接口请求参数;2、修改 tenantId 拼写错误(原内容为 tentantId) |
1.0.9 | 20200918 | 朱文诚 | 1、增加通过 id 获取用户详情;2、增加根据用户名获取用户详情 3、增加根据用户名批量获取用户 |
1.0.10 | 20200923 | 张现超 | 1.增加状态码 1103 2.接口/api/approval/myApproveToDo 接口 tempId 和 taskName 3. 审批详情查询增加 comment 字段,comments 字段将不再维护 |
1.0.11 | 20200924 | 张现超 | 1.审批详情增加 hisList 字段,record 字段将逐渐不再维护 |
1.0.12 | 20201103 | 张现超 | 1.发起审批增加 tempKey 字段 2. 我的发起列表接口支持 tempKey 字段查询 |
1.0.13 | 20201117 | 朱文诚 | 1.增加获取租户下用户,并通过角色分组 2. 获取机构下全部角色 |
1.0.14 | 20201202 | 朱文诚 | 1.增加表单使用说明 |
1.0.15 | 20210105 | 王梦杰 | 1.修正3.15文档描述 2. 修正3.16文档描述 |
1.0.16 | 20210305 | 王梦杰 | 1.更新access_token获取逻辑 |
1.0.17 | 20210714 | 王梦杰 | 1.新增获取access_token的方式 |
1.0.18 | 20210720 | 覃略 | 1.修正3.1文档描述 2. 修正3.2文档描述 |
1.0.19 | 20210909 | 覃略 | 1.新增用户数据权限查询 |
1.0.20 | 20210910 | 覃略 | 1、修正 user/list 接口请求参数描述;2、修改 user/listWithPaging 接口请求参数描述; |
1.0.21 | 20210914 | 覃略 | 1、 user/list,user/listWithPaging 接口支持fetchChild参数 |
1.0.22 | 20211212 | 王梦杰 | 新增”身份验证“模块 |
1.0.23 | 20220422 | 赵正西 | 1.添加审批回调接入方式 2.修改审批接入多租户后,在header中传入tenantid和iamid |
1.1.0 | 20221021 | 王梦杰 | 更新Center API内容,去除已弃用信息 |
[TOC]
# 使用说明
几个概念
# CENTER_HOST
BCenter Host地址 公网地址如图:
内网地址形如:http://incubator-center:8080
# IAM_HOST
B端用户鉴权服务Host地址。
访问BCenter,跳转到登录页之后,/portal.html
之前的部分即为IAM_HOST,如:
IAM_HOST即为:https://admin.sdm.qq.com/iam
# 租户ID
获取方式——
# 公共参数
- 请求方法:
POST
- 请求地址:
https://{CENTER_HOST}/${API_PATH}
,如“用户列表”:http://incubator-center:8080/api/user/list
- 请求头:
Header | 必填 | 说明 |
---|---|---|
Content-Type | 1 | 固定为:application/json |
incubator-appid | 0 | 在 B 端应用平台创建的应用 ID。如果需要获取账号在某个应用下的权限信息,此字段必传 |
incubator-access-token | 1 | access_token。如果是内网访问,传1即可,且CENTER_HOST为内网地址 |
incubator-companyid | 0 | 租户ID(获取方式见”使用说明“部分)。获取指定租户下的数据时,需要传 |
注: 如果子应用想获取当前登录用户在这个子应用下的权限信息(permApiList/permIdList/permList),需要传incubator-appid
,值为center平台为子应用分配的appid。
# 身份验证(BCenter SSO)
BCenter提供了OAuth的授权登录方式,可以在打开第三方应用网页时获取BCenter成员身份信息,从而免去登录的环节。
# BCenter oAuth2接入流程
# 接入准备
1、请第三方应用开发者提供Redirect_URL
参数
2、BCenter将提供应用开发所需要的:clientId
、clientSecret
、appId
、IAM Host
# 构造网页授权链接
构造如下的链接来获取code参数:
https://{IAM_HOST}/oauth/authorize?client_id={CLIENT_ID}&redirect_uri={REDIRECT_URI}&response_type=code&state=123&nonce=456&appid={APPID}
注意: 授权链接中HOST为"IAM_HOST"
参数说明:
参数 | 必须 | 说明 |
---|---|---|
client_id | 是 | 给应用分配的client_id |
redirect_uri | 是 | 授权后重定向的回调链接地址 |
response_type | 是 | 返回类型,此时固定为:code |
state | 是 | 重定向后会带上state参数 |
nonce | 是 | 随机串 |
appid | 否 | 若需要指定租户登录,appid为该租户ID(获取方式见”使用说明“部分) |
访问授权链接,页面将跳转至 redirect_uri?code=CODE&state=STATE,如果未登录,会先跳转到登录页完成登录
# 获取用户token
该接口用于根据code获取用户token
请求方式:POST
请求地址:https://{CENTER_HOST}/sso/oauth/token
请求Header: 注:无需传公共参数中的Header
参数 | 必须 | 说明 |
---|---|---|
Content-Type | 是 | 固定值:application/x-www-form-urlencoded |
Authorization | 是 | 算法:Basic Base64(client_id:client_secret) |
参数说明:
参数 | 必须 | 说明 |
---|---|---|
grant_type | 是 | 固定值:authorization_code |
code | 是 | 上一步获取的code值 |
redirect_uri | 是 | 授权后重定向的回调链接地址 |
curl样例:
curl --location --request POST 'https://{CENTER_HOST}/sso/oauth/token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Authorization: {Authorization}' \
--data-urlencode 'code={code}' \
--data-urlencode 'grant_type=authorization_code' \
--data-urlencode 'redirect_uri={redirect_uri}'
2
3
4
5
6
返回结果:
字段说明
参数 | 说明 |
---|---|
access_token | 用户token |
token_type | 固定值:bearer |
expires_in | token有效期 |
样例
{
"access_token": "afc03344-3a52-4887-848f-c7813a92b883",
"token_type": "bearer",
"expires_in": 86399
}
2
3
4
5
# 获取用户信息
该接口用于根据token获取用户信息
请求方式:GET
请求地址:https://{CENTER_HOST}/sso/oauth/userinfo
请求Header: 注:无需传公共参数中的Header
参数 | 必须 | 说明 |
---|---|---|
Content-Type | 是 | 固定值:application/json |
Authorization | 是 | 算法:Bearer {token} |
参数说明:
curl样例:
curl --location --request GET 'https://{CENTER_HOST}/sso/oauth/userinfo' \
--header 'Content-Type: application/json' \
--header 'Authorization: ${Authorization}'
2
3
返回结果:
字段说明
参数 | 说明 |
---|---|
sub | 用户ID |
name | 用户主数据ID |
phoneNumber | 用户手机号 |
用户邮箱 | |
userName | 用户姓名 |
样例
{
"sub": "144115205301842423",
"name": "1427824034486460416",
"phoneNumber": "13012345678",
"email": "zhangshan@inc.com",
"userName": "张珊"
}
2
3
4
5
6
7
注:如果想获取更多用户信息,请调用"用户管理"模块-"获取用户"接口
# 用户管理
# 用户列表
请求地址:/api/user/list
请求参数:
字段 | 类型 | 必选 | 含义 | 备注 |
---|---|---|---|---|
String | 0 | 邮箱 | ||
startTime | String | 0 | 创建时间-起始 | |
endTime | String | 0 | 创建时间-结束 | |
mobile | String | 0 | 手机号 | |
name | String | 0 | 用户名 | |
org | ObjectId | 0 | 组织机构节点id | |
roles | String | 0 | 角色 id | |
status | String | 0 | 状态 | ENABLE/DISABLE |
userName | String | 0 | 用户名 | |
fetchChild | Number | 0 | 获取子节点 0不获取 1获取 | 默认为1 |
样例
{
"email": null,
"endTime": null,
"mobile": null,
"name": null,
"org": "5e730c000d08f24930c6450f",
"roles": null,
"startTime": null,
"status": null,
"userName": null
}
2
3
4
5
6
7
8
9
10
11
请求响应:
字段说明
注:只说明data.list
部分
字段 | 类型 | 含义 | 备注 |
---|---|---|---|
_id | String | 用户主键 | |
status | Enum<String> | 账户状态 | ENABLE/DISABLE |
gender | Enum<String> | 性别 | M/F/U |
isInitial | Enum<String> | 是否为初始化账户 | Y/N |
name | String | 用户名 | |
mobile | String | 手机号 | |
String | 邮箱 | ||
id | String | 用户 ID | |
userName | String | 真实姓名 | |
birthday | Date | 生日 | |
org | Array<Org> | 所属组织机构信息 | |
Org.code | String | 组织机构代码 | |
Org._id | String | 组织机构主键 id | |
Org.name | String | 组织机构名称 | |
roles | Array<Role> | 所属角色信息 | 角色详细 |
Role.type | String | 角色类型 | 0/1/2/3(超级管理员/租户管理员/应用管理员/普通角色) |
Role._id | String | 角色主键 | |
Role.roleName | String | 角色名称 | |
extra | String | 用户附带信息 | json 字符串 |
mainTenant | String | 主租户 | |
manageOrgs | Array<ObjectId> | 管理的机构 | |
tenant | Array<ObjectId> | 所属租户 | |
created_at | Date | 创建时间 | |
avatar | String | 头像 | |
loginTime | Date | 登录时间 | |
isThirdPartyImport | Boolean | 是否由第三方应用导入创建 |
样例
{
"code": 0,
"msg": "SUCCESS",
"data": {
"list": [
{
"userName": "UNKNOWN",
"isInitial": "Y",
"roles": [
{
"type": "3",
"_id": "5e045ad6f88d484ccc85d617",
"roleName": "超级管理员"
}
],
"email": "UNKOW@UNKNOW.COM",
"avatar": null,
"mobile": "18610001000",
"status": "DISABLE",
"birthday": null,
"gender": "U",
"manageOrgs": [],
"mainTenant": null,
"tenant": [],
"org": [],
"extra": "{}",
"loginTime": "2020-03-06T07:26:49.065Z",
"_id": "5e5e282f17fc420bb0b8038d",
"isThirdPartyImport": false,
"name": "UNKNOW",
"id": "144115205374725217",
"created_at": "2020-03-03T09:49:35.915Z"
}
]
}
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# 用户列表-分页
请求地址:/api/user/listWithPaging
请求参数:
字段 | 类型 | 必选 | 含义 | 备注 |
---|---|---|---|---|
page | Number | 1 | 页码 | 默认为 1 |
pageSize | Number | 1 | 每页条数 | 默认为 10 |
app | ObjectId | 0 | 应用 id | |
String | 0 | 邮箱 | ||
startTime | String | 0 | 创建时间-起始 | |
endTime | String | 0 | 创建时间-结束 | |
mobile | String | 0 | 手机号 | |
name | String | 0 | 用户名 | |
org | ObjectId | 0 | 组织机构节点id | |
roles | String | 0 | 角色 id | |
status | String | 0 | 状态 | ENABLE/DISABLE |
userName | String | 0 | 用户名 | |
fetchChild | Number | 0 | 获取子节点 0不获取 1获取 | 默认为1 |
样例
{
"app": null,
"email": null,
"endTime": null,
"mobile": null,
"name": null,
"org": "",
"page": 1,
"pageSize": 10,
"roles": null,
"startTime": null,
"status": null,
"userName": null
}
2
3
4
5
6
7
8
9
10
11
12
13
14
请求响应:
字段说明
注:只说明data
部分
字段 | 类型 | 含义 | 备注 |
---|---|---|---|
page | Number | 当前页码 | |
count | Number | 总条数 | |
list | Array<User> | 用户列表 | |
User._id | String | 用户主键 | |
User.status | Enum<String> | 账户状态 | ENABLE/DISABLE |
User.created_at | String | 创建时间 | |
User.gender | Enum<String> | 性别 | M/F/U |
User.isInitial | Enum<String> | 是否为初始化账户 | Y/N |
User.name | String | 用户名 | |
User.apps | Array <ObjectId> | 所拥有的应用 id 集合 | |
User.mobile | String | 手机号 | |
User.email | String | 邮箱 | |
User.id | String | 用户 ID | |
User.userName | String | 真实姓名 | |
User.birthday | Date | 生日 | |
User.manageOrgs | Array <ObjectId> | 用户管理的机构 id 集合 | |
User.tenant | Array <ObjectId> | 用户所属租户 id 集合 | |
User.mainTenant | ObjectId | 用户所属主租户 id | |
User.org | Object<Org> | 所属组织机构信息 | |
Org.code | String | 组织机构代码 | |
Org._id | String | 组织机构主键 id | |
Org.name | String | 组织机构名称 | |
Org.status | Enum<String> | 组织机构状态 | 0/1(禁用/启用) |
Org.rootId | String | 组织机构跟机构 id | |
Org.orgType | Enum<String> | 机构类型 | 0/1(租户/机构) |
Org.associationRole | Array | 父级路径 id | |
Org.fullPath | String | 组织机构名称 | |
User.roles | Array<Role> | 所属角色信息 | |
Role._id | String | 角色主键 id | |
Role.roleName | String | 角色名 | |
Role.apps | Array | 角色拥有的应用 id | |
Role.org | ObjectId | 角色所属租户 id | |
Role.rolePerm | Array | 角色关联的权限值 id | |
Role.status | Enum<String> | 角色状态 | ENABLE/DISABLE(禁用/启用) |
Role.type | Enum<String> | 角色类型 | 0/1/2/3(超级管理员/租户管理员/应用管理员/普通角色) |
User.tenantList | Array<Tenant> | 所属租户详细信息 | |
Tenant.fullOrgs | Array | 所属机构完整机构路径 id | |
Tenant.isAdmin | Boolean | 是否为租户管理员 | |
Tenant.manageOrgs | Array <ObjectId> | 该租户下管理的机构 id 集合 | |
Tenant.orgs | Array | 所属机构详细 | |
Tenant.roles | Array | 所关联角色详细 | |
Tenant.tenantId | ObjectId | 当前租户 id | |
isThirdPartyImport | Boolean | 是否由第三方应用导入创建 |
样例
{
"code": 0,
"msg": "SUCCESS",
"data": {
"page": 1,
"count": 100,
"list": [
{
"isInitial": "N",
"roles": [],
"status": "ENABLE",
"birthday": null,
"gender": "U",
"manageOrgs": [],
"mainTenant": "5f06b2c8b0598f5fe4e05062",
"tenant": ["5f06b2c8b0598f5fe4e05062"],
"org": [
{
"status": "1",
"rootId": "5f06b2c8b0598f5fe4e05062",
"orgType": "1",
"associationRole": null,
"fullPath": [
"5f06b2c8b0598f5fe4e05062",
"5f195630df7d5214203c6128"
],
"_id": "5f19569ed8402261181e998e",
"name": "23423423",
"code": "4234234234"
}
],
"_id": "5f1a4eedb58b530138a8aa02",
"name": "ceshiyonhu2",
"email": "ceshiyonhu2@qq.com",
"id": "144115205301731593",
"created_at": "2020-07-24T03:01:01.821Z",
"userName": null,
"isThirdPartyImport": false,
"tenantList": [
{
"tenantId": "5f06b2c8b0598f5fe4e05062",
"orgs": [
{
"status": "1",
"rootId": "5f06b2c8b0598f5fe4e05062",
"orgType": "1",
"associationRole": null,
"fullPath": [
"5f06b2c8b0598f5fe4e05062",
"5f195630df7d5214203c6128"
],
"_id": "5f19569ed8402261181e998e",
"name": "23423423",
"code": "4234234234"
}
],
"isAdmin": false,
"fullOrgs": [
[
"5f06b2c8b0598f5fe4e05062",
"5f195630df7d5214203c6128",
"5f19569ed8402261181e998e"
]
],
"manageOrgs": [],
"roles": []
}
],
"apps": []
}
]
}
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# 保存用户
保存租户信息通过 tenantList 进行分组,便于前端交互。服务端通过租户分组信息整理,分离出租户机构、角色、管理的机构等信息保存。查询相关接口同保存信息一致
请求地址:/api/user/save
请求参数:
字段 | 类型 | 必选 | 含义 | 备注 |
---|---|---|---|---|
name | String | 0 | 用户名 | name/mobile/email 至少有一项不为空 |
mobile | String | 0 | 手机号 | name/mobile/email 至少有一项不为空 |
String | 0 | 邮箱 | name/mobile/email 至少有一项不为空 | |
password | String | 1 | 密码 | 使用 bcrypt 加密 |
mainTenant | ObjectId | 1 | 主租户 id | |
tenantList | Array | 1 | 租户详情集合 | |
tenantList.isAdmin | Boolean | 1 | 是否是租户管理员 | |
tenantList.manageOrgs | Array <ObjectId> | 1 | 管理的机构 | |
tenantList.orgs | Array | 1 | 机构完整路径集合 | |
tenantList.roles | Array <ObjectId> | 1 | 角色 id 集合 | |
tenantList.tenantId | ObjectId | 1 | 租户 id |
password 加密示例
let password = bcrypt.hashSync("mypassword", bcrypt.genSaltSync(10));
样例
{
"email": "usertest1123@qq.com",
"mainTenant": "5f03e4c70868e338b0581516",
"mobile": "17300011134",
"name": "usertest112",
"password": "$2a$10$NBv2xPlnAfD6DGAs9Zq2N.0nKXY22WDbxQRM/z5vijAhQkZZlpMp2",
"tenantList": [
{
"isAdmin": false,
"manageOrgs": ["5f06b1adb0598f5fe4e0505d"],
"orgs": [["5f03e4c70868e338b0581516", "5f06b1adb0598f5fe4e0505d"]],
"roles": ["5f06b1adb0598f5fe4e0505f"],
"tenantId": "5f03e4c70868e338b0581516"
}
],
"userName": "usertest0012ame"
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
请求响应:
字段说明
字段 | 类型 | 含义 | 备注 |
---|---|---|---|
_id | String | 用户主键 | |
created_at | String | 创建时间 | |
isInitial | Enum<String> | 是否为初始化账户 | Y/N |
name | String | 用户名 | |
mobile | String | 手机号 | |
String | 邮箱 | ||
id | String | 用户 ID | |
userName | String | 真实姓名 | |
birthday | Date | 生日 | |
manageOrgs | Array <ObjectId> | 用户管理的机构 id 集合 | |
tenant | Array <ObjectId> | 用户所属租户 id 集合 | |
mainTenant | ObjectId | 用户所属主租户 id | |
org | Array <ObjectId> | 所属机构 id 集合 | |
roles | Array <ObjectId> | 角色主键 id 集合 | |
status | Enum<String> | 账户状态 | ENABLE/DISABLE |
gender | Enum<String> | 性别 | M/F/U |
样例
{
"code": 0,
"msg": "SUCCESS",
"data": {
"userName": "usertest0012ame",
"isInitial": "N",
"roles": ["5f06b1adb0598f5fe4e0505f"],
"email": "usertest1123@qq.com",
"mobile": "17300011134",
"status": "ENABLE",
"birthday": null,
"gender": "U",
"manageOrgs": ["5f06b1adb0598f5fe4e0505d"],
"mainTenant": "5f03e4c70868e338b0581516",
"tenant": ["5f03e4c70868e338b0581516"],
"org": ["5f06b1adb0598f5fe4e0505d"],
"_id": "5f1e6ab731f3105478bb2f14",
"name": "usertest112",
"id": "144115205301731617",
"created_at": "2020-07-27T05:48:39.805Z"
}
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# 更新用户
请求地址:/api/user/update
请求参数:
字段 | 类型 | 必选 | 含义 | 备注 |
---|---|---|---|---|
id | String | 1 | 用户 ID | |
name | String | 0 | 用户名 | |
mobile | String | 0 | 手机号 | |
String | 0 | 邮箱 | ||
birthday | Date | 0 | 生日 | |
wxUnionId | String | 0 | 微信 UnionId | |
qqUnionId | String | 0 | qqUnionId | |
avatar | String | 0 | 头像 | |
status | String | 0 | 状态 | (0/1)(禁用/启用) |
gender | String | 0 | 性别 | (M/F/U)(男/女/未知) |
mainTenant | ObjectId | 1 | 主租户 id | |
tenantList | Array | 1 | 租户详情集合 | |
tenantList.isAdmin | Boolean | 1 | 是否是租户管理员 | |
tenantList.manageOrgs | Array <ObjectId> | 1 | 管理的机构 | |
tenantList.orgs | Array | 1 | 机构完整路径集合 | |
tenantList.roles | Array <ObjectId> | 1 | 角色 id 集合 | |
tenantList.tenantId | ObjectId | 1 | 租户 id |
样例
{
"id": "144115205374725061",
"email": "usertest1123@qq.com",
"mainTenant": "5f03e4c70868e338b0581516",
"mobile": "17300011134",
"name": "usertest112",
"password": "$2a$10$NBv2xPlnAfD6DGAs9Zq2N.0nKXY22WDbxQRM/z5vijAhQkZZlpMp2",
"tenantList": [
{
"isAdmin": false,
"manageOrgs": ["5f06b1adb0598f5fe4e0505d"],
"orgs": [["5f03e4c70868e338b0581516", "5f06b1adb0598f5fe4e0505d"]],
"roles": ["5f06b1adb0598f5fe4e0505f"],
"tenantId": "5f03e4c70868e338b0581516"
}
],
"userName": "usertest0012ame"
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
请求响应:
字段说明
字段 | 类型 | 含义 | 备注 |
---|
样例
{
"code": 0,
"msg": "SUCCESS",
"data": {}
}
2
3
4
5
# 获取用户
请求地址:/api/user/get
请求参数:
字段 | 类型 | 必选 | 含义 | 备注 |
---|---|---|---|---|
id | ObjectId | 1 | 用户 ID |
样例
{
"id": "144115205374725511"
}
2
3
请求响应:
字段说明
字段 | 类型 | 含义 | 备注 |
---|---|---|---|
_id | String | 用户主键 | |
created_at | String | 创建时间 | |
isInitial | Enum<String> | 是否为初始化账户 | Y/N |
name | String | 用户名 | |
mobile | String | 手机号 | |
String | 邮箱 | ||
id | String | 用户 ID | |
userName | String | 真实姓名 | |
birthday | Date | 生日 | |
manageOrgs | Array <ObjectId> | 用户管理的机构 id 集合 | |
tenant | Array <ObjectId> | 用户所属租户 id 集合 | |
mainTenant | ObjectId | 用户所属主租户 id | |
status | Enum<String> | 账户状态 | ENABLE/DISABLE |
gender | Enum<String> | 性别 | M/F/U |
tenantList | Array | 租户详情集合 | |
tenantList.isAdmin | Boolean | 是否是租户管理员 | |
tenantList.manageOrgs | Array <ObjectId> | 管理的机构 | |
tenantList.orgs | Array | 机构完整路径集合 | |
tenantList.roles | Array <ObjectId> | 角色 id 集合 | |
tenantList.tenantId | ObjectId | 租户 id |
样例
{
"code": 0,
"msg": "SUCCESS",
"data": {
"userName": "usertest0012ame",
"isInitial": "N",
"email": "usertest1123@qq.com",
"mobile": "17300011134",
"status": "ENABLE",
"birthday": null,
"gender": "U",
"mainTenant": "5f03e4c70868e338b0581516",
"tenant": ["5f03e4c70868e338b0581516"],
"_id": "5f1e6ab731f3105478bb2f14",
"name": "usertest112",
"id": "144115205301731617",
"created_at": "2020-07-27T05:48:39.805Z",
"tenantList": [
{
"tenantId": "5f03e4c70868e338b0581516",
"orgs": [["5f03e4c70868e338b0581516", "5f06b1adb0598f5fe4e0505d"]],
"isAdmin": false,
"fullOrgs": [["5f03e4c70868e338b0581516", "5f06b1adb0598f5fe4e0505d"]],
"manageOrgs": ["5f06b1adb0598f5fe4e0505d"],
"roles": ["5f06b1adb0598f5fe4e0505f"]
}
]
}
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# 根据 Id 批量获取用户
请求地址:/api/user/getUsersById
请求参数:
字段 | 类型 | 必选 | 含义 | 备注 |
---|---|---|---|---|
id | Array | 1 | 用户 ID 数组 |
样例
{
"id": ["144115205301731909", "144115205301731615"]
}
2
3
请求响应:
字段说明
字段 | 类型 | 含义 | 备注 |
---|---|---|---|
_id | String | 用户主键 | |
isInitial | Enum<String> | 是否为初始化账户 | Y/N |
name | String | 用户名 | |
mobile | String | 手机号 | |
String | 邮箱 | ||
id | String | 用户 ID | |
userName | String | 真实姓名 | |
birthday | Date | 生日 | |
avatar | Date | 头像 | |
manageOrgs | Array <Object> | 用户管理的机构 id 集合 | |
manageOrgs.status | Boolean | 用户管理的机构状态 | |
manageOrgs._id | Array | 用户管理的机构 id | |
manageOrgs.name | Array <ObjectId> | 用户管理的机构名称 | |
manageOrgs.code | ObjectId | 用户管理的机构 code | |
tenant | Array <ObjectId> | 用户所属租户 id 集合 | |
mainTenant | ObjectId | 用户所属主租户 id | |
status | Enum<String> | 账户状态 | ENABLE/DISABLE |
gender | Enum<String> | 性别 | M/F/U |
org | Array <Object> | 机构详情 | |
org.status | Boolean | 机构状态 | |
org.orgType | Array <ObjectId> | 机构类型 | |
org._id | Array | 机构 id | |
org.name | Array <ObjectId> | 机构名称 | |
org.code | ObjectId | 机构 code | |
roles | Array <Object> | 角色详情 | |
roles.status | Boolean | 角色状态 | |
roles.type | Array <ObjectId> | 角色类型 | |
roles._id | Array | 角色 id | |
roles.name | Array <ObjectId> | 角色名称 |
样例
"code": 0,
"msg": "SUCCESS",
"data": [
{
"userName": "usertest001name",
"isInitial": "N",
"roles": [
{
"status": "1",
"type": "3",
"_id": "5f06b1adb0598f5fe4e0505f",
"roleName": "测试机构2-默认角色"
}
],
"email": "usertest001@qq.com",
"avatar": null,
"mobile": "17300002034",
"status": "ENABLE",
"birthday": null,
"gender": "U",
"manageOrgs": [
{
"status": "1",
"_id": "5f06b1adb0598f5fe4e0505d",
"name": "测试机构2",
"code": "12321321321"
}
],
"mainTenant": "5f03e4c70868e338b0581516",
"tenant": [
"5f03e4c70868e338b0581516"
],
"org": [
{
"status": "1",
"orgType": "1",
"_id": "5f06b1adb0598f5fe4e0505d",
"name": "测试机构2",
"code": "12321321321"
}
],
"_id": "5f1e6a3231f3105478bb2f12",
"name": "usertest001",
"id": "144115205301731615"
},
{
"userName": "王梦杰",
"isInitial": "N",
"roles": [],
"email": null,
"avatar": null,
"mobile": null,
"status": "ENABLE",
"birthday": null,
"gender": "U",
"manageOrgs": [],
"mainTenant": "5f3cda787c40df8998f3f450",
"tenant": [
"5f3cda787c40df8998f3f450"
],
"org": [
{
"status": "1",
"orgType": "1",
"_id": "5f436beba9198c4e38f16207",
"name": "技术中心",
"code": "4"
},
{
"status": "1",
"orgType": "1",
"_id": "5f436beba9198c4e38f16209",
"name": "开发组",
"code": "5"
}
],
"_id": "5f436beca9198c4e38f16218",
"name": "qwaslinwang",
"id": "144115205301731909"
}
]
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# 启用用户
请求地址:/api/user/enable
请求参数:
字段 | 类型 | 必选 | 含义 | 备注 |
---|---|---|---|---|
id | String | 1 | 用户 ID |
样例
{
"id": "144115205374725061"
}
2
3
请求响应:
字段说明
字段 | 类型 | 含义 | 备注 |
---|
样例
{
"code": 0,
"msg": "SUCCESS",
"data": {}
}
2
3
4
5
# 禁用用户
请求地址:/api/user/disable
请求参数:
字段 | 类型 | 必选 | 含义 | 备注 |
---|---|---|---|---|
id | String | 1 | 用户 ID |
样例
{
"id": "144115205374725061"
}
2
3
请求响应:
字段说明
字段 | 类型 | 含义 | 备注 |
---|
样例
{
"code": 0,
"msg": "SUCCESS",
"data": {}
}
2
3
4
5
# 删除用户
请求地址:/api/user/remove
请求参数:
字段 | 类型 | 必选 | 含义 | 备注 |
---|---|---|---|---|
id | String | 1 | 用户 ID |
样例
{
"id": "144115205374725061"
}
2
3
请求响应:
字段说明
字段 | 类型 | 含义 | 备注 |
---|
样例
{
"code": 0,
"msg": "SUCCESS",
"data": {}
}
2
3
4
5
# 用户续期
请求地址:/api/user/renew
请求参数:
字段 | 类型 | 必选 | 含义 | 备注 |
---|---|---|---|---|
id | String | 1 | 用户 ID |
样例
{
"id": "144115205374725061"
}
2
3
请求响应:
字段说明
字段 | 类型 | 含义 | 备注 |
---|
样例
{
"code": 0,
"msg": "SUCCESS",
"data": {
"expireTime": "2020-01-04T16:25:41.407Z"
}
}
2
3
4
5
6
7
# 获取用户所属租户
请求地址: /api/user/tenantInfo
请求参数:
字段 | 类型 | 必选 | 含义 | 备注 |
---|
样例
{}
请求响应:
字段说明
字段 | 类型 | 含义 | 备注 |
---|---|---|---|
userId | String | 用户 id | |
tenant | Array<Object> | 租户信息 | |
tenant.status | String | 状态 | |
tenant._id | String | 租户 id | |
tenant.name | String | 租户名称 | |
tenant.isMainTenant | Boolean | 是否是主租户 |
样例
{
"code": 0,
"msg": "SUCCESS",
"data": {
"userId": "144115205301731476",
"tenant": [
{
"status": "1",
"_id": "5f03e4c70868e338b0581516",
"name": "二期测试租户2",
"isMainTenant": true
}
]
}
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# 解绑租户
当前操作人可以解绑自己所管理租户下的用户
请求地址: /api/user/unBind
请求参数:
字段 | 类型 | 必选 | 含义 | 备注 |
---|---|---|---|---|
id | String | 1 | 用户 ID |
样例
{
"id": "144115205374725061"
}
2
3
请求响应:
字段说明
字段 | 类型 | 含义 | 备注 |
---|
样例
{
"code": 0,
"msg": "SUCCESS",
"data": {}
}
2
3
4
5
# 根据 Id 获取用户详情
请求地址:/api/user/getUserInfoById
请求参数:
字段 | 类型 | 必选 | 含义 | 备注 |
---|---|---|---|---|
id | String | 1 | 用户 ID |
样例
{
"id": "144115205301725099"
}
2
3
响应
字段说明
字段 | 类型 | 含义 | 备注 |
---|---|---|---|
user | Object<User> | 用户详情 | |
User._id | String | 用户主键 | |
User.token | String | 用户 token | |
User.status | Enum<String> | 账户状态 | ENABLE/DISABLE |
User.gender | Enum<String> | 性别 | M/F/U |
User.name | String | 用户名 | |
User.isInitial | Enum<String> | 是否为初始化账户 | Y/N |
User.mobile | String | 手机号 | |
User.email | String | 邮箱 | |
User.id | String | 用户 ID | |
User.extra | String | 用户附带信息 | |
User.userName | String | 真实姓名 | |
User.roles | Array<ObjectId> | 角色主键 Id 数组 | |
User.birthday | Date | 生日 | |
User.org | Array<ObjectId> | 所属组织机构信息 | org 主键 id 数组 |
User.orgName | Array<String> | 所属组织机构名称 | |
User.orgCode | Array<String> | 所属组织机构 code 信息 | |
User.roleNames | Array<String> | 所属角色名称集合 | |
User.roleType | Enum<String> | 角色类型 | 0/1/2/3/4(超级管理员/租户管理员/应用管理员/普通角色/机构管理员) |
User.permIdList | Array<String> | 所拥有权限值集合 | |
User.permApiList | Array<String> | 所拥有 api 接口集合 | |
User.manageOrgs | Array<ObjectId> | 管理机构 id 集合 | |
User.mainTenant | ObjectId | 主租户 id | |
User.isThirdPartyImport | Boolean | 是否为企微导入用户 | |
User.tenant | Array<ObjectId> | 所属租户 id 集合 | |
User.created_at | Date | 创建时间 | |
User.loginTime | Date | 登陆时间 | |
User.avatar | String | 头像地址 | |
User.tenantList | Array | 租户详情集合 | |
tenantList.isAdmin | Boolean | 是否是租户管理员 | |
tenantList.manageOrgs | Array <ObjectId> | 管理的机构 | |
tenantList.orgs | Array | 机构完整路径集合 | |
tenantList.roles | Array <ObjectId> | 角色 id 集合 | |
tenantList.tenantId | ObjectId | 租户 id | |
User.permList | Array | 权限详情 | |
permList.apis | string | api | |
permList.extra | string | 附带信息 | |
permList._id | string<ObjectId> | 权限主键 | |
permList.appId | string | 所属应用 |
样例
{
"code": 0,
"msg": "SUCCESS",
"data": {
"user": {
"userName": null,
"isInitial": "N",
"roles": [],
"email": "jigouadmin1@qq.com",
"avatar": null,
"mobile": "15928282821",
"status": "ENABLE",
"birthday": null,
"gender": "U",
"manageOrgs": [],
"mainTenant": "5edf4e4d61eb5a21dc00cdb8",
"tenant": ["5edf4e4d61eb5a21dc00cdb8"],
"org": [],
"extra": "{}",
"loginTime": "2020-09-12T09:44:38.490Z",
"isThirdPartyImport": false,
"_id": "5f5b24982c268e5cfc8778e1",
"name": "jigouadmin1",
"id": "144115205301733323",
"created_at": "2020-09-11T07:17:44.140Z",
"tenantList": [
{
"tenantId": "5edf4e4d61eb5a21dc00cdb8",
"orgs": [
{
"status": "1",
"rootId": "5edf4e4d61eb5a21dc00cdb8",
"orgType": "1",
"associationRole": null,
"fullPath": [],
"_id": "5ee1924e18216457083a7db3",
"name": "123213123123123124444",
"code": "12312321321321312"
}
],
"isAdmin": false,
"fullOrgs": [["5ee1924e18216457083a7db3"]],
"manageOrgs": [
{
"status": "1",
"rootId": "5edf4e4d61eb5a21dc00cdb8",
"orgType": "1",
"associationRole": null,
"fullPath": [],
"_id": "5ee1924e18216457083a7db3",
"name": "123213123123123124444",
"code": "12312321321321312"
}
],
"roles": []
}
],
"orgCode": [],
"orgName": [],
"roleType": "3",
"isAdmin": false,
"roleNames": [],
"permApiList": [],
"permIdList": [],
"permList": []
}
}
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# 根据 name 获取用户详情(支持批量)
请求地址:/api/user/getUserInfoByName
请求参数:
字段 | 类型 | 必选 | 含义 | 备注 |
---|---|---|---|---|
name | String|Array | 1 | 用户name | Array类型为批量获取 |
样例
{
"name": "zuhu22"
}
2
3
或
{
"name": ["zuhu22", "liuyang2"]
}
2
3
响应
字段说明
字段 | 类型 | 含义 | 备注 |
---|---|---|---|
user | Object<User>|Array<User> | 用户详情 | 如果user是数组,则表示批量结果 |
User._id | String | 用户主键 | |
User.token | String | 用户 token | |
User.status | Enum<String> | 账户状态 | ENABLE/DISABLE |
User.gender | Enum<String> | 性别 | M/F/U |
User.name | String | 用户名 | |
User.isInitial | Enum<String> | 是否为初始化账户 | Y/N |
User.mobile | String | 手机号 | |
User.email | String | 邮箱 | |
User.id | String | 用户 ID | |
User.extra | String | 用户附带信息 | |
User.userName | String | 真实姓名 | |
User.roles | Array<ObjectId> | 角色主键 Id 数组 | |
User.birthday | Date | 生日 | |
User.org | Array<ObjectId> | 所属组织机构信息 | org 主键 id 数组 |
User.orgName | Array<String> | 所属组织机构名称 | |
User.orgCode | Array<String> | 所属组织机构 code 信息 | |
User.roleNames | Array<String> | 所属角色名称集合 | |
User.roleType | Enum<String> | 角色类型 | 0/1/2/3/4(超级管理员/租户管理员/应用管理员/普通角色/机构管理员) |
User.permIdList | Array<String> | 所拥有权限值集合 | |
User.permApiList | Array<String> | 所拥有 api 接口集合 | |
User.manageOrgs | Array<ObjectId> | 管理机构 id 集合 | |
User.mainTenant | ObjectId | 主租户 id | |
User.isThirdPartyImport | Boolean | 是否为企微导入用户 | |
User.tenant | Array<ObjectId> | 所属租户 id 集合 | |
User.created_at | Date | 创建时间 | |
User.loginTime | Date | 登陆时间 | |
User.avatar | String | 头像地址 | |
User.tenantList | Array | 租户详情集合 | |
tenantList.isAdmin | Boolean | 是否是租户管理员 | |
tenantList.manageOrgs | Array <ObjectId> | 管理的机构 | |
tenantList.orgs | Array | 机构完整路径集合 | |
tenantList.roles | Array <ObjectId> | 角色 id 集合 | |
tenantList.tenantId | ObjectId | 租户 id | |
User.permList | Array | 权限详情 | |
permList.apis | string | api | |
permList.extra | string | 附带信息 | |
permList._id | string<ObjectId> | 权限主键 | |
permList.appId | string | 所属应用 |
样例
{
"code": 0,
"msg": "SUCCESS",
"data": {
"user": {
"userName": null,
"isInitial": "N",
"roles": [],
"email": "jigouadmin1@qq.com",
"avatar": null,
"mobile": "15928282821",
"status": "ENABLE",
"birthday": null,
"gender": "U",
"manageOrgs": [],
"mainTenant": "5edf4e4d61eb5a21dc00cdb8",
"tenant": ["5edf4e4d61eb5a21dc00cdb8"],
"org": [],
"extra": "{}",
"loginTime": "2020-09-12T09:44:38.490Z",
"isThirdPartyImport": false,
"_id": "5f5b24982c268e5cfc8778e1",
"name": "jigouadmin1",
"id": "144115205301733323",
"created_at": "2020-09-11T07:17:44.140Z",
"tenantList": [
{
"tenantId": "5edf4e4d61eb5a21dc00cdb8",
"orgs": [
{
"status": "1",
"rootId": "5edf4e4d61eb5a21dc00cdb8",
"orgType": "1",
"associationRole": null,
"fullPath": [],
"_id": "5ee1924e18216457083a7db3",
"name": "123213123123123124444",
"code": "12312321321321312"
}
],
"isAdmin": false,
"fullOrgs": [["5ee1924e18216457083a7db3"]],
"manageOrgs": [
{
"status": "1",
"rootId": "5edf4e4d61eb5a21dc00cdb8",
"orgType": "1",
"associationRole": null,
"fullPath": [],
"_id": "5ee1924e18216457083a7db3",
"name": "123213123123123124444",
"code": "12312321321321312"
}
],
"roles": []
}
],
"orgCode": [],
"orgName": [],
"roleType": "3",
"isAdmin": false,
"roleNames": [],
"permApiList": [],
"permIdList": [],
"permList": []
}
}
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# 根据 name 批量获取用户
获取用户的基础信息,详细信息请使用3.16接口
请求地址:/api/user/getUsersByName
请求参数:
字段 | 类型 | 必选 | 含义 | 备注 |
---|---|---|---|---|
names | Array | 1 | 用户 name 数组 |
样例
{
"names": ["4", "3"]
}
2
3
请求响应:
字段说明
字段 | 类型 | 含义 | 备注 |
---|---|---|---|
_id | String | 用户主键 | |
isInitial | Enum<String> | 是否为初始化账户 | Y/N |
name | String | 用户名 | |
mobile | String | 手机号 | |
String | 邮箱 | ||
id | String | 用户 ID | |
userName | String | 真实姓名 | |
birthday | Date | 生日 | |
avatar | Date | 头像 | |
manageOrgs | Array <Object> | 用户管理的机构 id 集合 | |
manageOrgs.status | Boolean | 用户管理的机构状态 | |
manageOrgs._id | Array | 用户管理的机构 id | |
manageOrgs.name | Array <ObjectId> | 用户管理的机构名称 | |
manageOrgs.code | ObjectId | 用户管理的机构 code | |
tenant | Array <ObjectId> | 用户所属租户 id 集合 | |
mainTenant | ObjectId | 用户所属主租户 id | |
status | Enum<String> | 账户状态 | ENABLE/DISABLE |
gender | Enum<String> | 性别 | M/F/U |
org | Array <Object> | 机构详情 | |
org.status | Boolean | 机构状态 | |
org.orgType | Array <ObjectId> | 机构类型 | |
org._id | Array | 机构 id | |
org.name | Array <ObjectId> | 机构名称 | |
org.code | ObjectId | 机构 code | |
roles | Array <Object> | 角色详情 | |
roles.status | Boolean | 角色状态 | |
roles.type | Array <ObjectId> | 角色类型 | |
roles._id | Array | 角色 id | |
roles.name | Array <ObjectId> | 角色名称 |
样例
"code": 0,
"msg": "SUCCESS",
"data": [
{
"userName": "usertest001name",
"isInitial": "N",
"roles": [
{
"status": "1",
"type": "3",
"_id": "5f06b1adb0598f5fe4e0505f",
"roleName": "测试机构2-默认角色"
}
],
"email": "usertest001@qq.com",
"avatar": null,
"mobile": "17300002034",
"status": "ENABLE",
"birthday": null,
"gender": "U",
"manageOrgs": [
{
"status": "1",
"_id": "5f06b1adb0598f5fe4e0505d",
"name": "测试机构2",
"code": "12321321321"
}
],
"mainTenant": "5f03e4c70868e338b0581516",
"tenant": [
"5f03e4c70868e338b0581516"
],
"org": [
{
"status": "1",
"orgType": "1",
"_id": "5f06b1adb0598f5fe4e0505d",
"name": "测试机构2",
"code": "12321321321"
}
],
"_id": "5f1e6a3231f3105478bb2f12",
"name": "usertest001",
"id": "144115205301731615"
},
{
"userName": "王梦杰",
"isInitial": "N",
"roles": [],
"email": null,
"avatar": null,
"mobile": null,
"status": "ENABLE",
"birthday": null,
"gender": "U",
"manageOrgs": [],
"mainTenant": "5f3cda787c40df8998f3f450",
"tenant": [
"5f3cda787c40df8998f3f450"
],
"org": [
{
"status": "1",
"orgType": "1",
"_id": "5f436beba9198c4e38f16207",
"name": "技术中心",
"code": "4"
},
{
"status": "1",
"orgType": "1",
"_id": "5f436beba9198c4e38f16209",
"name": "开发组",
"code": "5"
}
],
"_id": "5f436beca9198c4e38f16218",
"name": "qwaslinwang",
"id": "144115205301731909"
}
]
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# 组织架构管理
# 获取组织架构树
请求地址:/api/org/getTreeById
请求参数:
字段 | 类型 | 必选 | 含义 | 备注 |
---|---|---|---|---|
id | String | 1 | 组织机构 ID |
样例
{
"id": "5e5cb6cdede208253896f25a"
}
2
3
请求响应:
返回该 ID 所在节点及其子节点的组织机构信息 字段说明
字段 | 类型 | 含义 | 备注 |
---|---|---|---|
data | Array<Org> | 机构树状信息 | 树形结构 |
Org._id | String | 主键 ID | |
Org.code | String | 组织机构代码 | |
Org.name | String | 组织机构名称 | |
Org.isInitial | String | 是否是内置租户 | |
Org.parentId | String | 父级 ID | |
Org.logoUrl | String | 租户图标地址 | |
Org.rootId | ObjectId | 机构所属租户 id | |
Org.orgType | Enum<String> | 类型 | 0/1 (根租户/机构) |
Org.adminRole | ObjectId | 租户管理员角色 id | |
Org.associationRole | ObjectId | 机构关联角色 id | |
Org.fullPath | Array<ObjectId> | 父级路径 id | |
Org.desc | String | 机构备注信息 | |
Org.created_at | Date | 创建时间 | |
Org.children | Array<Org> | 机构子级集合,内容同 org 相同 | |
Org.status | Enum<String> | 状态 | 0/1(禁用/启用) |
样例
{
"code": 0,
"msg": "SUCCESS",
"data": [
{
"isInitial": "N",
"status": "1",
"logoUrl": "",
"rootId": null,
"orgType": "0",
"parentId": null,
"adminRole": "5f06b2c8b0598f5fe4e05064",
"associationRole": null,
"fullPath": [],
"_id": "5f06b2c8b0598f5fe4e05062",
"name": "租户迭代测试租户2",
"code": "123213123213",
"desc": "123213213213213",
"created_at": "2020-07-09T06:01:44.182Z",
"children": [...{}]
}
]
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# 获取组织架构列表
请求地址: /api/org/getOrgList
请求参数:
字段 | 类型 | 必选 | 含义 | 备注 |
---|---|---|---|---|
_id | String | 1 | 组织机构 ID |
样例
{
"_id": "5e5cb6cdede208253896f25a"
}
2
3
请求响应:
返回该 ID 所在节点及其子节点的组织机构信息 字段说明
字段 | 类型 | 含义 | 备注 |
---|---|---|---|
data | Array<Org> | 机构树状信息 | 树形结构 |
Org._id | String | 主键 ID | |
Org.code | String | 组织机构代码 | |
Org.name | String | 组织机构名称 | |
Org.isInitial | String | 是否是内置租户 | |
Org.parentId | String | 父级 ID | |
Org.logoUrl | String | 租户图标地址 | |
Org.rootId | ObjectId | 机构所属租户 id | |
Org.orgType | Enum<String> | 类型 | 0/1 (根租户/机构) |
Org.fullPath | Array<ObjectId> | 父级路径 id | |
Org.desc | String | 机构备注信息 | |
Org.status | Enum<String> | 状态 | 0/1(禁用/启用) |
样例
{
"code": 0,
"msg": "SUCCESS",
"data": [
{
"isInitial": "N",
"status": "1",
"desc": "123213213213213",
"logoUrl": "",
"rootId": null,
"orgType": "0",
"parentId": null,
"fullPath": [],
"_id": "5f06b2c8b0598f5fe4e05062",
"name": "租户迭代测试租户2",
"code": "123213123213"
}
]
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# 获取通讯录
请求地址:/api/org/getOrgAndMembers
请求参数:
字段 | 类型 | 必选 | 含义 | 备注 |
---|---|---|---|---|
tenant | String | 0 | 租户 ID | 仅允许 center 租户按租户查询,其他租户只能查询当前租户下信息 |
样例
{
"tenant": "5e9ffedf36be045ce0c3f6c8"
}
2
3
请求响应:
返回该 ID 所在节点及其子节点的组织机构信息 字段说明
字段 | 类型 | 含义 | 备注 |
---|---|---|---|
data | Array<Org> | 机构树状信息 | 树形结构 |
Org._id | String | 主键 ID | |
Org.name | String | 组织机构名称 | |
Org.parentId | String | 父级 ID | |
Org.children | Array<Org> | 机构子级集合,内容同 org 相同 | |
Org.members | Array<User> | 机构用户成员 | |
User._id | String | 用户主键 | |
User.name | String | 用户名 | |
User.userName | String | 用户真实名称 | |
User.id | String | 用户 userId |
样例
{
"code": 0,
"msg": "SUCCESS",
"data": [
{
"parentId": null,
"_id": "5e9ffedf36be045ce0c3f6c8",
"name": "中国长春一汽",
"members": [
{
"_id": "5ea01c2e027afa50c4d35a63",
"name": "yiqi-admin123",
"userName": "yiqi-admin123",
"id": "144115205301725435"
}
],
"children": [...]
}
]
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# 角色管理
# 获取机构下全部角色
请求地址:/api/role/listAll
请求参数:
字段 | 类型 | 必选 | 含义 | 备注 |
---|---|---|---|---|
roleName | String | 0 | 角色名称 | 支持模糊查询 |
org | String | 0 | 角色所属租户 _id | |
status | String | 0 | 角色状态 | 0/1 (禁用/启用) |
样例
{
"roleName": "测试角色",
"org": "5e5cb6cdede208253896f25a",
"status": ""
}
2
3
4
5
请求响应:
字段说明
字段 | 类型 | 含义 | 备注 |
---|---|---|---|
data | Array<Role> | 角色详情 | |
Role.rolePerm | Array | 权限 id 数组 | |
Role.status | Enum<String> | 角色状态 | 0/1 (禁用/启用) |
Role.apps | Array<App> | 关联应用详情 | |
App._id | ObjectId | 应用 id | |
App.name | String | 应用名称 | |
Role.isOrgBind | Boolean | 是否是机构关联角色 | |
Role.org | Object <Org> | 所属机构详情 | |
Org._id | ObjectId | 机构 id | |
Org.name | String | 机构名称 | |
Role.type | Enum<String> | 角色类型 | |
Role._id | ObjectId | 角色 id | |
Role.roleName | String | 角色名称 | |
Role.roleDesc | String | 角色描述 | |
Role.desc | String | 机构备注信息 | |
Role.created_at | Date | 创建时间 |
样例
{
"code": 0,
"msg": "SUCCESS",
"data": [
{
"rolePerm": ["5facaf7f4a057d001a1c9810", "5fb3712d4a057d001a1c9c3d"],
"status": "1",
"apps": [
{
"_id": "5facaf7f4a057d001a1c980e",
"name": "linkflow开发测试"
}
],
"isOrgBind": false,
"org": {
"_id": "5fb371a34a057d001a1c9c3f",
"name": "linkflow"
},
"type": "3",
"_id": "5fb371ff4a057d001a1c9c46",
"roleName": "经销商",
"roleDesc": "经销商~~~~",
"createDate": "2020-11-17T06:47:27.104Z"
}
]
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# 【Deprecated】审批管理 - 旧版
已接入在使用的业务参考此版本文档,新业务接入请咨询新的接入方式
# 概述
业务开发者如果需要调用审批管理 API,将审批能力集成到业务系统中,需要先到审批中心管理后台创建审批模板。审批模板中包含:模板基础信息、发起申请所需要填写的表单、审批工作流设计。
# 表单使用说明
自定义表格配置说明: 配置表格数据源, 请求仅支持jsonp格式,如:https://api.asilu.com/idcard/?callback=cb_1606878294086。callback查询字段为jsonp回调方法。 返回数据源格式:
{
//表头映射关系
column: [
{
label: '日期(示例)',
labelKey: 'date'
},
{
label: '名称(示例)',
labelKey: 'name'
},
{
label: '地址(示例)',
labelKey: 'address'
},
],
//表格数据
tableData: [{
date: '2016-05-02',
name: '王小虎',
address: '上海市普陀区金沙江路 1518 弄'
}, {
date: '2016-05-04',
name: '王小虎',
address: '上海市普陀区金沙江路 1517 弄'
}, {
date: '2016-05-01',
name: '王小虎',
address: '上海市普陀区金沙江路 1519 弄'
}, {
date: '2016-05-03',
name: '王小虎',
address: '上海市普陀区金沙江路 1516 弄'
}]
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# 字段说明
- 审批单号 = 流程实例 id (processInstanceId) ,流程定义 ID(processDefinitionId)是设计保存的流程 id,流程定义相当于是一个模版,如同 class 文件,流程实例相当于内存运行的对象,一个流程定义 ID 对应多个 流程实例 id
- variables 用于传递诸如区分条件分支时的值的 k-v,例:金额大于 10000 时为判断分支的条件,则传递
variables: {price: 10000}
- 文字描述“发起人”和“申请人”是指同一个人
# 错误码
错误码 | 含义 | 备注 |
---|---|---|
1100 | 部署流程模版,文件保存失败 | |
1101 | 模版管理不存在 | |
1103 | 流程节点名称不存在 | |
1201 | 任务不存在 | |
1202 | 流程实例不存在 | |
1203 | 任务驳回错误,任务没有上个节点 | |
1204 | 查询待审批任务记录错误,时间参数不应该存在 | |
1205 | 查询任务记录错误,提交开始时间大于提交结束时间 | |
1206 | 查询任务记录错误,审批类型不存在 | |
1207 | 任务驳回错误,发起人不能进行驳回 | |
1208 | 任务审批错误,操作人和审批人不匹配 | |
1209 | 流程实例删除错误,存在运行中的流程 | |
1210 | 流程发起人错误,操作用户无权发起 | |
1211 | 撤回错误,用户不是流程发起人 | |
1212 | 该流程未正常开启,流程轨迹线不存在 | |
1213 | 操作的用户 id 不能为空 | |
1214 | 操作的用户id 和 用户id和角色id集合都为空 | |
1401 | 请求center系统异常 | |
1402 | 角色节点不包含该用户 | |
1403 | 节点该用户已经审批过了 |
# 发起审批
请求地址:/api/approval/start
请求参数:
字段 | 类型 | 必选 | 含义 | 备注 |
---|---|---|---|---|
templateId | String | 0 | 模板 ID | |
tempKey | String | 1 | 模板唯一标识 key | |
startUserId | String | 1 | 流程发起人用户 ID | |
formData | String | 1 | 发起审批的表单数据 | 表单的 key 与 bpmn 中条件网关中的参数名一致。不同表单设计,值会不同。格式为 json 串 |
样例
{
"tempKey": "temp_key_12he89123219",
"startUserId": "144115205301731617",
"formData": "{\"vin\":\"xxxx\",\"env\":\"xxxx\",\"pkginfo\":\"xxxx\",\"charge\":\"xxxx\"}"
}
2
3
4
5
请求响应:
字段 | 类型 | 含义 | 备注 |
---|---|---|---|
code | number | 错误码 | |
message | String | 错误信息 | |
data | Object | 返回内容 | |
data.processInstanceId | String | 节点 Id |
样例
{
"code": 0,
"message": "SUCCESS",
"data": {
"processInstanceId": "123"
}
}
2
3
4
5
6
7
# 审批详情
请求地址:/api/approval/info
请求参数:
字段 | 类型 | 必选 | 含义 | 备注 |
---|---|---|---|---|
processInstanceId | String | 1 | 流程实例 id |
样例
{
"processInstanceId": "5e9ffedf36be045ce0c3f6c8"
}
2
3
请求响应:
字段 | 类型 | 含义 | 备注 |
---|---|---|---|
code | number | 错误码 | |
message | String | 错误信息 | |
data | Object | 返回内容 | |
data.status | number | 流程审核状态 | 1-已通过,2-审批中,3-撤回,4-已驳回 |
data.createTime | String | 流程提交时间 | |
data.createUserId | string | 发起人用户 ID | 由接入层自行转为用户名 |
data.record | object[] | 审批历史,各节点审批详情 | |
data.record[].approver | string | 审批人 ID | |
data.record[].status | string | 节点审核状态 | 1-已通过,2-审批中,3-撤回,4-已驳回 |
data.record[].opTime | number | 节点审批时间 | |
data.record[].comments | object[] | 节点审批意见 | |
data.record[].comment | string | 审批意见 | |
data.record[].taskName | String | 节点名称 | |
data.record[].taskKey | String | 节点 key | |
data.record[].type | String | 节点类型 | user 代表指定审批人节点,role 代表角色节点 |
data.record[].roleId | String | 角色节点 id | |
data.formTpl | string | 流程已经过节点的表单模板 | json 字符串 |
data.formTpl["start-event-task"] | string | 发起人节点(start-event-task)对应的表单 json 串 | |
data.formTpl["user-task-om30dkg"] | string | 节点(user-task-om30dkg)对应的表单 json 串 | |
data.formData | string | 流程已经过节点的表单数据 | json 字符串 |
data.formData["start-event-task"] | string | 发起人节点(start-event-task)对应的表单数据 | |
data.formData["user-task-om30dkg"] | string | 节点(user-task-om30dkg)对应的表单数据 | |
data.curFormTpl | sting | 流程当前节点的表单模板,供当前审批人填写 | json 字符串 |
data.curFormTpl["user-task-vr5lgsicnr0"] | string | user-task-vr5lgsicnr01 节点对应的表单 json 串 | 流程当前节点的表单模板,供当前审批人填写 |
样例
{
"message": "SUCCESS",
"code": "0",
"data": {
"status": 2,
"createTime": "2020-08-18 16:23:20",
"createUserId": "144115205301731413",
"record": [
{
"taskKey": "user-task-uil2c59ktak0",
"approver": "144115205301731413",
"status": 2,
"opTime": null,
"comments": null,
"taskName": "节点",
"roleId": "123",
"type": "role"
},
{
"taskKey": "user-task-r221nigi3540",
"approver": null,
"status": 1,
"opTime": "2020-08-18 16:58:14",
"taskName": "节点",
"roleId": null,
"type": "user",
"comments": [
{
"time": "2020-08-18 16:58:14",
"message": "审批驳回lala1"
}
]
},
{
"taskKey": "user-task-p4v6m3qnlg40",
"approver": "144115205301731413",
"status": 1,
"opTime": "2020-08-18 16:39:16",
"comments": [
{
"time": "2020-08-18 16:39:16",
"message": "审批通过lala"
}
]
},
{
"taskKey": "user-task-start",
"approver": null,
"status": 1,
"opTime": "2020-08-18 16:23:20",
"comments": null
}
],
"formTpl": "{\"user-task-p4v6m3qnlg40\":\"{\"list\":[{\"type\":\"input\",\"icon\":\"icon-input\",\"options\":{\"width\":\"100%\",\"defaultValue\":\"\",\"required\":true,\"dataType\":\"string\",\"pattern\":\"\",\"placeholder\":\"\",\"disabled\":false,\"remoteFunc\":\"func_1597738814000_88426\"},\"name\":\"单行文本\",\"key\":\"1597738814000_88426\",\"model\":\"name1\",\"rules\":[{\"type\":\"string\",\"message\":\"单行文本格式不正确\"},{\"required\":true,\"message\":\"单行文本必须填写\"}]}],\"config\":{\"labelWidth\":100,\"labelPosition\":\"right\",\"size\":\"small\"}}\",\"user-task-uil2c59ktak0\":\"{\"list\":[{\"type\":\"input\",\"icon\":\"icon-input\",\"options\":{\"width\":\"100%\",\"defaultValue\":\"\",\"required\":false,\"dataType\":\"string\",\"pattern\":\"\",\"placeholder\":\"\",\"disabled\":false,\"remoteFunc\":\"func_1597738837000_36838\"},\"name\":\"单行文本\",\"key\":\"1597738837000_36838\",\"model\":\"name2\",\"rules\":[{\"type\":\"string\",\"message\":\"单行文本格式不正确\"}]}],\"config\":{\"labelWidth\":100,\"labelPosition\":\"right\",\"size\":\"small\"}}\",\"user-task-start\":\"{\"list\":[{\"type\":\"number\",\"icon\":\"icon-number\",\"options\":{\"width\":\"\",\"required\":true,\"defaultValue\":0,\"min\":0,\"max\":0,\"step\":1,\"disabled\":false,\"controlsPosition\":\"\",\"remoteFunc\":\"func_1597738685000_441\"},\"name\":\"计数器\",\"key\":\"1597738685000_441\",\"model\":\"number\",\"rules\":[{\"required\":true,\"message\":\"计数器必须填写\"}]}],\"config\":{\"labelWidth\":100,\"labelPosition\":\"right\",\"size\":\"small\"}}\"}",
"formData": "{\"user-task-p4v6m3qnlg40\":{\"name2\":\"测试审批通过了啊啊啊1\"}\",\"user-task-uil2c59ktak0\":\"{\"name2\":\"测试审批通过了啊啊啊2\"}\",\"user-task-start\":\"{\"number\":100}\"}",
"curFormTpl": "{\"user-task-uil2c59ktak0\":\"{\"list\":[{\"type\":\"input\",\"icon\":\"icon-input\",\"options\":{\"width\":\"100%\",\"defaultValue\":\"\",\"required\":false,\"dataType\":\"string\",\"pattern\":\"\",\"placeholder\":\"\",\"disabled\":false,\"remoteFunc\":\"func_1597738837000_36838\"},\"name\":\"单行文本\",\"key\":\"1597738837000_36838\",\"model\":\"name2\",\"rules\":[{\"type\":\"string\",\"message\":\"单行文本格式不正确\"}]}],\"config\":{\"labelWidth\":100,\"labelPosition\":\"right\",\"size\":\"small\"}}\"}"
}
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# 重新发起审批
请求地址:/api/approval/reStart
请求参数:
字段 | 类型 | 必选 | 含义 | 备注 |
---|---|---|---|---|
taskId | String | 1 | 节点 ID | |
approver | String | 1 | 发起人 ID | |
formData | String | 1 | 发起审批的表单数据 | 申请表单数据的 json 字符串,表单的 key 与 bpmn 中条件网关中的参数名一致。不同表单设计,值会不同,以”流量购买“审批为例 |
样例
{
"taskId": "1508",
"approver": "12322122222222232",
"formData": "{\"vin\":\"xxxx\",\"env\":\"xxxx\",\"pkginfo\":\"xxxx\",\"charge\":\"xxxx\"}"
}
2
3
4
5
请求响应:
字段 | 类型 | 含义 | 备注 |
---|---|---|---|
code | number | 错误码 | |
message | String | 错误信息 | |
data | Object | 返回内容 |
样例
{
"code": 0,
"message": "流程重新发起成功",
"data": {
"processInstanceId": "123"
}
}
2
3
4
5
6
7
# 审批操作
请求地址:/api/approval/exec
请求参数:
字段 | 类型 | 必选 | 含义 | 备注 |
---|---|---|---|---|
taskId | String | 1 | 节点 ID | |
approver | String | 1 | 审批人用户 ID | |
comment | string | 0 | 审批评论 | |
formData | String | 1 | 发起审批的表单数据 | 申请表单数据的 json 字符串,表单的 key 与 bpmn 中条件网关中的参数名一致。不同表单设计,值会不同,以”流量购买“审批为例 |
backIfReject | boolean | 0 | 如果驳回,是否返回上一个流程节点。不返回则流程结束。默认为 false | |
audit | boolean | 1 | 审批动作 | false-驳回;true-通过 |
样例
{
"taskId": "1508",
"approver": "12322122222222232",
"audit": true,
"comment": "注意金额,先通过",
"backIfReject": true,
"formData": "{\"vin\":\"xxxx\",\"env\":\"xxxx\",\"pkginfo\":\"xxxx\",\"charge\":\"xxxx\"}"
}
2
3
4
5
6
7
8
请求响应:
字段 | 类型 | 含义 | 备注 |
---|---|---|---|
code | number | 错误码 | |
message | String | 错误信息 | |
data | Object | 返回内容 |
样例
{
"code": 0,
"message": "流程审批通过",
"data": {
"processInstanceId": "123"
}
}
2
3
4
5
6
7
# 批量审批
请求地址:/api/approval/execAll
请求参数:
字段 | 类型 | 必选 | 含义 | 备注 |
---|---|---|---|---|
taskIds | Array | 1 | 节点 ID 数组 | |
approver | String | 1 | 审批人用户 ID | |
backIfReject | boolean | 0 | 如果驳回,是否返回上一个流程节点。不返回则流程结束。默认为 false | |
audit | boolean | 1 | 审批动作 | false-驳回;true-通过 |
样例
{
"taskId": ["1508", "1501"],
"approver": "12322122222222232",
"audit": true,
"backIfReject": true
}
2
3
4
5
6
请求响应:
字段 | 类型 | 含义 | 备注 |
---|---|---|---|
code | number | 错误码 | |
message | String | 错误信息,审批操作成功(只有所有操作成功才返回操作成功)、审批操作失败 | |
data | Array | 返回数据 | 返回审批成功的 processInstanceId 组成的数组,失败的 processInstanceId 不会返回 |
样例
{
"code": 0,
"message": "审批操作成功",
"data": ["123", "124"]
}
2
3
4
5
# 审批撤回
请求地址:/api/approval/recall
请求参数:
字段 | 类型 | 必选 | 含义 | 备注 |
---|---|---|---|---|
userId | String | 0 | 申请人 id | 只有申请人才能撤销 |
processInstanceId | String | 1 | 流程实例 id | |
deleteReason | string | 0 | 撤回填写原因 | 默认:用户撤销 |
样例
{
"userId": "12322122222222232",
"processInstanceId": "1232",
"deleteReason": "不符合要求"
}
2
3
4
5
请求响应:
字段 | 类型 | 含义 | 备注 |
---|---|---|---|
code | number | 错误码 | |
message | String | 错误信息 | |
data | Object | 返回内容 |
样例
{
"code": 0,
"message": "",
"data": {}
}
2
3
4
5
# 审批列表
请求地址:/api/approval/list
请求参数:
字段 | 类型 | 必选 | 含义 | 备注 |
---|---|---|---|---|
processDefinitionId | String | 0 | 流程定义 id | |
type | string | 0 | 审核状态 | 1: 已通过 2:审批中 3: 撤回 4:驳回 |
submitStartTime | string | 0 | 提交开始时间 | |
submitEndTime | string | 0 | 提交结束时间 | |
finishStartTime | string | 0 | 完成开始时间 | |
finishEndTime | string | 0 | 完成结束时间 | |
pageSize | number | 0 | 每页行数 | |
pageNum | number | 0 | 页数 |
样例
{
"processDefinitionId": "123",
"type": 1,
"submitStartTime": "2020-08-01 00:00:00",
"submitEndTime": "2020-08-01 00:00:00",
"finishStartTime": "2020-08-01 00:00:00",
"finishEndTime": "2020-08-01 00:00:00",
"pageSize": 10,
"pageNum": 1
}
2
3
4
5
6
7
8
9
10
请求响应:
字段 | 类型 | 含义 | 备注 |
---|---|---|---|
code | number | 错误码 | |
message | String | 错误信息 | |
data | Object | 返回内容 | |
data.records | object[] | 记录列表 | |
data.records[].processInstanceId | String | 流程实例 id | |
data.records[].startUserId | String | 发起人用户 id | |
data.records[].createTime | String | 发起时间 | |
data.records[].endTime | String | 结束时间 | |
data.records[].status | String | 状态中文 | |
data.records[].taskId | String | 节点 id | |
data.records[].processDefinitionId | String | 流程定义 id | |
data.records[].reStart | Boolean | 是否可以重新发起审批(审批人) | |
data.total | number | 总数 | |
data.size | number | 每页个数 | |
data.current | number | 当前页数 | |
data.pages | number | 总页数 |
样例
{
"message": "SUCCESS",
"code": "enim reprehenderit",
"data": {
"records": [
{
"processInstanceId": "123",
"startUserId": "exerc",
"createTime": "2020-08-01 00:00:00",
"endTime": "2020-08-01 00:00:00",
"status": 1,
"taskId": "1231",
"processDefinitionId": "12331",
"reStart": false
}
],
"total": 100,
"size": 1,
"current": 1,
"pages": 5
}
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# 我的发起列表
请求地址:/api/approval/myApply
请求参数:
字段 | 类型 | 必选 | 含义 | 备注 |
---|---|---|---|---|
type | string | 0 | 审核状态 | 1: 已通过 2:审批中 3: 撤回 4:驳回 |
submitStartTime | string | 0 | 提交开始时间 | |
submitEndTime | string | 0 | 提交结束时间 | |
finishStartTime | string | 0 | 完成开始时间 | |
finishEndTime | string | 0 | 完成结束时间 | |
userId | string | 0 | 发起人 id | |
templateId | String | 0 | 模板 id | |
tempKey | String | 0 | 模板唯一标识 key | |
pageSize | number | 0 | 每页行数 | |
pageNum | number | 0 | 页数 |
样例
{
"processDefinitionId": "123",
"type": 1,
"submitStartTime": "2020-08-01 00:00:00",
"submitEndTime": "2020-08-01 00:00:00",
"finishStartTime": "2020-08-01 00:00:00",
"finishEndTime": "2020-08-01 00:00:00",
"userId": "1142343323323",
"templateId": "1",
"pageSize": 10,
"pageNum": 1
}
2
3
4
5
6
7
8
9
10
11
12
请求响应:
字段 | 类型 | 含义 | 备注 |
---|---|---|---|
code | number | 错误码 | |
message | String | 错误信息 | |
data | Object | 返回内容 | |
data.records | object[] | 记录列表 | |
data.records[].processInstanceId | String | 流程实例 id | |
data.records[].startUserId | String | 发起人用户 id | |
data.records[].createTime | String | 发起时间 | |
data.records[].endTime | String | 结束时间 | |
data.records[].status | String | 状态中文 | |
data.records[].taskId | String | 节点 id | |
data.records[].processDefinitionId | String | 流程定义 id | |
data.records[].reStart | Boolean | 是否可以重新发起审批(审批人) | |
data.total | number | 总数 | |
data.size | number | 每页个数 | |
data.current | number | 当前页数 | |
data.pages | number | 总页数 |
样例
{
"message": "SUCCESS",
"code": "0",
"data": {
"records": [
{
"processInstanceId": "123",
"startUserId": "exerc",
"createTime": "2020-08-01 00:00:00",
"endTime": "2020-08-01 00:00:00",
"status": 1,
"taskId": "1231",
"processDefinitionId": "12331",
"reStart": false
}
],
"total": 100,
"size": 1,
"current": 1,
"pages": 5
}
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# 我的审批列表-待处理
请求地址:/api/approval/myApproveToDo
请求参数:
字段 | 类型 | 必选 | 含义 | 备注 |
---|---|---|---|---|
processDefinitionId | String | 0 | 流程定义 id | |
processInstanceId | String | 0 | 流程实例 id | |
submitStartTime | String | 0 | 提交开始时间 | |
submitEndTime | String | 0 | 提交结束时间 | |
userId | String | 0 | 审批人 id | |
taskKey | String | 0 | 节点名称 key | |
taskName | String | 0 | 节点名称(节点名称查询必须传 tempId) | |
tempId | String | 0 | 模板 id | |
startUserId | String | 0 | 申请人 id | |
pageSize | number | 0 | 每页行数 | |
pageNum | number | 0 | 页数 |
样例
{
"processDefinitionId": "123",
"processInstanceId": "112",
"submitStartTime": "2020-08-01 00:00:00",
"submitEndTime": "2020-08-01 00:00:00",
"startUserId": "1142343322345",
"userId": "1142343323323",
"pageSize": 10,
"pageNum": 1
}
2
3
4
5
6
7
8
9
10
请求响应:
字段 | 类型 | 含义 | 备注 |
---|---|---|---|
code | number | 错误码 | |
message | String | 错误信息 | |
data | Object | 返回内容 | |
data.records | object[] | 记录列表 | |
data.records[].processInstanceId | String | 流程实例 id | |
data.records[].startUserId | String | 发起人用户 id | |
data.records[].createTime | String | 发起时间 | |
data.records[].endTime | String | 结束时间 | |
data.records[].status | String | 状态中文 | |
data.records[].taskId | String | 任务 id | |
data.records[].processDefinitionId | String | 流程定义 id | |
data.records[].taskName | String | 节点名称 | |
data.records[].reStart | Boolean | 是否可以重新发起审批(审批人) | |
data.records[].approvered | Boolean | 是否审批过(true:已审批;false:未审批) | |
data.total | number | 总数 | |
data.size | number | 每页个数 | |
data.current | number | 当前页数 | |
data.pages | number | 总页数 |
样例
{
"message": "SUCCESS",
"code": "0",
"data": {
"records": [
{
"processInstanceId": "123",
"startUserId": "exerc",
"createTime": "2020-08-01 00:00:00",
"endTime": "2020-08-01 00:00:00",
"status": 1,
"taskId": "1231",
"processDefinitionId": "12331",
"taskName": "节点",
"approvered": false
}
],
"total": 100,
"size": 1,
"current": 1,
"pages": 5
}
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# 我的审批列表-已处理
请求地址:/api/approval/myApproveDone
请求参数:
字段 | 类型 | 必选 | 含义 | 备注 |
---|---|---|---|---|
processDefinitionId | String | 0 | 流程定义 id | |
type | string | 0 | 审核状态 | 1: 已通过 2:审批中 3: 撤回 4:驳回 |
submitStartTime | string | 0 | 提交开始时间 | |
submitEndTime | string | 0 | 提交结束时间 | |
finishStartTime | string | 0 | 完成开始时间 | |
finishEndTime | string | 0 | 完成结束时间 | |
userId | string | 0 | 审批人 id | |
pageSize | number | 0 | 每页行数 | |
pageNum | number | 0 | 页数 |
样例
{
"processDefinitionId": "123",
"submitStartTime": "2020-08-01 00:00:00",
"submitEndTime": "2020-08-01 00:00:00",
"userId": "1142343323323",
"pageSize": 10,
"pageNum": 1
}
2
3
4
5
6
7
8
请求响应:
字段 | 类型 | 含义 | 备注 |
---|---|---|---|
code | number | 错误码 | |
message | String | 错误信息 | |
data | Object | 返回内容 | |
data.records | object[] | 记录列表 | |
data.records[].processInstanceId | String | 流程实例 id | |
data.records[].startUserId | String | 发起人用户 id | |
data.records[].createTime | String | 发起时间 | |
data.records[].endTime | String | 结束时间 | |
data.records[].status | String | 状态中文 | |
data.records[].taskId | String | 任务 id | |
data.records[].processDefinitionId | String | 流程定义 id | |
data.records[].reStart | Boolean | 是否可以重新发起审批(审批人) | |
data.total | number | 总数 | |
data.size | number | 每页个数 | |
data.current | number | 当前页数 | |
data.pages | number | 总页数 |
样例
{
"message": "SUCCESS",
"code": "0",
"data": {
"records": [
{
"processInstanceId": "123",
"startUserId": "exerc",
"createTime": "2020-08-01 00:00:00",
"endTime": "2020-08-01 00:00:00",
"status": 1,
"taskId": "1231",
"processDefinitionId": "12331",
"reStart": false
}
],
"total": 100,
"size": 1,
"current": 1,
"pages": 5
}
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# 模板详情查询
注:可获取某个模板下的所有节点名称列表
请求地址:/api/approval/tplInfo
请求参数:
字段 | 类型 | 必选 | 含义 | 备注 |
---|---|---|---|---|
id | String | 1 | 模板 id |
样例
{
"id": "5"
}
2
3
请求响应:
字段 | 类型 | 备注 | 含义 |
---|---|---|---|
code | String | 错误码 | |
message | String | 错误信息 | |
data | Object | 返回内容 | |
data.id | Stirng | 模板 id | |
data.icon | String | 模板图标地址 | |
data.category | String | 模板分组名称 | |
data.name | String | 模板名称 | |
data.tempKey | String | 模板 key | |
data.description | String | 模板说明 | |
data.owner | String | 发起人列表 | id 用逗号隔开的字符串"144115205301731423,144115205301731413" |
data.form | String | 模板所有表单 key-value JSON 串 | 同“审批详情” data.formTpl |
data.bpmn | String | bpmn xml 字符串 | 使用需转义 json |
data.nodes | String | 当前模板名称列表 JSON 串 | 用于获取节点名称列表,key-value 组合的 json 串,key:节点 id,value: 节点 name |
data.createdTime | String | 创建时间 | |
data.updatedTime | String | 更新时间 | |
data.did | String |
样例
{
"message": "SUCCESS",
"code": "0",
"data": {
"id": 3,
"icon": "",
"category": "财务",
"name": "测试条件保存",
"tempKey": "temp_key_iuuir46fs1s0",
"description": "111",
"owner": "144115205301731423,144115205301731413,144115205301731318,144115205301731063",
"form": "{\"user-task-start\":\"{\\\"list\\\":[{\\\"type\\\":\\\"number\\\",\\\"icon\\\":\\\"icon-number\\\",\\\"options\\\":{\\\"width\\\":\\\"\\\",\\\"required\\\":false,\\\"defaultValue\\\":0,\\\"min\\\":0,\\\"max\\\":0,\\\"step\\\":1,\\\"disabled\\\":false,\\\"controlsPosition\\\":\\\"\\\",\\\"remoteFunc\\\":\\\"func_1598144379000_24230\\\"},\\\"name\\\":\\\"计数器\\\",\\\"key\\\":\\\"1598144379000_24230\\\",\\\"model\\\":\\\"number\\\",\\\"rules\\\":[]},{\\\"type\\\":\\\"radio\\\",\\\"icon\\\":\\\"icon-radio-active\\\",\\\"options\\\":{\\\"inline\\\":false,\\\"defaultValue\\\":\\\"\\\",\\\"showLabel\\\":false,\\\"options\\\":[{\\\"value\\\":\\\"Option 1\\\",\\\"label\\\":\\\"Option 1\\\"},{\\\"value\\\":\\\"Option 2\\\",\\\"label\\\":\\\"Option 2\\\"},{\\\"value\\\":\\\"Option 3\\\",\\\"label\\\":\\\"Option 3\\\"}],\\\"required\\\":false,\\\"width\\\":\\\"\\\",\\\"remote\\\":false,\\\"remoteOptions\\\":[],\\\"props\\\":{\\\"value\\\":\\\"value\\\",\\\"label\\\":\\\"label\\\"},\\\"remoteFunc\\\":\\\"func_1598144379000_50372\\\",\\\"disabled\\\":false},\\\"name\\\":\\\"单选框组\\\",\\\"key\\\":\\\"1598144379000_50372\\\",\\\"model\\\":\\\"radio_1598144379000_50372\\\",\\\"rules\\\":[]}],\\\"config\\\":{\\\"labelWidth\\\":100,\\\"labelPosition\\\":\\\"right\\\",\\\"size\\\":\\\"small\\\"}}\"}",
"bpmn": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><definitions xmlns=\"http://www.omg.org/spec/BPMN/20100524/MODEL\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:activiti=\"http://activiti.org/bpmn\" xmlns:bpmndi=\"http://www.omg.org/spec/BPMN/20100524/DI\" xmlns:omgdc=\"http://www.omg.org/spec/DD/20100524/DC\" xmlns:omgdi=\"http://www.omg.org/spec/DD/20100524/DI\" typeLanguage=\"http://www.w3.org/2001/XMLSchema\" expressionLanguage=\"http://www.w3.org/1999/XPath\" targetNamespace=\"http://www.activiti.org/processdef\"><process id=\"temp_key_iuuir46fs1s0\" name=\"iov流程设计demo\" isExecutable=\"true\"><startEvent id=\"start-event-oug9i7rr4680\"/><userTask id=\"user-task-start\" activiti:assignee=\"${startUser}\"><documentation>{}</documentation></userTask><userTask id=\"user-task-n8lu63r4tbk0\" name=\"leader2\" activiti:assignee=\"144115205301731413\"><documentation>{\"userName\":\"张现超\"}</documentation></userTask><userTask id=\"user-task-ib6flu4itg00\" name=\"leader2\" activiti:assignee=\"144115205301731413\"><documentation>{\"userName\":\"张现超\"}</documentation></userTask><userTask id=\"user-task-itn2kpqbvpg0\" name=\"leader3\" activiti:assignee=\"144115205301731413\"><documentation>{\"userName\":\"张现超\"}</documentation></userTask><exclusiveGateway id=\"exclusive-gateway-visp174dbjk0\"/><endEvent id=\"end-event-s97eegdug680\"/><sequenceFlow id=\"flow-134ko0p8jg680\" sourceRef=\"start-event-oug9i7rr4680\" targetRef=\"user-task-start\"/><sequenceFlow id=\"flow-103vspumc5rg0\" sourceRef=\"user-task-ib6flu4itg00\" targetRef=\"exclusive-gateway-visp174dbjk0\"/><sequenceFlow id=\"flow-msvb1ka2lrk0\" name=\"计数器:大于100\" sourceRef=\"exclusive-gateway-visp174dbjk0\" targetRef=\"user-task-n8lu63r4tbk0\"><conditionExpression xsi:type=\"tFormalExpression\"><![CDATA[${number>100}]]></conditionExpression></sequenceFlow><sequenceFlow id=\"flow-117n9p1s16jg0\" sourceRef=\"user-task-n8lu63r4tbk0\" targetRef=\"end-event-s97eegdug680\"/><sequenceFlow id=\"flow-rt8skuijlrk0\" sourceRef=\"exclusive-gateway-visp174dbjk0\" targetRef=\"user-task-itn2kpqbvpg0\"/><sequenceFlow id=\"flow-tdp985jdp800\" name=\"leader2\" sourceRef=\"user-task-start\" targetRef=\"user-task-ib6flu4itg00\"/><sequenceFlow id=\"flow-13l5ln2c7qe80\" sourceRef=\"user-task-itn2kpqbvpg0\" targetRef=\"end-event-s97eegdug680\"/></process></definitions>",
"nodes": "{\"user-task-oduew03s\": \"leader1\", \"user-task-mb90uew03s\": \"leader2\"}",
"createdTime": "2020-08-23 17:01:11",
"updatedTime": null,
"did": "7"
}
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# 错误码
错误码 | 含义 | 备注 |
---|---|---|
-10001 | 未登录,需要登录 | |
-10003 | 获取 token 失败 | |
-10004 | token 校验失败 | |
-10006 | jwt 校验失败 | |
-10010 | 账号服务内部错误 | |
-10011 | 账号过期 | |
-10012 | 账号未在 IAM 中注册 | |
-10013 | 账号被禁用 | |
-10014 | 请求无权限 | |
-10015 | 用户无系统角色 | |
-10016 | 用户无系统组织机构 | |
-20000 | 系统内部错误 | |
-20002 | redis 连接错误 | |
-20003 | http 方法错误 | |
-20004 | sdk 无权限访问系统 | |
-20005 | 子应用非法访问系统 | |
-20006 | 应用管理服务内部错误 | |
-20007 | http 请求错误 | |
-20008 | 方法参数错误 | |
-20010 | inc sdk 内部错误 | |
-30000 | 日志服务内部错误 | |
-40000 | 用户服务内部错误 | |
-40004 | 保存用户失败 | |
-40005 | 删除用户失败 | |
-40006 | 更新用户失败 | |
-40007 | 获取用户失败 | |
-50000 | 权限服务内部错误 | |
-70000 | 组织机构/租户服务内部错误 | |
-80001 | 文件导出失败 | |
-90001 | cos 未配置 |