Commit fb9da191adb498f81c265f3a3464ac341cbac95b

Authored by 王富国
1 parent de4098a8
Exists in master

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

Showing 1 changed file with 20 additions and 13 deletions   Show diff stats
jinrun/audit/审批接口.md
@@ -36,9 +36,8 @@ public static String getMD5Lower(String input) { @@ -36,9 +36,8 @@ public static String getMD5Lower(String input) {
36 数据加密采用AES算法 36 数据加密采用AES算法
37 加密模式: CBC 37 加密模式: CBC
38 填充方式:PKCS5Padding 38 填充方式:PKCS5Padding
39 -偏移量:iv(则一提供)  
40 加密内容:data(加密数据) 39 加密内容:data(加密数据)
41 -密钥:appSecret(则一提供) 40 +密钥:aesSecret(则一提供)
42 输出:base64 41 输出:base64
43 字符集:utf-8 42 字符集:utf-8
44 注:无敏感数据则无需加密 43 注:无敏感数据则无需加密
@@ -46,13 +45,19 @@ public static String getMD5Lower(String input) { @@ -46,13 +45,19 @@ public static String getMD5Lower(String input) {
46 ### 数据加密示例 45 ### 数据加密示例
47 46
48 ```java 47 ```java
49 -public static String aesEncrypt(String source, String secret) { 48 +public static String encrypt(String plaintext, String aesSecret) {
  49 + byte[] keyBytes = Base64.getDecoder().decode(keyBase64);
  50 + SecretKeySpec secretKey = new SecretKeySpec(keyBytes, "AES");
  51 + byte[] iv = new byte[16];
  52 + SecureRandom secureRandom = new SecureRandom();
  53 + secureRandom.nextBytes(iv);
  54 + IvParameterSpec ivParam = new IvParameterSpec(iv);
50 Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding"); 55 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 + cipher.init(1, secretKey, ivParam);
  57 + byte[] ciphertext = cipher.doFinal(plaintext.getBytes(StandardCharsets.UTF_8));
  58 + byte[] result = new byte[16 + ciphertext.length];
  59 + System.arraycopy(iv, 0, result, 0, 16);
  60 + System.arraycopy(ciphertext, 0, result, 16, ciphertext.length);
56 return Base64.getEncoder().encodeToString(result); 61 return Base64.getEncoder().encodeToString(result);
57 } 62 }
58 ``` 63 ```
@@ -155,12 +160,13 @@ public static String aesEncrypt(String source, String secret) { @@ -155,12 +160,13 @@ public static String aesEncrypt(String source, String secret) {
155 160
156 #### 请求示例Java-SDK方式 161 #### 请求示例Java-SDK方式
157 162
158 -##### [下载SDK](https://zeyi-tms-product.oss-cn-hangzhou.aliyuncs.com/file/jar/java-sdk/zy-java-sdk-1.0.0.jar) 163 +##### [下载SDK](https://zeyi-tms-product.oss-cn-hangzhou.aliyuncs.com/file/jar/java-sdk/zy-java-sdk-2.0.0.jar)
159 164
160 ```java 165 ```java
161 public static void main(String[] args) { 166 public static void main(String[] args) {
162 String appKey = "bd95591ce63f4a78a54658c2d8ad5ff6"; 167 String appKey = "bd95591ce63f4a78a54658c2d8ad5ff6";
163 String appSecret = "734a18117f614e60859efb8eea27c680"; 168 String appSecret = "734a18117f614e60859efb8eea27c680";
  169 + String aesSecret = "wJ3472SLpkZLnjtwMArhRg==";
164 ZYClient ZYClient = new ZYClient(appKey, appSecret); 170 ZYClient ZYClient = new ZYClient(appKey, appSecret);
165 String data = "{\n" + 171 String data = "{\n" +
166 " \"code\": \"JR202510200000003\",\n" + 172 " \"code\": \"JR202510200000003\",\n" +
@@ -190,7 +196,7 @@ public static void main(String[] args) { @@ -190,7 +196,7 @@ public static void main(String[] args) {
190 " }\n" + 196 " }\n" +
191 " ]\n" + 197 " ]\n" +
192 "}"; 198 "}";
193 - HttpResponseData httpResponseData = ZYClient.doPost(Constants.TEST_HOST + "/tms-service-api/audit/send", AesUtils.aesEncrypt(data, appSecret)); 199 + HttpResponseData httpResponseData = ZYClient.doPost(Constants.TEST_HOST + "/tms-service-api/audit/send", AesUtils.aesEncrypt(data, aesSecret));
194 } 200 }
195 ``` 201 ```
196 202
@@ -276,12 +282,13 @@ public static void main(String[] args) { @@ -276,12 +282,13 @@ public static void main(String[] args) {
276 282
277 #### 请求示例Java-SDK方式 283 #### 请求示例Java-SDK方式
278 284
279 -##### [下载SDK](https://zeyi-tms-product.oss-cn-hangzhou.aliyuncs.com/file/jar/java-sdk/zy-java-sdk-1.0.0.jar) 285 +##### [下载SDK](https://zeyi-tms-product.oss-cn-hangzhou.aliyuncs.com/file/jar/java-sdk/zy-java-sdk-2.0.0.jar)
280 286
281 ```java 287 ```java
282 public static void main(String[] args) { 288 public static void main(String[] args) {
283 String appKey = "bd95591ce63f4a78a54658c2d8ad5ff6"; 289 String appKey = "bd95591ce63f4a78a54658c2d8ad5ff6";
284 String appSecret = "734a18117f614e60859efb8eea27c680"; 290 String appSecret = "734a18117f614e60859efb8eea27c680";
  291 + String aesSecret = "wJ3472SLpkZLnjtwMArhRg==";
285 ZYClient ZYClient = new ZYClient(appKey, appSecret); 292 ZYClient ZYClient = new ZYClient(appKey, appSecret);
286 String data = "{\n" + 293 String data = "{\n" +
287 " \"code\": \"JR202510200000002\",\n" + 294 " \"code\": \"JR202510200000002\",\n" +
@@ -290,7 +297,7 @@ public static void main(String[] args) { @@ -290,7 +297,7 @@ public static void main(String[] args) {
290 " \"remark\": \"付款金额错误, 撤销重新提交\",\n" + 297 " \"remark\": \"付款金额错误, 撤销重新提交\",\n" +
291 " \"username\": \"001073\"\n" + 298 " \"username\": \"001073\"\n" +
292 "}"; 299 "}";
293 - HttpResponseData httpResponseData = ZYClient.doPost(Constants.TEST_HOST + "/tms-service-api/audit/cancel", AesUtils.aesEncrypt(data, appSecret)); 300 + HttpResponseData httpResponseData = ZYClient.doPost(Constants.TEST_HOST + "/tms-service-api/audit/cancel", AesUtils.aesEncrypt(data, aesSecret));
294 } 301 }
295 ``` 302 ```
296 303
@@ -378,7 +385,7 @@ public static void main(String[] args) { @@ -378,7 +385,7 @@ public static void main(String[] args) {
378 385
379 ### 则一Java-sdk 386 ### 则一Java-sdk
380 387
381 -##### [下载Java-sdk](https://zeyi-tms-product.oss-cn-hangzhou.aliyuncs.com/file/jar/java-sdk/zy-java-sdk-1.0.0.jar) 388 +##### [下载Java-sdk](https://zeyi-tms-product.oss-cn-hangzhou.aliyuncs.com/file/jar/java-sdk/zy-java-sdk-2.0.0.jar)
382 389
383 ## 更新日志 390 ## 更新日志
384 391