# E10_HR同步_通过ESB动作流同步E9组织架构、人员配置文档

来源快照：`result_data_new_260518.json`

- 来源 ID：`1234811661830660097`
- 模块：低代码平台e-builder
- 目录：动作流 - 场景搭建 - 数据同步相关场景
- space ID：`1157961794811633670`
- 原文链接：未提供
- 产品基线：未提供

## 正文

# E10_HR同步_通过ESB动作流同步E9组织架构、人员配置文档

## 一、前提条件

1.

具有ESB中心-动作流配置权限

2.

具有集成中心-HR同步配置权限

3.

拥有E9系统接口调用许可证appid，许可证获取文档如下：

Token认证使用步骤V3：[https://www.showdoc.com.cn/p/1b3374375d38acb1b9f808daa36906ae](https://www.showdoc.com.cn/p/1b3374375d38acb1b9f808daa36906ae)

E9接口文档：[https://e-cloudstore.com/doc.html?appId=c373a4b01fb74d098b62e2b969081d2d#3.%E8%8E%B7%E5%8F%96%E5%B2%97%E4%BD%8D%E5%88%97%E8%A1%A8](https://e-cloudstore.com/doc.html?appId=c373a4b01fb74d098b62e2b969081d2d#3.%E8%8E%B7%E5%8F%96%E5%B2%97%E4%BD%8D%E5%88%97%E8%A1%A8)

## 二、生成系统公钥以及系统密钥

参照[Token认证使用步骤V3](https://www.showdoc.com.cn/p/1b3374375d38acb1b9f808daa36906ae)生成服务端公钥以及密钥信息

后续会将appid，服务端密钥，服务端公钥分别配置在自定义参数1、自定义参数2以及自定义参数3上

![](https://weapp.eteams.cn/papi/file/preview?fileId=1234811777844961283&type=redirect&customParam=%7B%22isExtDist%22%3Atrue%2C%22distributeId%22%3A%22%22%2C%22externalId%22%3A%22%22%2C%22appId%22%3A%22%22%7D)

![](https://weapp.eteams.cn/papi/file/preview?fileId=1234811782123151366&type=redirect&customParam=%7B%22isExtDist%22%3Atrue%2C%22distributeId%22%3A%22%22%2C%22externalId%22%3A%22%22%2C%22appId%22%3A%22%22%7D)

## 三、构建E9系统连接器

### 3.1 新建连接信息

按照实际情况填写

![](https://weapp.eteams.cn/papi/file/preview?fileId=1234811799461576707&type=redirect&customParam=%7B%22isExtDist%22%3Atrue%2C%22distributeId%22%3A%22%22%2C%22externalId%22%3A%22%22%2C%22appId%22%3A%22%22%7D)

新建常量，存储系统中有组织架构查询权限的人员的人员id

![](https://weapp.eteams.cn/papi/file/preview?fileId=1234811782075392017&type=redirect&customParam=%7B%22isExtDist%22%3Atrue%2C%22distributeId%22%3A%22%22%2C%22externalId%22%3A%22%22%2C%22appId%22%3A%22%22%7D)

### 3.2 配置接口信息

#### 3.2.1 获取token接口

参照[Token认证使用步骤V3](https://www.showdoc.com.cn/p/1b3374375d38acb1b9f808daa36906ae)中的获取token接口配置接口信息，示例如下：

1.

基础信息

![](https://weapp.eteams.cn/papi/file/preview?fileId=1234811825134116866&type=redirect&customParam=%7B%22isExtDist%22%3Atrue%2C%22distributeId%22%3A%22%22%2C%22externalId%22%3A%22%22%2C%22appId%22%3A%22%22%7D)

2.

请求信息

![](https://weapp.eteams.cn/papi/file/preview?fileId=1234811803652096000&type=redirect&customParam=%7B%22isExtDist%22%3Atrue%2C%22distributeId%22%3A%22%22%2C%22externalId%22%3A%22%22%2C%22appId%22%3A%22%22%7D)

3.

响应信息

![](https://weapp.eteams.cn/papi/file/preview?fileId=1234811790780194823&type=redirect&customParam=%7B%22isExtDist%22%3Atrue%2C%22distributeId%22%3A%22%22%2C%22externalId%22%3A%22%22%2C%22appId%22%3A%22%22%7D)

4.

成功失败

![](https://weapp.eteams.cn/papi/file/preview?fileId=1234811825134116869&type=redirect&customParam=%7B%22isExtDist%22%3Atrue%2C%22distributeId%22%3A%22%22%2C%22externalId%22%3A%22%22%2C%22appId%22%3A%22%22%7D)

#### 3.2.2 获取分部列表

根据[E9接口文档](https://e-cloudstore.com/doc.html?appId=c373a4b01fb74d098b62e2b969081d2d#3.%E8%8E%B7%E5%8F%96%E5%B2%97%E4%BD%8D%E5%88%97%E8%A1%A8)中获取分部列表接口进行相关配置

1.

基础信息

![](https://weapp.eteams.cn/papi/file/preview?fileId=1234811786383736850&type=redirect&customParam=%7B%22isExtDist%22%3Atrue%2C%22distributeId%22%3A%22%22%2C%22externalId%22%3A%22%22%2C%22appId%22%3A%22%22%7D)

2.

请求信息

![](https://weapp.eteams.cn/papi/file/preview?fileId=1234811777760247809&type=redirect&customParam=%7B%22isExtDist%22%3Atrue%2C%22distributeId%22%3A%22%22%2C%22externalId%22%3A%22%22%2C%22appId%22%3A%22%22%7D)

![](https://weapp.eteams.cn/papi/file/preview?fileId=1234811820786245638&type=redirect&customParam=%7B%22isExtDist%22%3Atrue%2C%22distributeId%22%3A%22%22%2C%22externalId%22%3A%22%22%2C%22appId%22%3A%22%22%7D)

3.

响应信息

![](https://weapp.eteams.cn/papi/file/preview?fileId=1234811799328186376&type=redirect&customParam=%7B%22isExtDist%22%3Atrue%2C%22distributeId%22%3A%22%22%2C%22externalId%22%3A%22%22%2C%22appId%22%3A%22%22%7D)

![](https://weapp.eteams.cn/papi/file/preview?fileId=1234811816545386499&type=redirect&customParam=%7B%22isExtDist%22%3Atrue%2C%22distributeId%22%3A%22%22%2C%22externalId%22%3A%22%22%2C%22appId%22%3A%22%22%7D)

4.

成功失败

![](https://weapp.eteams.cn/papi/file/preview?fileId=1234811816586125322&type=redirect&customParam=%7B%22isExtDist%22%3Atrue%2C%22distributeId%22%3A%22%22%2C%22externalId%22%3A%22%22%2C%22appId%22%3A%22%22%7D)

#### 3.2.3 获取部门列表

根据[E9接口文档](https://e-cloudstore.com/doc.html?appId=c373a4b01fb74d098b62e2b969081d2d#3.%E8%8E%B7%E5%8F%96%E5%B2%97%E4%BD%8D%E5%88%97%E8%A1%A8)中获取部门列表接口进行相关配置

1.

基础信息

![](https://weapp.eteams.cn/papi/file/preview?fileId=1234811786530947076&type=redirect&customParam=%7B%22isExtDist%22%3Atrue%2C%22distributeId%22%3A%22%22%2C%22externalId%22%3A%22%22%2C%22appId%22%3A%22%22%7D)

2.

请求信息

![](https://weapp.eteams.cn/papi/file/preview?fileId=1234811799448199174&type=redirect&customParam=%7B%22isExtDist%22%3Atrue%2C%22distributeId%22%3A%22%22%2C%22externalId%22%3A%22%22%2C%22appId%22%3A%22%22%7D)

![](https://weapp.eteams.cn/papi/file/preview?fileId=1234811807976013839&type=redirect&customParam=%7B%22isExtDist%22%3Atrue%2C%22distributeId%22%3A%22%22%2C%22externalId%22%3A%22%22%2C%22appId%22%3A%22%22%7D)

3.

响应信息

![](https://weapp.eteams.cn/papi/file/preview?fileId=1234811795036995590&type=redirect&customParam=%7B%22isExtDist%22%3Atrue%2C%22distributeId%22%3A%22%22%2C%22externalId%22%3A%22%22%2C%22appId%22%3A%22%22%7D)

![](https://weapp.eteams.cn/papi/file/preview?fileId=1234811807954247684&type=redirect&customParam=%7B%22isExtDist%22%3Atrue%2C%22distributeId%22%3A%22%22%2C%22externalId%22%3A%22%22%2C%22appId%22%3A%22%22%7D)

4.

成功失败

![](https://weapp.eteams.cn/papi/file/preview?fileId=1234811799461576706&type=redirect&customParam=%7B%22isExtDist%22%3Atrue%2C%22distributeId%22%3A%22%22%2C%22externalId%22%3A%22%22%2C%22appId%22%3A%22%22%7D)

#### 3.2.4 获取岗位列表

根据[E9接口文档](https://e-cloudstore.com/doc.html?appId=c373a4b01fb74d098b62e2b969081d2d#3.%E8%8E%B7%E5%8F%96%E5%B2%97%E4%BD%8D%E5%88%97%E8%A1%A8)中获取岗位列表接口进行相关配置

1.

基础信息

![](https://weapp.eteams.cn/papi/file/preview?fileId=1234811790854864897&type=redirect&customParam=%7B%22isExtDist%22%3Atrue%2C%22distributeId%22%3A%22%22%2C%22externalId%22%3A%22%22%2C%22appId%22%3A%22%22%7D)

2.

请求信息

![](https://weapp.eteams.cn/papi/file/preview?fileId=1234811803652096007&type=redirect&customParam=%7B%22isExtDist%22%3Atrue%2C%22distributeId%22%3A%22%22%2C%22externalId%22%3A%22%22%2C%22appId%22%3A%22%22%7D)

![](https://weapp.eteams.cn/papi/file/preview?fileId=1234811825172660231&type=redirect&customParam=%7B%22isExtDist%22%3Atrue%2C%22distributeId%22%3A%22%22%2C%22externalId%22%3A%22%22%2C%22appId%22%3A%22%22%7D)

3.

响应信息

![](https://weapp.eteams.cn/papi/file/preview?fileId=1234811795036995589&type=redirect&customParam=%7B%22isExtDist%22%3Atrue%2C%22distributeId%22%3A%22%22%2C%22externalId%22%3A%22%22%2C%22appId%22%3A%22%22%7D)

![](https://weapp.eteams.cn/papi/file/preview?fileId=1234811816541609985&type=redirect&customParam=%7B%22isExtDist%22%3Atrue%2C%22distributeId%22%3A%22%22%2C%22externalId%22%3A%22%22%2C%22appId%22%3A%22%22%7D)

4.

成功失败

![](https://weapp.eteams.cn/papi/file/preview?fileId=1234811820786245639&type=redirect&customParam=%7B%22isExtDist%22%3Atrue%2C%22distributeId%22%3A%22%22%2C%22externalId%22%3A%22%22%2C%22appId%22%3A%22%22%7D)

#### 3.2.5 获取人员信息列表

根据[E9接口文档](https://e-cloudstore.com/doc.html?appId=c373a4b01fb74d098b62e2b969081d2d#3.%E8%8E%B7%E5%8F%96%E5%B2%97%E4%BD%8D%E5%88%97%E8%A1%A8)中获取人员信息列表接口进行相关配置

1.

基础信息

![](https://weapp.eteams.cn/papi/file/preview?fileId=1234811790854864901&type=redirect&customParam=%7B%22isExtDist%22%3Atrue%2C%22distributeId%22%3A%22%22%2C%22externalId%22%3A%22%22%2C%22appId%22%3A%22%22%7D)

2.

请求信息

![](https://weapp.eteams.cn/papi/file/preview?fileId=1234811777931419653&type=redirect&customParam=%7B%22isExtDist%22%3Atrue%2C%22distributeId%22%3A%22%22%2C%22externalId%22%3A%22%22%2C%22appId%22%3A%22%22%7D)

![](https://weapp.eteams.cn/papi/file/preview?fileId=1234811782185648134&type=redirect&customParam=%7B%22isExtDist%22%3Atrue%2C%22distributeId%22%3A%22%22%2C%22externalId%22%3A%22%22%2C%22appId%22%3A%22%22%7D)

3.

响应信息

![](https://weapp.eteams.cn/papi/file/preview?fileId=1234811812225253378&type=redirect&customParam=%7B%22isExtDist%22%3Atrue%2C%22distributeId%22%3A%22%22%2C%22externalId%22%3A%22%22%2C%22appId%22%3A%22%22%7D)

![](https://weapp.eteams.cn/papi/file/preview?fileId=1234811812173717513&type=redirect&customParam=%7B%22isExtDist%22%3Atrue%2C%22distributeId%22%3A%22%22%2C%22externalId%22%3A%22%22%2C%22appId%22%3A%22%22%7D)

![](https://weapp.eteams.cn/papi/file/preview?fileId=1234811816586125321&type=redirect&customParam=%7B%22isExtDist%22%3Atrue%2C%22distributeId%22%3A%22%22%2C%22externalId%22%3A%22%22%2C%22appId%22%3A%22%22%7D)

4.

成功失败

![](https://weapp.eteams.cn/papi/file/preview?fileId=1234811816541609991&type=redirect&customParam=%7B%22isExtDist%22%3Atrue%2C%22distributeId%22%3A%22%22%2C%22externalId%22%3A%22%22%2C%22appId%22%3A%22%22%7D)

## 四、配置动作流

### 4.1 选择HR同步触发组件

选择HR同步-同步分部/部门/岗位/人员等触发组件

![](https://weapp.eteams.cn/papi/file/preview?fileId=1234811782075392016&type=redirect&customParam=%7B%22isExtDist%22%3Atrue%2C%22distributeId%22%3A%22%22%2C%22externalId%22%3A%22%22%2C%22appId%22%3A%22%22%7D)

### 4.2 配置执行组件获取token

选择好触发组件 后，按照[Token认证使用步骤V3](https://www.showdoc.com.cn/p/1b3374375d38acb1b9f808daa36906ae)中需要调用token接口获取token，选择获取token的执行组件，而后输入参数配置：

![](https://weapp.eteams.cn/papi/file/preview?fileId=1234811777931419655&type=redirect&customParam=%7B%22isExtDist%22%3Atrue%2C%22distributeId%22%3A%22%22%2C%22externalId%22%3A%22%22%2C%22appId%22%3A%22%22%7D)

调用token接口需要设置header里面的对应参数，appid选择触发组件的自定义参数一，secret参数需要对公钥进行加密使用，如下图所示：

appid参数

![](https://weapp.eteams.cn/papi/file/preview?fileId=1234811790854864916&type=redirect&customParam=%7B%22isExtDist%22%3Atrue%2C%22distributeId%22%3A%22%22%2C%22externalId%22%3A%22%22%2C%22appId%22%3A%22%22%7D)

secret参数,需要进行RSA加密

![](https://weapp.eteams.cn/papi/file/preview?fileId=1234811795158220809&type=redirect&customParam=%7B%22isExtDist%22%3Atrue%2C%22distributeId%22%3A%22%22%2C%22externalId%22%3A%22%22%2C%22appId%22%3A%22%22%7D)

### 4.3 配置执行组件获取分部/部门/岗位/人员数据

设置好获取token的执行组件后，根据[E9接口文档](https://e-cloudstore.com/doc.html?appId=c373a4b01fb74d098b62e2b969081d2d#3.%E8%8E%B7%E5%8F%96%E5%B2%97%E4%BD%8D%E5%88%97%E8%A1%A8)中获取数据接口进行相关配置

#### 4.3.1 Header参数

appid

![](https://weapp.eteams.cn/papi/file/preview?fileId=1234811799415848962&type=redirect&customParam=%7B%22isExtDist%22%3Atrue%2C%22distributeId%22%3A%22%22%2C%22externalId%22%3A%22%22%2C%22appId%22%3A%22%22%7D)

token参数使用token执行组件的响应参数设置

![](https://weapp.eteams.cn/papi/file/preview?fileId=1234811777739685897&type=redirect&customParam=%7B%22isExtDist%22%3Atrue%2C%22distributeId%22%3A%22%22%2C%22externalId%22%3A%22%22%2C%22appId%22%3A%22%22%7D)

Content-Type 设置为application/json; charset=utf-8

![](https://weapp.eteams.cn/papi/file/preview?fileId=1234811820786245632&type=redirect&customParam=%7B%22isExtDist%22%3Atrue%2C%22distributeId%22%3A%22%22%2C%22externalId%22%3A%22%22%2C%22appId%22%3A%22%22%7D)

userid需要进行RSA加密，userid使用之前设置的常量

![](https://weapp.eteams.cn/papi/file/preview?fileId=1234811782071992323&type=redirect&customParam=%7B%22isExtDist%22%3Atrue%2C%22distributeId%22%3A%22%22%2C%22externalId%22%3A%22%22%2C%22appId%22%3A%22%22%7D)

#### 4.3.2 Body参数

canceled 封存标识，如果有的话填写固定值为2，查询封存以及非封存的组织架构

![](https://weapp.eteams.cn/papi/file/preview?fileId=1234811803652096001&type=redirect&customParam=%7B%22isExtDist%22%3Atrue%2C%22distributeId%22%3A%22%22%2C%22externalId%22%3A%22%22%2C%22appId%22%3A%22%22%7D)

modified设置为增量标识值，用于满足增量同步的需求

![](https://weapp.eteams.cn/papi/file/preview?fileId=1234811812225253382&type=redirect&customParam=%7B%22isExtDist%22%3Atrue%2C%22distributeId%22%3A%22%22%2C%22externalId%22%3A%22%22%2C%22appId%22%3A%22%22%7D)

pagesize 设置为触发组件的分页大小

![](https://weapp.eteams.cn/papi/file/preview?fileId=1234811825152098305&type=redirect&customParam=%7B%22isExtDist%22%3Atrue%2C%22distributeId%22%3A%22%22%2C%22externalId%22%3A%22%22%2C%22appId%22%3A%22%22%7D)

curpage 当前页选择触发组件的页码

![](https://weapp.eteams.cn/papi/file/preview?fileId=1234811773636452358&type=redirect&customParam=%7B%22isExtDist%22%3Atrue%2C%22distributeId%22%3A%22%22%2C%22externalId%22%3A%22%22%2C%22appId%22%3A%22%22%7D)

### 4.4 配置输出组件

必须配置输出组件HR同步才可接收到动作流返回的数据，配置示例如下：

#### 4.4.1 分页相关输出参数配置

注：若要支持分页调用动作流则必须配置分页总数，会根据分页总数计算分页页数，然后循环调用，当循环调用到某页没有返回值时也会终止循环

![](https://weapp.eteams.cn/papi/file/preview?fileId=1234811786502004737&type=redirect&customParam=%7B%22isExtDist%22%3Atrue%2C%22distributeId%22%3A%22%22%2C%22externalId%22%3A%22%22%2C%22appId%22%3A%22%22%7D)

此处总数参数配置为接口返回的总数：

![](https://weapp.eteams.cn/papi/file/preview?fileId=1234811807976013827&type=redirect&customParam=%7B%22isExtDist%22%3Atrue%2C%22distributeId%22%3A%22%22%2C%22externalId%22%3A%22%22%2C%22appId%22%3A%22%22%7D)

#### 4.4.2 数据集合相关参数设置

将数据集合设置为接口返回的分部/部门/岗位/人员数据数组集合

![](https://weapp.eteams.cn/papi/file/preview?fileId=1234811820855926790&type=redirect&customParam=%7B%22isExtDist%22%3Atrue%2C%22distributeId%22%3A%22%22%2C%22externalId%22%3A%22%22%2C%22appId%22%3A%22%22%7D)

使用依据值属性，配置字段映射

![](https://weapp.eteams.cn/papi/file/preview?fileId=1234811812225253383&type=redirect&customParam=%7B%22isExtDist%22%3Atrue%2C%22distributeId%22%3A%22%22%2C%22externalId%22%3A%22%22%2C%22appId%22%3A%22%22%7D)

## 五、配置HR同步

### 5.1 基础设置

新建HR同步

![](https://weapp.eteams.cn/papi/file/preview?fileId=1234811773636452355&type=redirect&customParam=%7B%22isExtDist%22%3Atrue%2C%22distributeId%22%3A%22%22%2C%22externalId%22%3A%22%22%2C%22appId%22%3A%22%22%7D)

选择集成方式为ESB方式，点击启用，进入下一步

![](https://weapp.eteams.cn/papi/file/preview?fileId=1234811807976013841&type=redirect&customParam=%7B%22isExtDist%22%3Atrue%2C%22distributeId%22%3A%22%22%2C%22externalId%22%3A%22%22%2C%22appId%22%3A%22%22%7D)

选择数据来源为ESB方式的同步分部/部门/岗位/人员，选择对应的数据目标，填写同步内容，点击下一步

![](https://weapp.eteams.cn/papi/file/preview?fileId=1234811790742028296&type=redirect&customParam=%7B%22isExtDist%22%3Atrue%2C%22distributeId%22%3A%22%22%2C%22externalId%22%3A%22%22%2C%22appId%22%3A%22%22%7D)

### 5.2 接口参数设置

参照[Token认证使用步骤V3](https://www.showdoc.com.cn/p/1b3374375d38acb1b9f808daa36906ae)生成服务端公钥以及密钥信息

后续会将appid，服务端密钥，服务端公钥分别配置在自定义参数1、自定义参数2以及自定义参数3上,选择对应的动作流：

![](https://weapp.eteams.cn/papi/file/preview?fileId=1234811786502004741&type=redirect&customParam=%7B%22isExtDist%22%3Atrue%2C%22distributeId%22%3A%22%22%2C%22externalId%22%3A%22%22%2C%22appId%22%3A%22%22%7D)

### 5.3 字段映射设置

字段映射会自动带出，但是一些字段需要自行转换，例如E9系统人员性别转换、状态转换、部门分部状态转换等

![](https://weapp.eteams.cn/papi/file/preview?fileId=1234811803652096005&type=redirect&customParam=%7B%22isExtDist%22%3Atrue%2C%22distributeId%22%3A%22%22%2C%22externalId%22%3A%22%22%2C%22appId%22%3A%22%22%7D)

### 5.4 执行同步

点击下一步，进行手动同步即可，同步完成后可在同步日志管理中查看同步日志

![](https://weapp.eteams.cn/papi/file/preview?fileId=1234811803718000643&type=redirect&customParam=%7B%22isExtDist%22%3Atrue%2C%22distributeId%22%3A%22%22%2C%22externalId%22%3A%22%22%2C%22appId%22%3A%22%22%7D)

同步日志：

![](https://weapp.eteams.cn/papi/file/preview?fileId=1234811807976013845&type=redirect&customParam=%7B%22isExtDist%22%3Atrue%2C%22distributeId%22%3A%22%22%2C%22externalId%22%3A%22%22%2C%22appId%22%3A%22%22%7D)

也可以在对应的ESB动作流中查询执行日志：

![](https://weapp.eteams.cn/papi/file/preview?fileId=1234811795158220813&type=redirect&customParam=%7B%22isExtDist%22%3Atrue%2C%22distributeId%22%3A%22%22%2C%22externalId%22%3A%22%22%2C%22appId%22%3A%22%22%7D)

![](https://weapp.eteams.cn/papi/file/preview?fileId=1234811812173717512&type=redirect&customParam=%7B%22isExtDist%22%3Atrue%2C%22distributeId%22%3A%22%22%2C%22externalId%22%3A%22%22%2C%22appId%22%3A%22%22%7D)
