Browse Source

fix:订单远程调用

liujunchi 2 years ago
parent
commit
be82e401bf

+ 18 - 17
mec-mall/mall-portal/src/main/java/com/yonge/cooleshow/portal/service/impl/OmsPortalOrderServiceImpl.java

@@ -137,7 +137,7 @@ public class OmsPortalOrderServiceImpl implements OmsPortalOrderService {
                         orderParam.getOrderNo());
                 userOrderPayment.setStatus(TradeStatusEnum.close.getCode());
 
-                String oldORderNo = userOrderPayment.getAdapayNo();
+                String oldOrderNo = userOrderPayment.getAdapayNo();
                 userOrderPaymentService.saveOrUpdate(userOrderPayment);
 
                 // 增加一个支付中的记录
@@ -146,7 +146,7 @@ public class OmsPortalOrderServiceImpl implements OmsPortalOrderService {
                 userOrderPayment.setId(null);
                 userOrderPaymentService.saveOrUpdate(userOrderPayment);
 
-                return feignMecCreateOrder(order.getCouponId(), oldORderNo, orderSn, null, detail.getMemberId().intValue(), detail.getTotalAmount());
+                return feignMecCreateOrder(order.getCouponId(), oldOrderNo, orderSn, null, detail.getMemberId().intValue(), detail.getTotalAmount());
             } else {
                 throw new BizException("订单信息获取失败");
             }
@@ -790,18 +790,18 @@ public class OmsPortalOrderServiceImpl implements OmsPortalOrderService {
             orderPayment.setStatus(TradeStatusEnum.succeeded.getCode());
             userOrderPaymentService.saveOrUpdate(orderPayment);
 
-            Map<String,Object> notifyMap = new HashMap<>();
-            notifyMap.put("channelType", payChannel);
-            notifyMap.put("tradeState", "1");
-            notifyMap.put("totalMoney", payAmount);
-            notifyMap.put("merOrderNo",orderNo);
-            HttpResponseResult httpResponseResult = webFeignService.updateOrder(notifyMap);
-            if (!httpResponseResult.getStatus()) {
-                throw new BizException(httpResponseResult.getMsg());
-            }
         } else {
             LOG.error("汇付支付回调,订单状态异常。 req is {}", detail.getOrderSn());
         }
+        Map<String,Object> notifyMap = new HashMap<>();
+        notifyMap.put("channelType", payChannel);
+        notifyMap.put("tradeState", "1");
+        notifyMap.put("totalMoney", payAmount);
+        notifyMap.put("merOrderNo",orderNo);
+        HttpResponseResult httpResponseResult = webFeignService.updateOrder(notifyMap);
+        if (!httpResponseResult.getStatus()) {
+            throw new BizException(httpResponseResult.getMsg());
+        }
     }
 
 
@@ -827,16 +827,17 @@ public class OmsPortalOrderServiceImpl implements OmsPortalOrderService {
             cancelOrder(detail.getId(), "支付失败");
 
             // 修改用户付款状态
-            orderPayment.setStatus(TradeStatusEnum.succeeded.getCode());
+            orderPayment.setStatus(TradeStatusEnum.failed.getCode());
             userOrderPaymentService.saveOrUpdate(orderPayment);
-
-            HttpResponseResult httpResponseResult = webFeignService.updateOrder(notifyMap);
-            if (!httpResponseResult.getStatus()) {
-                throw new BizException(httpResponseResult.getMsg());
-            }
         } else {
             LOG.error("汇付支付回调,订单状态异常。 req is {}", orderNo);
         }
+
+
+        HttpResponseResult httpResponseResult = webFeignService.updateOrder(notifyMap);
+        if (!httpResponseResult.getStatus()) {
+            throw new BizException(httpResponseResult.getMsg());
+        }
     }
 
     @Override