批量同步接口
- 接口:common/departments/v2/batch
- Method:POST
- 数据格式:JSON
- 限流信息:100次每天和50次每小时
- 多语言环境:在接口请求头中添加Key为locale,Value值为语言环境,目前支持的语言有zh_CN(中文)、en_US(英文)、ja_JP(日文)、zh_TW(繁体),请选取其中一种
- 接口说明:该接口用作部门、成本中心的批量同步,在整批数据中如果只有几条数据因为其他原因失败,那么只有这几条数据不会被处理,其他数据仍会被正常处理
- 其他补充信息:单次数据量过大时候(超过200条)会全部转为异步处理,具体参考回调示例
参数:
请求参数
字段名称 |
字段类型 |
字段描述 |
是否必填 |
长度限制(字节) |
bizId |
String |
当前次接口同步的唯一标识 |
TRUE |
36 |
timestamp |
long |
当前次接口同步对应的时间戳 |
TRUE |
13 |
data |
Array |
当前次接口同步的数据集合 |
TRUE |
无 |
data.code |
String |
编码 (typeB表示公司编码, C成本中心编码, D部门编码) |
TRUE |
64 |
data.parent_code |
String |
父级公司/成本中心/部门编码 |
FALSE |
64 |
data.department_name |
String |
组织名称 |
TRUE |
64 |
data.supervisor |
String |
主管员工号 |
FALSE |
64 |
data.type |
String |
同步的类型(B-公司 C-成本中心 D-部门) |
TRUE |
64 |
data.sequence_num |
Integer |
当前条数据在此批次中所对应的序号 |
FALSE |
10 |
data.approval_level |
Integer |
审批等级 |
FALSE |
10 |
data.address |
String |
地址 |
FALSE |
255 |
data.phone |
String |
电话 |
FALSE |
255 |
data.email_address |
String |
邮箱地址 |
FALSE |
255 |
data.company_name |
String |
开票信息: 名称 |
FALSE |
255 |
data.tax_number |
String |
开票信息: 纳税人识别号 |
FALSE |
255 |
data.tax_address |
String |
开票信息: 开票地址 |
FALSE |
255 |
data.bank_name |
String |
银行名称 |
FALSE |
255 |
data.account_number |
String |
银行账号 |
FALSE |
255 |
data.currency_code |
String |
币种 |
FALSE |
16 |
data.cost_center_flag |
String |
成本中心标志(Y/N,默认为Y) |
ture |
1 |
data.budget_flag |
String |
是编制预算(Y/N,默认为Y) |
FALSE |
1 |
data.ledger1 |
String |
主帐套名称 |
FALSE |
255 |
data.ledger2 |
String |
次帐套 |
FALSE |
255 |
data.ex_rate_category |
String |
汇率类型代码 |
FALSE |
64 |
data.enabled_flag |
String |
是否启用标志(Y/N,默认为Y) |
FALSE |
1 |
data.invoicing_limit_number |
BigDecimal |
销项开票单张开票限额 |
FALSE |
65 |
data.invoicing_payer |
String |
销项开票收款人 |
FALSE |
64 |
data.invoicing_reviewer |
String |
销项开票复核人 |
FALSE |
64 |
data.invoicing_issuer |
String |
销项开票开票人 |
FALSE |
64 |
data.invoice_authentication_flag |
String |
是否开启专票认证 |
FALSE |
1 |
data.invoice_output_flag |
String |
是否开启销项开票 |
FALSE |
1 |
data.description |
String |
描述信息 |
FALSE |
255 |
data.column1-column50 |
String |
column字段信息 |
FALSE |
255 |
data.clear_field_array |
Array |
清除字段 |
FALSE |
必填字段不能清除 |
返回参数
字段名称 |
字段类型 |
字段描述 |
bizId |
String |
当前次接口同步的唯一标识 |
resCode |
Integer |
响应状态码(见附录) |
resMsg |
String |
返回信息描述 |
created |
String |
创建成功的条数 |
updated |
String |
更新成功的条数 |
validatorErrors |
Array |
字段强校验不合格的数据 |
dbErrors |
Array |
数据持久化时出现错误的数据 |
warnings |
Array |
字段弱校验不合格的数据,仍会做同步处理 |
示例:
请求数据
{
"bizId" : "c40f1bf0-e757-4a72-8863-fd6749821584",
"timestamp" : 1591266599229,
"data" : [ {
"supervisor" : "123",
"type" : "D",
"address" : "中国上海浦东开发区",
"column1" : "是",
"description" : "产品测试新建",
"code" : "A9003",
"parent_code" : "D001",
"department_name" : "测试部门",
"sequence_num" : 6,
"approval_level" : 2,
"email_address" : "wsj123@qq.com",
"enabled_flag" : "Y",
"ledger1" : "主帐套",
"ex_rate_category" : "1211",
"invoicing_limit_number":555.00,
"invoicing_payer":"jin",
"invoicing_reviewer":"jin",
"invoicing_issuer":"jin",
"invoice_authentication_flag":"Y",
"invoice_output_flag":"Y",
"clear_field_array": ["description", "email_address"]
}, {
"supervisor" : "A002",
"type" : "D",
"code" : "test-E",
"parent_code" : "D001",
"department_name" : "部门1"
}, {
"supervisor" : "A002",
"type" : "D",
"language" : "zh_CN",
"description" : "测试无序",
"code" : "test-code-B",
"parent_code" : "D001",
"department_name" : "test-name-3"
}, {
"supervisor" : "A002",
"type" : "D",
"description" : "测试新建",
"code" : "code-5",
"parent_code" : "test-name-update",
"department_name" : "test-name-update"
}, {
"supervisor" : "",
"type" : "B",
"description" : "测试校验",
"code" : "valid",
"parent_code" : "D001",
"department_name" : "test-name-create",
"email_address" : "emailtest",
"enabled_flag" : "Y"
} ]
}
返回数据
{
"resCode" : 200000,
"resMsg" : "success",
"bizId" : "c40f1bf0-e757-4a72-8863-fd6749821584",
"data" : {
"validatorErrors" : [ {
"code" : "valid",
"messages" : [ "无效的email地址", "部门启用标志请输入Y/N或者使用默认值" ]
} ],
"created" : "此次请求新建成功了1条数据",
"warnings" : [ {
"code" : "A9003",
"messages" : [ "部门code为A9003的部门负责人不存在,已经重新设置为null" ]
} ],
"dbErrors" : [ {
"code" : "code-5",
"messages" : [ "上级编码test-name-update不存在" ]
} ],
"updated" : "此次请求更新成功了2条数据"
}