scope: org:relation:dingtalk
| 项目 | 说明 |
|---|---|
| 接口路径 | POST /open/api/v1/org/setOrgDingTalkDept |
| Content-Type | application/json |
| 所需权限 | org:relation:dingtalk |
| 接口说明 | 将 Venus 系统中的组织与钉钉通讯录部门建立关联映射关系 |
| 参数名 | 类型 | 是否必填 | 说明 | 示例 |
|---|---|---|---|---|
corpId | String | 是 | 企业ID | "ding4c7c311a701851ac35c2f4657eb6378f" |
orgId | String | 是 | Venus 系统组织ID | "org_14bfa9a7264848ea929a03151121816c" |
deptId | String | 是 | 钉钉通讯录部门ID | "12345678" |
{
"corpId": "ding4c7c311a701851ac35c2f4657eb6378f",
"orgId": "org_14bfa9a7264848ea929a03151121816c",
"deptId": "12345678"
}| 参数名 | 类型 | 说明 |
|---|---|---|
data | Object | 响应数据体 |
success | Boolean | 请求是否成功 |
errorCode | String | 错误编码,正常为 null |
errorMsg | String | 错误信息,正常为 null |
| 参数名 | 类型 | 说明 |
|---|---|---|
corpId | String | 企业ID |
orgId | String | 组织ID |
deptId | String | 钉钉部门ID |
errorMsg | Map<String, String> | 错误信息。null 表示操作成功;非 null 时,key 为字段标识,value 为错误提示 |
{
"data": {
"corpId": "ding4c7c311a701851ac35c2f4657eb6378f",
"orgId": "org_14bfa9a7264848ea929a03151121816c",
"deptId": "12345678",
"errorMsg": null
},
"success": true,
"errorCode": null,
"errorMsg": null
}{
"data": {
"corpId": "ding4c7c311a701851ac35c2f4657eb6378f",
"orgId": "org_xxxx",
"deptId": "12345678",
"errorMsg": {
"orgId": "组织不存在"
}
},
"success": true,
"errorCode": null,
"errorMsg": null
}{
"data": {
"corpId": "ding4c7c311a701851ac35c2f4657eb6378f",
"orgId": "org_14bfa9a7264848ea929a03151121816c",
"deptId": "12345678",
"errorMsg": {
"orgId": "已经关联"
}
},
"success": true,
"errorCode": null,
"errorMsg": null
}{
"success": false,
"errorCode": "400",
"errorMsg": "钉钉部门ID不能为空"
}| 序号 | 校验项 | 错误信息 | 错误字段 key |
|---|---|---|---|
| 1 | 企业ID不能为空 | 企业ID不能为空 | 参数校验层返回 |
| 2 | 组织ID不能为空 | 组织ID不能为空 | 参数校验层返回 |
| 3 | 钉钉部门ID不能为空 | 钉钉部门ID不能为空 | 参数校验层返回 |
| 4 | 组织必须存在(基于当 前日期生效的记录) | 组织不存在 | orgId |
| 5 | 同一组织与同一钉钉部门不能重复关联 | 已经关联 | orgId |
请求进入
│
├── 1. 参数校验(corpId / orgId / deptId 不能为空)
│
├── 2. 权限校验(需要 org:relation:dingtalk 权限)
│
├── 3. 校验组织是否存在(基于当前日期查询生效中的组织记录)
│ └── 不存在 → 返回"组织不存在"
│
├── 4. 查询该组织与该钉钉部门是否已有映射关系
│ └── 已存在且同步完成 → 返回"已经关联"
│
├── 5. 创建或更新映射关系
│ ├── 无映射记录 → 创建新的映射关系
│ └── 有映射记录但未同步 → 更新映射状态为已同步
│
├── 6. 保存映射关系
│
└── 返回成功响应(errorMsg = null)success 始终为 true,需要通过 data.errorMsg 是否为 null 来判断操作是否真正成功/open/api/v1/org/cancelOrgDingTalkDept)