Browse Source

更新物流查询

Yangzw 2 months ago
parent
commit
6070e4431b

+ 5 - 1
feifan-module-mall/feifan-module-trade-biz/src/main/java/cn/newfeifan/mall/module/trade/framework/delivery/core/client/dto/ExpressTrackQueryReqDTO.java

@@ -13,7 +13,6 @@ public class ExpressTrackQueryReqDTO {
 
     /**
      * 快递公司编码
-     *
      * 对应 {@link DeliveryExpressDO#getCode()}
      */
     private String expressCode;
@@ -28,4 +27,9 @@ public class ExpressTrackQueryReqDTO {
      */
     private String phone;
 
+    /**
+     * 订单id
+     */
+    private Long orderId;
+
 }

+ 3 - 2
feifan-module-mall/feifan-module-trade-biz/src/main/java/cn/newfeifan/mall/module/trade/framework/delivery/core/client/impl/kd100/Kd100ExpressClient.java

@@ -86,7 +86,7 @@ public class Kd100ExpressClient implements ExpressClient {
 
         //如果状态为已签收("3"),则保存到订单信息中
         if(respDTO.getState().equals(TradeOrderStateEnum.RECEIVED.getState())){
-            updateOrder(respDTO.getExpressCompanyCode(),respDTO.getLogisticsNo(),expressTrackRespDTOS.get(0).getTime());
+            updateOrder(respDTO.getExpressCompanyCode(),respDTO.getLogisticsNo(),expressTrackRespDTOS.get(0).getTime(),reqDTO.getOrderId());
         }
         return expressTrackRespDTOS;
     }
@@ -96,9 +96,10 @@ public class Kd100ExpressClient implements ExpressClient {
      * @param com 快递公司编码
      * @param nu 单号
      */
-    private void updateOrder(String com, String nu, LocalDateTime time){
+    private void updateOrder(String com, String nu, LocalDateTime time, Long orderId) {
         DeliveryExpressDO deliveryExpressDO = deliveryExpressMapper.selectByCode(com);
         TradeOrderDO tradeOrderDO = tradeOrderMapper.selectOne(new LambdaQueryWrapper<TradeOrderDO>()
+                .eq(TradeOrderDO::getId, orderId)
                 .eq(TradeOrderDO::getLogisticsNo, nu)
                 .eq(TradeOrderDO::getLogisticsId, deliveryExpressDO.getId())
                 .isNull(TradeOrderDO::getReceivingTime)

+ 3 - 3
feifan-module-mall/feifan-module-trade-biz/src/main/java/cn/newfeifan/mall/module/trade/service/order/TradeOrderQueryServiceImpl.java

@@ -377,7 +377,7 @@ public class TradeOrderQueryServiceImpl implements TradeOrderQueryService {
             throw exception(EXPRESS_NOT_EXISTS);
         }
         // 查询物流轨迹
-        return getSelf().getExpressTrackList(express.getCode(), order.getLogisticsNo(), order.getReceiverMobile());
+        return getSelf().getExpressTrackList(express.getCode(), order.getLogisticsNo(), order.getReceiverMobile(),order.getId());
     }
 
     /**
@@ -391,8 +391,8 @@ public class TradeOrderQueryServiceImpl implements TradeOrderQueryService {
      * @return 物流轨迹
      */
     @Cacheable(cacheNames = RedisKeyConstants.EXPRESS_TRACK, key = "#code + '-' + #logisticsNo + '-' + #receiverMobile", condition = "#result != null")
-    public List<ExpressTrackRespDTO> getExpressTrackList(String code, String logisticsNo, String receiverMobile) {
-        return expressClientFactory.getDefaultExpressClient().getExpressTrackList(new ExpressTrackQueryReqDTO().setExpressCode(code).setLogisticsNo(logisticsNo).setPhone(receiverMobile));
+    public List<ExpressTrackRespDTO> getExpressTrackList(String code, String logisticsNo, String receiverMobile, Long orderId) {
+        return expressClientFactory.getDefaultExpressClient().getExpressTrackList(new ExpressTrackQueryReqDTO().setExpressCode(code).setLogisticsNo(logisticsNo).setPhone(receiverMobile).setOrderId(orderId));
     }