/**
  * 更新时间价格表.
  *
  * @param housePriceId
  */
 private void updateRouteStockTimePrice(EbkHousePrice ehp) {
   TimePrice tp = new TimePrice();
   tp.setMetaBranchId(ehp.getMetaBranchId());
   tp.setBeginDate(ehp.getStartDate());
   tp.setEndDate(ehp.getEndDate());
   // 是否关班
   // 若关班则库存清零,不可超卖;否则正常流程
   if ("true".equalsIgnoreCase(ehp.getIsStockZero())) {
     tp.setOverSale("false");
     tp.setDayStock(0);
   } else { // 库存不清零
     tp.setOverSale(ehp.getIsOverSale());
     // 设定日库存
     if (ehp.getStockAddOrMinus() < 0) {
       throw new RuntimeException("增减库存不能为负数");
     }
     tp.setDayStock(ehp.getStockAddOrMinus());
     tp.setIsAddDayStock(ehp.getIsAddDayStock());
   }
   // 不修改资源状态
   if (tp.getDayStock() >= 0) {
     tp.setResourceConfirm("false");
   } else {
     tp.setResourceConfirm(null);
   }
   tp.setClose("false");
   String result = productProxy.saveOrUpdateMetaTimePrice("op2", tp, ehp.getSubmitUser());
   if (result != null) {
     throw new RuntimeException(result);
   }
 }
  /**
   * 需要检查最晚取消时间在废单时间一小时之前的使用该方法
   *
   * @param branch
   * @param visitTime
   * @param initialProduct 是否需要初始化产品信息
   * @param checkCancelHour 是否需要检查当前时间在最晚废单时间前一小时
   * @return
   */
  public ProdProductBranch fill(
      ProdProductBranch branch,
      Date visitTime,
      boolean initialProduct,
      boolean checkOnline,
      boolean checkCancelHour,
      boolean todayOrderAble) {
    if (initialProduct) {
      ProdProduct product = prodProductDAO.selectProductDetailByPrimaryKey(branch.getProductId());
      branch.setProdProduct(product);
    }
    if (branch.getProdProduct() == null || branch.getProdProduct().isDisabled()) {
      return null;
    }
    if (checkOnline) {
      if (!branch.getProdProduct().isOnLine() || !branch.hasOnline()) {
        return null;
      }
    }
    // 只针对非超级自由行
    if (!branch.getProdProduct().hasSelfPack()
        && prodProductBranchItemDAO.countProductItem(branch.getProdBranchId())
            == 0) { // 如果产品进行了打包才加入到有效的相关产品列表中
      return null;
    }
    if (visitTime != null) { // 如果时间为空跳过时间及库存	
      if (!branch.getProdProduct().hasSelfPack()) {
        TimePrice price = null;
        if (todayOrderAble) {
          price =
              productTimePriceLogic.calcCurrentProdTimePrice(branch.getProdBranchId(), visitTime);
        } else {
          price = productTimePriceLogic.calcProdTimePrice(branch.getProdBranchId(), visitTime);
        }
        if (price == null) {
          return null;
        }

        if (checkCancelHour && !TimePriceUtil.checkLastCancel(price)) {
          return null;
        }
        branch.setSellPrice(price.getPrice());
        branch.setMarketPrice(price.getMarketPrice());
        branch.setStock(price.getDayStock());
        if (branch.getStock() == 0L && price.isOverSaleAble()) { // 能超卖时显示有库存
          branch.setStock(-1);
        }
      }
      // 只针对非超级自由行
      if (!branch.getProdProduct().hasSelfPack()
          && branch.getStock() != -1
          && (branch.getStock() < 1L || branch.getStock() < branch.getMinimum())) {
        return null;
      }
    }

    return branch;
  }