Commit 8ccc55d1aa2759e09e4f76305e84e67c55847f6d

Authored by YunaiV
1 parent 2dc8071f

【功能优化】商城:KdNiaoExpressClient 增加 requestType 配置,使用免费版,还是增值版

yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/framework/delivery/config/TradeExpressProperties.java
... ... @@ -56,6 +56,15 @@ public class TradeExpressProperties {
56 56 @NotEmpty(message = "快递鸟 Api Key 配置项不能为空")
57 57 private String apiKey;
58 58  
  59 + /**
  60 + * 接口指令
  61 + *
  62 + * 1. 1002:免费版(只能查询申通、圆通快递)
  63 + * 2. 8001:付费版
  64 + */
  65 + @NotEmpty(message = "RequestType 配置项不能为空")
  66 + private String requestType = "1002";
  67 +
59 68 }
60 69  
61 70 /**
... ...
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/framework/delivery/core/client/impl/kdniao/KdNiaoExpressClient.java
... ... @@ -39,11 +39,6 @@ public class KdNiaoExpressClient implements ExpressClient {
39 39  
40 40 private static final String REAL_TIME_QUERY_URL = "https://api.kdniao.com/Ebusiness/EbusinessOrderHandle.aspx";
41 41  
42   - /**
43   - * 快递鸟即时查询免费版 RequestType
44   - */
45   - private static final String REAL_TIME_FREE_REQ_TYPE = "1002";
46   -
47 42 private final RestTemplate restTemplate;
48 43 private final TradeExpressProperties.KdNiaoConfig config;
49 44  
... ... @@ -67,7 +62,7 @@ public class KdNiaoExpressClient implements ExpressClient {
67 62 && StrUtil.length(reqDTO.getPhone()) >= 4) {
68 63 requestDTO.setCustomerName(StrUtil.subSufByLength(reqDTO.getPhone(), 4));
69 64 }
70   - KdNiaoExpressQueryRespDTO respDTO = httpRequest(REAL_TIME_QUERY_URL, REAL_TIME_FREE_REQ_TYPE,
  65 + KdNiaoExpressQueryRespDTO respDTO = httpRequest(REAL_TIME_QUERY_URL, config.getRequestType(),
71 66 requestDTO, KdNiaoExpressQueryRespDTO.class);
72 67  
73 68 // 处理结果
... ...
yudao-server/src/main/resources/application.yaml
... ... @@ -340,10 +340,11 @@ yudao:
340 340 receive-expire-time: 14d # 收货的过期时间
341 341 comment-expire-time: 7d # 评论的过期时间
342 342 express:
343   - client: kd_niao
  343 + client: KD_NIAO
344 344 kd-niao:
345 345 api-key: cb022f1e-48f1-4c4a-a723-9001ac9676b8
346 346 business-id: 1809751
  347 + request-type: 1002 # 免费版 1002;付费版 8001
347 348 kd100:
348 349 key: pLXUGAwK5305
349 350 customer: E77DF18BE109F454A5CD319E44BF5177
... ...