/**
   * 重置订单优惠信息(主要用于京东订单)
   *
   * @param originalOrderList
   */
  public void resetDiscountInfo(List<OriginalOrder> originalOrderList) {
    if (CollectionUtils.isEmpty(originalOrderList)) {
      return;
    }

    for (OriginalOrder originalOrder : originalOrderList) {
      originalOrder.setDiscountFee(getDiscountFee(originalOrder.getPromotionInfoList()));
      originalOrder.setSelfDiscountFee(getSelfDiscountFee(originalOrder.getPromotionInfoList()));

      if (CollectionUtils.isEmpty(originalOrder.getOriginalOrderItemList())) {
        continue;
      }

      Money totalPayableFee = getTotalPayableFee(originalOrder);

      for (OriginalOrderItem originalOrderItem : originalOrder.getOriginalOrderItemList()) {
        originalOrderItem.setPartMjzDiscount(
            getItemMjzDiscountFee(
                originalOrderItem.getPayableFee(),
                totalPayableFee,
                originalOrder.getDiscountFee()));
        originalOrderItem.setSelfPartMjzDiscount(
            getItemMjzDiscountFee(
                originalOrderItem.getPayableFee(),
                totalPayableFee,
                originalOrder.getSelfDiscountFee()));
        saveOriginalOrderItem(originalOrderItem);
      }

      saveOriginalOrder(originalOrder);
    }
  }
  /**
   * 保存指定状态的原始订单至数据库
   *
   * @param originalOrderList
   */
  public void saveOriginalOrders(List<OriginalOrder> originalOrderList) {

    if (CollectionUtils.isEmpty(originalOrderList)) {
      return;
    }

    for (OriginalOrder originalOrder : originalOrderList) {

      if (!(StringUtils.equalsIgnoreCase(
              originalOrder.getStatus(), OriginalOrderStatus.WAIT_SELLER_SEND_GOODS.toString())
          || StringUtils.equalsIgnoreCase(
              originalOrder.getStatus(), OriginalOrderStatus.WAIT_BUYER_CONFIRM_GOODS.toString())
          || StringUtils.equalsIgnoreCase(
              originalOrder.getStatus(), OriginalOrderStatus.TRADE_FINISHED.toString()))) {
        continue;
      }
      // 保存原始订单
      saveOriginalOrder(originalOrder);
      for (OriginalOrderItem originalOrderItem : originalOrder.getOriginalOrderItemList()) {
        // 保存原始订单项
        originalOrderItem.setOriginalOrderId(originalOrder.getId());
        saveOriginalOrderItem(originalOrderItem);
      }
      for (PromotionInfo promotionInfo : originalOrder.getPromotionInfoList()) {
        // 保存订单优惠记录
        promotionInfo.setOriginalOrderId(originalOrder.getId());
        savePromotionInfo(promotionInfo);
      }
    }
  }