コード例 #1
0
  /**
   * 保存指定状态的原始订单至数据库
   *
   * @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);
      }
    }
  }
コード例 #2
0
  /**
   * 获取订单、订单项、订单优惠信息
   *
   * @param originalOrder
   * @param startTime
   * @param endTime
   * @return
   */
  @Transactional(readOnly = true)
  public List<OriginalOrder> findOriginalOrderFullinfos(
      OriginalOrder originalOrder, Date startTime, Date endTime) {
    List<OriginalOrder> originalOrderList = getOriginalOrder(originalOrder, startTime, endTime);

    if (CollectionUtils.isNotEmpty(originalOrderList)) {
      for (OriginalOrder originalOrderOri : originalOrderList) {
        OriginalOrderItem originalOrderItem = new OriginalOrderItem();
        originalOrderItem.setOriginalOrderId(originalOrderOri.getId());
        List<OriginalOrderItem> originalOrderItemList = findOriginalOrderItem(originalOrderItem);
        if (CollectionUtils.isNotEmpty(originalOrderItemList)) {
          originalOrderOri.setOriginalOrderItemList(originalOrderItemList);
        }

        PromotionInfo promotionInfo = new PromotionInfo();
        promotionInfo.setOriginalOrderId(originalOrderOri.getId());
        List<PromotionInfo> promotionInfoList = findPromotionInfos(promotionInfo);
        if (CollectionUtils.isNotEmpty(promotionInfoList)) {
          originalOrderOri.setPromotionInfoList(promotionInfoList);
        }
      }
    }
    return originalOrderList;
  }