diff --git a/jinrun/audit/审批接口.md b/jinrun/audit/审批接口.md index e446ba9..ef17a31 100644 --- a/jinrun/audit/审批接口.md +++ b/jinrun/audit/审批接口.md @@ -13,18 +13,50 @@ 采用md5(32位小写)算法生成签名 appKey(则一提供) + appSecret(则一提供) + timestamp(当前时间戳毫秒) + nonce(6位随机码大小写字母数子组合) + data(请求数据) +### 生成签名示例 + +```java +public static String getMD5Lower(String input) { + MessageDigest md = MessageDigest.getInstance("MD5"); + byte[] digest = md.digest(input.getBytes()); + StringBuilder sb = new StringBuilder(); + for (byte b : digest) { + String hex = Integer.toHexString(b & 0xff); + if (hex.length() == 1) { + sb.append("0"); + } + sb.append(hex); + } + return sb.toString(); +} +``` + ## 数据加密 数据加密采用AES算法 加密模式: CBC 填充方式:PKCS5Padding 偏移量:iv(则一提供) -加密内容:appKey(则一提供) + timestamp(当前时间戳毫秒) + nonce(6位随机码大小写字母数子组合) + data(加密数据) -密钥: appSecret(则一提供) +加密内容:data(加密数据) +密钥:appSecret(则一提供) 输出:base64 字符集:utf-8 注:无敏感数据则无需加密 +### 数据加密示例 + +```java +public static String aesEncrypt(String source, String secret) { + Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding"); + SecretKeySpec keySpec = new SecretKeySpec(secret.getBytes(), "AES"); + IvParameterSpec ivSpec = new IvParameterSpec(IV_BYTES); + byte[] byteContent = source.getBytes("UTF-8"); + cipher.init(1, keySpec, ivSpec); + byte[] result = cipher.doFinal(byteContent); + return Base64.getEncoder().encodeToString(result); +} +``` + ## 业务接口 * __1.发起审批__ * __2.撤销审批__ @@ -93,8 +125,8 @@ appKey(则一提供) + appSecret(则一提供) + timestamp(当前时间戳毫秒 ```json { "code": "JR202510110000001", - "auditType": "BILL_APPLY_PAY_AUDIT", - "username": "001001", + "auditType": "JINRUN_VEHICLE_FEE_AUDIT", + "username": "001073", "auditFormList": [ { "type": "text", @@ -103,12 +135,12 @@ appKey(则一提供) + appSecret(则一提供) + timestamp(当前时间戳毫秒 }, { "type": "text", - "name": "feeAmount", + "name": "applyAmount", "value": "200000" }, { "type": "file", - "name": "attachment", + "name": "billAttachment", "value": "https://example.com/path/1.jpg" } ], @@ -121,6 +153,48 @@ appKey(则一提供) + appSecret(则一提供) + timestamp(当前时间戳毫秒 } ``` +#### 请求示例Java-SDK方式 + +##### [下载SDK](https://zeyi-tms-product.oss-cn-hangzhou.aliyuncs.com/file/jar/java-sdk/zy-java-sdk-1.0.0.jar) + +```java +public static void main(String[] args) { + String appKey = "bd95591ce63f4a78a54658c2d8ad5ff6"; + String appSecret = "734a18117f614e60859efb8eea27c680"; + String aesSecret = "734a18117f614e60859efb8eea27c680"; + ZYClient ZYClient = new ZYClient(appKey, appSecret); + String data = "{\n" + + " \"code\": \"JR202510200000003\",\n" + + " \"auditType\": \"JINRUN_VEHICLE_FEE_AUDIT\",\n" + + " \"username\": \"001073\",\n" + + " \"auditFormList\": [\n" + + " {\n" + + " \"type\": \"text\",\n" + + " \"name\": \"feeType\",\n" + + " \"value\": \"车辆保险费用\"\n" + + " },\n" + + " {\n" + + " \"type\": \"text\",\n" + + " \"name\": \"applyAmount\",\n" + + " \"value\": \"200000\"\n" + + " },\n" + + " {\n" + + " \"type\": \"file\",\n" + + " \"name\": \"billAttachment\",\n" + + " \"value\": \"https://zeyi-tms-product.oss-cn-hangzhou.aliyuncs.com/image/tms/d05b7f1b-1844-49b6-9931-11ac4cd783ea.jpg\"\n" + + " }\n" + + " ],\n" + + " \"conditionParamList\": [\n" + + " {\n" + + " \"name\": \"businessType\",\n" + + " \"value\": \"BULK_BUSINESS_TYPE\"\n" + + " }\n" + + " ]\n" + + "}"; + HttpResponseData httpResponseData = ZYClient.doPost(Constants.TEST_HOST + "/tms-service-api/audit/send", AesUtils.aesEncrypt(data, aesSecret)); +} +``` + #### 返回示例 ```json @@ -200,6 +274,28 @@ appKey(则一提供) + appSecret(则一提供) + timestamp(当前时间戳毫秒 } ``` + +#### 请求示例Java-SDK方式 + +##### [下载SDK](https://zeyi-tms-product.oss-cn-hangzhou.aliyuncs.com/file/jar/java-sdk/zy-java-sdk-1.0.0.jar) + +```java +public static void main(String[] args) { + String appKey = "bd95591ce63f4a78a54658c2d8ad5ff6"; + String appSecret = "734a18117f614e60859efb8eea27c680"; + String aesSecret = "734a18117f614e60859efb8eea27c680"; + ZYClient ZYClient = new ZYClient(appKey, appSecret); + String data = "{\n" + + " \"code\": \"JR202510200000002\",\n" + + " \"auditId\": \"LgXYezIUQYC1WxnzMpZatA03781760922998\",\n" + + " \"auditType\": \"JINRUN_VEHICLE_FEE_AUDIT\",\n" + + " \"remark\": \"付款金额错误, 撤销重新提交\",\n" + + " \"username\": \"001073\"\n" + + "}"; + HttpResponseData httpResponseData = ZYClient.doPost(Constants.TEST_HOST + "/tms-service-api/audit/cancel", AesUtils.aesEncrypt(data, aesSecret)); +} +``` + #### 返回示例 ```json -- libgit2 0.21.0