소스 검색

fix 退款

zoujiajian 2 년 전
부모
커밋
a9e387b485

+ 6 - 3
netflix-service/src/main/java/com/cyksj/service/mange/impl/CmsOrderDonServiceImpl.java

@@ -278,8 +278,11 @@ public class CmsOrderDonServiceImpl extends ServiceImpl<OrderDonMapper,OrderDon>
     @Transactional(rollbackFor = Throwable.class)
     public void unifiedRefund(OrderRefundReq refundReq) throws Exception {
         OrderDon orderDon = orderDonMapper.selectById(refundReq.getOrderId());
-        GoodsDonSku sku = goodsDonSkuMapper.selectById(orderDon.getSkuId());
-        GoodsDon goodsDon = goodsDonMapper.selectById(sku.getGoodsId());
+        GoodsDonSku sku = null;
+        if (orderDon.getSkuId() != null) {
+            sku = goodsDonSkuMapper.selectById(orderDon.getSkuId());
+        }
+        GoodsDon goodsDon = goodsDonMapper.selectById(orderDon.getGoodsId());
         if (StrUtil.isEmpty(refundReq.getRefundType())) {
             refundReq.setRefundType("money");
         }
@@ -557,7 +560,7 @@ public class CmsOrderDonServiceImpl extends ServiceImpl<OrderDonMapper,OrderDon>
         if (OrderDon.Status.noPayment == orderDon.getStatus() || OrderDon.Status.close == orderDon.getStatus()) {
             throw BusinessRuntimeException.getInstance("订单{0}状态不支持退款", orderDon.getStatus());
         }
-        if (goodsDon.getType() == 1) {
+        if (goodsDon.getType() == 1 && sku != null) {
             //虚拟原订单是否已过期
             Integer months = sku.getMonths();
             Integer days = sku.getDays();

+ 1 - 1
netflix-service/src/main/java/com/cyksj/service/order/impl/OrderCommonServiceImpl.java

@@ -44,7 +44,7 @@ public class OrderCommonServiceImpl implements OrderCommonService {
 
 	@Override
 	public void clearUnrealGoodsDetail(OrderDon orderDon, Integer goodsType, GoodsDonSku sku) {
-		if (goodsType == 1) {
+		if (goodsType == 1 && sku != null) {
 			//清出车队,车位变为已过期
 			Long relationId = orderDon.getRelationId();
 			//更换车票前后的座位id集合