Browse Source

刷新物流信息,同时返回数据

liujunchi 2 years ago
parent
commit
386416b5c9

+ 1 - 2
cooleshow-mall/mall-portal/src/main/java/com/yonge/cooleshow/portal/controller/OmsPortalOrderController.java

@@ -234,7 +234,6 @@ public class OmsPortalOrderController {
     @GetMapping(value = "/refreshCourier")
     @ResponseBody
     public CommonResult refreshCourier(@RequestParam String  deliverySn) throws InterruptedException {
-        orderCourierService.refreshCourier(deliverySn);
-        return CommonResult.success(null);
+        return CommonResult.success(orderCourierService.refreshCourier(deliverySn));
     }
 }

+ 2 - 1
cooleshow-mall/mall-portal/src/main/java/com/yonge/cooleshow/portal/service/OmsOrderCourierService.java

@@ -23,7 +23,8 @@ public interface OmsOrderCourierService {
 
     /**
      * 刷新物流信息
+     * @return
      */
     @Transactional
-    void refreshCourier(String deliverySn) throws InterruptedException;
+    OmsOrderCourier refreshCourier(String deliverySn) throws InterruptedException;
 }

+ 5 - 3
cooleshow-mall/mall-portal/src/main/java/com/yonge/cooleshow/portal/service/impl/OmsOrderCourierServiceImpl.java

@@ -50,11 +50,12 @@ public class OmsOrderCourierServiceImpl implements OmsOrderCourierService {
     }
 
     @Override
-    public void refreshCourier(String deliverySn) throws InterruptedException {
+    public OmsOrderCourier refreshCourier(String deliverySn) throws InterruptedException {
         RLock lock = redissonClient.getLock(OrderCacheEnum.COURIER_LOCK.getCode());
-        boolean b = lock.tryLock(1, TimeUnit.HOURS);
+        boolean b = lock.tryLock(0,1, TimeUnit.HOURS);
+
+        OmsOrderCourier omsOrderCourier = omsOrderCourierMapper.queryByCourierNo(deliverySn);
         if (b) {
-            OmsOrderCourier omsOrderCourier = omsOrderCourierMapper.queryByCourierNo(deliverySn);
             if (omsOrderCourier == null) {
                 throw new BizException("未找到物流信息");
             }
@@ -62,5 +63,6 @@ public class OmsOrderCourierServiceImpl implements OmsOrderCourierService {
                                                                 omsOrderCourier.getCourierNo());
             updateCourierInfo(courierInfo);
         }
+        return omsOrderCourierMapper.queryByCourierNo(deliverySn);
     }
 }