# 三方快捷审批回调
审批人在【待审批】列表中,对审批任务进行【同意】【拒绝】操作时,审批中心会调用审批定义中配置的回调URL通知三方系统。
三方系统收到回调后,进行流程流转,并将最新的任务信息通过审批实例同步接口同步回审批中心。
回调响应失败时(http code != 200),尝试从response body中获取 message 字段并展示给用户。
# 接口定义
# 未加密(该代码为示例代码,企业须填写企业对应信息)
curl --location --request POST 'https://www.zhipin.cn/approval/openapi/v2/external/instanceOperate' \
--header 'Content-Type: application/json' \
--data-raw '{
"action_type": "APPROVE",
"user_id": "b85s39b",
"approval_code": "123",
"instance_id": "people_1234",
"task_id": "step1",
"reason": "审核意见"
"token": "aaaaa"
}'
# 加密 curl --location --request POST 'https://www.zhipin.com/approval/openapi/v2/external/instanceOperate' \
--header 'Content-Type: application/json' \
--data-raw '{
"encrypt": "=sfasdfasfsdafasfaf="
}'
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
//解密实例代码
public static String decrypt(String base64,String key) throws Exception {
byte[] decode = Base64.getDecoder().decode(base64);
Cipher cipher = Cipher.getInstance("AES/CBC/PKCS7Padding");
byte[] keyBs = decrypterKey(key);
byte[] iv = new byte[16];
System.arraycopy(decode, 0, iv, 0, 16);
byte[] data = new byte[decode.length - 16];
System.arraycopy(decode, 16, data, 0, data.length);
cipher.init(Cipher.DECRYPT_MODE, new SecretKeySpec(keyBs, "AES"), new IvParameterSpec(iv));
byte[] r = cipher.doFinal(data);
if (r.length > 0) {
int p = r.length - 1;
for (; p >= 0 && r[p] <= 16; p--) {
}
if (p != r.length - 1) {
byte[] rr = new byte[p + 1];
System.arraycopy(r, 0, rr, 0, p + 1);
r = rr;
}
}
return new String(r, StandardCharsets.UTF_8);
}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# 接口描述
参数 | 类型 | 必须 | 说明 |
---|---|---|---|
action_type | string | 是 | 操作类型 APPROVED - 同意 REJECTED - 拒绝 |
user_id | string | 是 | 操作人 |
approval_code | string | 是 | 审批定义 code |
instance_id | string | 否 | 实例 id |
task_id | string | 否 | 任务 id |