/**
  * 查询产品类别,顺便初始化产品
  *
  * @param prodBranchId
  * @return
  */
 public ProdProductBranch getProdProductBranch(final Long prodBranchId) {
   ProdProductBranch ppb = prodProductBranchDAO.selectByPrimaryKey(prodBranchId);
   if (ppb != null) {
     ppb.setProdProduct(prodProductDAO.selectProductDetailByPrimaryKey(ppb.getProductId()));
   }
   return ppb;
 }
  private void singleSmsInMerged(PassCode passCode, boolean mergeCertificateSMS) {
    List<OrdOrderItemMeta> ordItemMetaList = null;
    OrdOrderItemMeta itemMeta = null;
    if (passCode.isForOrder()) {
      ordItemMetaList = orderServiceProxy.queryOrdOrderItemMetaByOrderId(passCode.getOrderId());
      itemMeta = ordItemMetaList.get(0);
    } else {
      itemMeta = orderServiceProxy.queryOrdOrderItemMetaBy(passCode.getObjectId());
    }
    OrdOrderItemProd ordItemProd =
        orderServiceProxy.queryOrdOrderItemProdById(itemMeta.getOrderItemId());
    ProdProductBranch prodProductBranch =
        prodProductBranchDAO.selectByPrimaryKey(ordItemProd.getProdBranchId());

    // 凭证短信合并发送,并且是各子子项独立申码
    if (mergeCertificateSMS && passCode.isForOrderItemMeta() && generateSMS) {
      // 【${销售类别} 取票码 ${code},辅助码xxxx ,含${adult} ${chaild}】
      String formatString = "【%s %s,%s,%s】";

      String branchName = prodProductBranch.getBranchName();
      String code = "";
      if (!"BASE64".equalsIgnoreCase(passCode.getCode())) {
        code = "取票码 " + passCode.getCode();
      }
      String addCode = passCode.getAddCode();

      if (StringUtils.isNotEmpty(addCode)) {
        addCode = "辅助码 " + addCode;
      } else {
        addCode = "";
      }

      long adult = ordItemProd.getQuantity() * prodProductBranch.getAdultQuantity();
      long child = ordItemProd.getQuantity() * prodProductBranch.getChildQuantity();

      StringBuilder quantity = new StringBuilder();
      if (itemMeta.isStudent()) {
        quantity.append("学生人数:" + (adult + child));
      } else {
        quantity.append("含");
        if (adult > 0) {
          quantity.append(adult + "成人  ");
        }
        if (child > 0) {
          quantity.append(child + "儿童");
        }
      }
      String smsContent = String.format(formatString, branchName, code, addCode, quantity);
      log.info("=====singleSmsInMerged smsContent===========" + smsContent);
      PassCode temp = new PassCode();
      temp.setCodeId(passCode.getCodeId());
      temp.setSmsContent(smsContent);
      passCodeService.updatePassCode(temp);
    }
  }
 private String getProductName(PassCode passCode) {
   List<OrdOrderItemMeta> ordItemMetaList = null;
   OrdOrderItemMeta itemMeta = null;
   if (passCode.isForOrder()) {
     ordItemMetaList = orderServiceProxy.queryOrdOrderItemMetaByOrderId(passCode.getOrderId());
     itemMeta = ordItemMetaList.get(0);
   } else {
     itemMeta = orderServiceProxy.queryOrdOrderItemMetaBy(passCode.getObjectId());
   }
   OrdOrderItemProd ordItemProd =
       orderServiceProxy.queryOrdOrderItemProdById(itemMeta.getOrderItemId());
   ProdProductBranch prodProductBranch =
       prodProductBranchDAO.selectByPrimaryKey(ordItemProd.getProdBranchId());
   ProdProduct product = prodProductService.getProdProduct(prodProductBranch.getProductId());
   return product.getProductName();
 }