Showing
9 changed files
with
173 additions
and
55 deletions
No preview for this file type
| 1 | package com.erry.iclear.dateInterface.api; | 1 | package com.erry.iclear.dateInterface.api; |
| 2 | 2 | ||
| 3 | import com.erry.iclear.dateInterface.api.request.HsCodeParam; | 3 | import com.erry.iclear.dateInterface.api.request.HsCodeParam; |
| 4 | +import com.erry.iclear.dateInterface.api.request.StampParam; | ||
| 4 | import com.erry.iclear.dateInterface.api.response.ResultHsCode; | 5 | import com.erry.iclear.dateInterface.api.response.ResultHsCode; |
| 5 | import com.erry.iclear.dateInterface.api.response.StampResult; | 6 | import com.erry.iclear.dateInterface.api.response.StampResult; |
| 6 | import com.erry.iclear.dateInterface.entity.IClearApiHsCodeLog; | 7 | import com.erry.iclear.dateInterface.entity.IClearApiHsCodeLog; |
| 7 | import com.erry.iclear.dateInterface.enums.ErrorCodeEnum; | 8 | import com.erry.iclear.dateInterface.enums.ErrorCodeEnum; |
| 8 | import com.erry.iclear.dateInterface.service.HsCodeService; | 9 | import com.erry.iclear.dateInterface.service.HsCodeService; |
| 9 | import com.erry.iclear.dateInterface.service.IClearApiHsCodeLogService; | 10 | import com.erry.iclear.dateInterface.service.IClearApiHsCodeLogService; |
| 11 | +import com.erry.iclear.dateInterface.util.FileUtils; | ||
| 10 | import com.erry.iclear.dateInterface.util.StringUtil; | 12 | import com.erry.iclear.dateInterface.util.StringUtil; |
| 11 | import io.swagger.annotations.ApiOperation; | 13 | import io.swagger.annotations.ApiOperation; |
| 12 | import lombok.extern.slf4j.Slf4j; | 14 | import lombok.extern.slf4j.Slf4j; |
| 15 | +import org.apache.log4j.spi.ErrorCode; | ||
| 13 | import org.springframework.beans.factory.annotation.Autowired; | 16 | import org.springframework.beans.factory.annotation.Autowired; |
| 17 | +import org.springframework.beans.factory.annotation.Value; | ||
| 14 | import org.springframework.web.bind.annotation.*; | 18 | import org.springframework.web.bind.annotation.*; |
| 15 | 19 | ||
| 16 | import javax.servlet.http.HttpServletRequest; | 20 | import javax.servlet.http.HttpServletRequest; |
| 21 | +import java.io.File; | ||
| 17 | import java.util.Date; | 22 | import java.util.Date; |
| 18 | 23 | ||
| 19 | /** | 24 | /** |
| ... | @@ -24,9 +29,10 @@ import java.util.Date; | ... | @@ -24,9 +29,10 @@ import java.util.Date; |
| 24 | @RequestMapping("/iknowU") | 29 | @RequestMapping("/iknowU") |
| 25 | @Slf4j | 30 | @Slf4j |
| 26 | public class IKnowUInterface { | 31 | public class IKnowUInterface { |
| 27 | - | 32 | + @Value("${stamp_path}") |
| 28 | - @Autowired | 33 | + String stampPath; |
| 29 | - HsCodeService hsCodeService; | 34 | + @Value("${stamp_file_name}") |
| 35 | + String stampFileName; | ||
| 30 | 36 | ||
| 31 | @Autowired | 37 | @Autowired |
| 32 | IClearApiHsCodeLogService iClearApiHsCodeLogService; | 38 | IClearApiHsCodeLogService iClearApiHsCodeLogService; |
| ... | @@ -35,24 +41,35 @@ public class IKnowUInterface { | ... | @@ -35,24 +41,35 @@ public class IKnowUInterface { |
| 35 | @PostMapping("/stampQuery") | 41 | @PostMapping("/stampQuery") |
| 36 | @ResponseBody | 42 | @ResponseBody |
| 37 | public StampResult stampQuery(HttpServletRequest request | 43 | public StampResult stampQuery(HttpServletRequest request |
| 38 | - , @RequestBody String consignmentCode) { | 44 | + , @RequestBody StampParam stampParam) { |
| 39 | - log.info("接收到请求数据consignmentCode:【"+consignmentCode+"】"); | 45 | + log.info("接收到请求数据consignmentCode:【"+stampParam.getConsignmentCode()+"】"); |
| 40 | String appId = (String) request.getHeader("Appid"); | 46 | String appId = (String) request.getHeader("Appid"); |
| 41 | String appkey = (String) request.getHeader("Appkey"); | 47 | String appkey = (String) request.getHeader("Appkey"); |
| 42 | IClearApiHsCodeLog iclearApiHsCodeLog = new IClearApiHsCodeLog(); | 48 | IClearApiHsCodeLog iclearApiHsCodeLog = new IClearApiHsCodeLog(); |
| 43 | StampResult stampResult = null; | 49 | StampResult stampResult = null; |
| 44 | long begin = System.currentTimeMillis(); | 50 | long begin = System.currentTimeMillis(); |
| 51 | + | ||
| 52 | + String filePath = this.stampPath + stampParam.getConsignmentCode() + File.separator + stampFileName; | ||
| 45 | try { | 53 | try { |
| 46 | iclearApiHsCodeLog.setAppId(appId); | 54 | iclearApiHsCodeLog.setAppId(appId); |
| 47 | iclearApiHsCodeLog.setAppKey(appkey); | 55 | iclearApiHsCodeLog.setAppKey(appkey); |
| 48 | iclearApiHsCodeLog.setCreateTime(new Date()); | 56 | iclearApiHsCodeLog.setCreateTime(new Date()); |
| 49 | - iclearApiHsCodeLog.setCode(consignmentCode); | 57 | + iclearApiHsCodeLog.setCode(stampParam.getConsignmentCode()); |
| 58 | + File file = new File(filePath); | ||
| 59 | + //判断文件是否存在 | ||
| 60 | + if(file.exists()){ | ||
| 61 | + String base64Image = FileUtils.convertFileToBase64(filePath); | ||
| 62 | + stampResult = new StampResult(Boolean.TRUE,ErrorCodeEnum.SUCCESS.getCode(),ErrorCodeEnum.SUCCESS.getName(),base64Image); | ||
| 63 | + }else{ | ||
| 64 | + stampResult = new StampResult(Boolean.FALSE,ErrorCodeEnum.ERROR_10119.getCode(),ErrorCodeEnum.ERROR_10119.getName(),null); | ||
| 65 | + } | ||
| 50 | }catch(Exception ex){ | 66 | }catch(Exception ex){ |
| 51 | log.error(ex.getMessage(),ex); | 67 | log.error(ex.getMessage(),ex); |
| 52 | - stampResult = new StampResult(Boolean.FALSE,ErrorCodeEnum.ERROR_30101.getCode(),ErrorCodeEnum.ERROR_30101.getName(),null); | 68 | + stampResult = new StampResult(Boolean.FALSE,ErrorCodeEnum.ERROR_10119.getCode(),ErrorCodeEnum.ERROR_10119.getName(),null); |
| 53 | return stampResult; | 69 | return stampResult; |
| 54 | }finally { | 70 | }finally { |
| 55 | iclearApiHsCodeLog.setReceiveResult(stampResult.getMsg()); | 71 | iclearApiHsCodeLog.setReceiveResult(stampResult.getMsg()); |
| 72 | + iclearApiHsCodeLog.setCode(filePath); | ||
| 56 | iclearApiHsCodeLog.setErrorCode(stampResult.getCode()); | 73 | iclearApiHsCodeLog.setErrorCode(stampResult.getCode()); |
| 57 | iclearApiHsCodeLog.setResponseTime(new Date()); | 74 | iclearApiHsCodeLog.setResponseTime(new Date()); |
| 58 | long end = System.currentTimeMillis(); | 75 | long end = System.currentTimeMillis(); | ... | ... |
| 1 | +package com.erry.iclear.dateInterface.api.request; | ||
| 2 | + | ||
| 3 | +import io.swagger.annotations.ApiModel; | ||
| 4 | +import lombok.Data; | ||
| 5 | + | ||
| 6 | +import java.io.Serializable; | ||
| 7 | + | ||
| 8 | +/** | ||
| 9 | + * 请求公章图样参数 | ||
| 10 | + * mt | ||
| 11 | + * 2023年6月9日15:57:52 | ||
| 12 | + */ | ||
| 13 | +@ApiModel(value = "stampParam", description = "需要查询的公章图样运单号") | ||
| 14 | +@Data | ||
| 15 | +public class StampParam implements Serializable { | ||
| 16 | + private static final long serialVersionUID = 786697399667065141L; | ||
| 17 | + //运单号 | ||
| 18 | + String consignmentCode; | ||
| 19 | +} |
| ... | @@ -18,6 +18,7 @@ public enum ErrorCodeEnum { | ... | @@ -18,6 +18,7 @@ public enum ErrorCodeEnum { |
| 18 | ERROR_10017("10017","无Appkey(缺少参数)"), | 18 | ERROR_10017("10017","无Appkey(缺少参数)"), |
| 19 | ERROR_10018("10018","无TimeStamp(缺少参数)"), | 19 | ERROR_10018("10018","无TimeStamp(缺少参数)"), |
| 20 | ERROR_10019("10019","未指定hscode编码,10分钟之内只允许查询一次。"), | 20 | ERROR_10019("10019","未指定hscode编码,10分钟之内只允许查询一次。"), |
| 21 | + ERROR_10119("10119","根据运单号查询用户上传的公章图样失败"), | ||
| 21 | ERROR_30001("30001","数据格式不正确"), | 22 | ERROR_30001("30001","数据格式不正确"), |
| 22 | ERROR_30002("30002","缺少必填项"), | 23 | ERROR_30002("30002","缺少必填项"), |
| 23 | ERROR_30003("30003","数据校验不通过"), | 24 | ERROR_30003("30003","数据校验不通过"), |
| ... | @@ -28,6 +29,7 @@ public enum ErrorCodeEnum { | ... | @@ -28,6 +29,7 @@ public enum ErrorCodeEnum { |
| 28 | ERROR_30104("30104","skuCode或skuName长度超出限制"), | 29 | ERROR_30104("30104","skuCode或skuName长度超出限制"), |
| 29 | ERROR_30105("30105","skuCode编码最少输入4位字符,skuName最少输入2个字符"); | 30 | ERROR_30105("30105","skuCode编码最少输入4位字符,skuName最少输入2个字符"); |
| 30 | 31 | ||
| 32 | + | ||
| 31 | ErrorCodeEnum(String code,String name){ | 33 | ErrorCodeEnum(String code,String name){ |
| 32 | this.code = code; | 34 | this.code = code; |
| 33 | this.name = name; | 35 | this.name = name; | ... | ... |
This diff could not be displayed because it is too large.
| ... | @@ -7,39 +7,41 @@ spring.datasource.driver-class-name=com.microsoft.sqlserver.jdbc.SQLServerDriver | ... | @@ -7,39 +7,41 @@ spring.datasource.driver-class-name=com.microsoft.sqlserver.jdbc.SQLServerDriver |
| 7 | spring.datasource.type=com.alibaba.druid.pool.DruidDataSource | 7 | spring.datasource.type=com.alibaba.druid.pool.DruidDataSource |
| 8 | #spring.datasource.jndi-name=jdbc/iclearProdTestDS | 8 | #spring.datasource.jndi-name=jdbc/iclearProdTestDS |
| 9 | 9 | ||
| 10 | -#推送海关回执 | 10 | +#\u63A8\u9001\u6D77\u5173\u56DE\u6267 |
| 11 | task.pushCustomsTask=0 0/1 * * * ? | 11 | task.pushCustomsTask=0 0/1 * * * ? |
| 12 | -#推送完整报文 | 12 | +#\u63A8\u9001\u5B8C\u6574\u62A5\u6587 |
| 13 | task.pushMawbTask=0 0/1 * * * ? | 13 | task.pushMawbTask=0 0/1 * * * ? |
| 14 | -#推送失败的回执数据 | 14 | +#\u63A8\u9001\u5931\u8D25\u7684\u56DE\u6267\u6570\u636E |
| 15 | task.pushErrorReturnDate=0 0/3 * * * ? | 15 | task.pushErrorReturnDate=0 0/3 * * * ? |
| 16 | -#推送失败的申报数据 | 16 | +#\u63A8\u9001\u5931\u8D25\u7684\u7533\u62A5\u6570\u636E |
| 17 | task.pushErrorDeclareDate=0 0/3 * * * ? | 17 | task.pushErrorDeclareDate=0 0/3 * * * ? |
| 18 | -#监听iclear节点是否正常定时任务间隔 | 18 | +#\u76D1\u542Ciclear\u8282\u70B9\u662F\u5426\u6B63\u5E38\u5B9A\u65F6\u4EFB\u52A1\u95F4\u9694 |
| 19 | task.monitorIclearNodes=0 0/5 * * * ? | 19 | task.monitorIclearNodes=0 0/5 * * * ? |
| 20 | 20 | ||
| 21 | api.base-address=http://localhost:8080/Exp | 21 | api.base-address=http://localhost:8080/Exp |
| 22 | -#获取token账号 | 22 | +#\u83B7\u53D6token\u8D26\u53F7 |
| 23 | api.token-info.username=iclear_external_ctm | 23 | api.token-info.username=iclear_external_ctm |
| 24 | -#获取token密码 | 24 | +#\u83B7\u53D6token\u5BC6\u7801 |
| 25 | api.token-info.password=toQu3arch6 | 25 | api.token-info.password=toQu3arch6 |
| 26 | -#IClearC类提交运单地址 | 26 | +#IClearC\u7C7B\u63D0\u4EA4\u8FD0\u5355\u5730\u5740 |
| 27 | api.address.iclear-submit-url=${api.base-address}/chmConsignmentController/submitConsignments | 27 | api.address.iclear-submit-url=${api.base-address}/chmConsignmentController/submitConsignments |
| 28 | -#IClear校验运单地址 | 28 | +#IClear\u6821\u9A8C\u8FD0\u5355\u5730\u5740 |
| 29 | api.address.iclear-check-url=${api.base-address}/chmConsignmentController/checkChmAndDetaliD | 29 | api.address.iclear-check-url=${api.base-address}/chmConsignmentController/checkChmAndDetaliD |
| 30 | -#IClear校验C类运单地址 | 30 | +#IClear\u6821\u9A8CC\u7C7B\u8FD0\u5355\u5730\u5740 |
| 31 | api.address.iclear-check-url-c=${api.base-address}/chmConsignmentController/checkChmAndDetaliC | 31 | api.address.iclear-check-url-c=${api.base-address}/chmConsignmentController/checkChmAndDetaliC |
| 32 | -#获取token地址 | 32 | +#\u83B7\u53D6token\u5730\u5740 |
| 33 | api.address.token-url=https://apiuat.iclrccd-fedex.com/login | 33 | api.address.token-url=https://apiuat.iclrccd-fedex.com/login |
| 34 | -#刷新token地址 | 34 | +#\u5237\u65B0token\u5730\u5740 |
| 35 | api.address.refresh-token-url=https://apiuat.iclrccd-fedex.com/user/token/refresh | 35 | api.address.refresh-token-url=https://apiuat.iclrccd-fedex.com/user/token/refresh |
| 36 | -#传输海关回执地址 | 36 | +#\u4F20\u8F93\u6D77\u5173\u56DE\u6267\u5730\u5740 |
| 37 | api.address.customs-url=https://apiuat.iclrccd-fedex.com/export/outbound/customs | 37 | api.address.customs-url=https://apiuat.iclrccd-fedex.com/export/outbound/customs |
| 38 | -#推送完整报文地址 | 38 | +#\u63A8\u9001\u5B8C\u6574\u62A5\u6587\u5730\u5740 |
| 39 | api.address.complete-msg-url=https://apiuat.iclrccd-fedex.com/export/outbound/mawb | 39 | api.address.complete-msg-url=https://apiuat.iclrccd-fedex.com/export/outbound/mawb |
| 40 | -#iclear应用节点是否能够正常访问 | 40 | +#iclear\u5E94\u7528\u8282\u70B9\u662F\u5426\u80FD\u591F\u6B63\u5E38\u8BBF\u95EE |
| 41 | iclear.address.url42=http://localhost:8080/Exp | 41 | iclear.address.url42=http://localhost:8080/Exp |
| 42 | iclear.address.url43=http://localhost:8080/Exp | 42 | iclear.address.url43=http://localhost:8080/Exp |
| 43 | -#代理地址(刷新token、传输海关回执地址、推送完整报文地址) | 43 | +stamp_path=/var/share/iclear/resources/upload/attachment/slipType_chm/ |
| 44 | +stamp_file_name=stamp.png | ||
| 45 | +#\u4EE3\u7406\u5730\u5740\uFF08\u5237\u65B0token\u3001\u4F20\u8F93\u6D77\u5173\u56DE\u6267\u5730\u5740\u3001\u63A8\u9001\u5B8C\u6574\u62A5\u6587\u5730\u5740\uFF09 | ||
| 44 | api.address.proxy-url=cn2-proxy.apac.fedex.com | 46 | api.address.proxy-url=cn2-proxy.apac.fedex.com |
| 45 | api.address.proxy-port=3128 | 47 | api.address.proxy-port=3128 |
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
| 1 | spring.servlet.context-path=/API | 1 | spring.servlet.context-path=/API |
| 2 | spring.datasource.jndi-name=jdbc/iclearDS | 2 | spring.datasource.jndi-name=jdbc/iclearDS |
| 3 | -#推送海关回执 | 3 | +#\u63A8\u9001\u6D77\u5173\u56DE\u6267 |
| 4 | task.pushCustomsTask=0 0/1 * * * ? | 4 | task.pushCustomsTask=0 0/1 * * * ? |
| 5 | -#推送完整报文 | 5 | +#\u63A8\u9001\u5B8C\u6574\u62A5\u6587 |
| 6 | task.pushMawbTask=0 0/1 * * * ? | 6 | task.pushMawbTask=0 0/1 * * * ? |
| 7 | -#推送失败的回执数据 | 7 | +#\u63A8\u9001\u5931\u8D25\u7684\u56DE\u6267\u6570\u636E |
| 8 | task.pushErrorReturnDate=0 0/30 * * * ? | 8 | task.pushErrorReturnDate=0 0/30 * * * ? |
| 9 | -#推送失败的申报数据 | 9 | +#\u63A8\u9001\u5931\u8D25\u7684\u7533\u62A5\u6570\u636E |
| 10 | task.pushErrorDeclareDate=0 0/30 * * * ? | 10 | task.pushErrorDeclareDate=0 0/30 * * * ? |
| 11 | -#监听iclear节点是否正常定时任务间隔 | 11 | +#\u76D1\u542Ciclear\u8282\u70B9\u662F\u5426\u6B63\u5E38\u5B9A\u65F6\u4EFB\u52A1\u95F4\u9694 |
| 12 | task.monitorIclearNodes=0 0/5 * * * ? | 12 | task.monitorIclearNodes=0 0/5 * * * ? |
| 13 | 13 | ||
| 14 | api.base-address=https://declaration.fedex.com.cn/Exp | 14 | api.base-address=https://declaration.fedex.com.cn/Exp |
| 15 | -#获取token账号 | 15 | +#\u83B7\u53D6token\u8D26\u53F7 |
| 16 | api.token-info.username=iclear_export_prod | 16 | api.token-info.username=iclear_export_prod |
| 17 | -#获取token密码 | 17 | +#\u83B7\u53D6token\u5BC6\u7801 |
| 18 | api.token-info.password=1qaz@WSX | 18 | api.token-info.password=1qaz@WSX |
| 19 | -#IClearC类提交运单地址 | 19 | +#IClearC\u7C7B\u63D0\u4EA4\u8FD0\u5355\u5730\u5740 |
| 20 | api.address.iclear-submit-url=${api.base-address}/chmConsignmentController/submitConsignments | 20 | api.address.iclear-submit-url=${api.base-address}/chmConsignmentController/submitConsignments |
| 21 | -#IClear校验运单地址 | 21 | +#IClear\u6821\u9A8C\u8FD0\u5355\u5730\u5740 |
| 22 | api.address.iclear-check-url=${api.base-address}/chmConsignmentController/checkChmAndDetaliD | 22 | api.address.iclear-check-url=${api.base-address}/chmConsignmentController/checkChmAndDetaliD |
| 23 | -#IClear校验C类运单地址 | 23 | +#IClear\u6821\u9A8CC\u7C7B\u8FD0\u5355\u5730\u5740 |
| 24 | api.address.iclear-check-url-c=${api.base-address}/chmConsignmentController/checkChmAndDetaliC | 24 | api.address.iclear-check-url-c=${api.base-address}/chmConsignmentController/checkChmAndDetaliC |
| 25 | -#获取token地址 | 25 | +#\u83B7\u53D6token\u5730\u5740 |
| 26 | api.address.token-url=https://apictm.iclrccd-fedex.com/login | 26 | api.address.token-url=https://apictm.iclrccd-fedex.com/login |
| 27 | -#刷新token地址 | 27 | +#\u5237\u65B0token\u5730\u5740 |
| 28 | api.address.refresh-token-url=https://apictm.iclrccd-fedex.com/admin/user/token/refresh | 28 | api.address.refresh-token-url=https://apictm.iclrccd-fedex.com/admin/user/token/refresh |
| 29 | -#传输海关回执地址 | 29 | +#\u4F20\u8F93\u6D77\u5173\u56DE\u6267\u5730\u5740 |
| 30 | api.address.customs-url=https://apictm.iclrccd-fedex.com/export/outbound/customs | 30 | api.address.customs-url=https://apictm.iclrccd-fedex.com/export/outbound/customs |
| 31 | -#推送完整报文地址 | 31 | +#\u63A8\u9001\u5B8C\u6574\u62A5\u6587\u5730\u5740 |
| 32 | api.address.complete-msg-url=https://apictm.iclrccd-fedex.com/export/outbound/mawb | 32 | api.address.complete-msg-url=https://apictm.iclrccd-fedex.com/export/outbound/mawb |
| 33 | -#iclear应用节点是否能够正常访问 | 33 | +#iclear\u5E94\u7528\u8282\u70B9\u662F\u5426\u80FD\u591F\u6B63\u5E38\u8BBF\u95EE |
| 34 | iclear.address.url42=https://pjec0003.cndczmd.apac.fedex.com:9002/Exp/ | 34 | iclear.address.url42=https://pjec0003.cndczmd.apac.fedex.com:9002/Exp/ |
| 35 | iclear.address.url43=https://pjec0004.cndczmd.apac.fedex.com:9002/Exp/ | 35 | iclear.address.url43=https://pjec0004.cndczmd.apac.fedex.com:9002/Exp/ |
| 36 | -#代理地址(刷新token、传输海关回执地址、推送完整报文地址) | 36 | +stamp_path=/var/share/iclear/resources/upload/attachment/slipType_chm/ |
| 37 | +stamp_file_name=stamp.png | ||
| 38 | +#\u4EE3\u7406\u5730\u5740\uFF08\u5237\u65B0token\u3001\u4F20\u8F93\u6D77\u5173\u56DE\u6267\u5730\u5740\u3001\u63A8\u9001\u5B8C\u6574\u62A5\u6587\u5730\u5740\uFF09 | ||
| 37 | api.address.proxy-url=cn2-proxy.apac.fedex.com | 39 | api.address.proxy-url=cn2-proxy.apac.fedex.com |
| 38 | api.address.proxy-port=3128 | 40 | api.address.proxy-port=3128 | ... | ... |
| 1 | spring.servlet.context-path=/API | 1 | spring.servlet.context-path=/API |
| 2 | spring.datasource.jndi-name=jdbc/iclearDS | 2 | spring.datasource.jndi-name=jdbc/iclearDS |
| 3 | -#推送海关回执 | 3 | +#\u63A8\u9001\u6D77\u5173\u56DE\u6267 |
| 4 | task.pushCustomsTask=0 0/1 * * * ? | 4 | task.pushCustomsTask=0 0/1 * * * ? |
| 5 | -#推送完整报文 | 5 | +#\u63A8\u9001\u5B8C\u6574\u62A5\u6587 |
| 6 | task.pushMawbTask=0 0/1 * * * ? | 6 | task.pushMawbTask=0 0/1 * * * ? |
| 7 | -#推送失败的回执数据 | 7 | +#\u63A8\u9001\u5931\u8D25\u7684\u56DE\u6267\u6570\u636E |
| 8 | task.pushErrorReturnDate=0 0/3 * * * ? | 8 | task.pushErrorReturnDate=0 0/3 * * * ? |
| 9 | -#推送失败的申报数据 | 9 | +#\u63A8\u9001\u5931\u8D25\u7684\u7533\u62A5\u6570\u636E |
| 10 | task.pushErrorDeclareDate=0 0/3 * * * ? | 10 | task.pushErrorDeclareDate=0 0/3 * * * ? |
| 11 | -#监听iclear节点是否正常定时任务间隔 | 11 | +#\u76D1\u542Ciclear\u8282\u70B9\u662F\u5426\u6B63\u5E38\u5B9A\u65F6\u4EFB\u52A1\u95F4\u9694 |
| 12 | task.monitorIclearNodes=0 0/5 * * * ? | 12 | task.monitorIclearNodes=0 0/5 * * * ? |
| 13 | 13 | ||
| 14 | api.base-address=https://declarationuat.fedex.com.cn/Exp | 14 | api.base-address=https://declarationuat.fedex.com.cn/Exp |
| 15 | -#获取token账号 | 15 | +#\u83B7\u53D6token\u8D26\u53F7 |
| 16 | api.token-info.username=iclear_external_ctm | 16 | api.token-info.username=iclear_external_ctm |
| 17 | -#获取token密码 | 17 | +#\u83B7\u53D6token\u5BC6\u7801 |
| 18 | api.token-info.password=toQu3arch6 | 18 | api.token-info.password=toQu3arch6 |
| 19 | -#IClearC类提交运单地址 | 19 | +#IClearC\u7C7B\u63D0\u4EA4\u8FD0\u5355\u5730\u5740 |
| 20 | api.address.iclear-submit-url=${api.base-address}/chmConsignmentController/submitConsignments | 20 | api.address.iclear-submit-url=${api.base-address}/chmConsignmentController/submitConsignments |
| 21 | -#IClear校验运单地址 | 21 | +#IClear\u6821\u9A8C\u8FD0\u5355\u5730\u5740 |
| 22 | api.address.iclear-check-url=${api.base-address}/chmConsignmentController/checkChmAndDetaliD | 22 | api.address.iclear-check-url=${api.base-address}/chmConsignmentController/checkChmAndDetaliD |
| 23 | -#IClear校验C类运单地址 | 23 | +#IClear\u6821\u9A8CC\u7C7B\u8FD0\u5355\u5730\u5740 |
| 24 | api.address.iclear-check-url-c=${api.base-address}/chmConsignmentController/checkChmAndDetaliC | 24 | api.address.iclear-check-url-c=${api.base-address}/chmConsignmentController/checkChmAndDetaliC |
| 25 | -#获取token地址 | 25 | +#\u83B7\u53D6token\u5730\u5740 |
| 26 | api.address.token-url=https://apiuat.iclrccd-fedex.com/login | 26 | api.address.token-url=https://apiuat.iclrccd-fedex.com/login |
| 27 | -#刷新token地址 | 27 | +#\u5237\u65B0token\u5730\u5740 |
| 28 | api.address.refresh-token-url=https://apiuat.iclrccd-fedex.com/user/token/refresh | 28 | api.address.refresh-token-url=https://apiuat.iclrccd-fedex.com/user/token/refresh |
| 29 | -#传输海关回执地址 | 29 | +#\u4F20\u8F93\u6D77\u5173\u56DE\u6267\u5730\u5740 |
| 30 | api.address.customs-url=https://apiuat.iclrccd-fedex.com/export/outbound/customs | 30 | api.address.customs-url=https://apiuat.iclrccd-fedex.com/export/outbound/customs |
| 31 | -#推送完整报文地址 | 31 | +#\u63A8\u9001\u5B8C\u6574\u62A5\u6587\u5730\u5740 |
| 32 | api.address.complete-msg-url=https://apiuat.iclrccd-fedex.com/export/outbound/mawb | 32 | api.address.complete-msg-url=https://apiuat.iclrccd-fedex.com/export/outbound/mawb |
| 33 | -#iclear应用节点是否能够正常访问 | 33 | +#iclear\u5E94\u7528\u8282\u70B9\u662F\u5426\u80FD\u591F\u6B63\u5E38\u8BBF\u95EE |
| 34 | iclear.address.url42=http://ujec0003.cndczmd.apac.fedex.com:9001/Exp/#login | 34 | iclear.address.url42=http://ujec0003.cndczmd.apac.fedex.com:9001/Exp/#login |
| 35 | iclear.address.url43=http://ujec0004.cndczmd.apac.fedex.com:9001/Exp/#login | 35 | iclear.address.url43=http://ujec0004.cndczmd.apac.fedex.com:9001/Exp/#login |
| 36 | -#代理地址(刷新token、传输海关回执地址、推送完整报文地址) | 36 | +stamp_path=/var/share/iclear/resources/upload/attachment/slipType_chm/ |
| 37 | +stamp_file_name=stamp.png | ||
| 38 | +#\u4EE3\u7406\u5730\u5740\uFF08\u5237\u65B0token\u3001\u4F20\u8F93\u6D77\u5173\u56DE\u6267\u5730\u5740\u3001\u63A8\u9001\u5B8C\u6574\u62A5\u6587\u5730\u5740\uFF09 | ||
| 37 | api.address.proxy-url=cn2-proxy.apac.fedex.com | 39 | api.address.proxy-url=cn2-proxy.apac.fedex.com |
| 38 | api.address.proxy-port=3128 | 40 | api.address.proxy-port=3128 |
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
| 1 | +package com.erry.iclear.dateInterface; | ||
| 2 | + | ||
| 3 | +import com.arronlong.httpclientutil.HttpClientUtil; | ||
| 4 | +import com.arronlong.httpclientutil.builder.HCB; | ||
| 5 | +import com.arronlong.httpclientutil.common.HttpConfig; | ||
| 6 | +import com.arronlong.httpclientutil.common.HttpHeader; | ||
| 7 | +import com.arronlong.httpclientutil.common.SSLs; | ||
| 8 | +import com.erry.iclear.dateInterface.api.response.IClearCheckResult; | ||
| 9 | +import com.erry.iclear.dateInterface.api.response.StampResult; | ||
| 10 | +import com.erry.iclear.dateInterface.util.FileUtils; | ||
| 11 | +import com.erry.iclear.dateInterface.util.JsonToJava; | ||
| 12 | +import com.erry.iclear.dateInterface.util.SHA256Util; | ||
| 13 | +import org.apache.http.Header; | ||
| 14 | + | ||
| 15 | +/** | ||
| 16 | + * 获取HSCODE接口地址 | ||
| 17 | + * fedex | ||
| 18 | + * 2022年4月14日17:55:55 | ||
| 19 | + */ | ||
| 20 | +public class StampRequest { | ||
| 21 | + public static String url = "https://localhost:8780"; | ||
| 22 | + //获取HSCODE接口地址 | ||
| 23 | + public static String path = "/iknowU/stampQuery"; | ||
| 24 | + //时间戳 | ||
| 25 | + public static String timeStamp = "1649839249891"; | ||
| 26 | + //APPID | ||
| 27 | + public static String appId = "DEMO1"; | ||
| 28 | + //APPKEY | ||
| 29 | + public static String appKey = "iClearExportDemo1"; | ||
| 30 | + //需要申请 | ||
| 31 | + public static String security = "8c7f1108316abfb1"; | ||
| 32 | + | ||
| 33 | + public static void main(String[] args) throws Exception{ | ||
| 34 | + hscodeRequest(); | ||
| 35 | + } | ||
| 36 | + | ||
| 37 | + /** | ||
| 38 | + * 获取HSCODE接口地址 | ||
| 39 | + */ | ||
| 40 | + public static void hscodeRequest() throws Exception{ | ||
| 41 | + //hscode 编码可修改 | ||
| 42 | + String json ="{\"consignmentCode\":\"aaaaaaaa\"}"; | ||
| 43 | + | ||
| 44 | + String token = SHA256Util.getSHA256String(StampRequest.appId + StampRequest.appKey + StampRequest.security + StampRequest.timeStamp); | ||
| 45 | + System.out.println(token); | ||
| 46 | + //消息头 | ||
| 47 | + Header[] headers = HttpHeader.custom() | ||
| 48 | + .other("Content-Type", "application/json") | ||
| 49 | + .other("Appid", StampRequest.appId) | ||
| 50 | + .other("appKey", StampRequest.appKey) | ||
| 51 | + .other("TimeStamp", StampRequest.timeStamp) | ||
| 52 | + .other("token", token) | ||
| 53 | + .build(); | ||
| 54 | + //客户端配置 | ||
| 55 | + HCB hcb = HCB.custom() | ||
| 56 | + .timeout(20000) | ||
| 57 | + .pool(100, 10) | ||
| 58 | + .sslpv(SSLs.SSLProtocolVersion.TLSv1_2) | ||
| 59 | + .ssl() | ||
| 60 | + .retry(3); | ||
| 61 | + //URL | ||
| 62 | + String url = StampRequest.url + StampRequest.path; | ||
| 63 | + //HTTP请求 | ||
| 64 | + HttpConfig config = HttpConfig.custom() | ||
| 65 | + .headers(headers) | ||
| 66 | + .url(url) | ||
| 67 | + .encoding("utf-8") | ||
| 68 | + .client(hcb.build()) | ||
| 69 | + .json(json); | ||
| 70 | + String result = HttpClientUtil.post(config); | ||
| 71 | + StampResult stampResult = JsonToJava.parseJson(result, StampResult.class); | ||
| 72 | + FileUtils.convertBase64ToFile(stampResult.getBase64Image(),"C:\\Users\\erry-Fedex\\Desktop\\电子章","bbbbbbb.png"); | ||
| 73 | + } | ||
| 74 | +} |
-
Please register or login to post a comment