Commit 561abe4eb040485bcc9ceacadebdf7f7f51f76cd

Authored by 王富国
1 parent f22dd8a0
Exists in master

feat:增加金润对接钉钉审批接口

Showing 1 changed file with 102 additions and 6 deletions   Show diff stats
jinrun/audit/审批接口.md
... ... @@ -13,18 +13,50 @@
13 13 采用md5(32位小写)算法生成签名
14 14 appKey(则一提供) + appSecret(则一提供) + timestamp(当前时间戳毫秒) + nonce(6位随机码大小写字母数子组合) + data(请求数据)
15 15  
  16 +### 生成签名示例
  17 +
  18 +```java
  19 +public static String getMD5Lower(String input) {
  20 + MessageDigest md = MessageDigest.getInstance("MD5");
  21 + byte[] digest = md.digest(input.getBytes());
  22 + StringBuilder sb = new StringBuilder();
  23 + for (byte b : digest) {
  24 + String hex = Integer.toHexString(b & 0xff);
  25 + if (hex.length() == 1) {
  26 + sb.append("0");
  27 + }
  28 + sb.append(hex);
  29 + }
  30 + return sb.toString();
  31 +}
  32 +```
  33 +
16 34 ## 数据加密
17 35  
18 36 数据加密采用AES算法
19 37 加密模式: CBC
20 38 填充方式:PKCS5Padding
21 39 偏移量:iv(则一提供)
22   -加密内容:appKey(则一提供) + timestamp(当前时间戳毫秒) + nonce(6位随机码大小写字母数子组合) + data(加密数据)
23   -密钥: appSecret(则一提供)
  40 +加密内容:data(加密数据)
  41 +密钥:appSecret(则一提供)
24 42 输出:base64
25 43 字符集:utf-8
26 44 注:无敏感数据则无需加密
27 45  
  46 +### 数据加密示例
  47 +
  48 +```java
  49 +public static String aesEncrypt(String source, String secret) {
  50 + Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
  51 + SecretKeySpec keySpec = new SecretKeySpec(secret.getBytes(), "AES");
  52 + IvParameterSpec ivSpec = new IvParameterSpec(IV_BYTES);
  53 + byte[] byteContent = source.getBytes("UTF-8");
  54 + cipher.init(1, keySpec, ivSpec);
  55 + byte[] result = cipher.doFinal(byteContent);
  56 + return Base64.getEncoder().encodeToString(result);
  57 +}
  58 +```
  59 +
28 60 ## 业务接口
29 61 * __1.发起审批__
30 62 * __2.撤销审批__
... ... @@ -93,8 +125,8 @@ appKey(则一提供) + appSecret(则一提供) + timestamp(当前时间戳毫秒
93 125 ```json
94 126 {
95 127 "code": "JR202510110000001",
96   - "auditType": "BILL_APPLY_PAY_AUDIT",
97   - "username": "001001",
  128 + "auditType": "JINRUN_VEHICLE_FEE_AUDIT",
  129 + "username": "001073",
98 130 "auditFormList": [
99 131 {
100 132 "type": "text",
... ... @@ -103,12 +135,12 @@ appKey(则一提供) + appSecret(则一提供) + timestamp(当前时间戳毫秒
103 135 },
104 136 {
105 137 "type": "text",
106   - "name": "feeAmount",
  138 + "name": "applyAmount",
107 139 "value": "200000"
108 140 },
109 141 {
110 142 "type": "file",
111   - "name": "attachment",
  143 + "name": "billAttachment",
112 144 "value": "https://example.com/path/1.jpg"
113 145 }
114 146 ],
... ... @@ -121,6 +153,48 @@ appKey(则一提供) + appSecret(则一提供) + timestamp(当前时间戳毫秒
121 153 }
122 154 ```
123 155  
  156 +#### 请求示例Java-SDK方式
  157 +
  158 +##### [下载SDK](https://zeyi-tms-product.oss-cn-hangzhou.aliyuncs.com/file/jar/java-sdk/zy-java-sdk-1.0.0.jar)
  159 +
  160 +```java
  161 +public static void main(String[] args) {
  162 + String appKey = "bd95591ce63f4a78a54658c2d8ad5ff6";
  163 + String appSecret = "734a18117f614e60859efb8eea27c680";
  164 + String aesSecret = "734a18117f614e60859efb8eea27c680";
  165 + ZYClient ZYClient = new ZYClient(appKey, appSecret);
  166 + String data = "{\n" +
  167 + " \"code\": \"JR202510200000003\",\n" +
  168 + " \"auditType\": \"JINRUN_VEHICLE_FEE_AUDIT\",\n" +
  169 + " \"username\": \"001073\",\n" +
  170 + " \"auditFormList\": [\n" +
  171 + " {\n" +
  172 + " \"type\": \"text\",\n" +
  173 + " \"name\": \"feeType\",\n" +
  174 + " \"value\": \"车辆保险费用\"\n" +
  175 + " },\n" +
  176 + " {\n" +
  177 + " \"type\": \"text\",\n" +
  178 + " \"name\": \"applyAmount\",\n" +
  179 + " \"value\": \"200000\"\n" +
  180 + " },\n" +
  181 + " {\n" +
  182 + " \"type\": \"file\",\n" +
  183 + " \"name\": \"billAttachment\",\n" +
  184 + " \"value\": \"https://zeyi-tms-product.oss-cn-hangzhou.aliyuncs.com/image/tms/d05b7f1b-1844-49b6-9931-11ac4cd783ea.jpg\"\n" +
  185 + " }\n" +
  186 + " ],\n" +
  187 + " \"conditionParamList\": [\n" +
  188 + " {\n" +
  189 + " \"name\": \"businessType\",\n" +
  190 + " \"value\": \"BULK_BUSINESS_TYPE\"\n" +
  191 + " }\n" +
  192 + " ]\n" +
  193 + "}";
  194 + HttpResponseData httpResponseData = ZYClient.doPost(Constants.TEST_HOST + "/tms-service-api/audit/send", AesUtils.aesEncrypt(data, aesSecret));
  195 +}
  196 +```
  197 +
124 198 #### 返回示例
125 199  
126 200 ```json
... ... @@ -200,6 +274,28 @@ appKey(则一提供) + appSecret(则一提供) + timestamp(当前时间戳毫秒
200 274 }
201 275 ```
202 276  
  277 +
  278 +#### 请求示例Java-SDK方式
  279 +
  280 +##### [下载SDK](https://zeyi-tms-product.oss-cn-hangzhou.aliyuncs.com/file/jar/java-sdk/zy-java-sdk-1.0.0.jar)
  281 +
  282 +```java
  283 +public static void main(String[] args) {
  284 + String appKey = "bd95591ce63f4a78a54658c2d8ad5ff6";
  285 + String appSecret = "734a18117f614e60859efb8eea27c680";
  286 + String aesSecret = "734a18117f614e60859efb8eea27c680";
  287 + ZYClient ZYClient = new ZYClient(appKey, appSecret);
  288 + String data = "{\n" +
  289 + " \"code\": \"JR202510200000002\",\n" +
  290 + " \"auditId\": \"LgXYezIUQYC1WxnzMpZatA03781760922998\",\n" +
  291 + " \"auditType\": \"JINRUN_VEHICLE_FEE_AUDIT\",\n" +
  292 + " \"remark\": \"付款金额错误, 撤销重新提交\",\n" +
  293 + " \"username\": \"001073\"\n" +
  294 + "}";
  295 + HttpResponseData httpResponseData = ZYClient.doPost(Constants.TEST_HOST + "/tms-service-api/audit/cancel", AesUtils.aesEncrypt(data, aesSecret));
  296 +}
  297 +```
  298 +
203 299 #### 返回示例
204 300  
205 301 ```json
... ...