private MergedSmsContentCreator(PassCode passCode, String mobile, boolean mergeCertificateSMS) {
   log.info("mergeCertificateSMS:" + mergeCertificateSMS);
   this.objectId = passCode.getOrderId();
   log.info("orderId:" + objectId);
   order = orderServiceProxy.queryOrdOrderByOrderId(objectId);
   this.passCode = passCode;
   this.mobile = mobile;
 }
  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 void addComLog(PassCode passCode, String logContent, String logName) {
   ComLog log = new ComLog();
   log.setObjectType("PASS_CODE");
   log.setParentId(passCode.getOrderId());
   log.setObjectId(passCode.getCodeId());
   log.setOperatorName("SYSTEM");
   log.setLogType(Constant.COM_LOG_ORDER_EVENT.systemApprovePass.name());
   log.setLogName(logName);
   log.setContent(logContent);
   comLogService.addComLog(log);
 }
  @SuppressWarnings({"unchecked", "rawtypes"})
  private Map<String, List<String>> checkAllApplySuccess(PassCode passCode) {

    /*
     * 检查订单中所有由非服务商发送短信、独立申码、并且开通了凭证短信合并功能
     * 的所有短信是否都已经生成,然后按服务商分组passCode
     *
     * 按服务商分组passCode的目的是,各服务商的凭证短信单独发送
     */
    Map params = new HashMap();
    params.put("orderId", passCode.getOrderId());
    List<PassPortCode> passportcodeList = passCodeService.selectAllMergeSmsByParams(params);

    int mergeCount = 0;
    if (passCode.getCodeTotal().intValue() == passportcodeList.size()) {
      for (PassPortCode passportcode : passportcodeList) {
        // 剔除非合并凭证短信的通关码
        if (!passportcode.isMergeCertificateSMS()) {
          if (otherPassportcodeList == null) {
            otherPassportcodeList = new ArrayList();
          }
          otherPassportcodeList.add(passportcode);

          continue;
        }
        mergeCount++;
      }
    } else {
      return null;
    }

    params.put("checkSmsContent", "true");
    List<PassPortCode> passportcodeStatusList = passCodeService.selectAllMergeSmsByParams(params);
    log.info(passportcodeStatusList.size());
    // 所有的合并凭证短信的码,都已经申码成功、生成短信内容片段成功
    if (mergeCount == passportcodeStatusList.size()) {
      Map<String, List<String>> groupPassPortCode = new HashMap<String, List<String>>();
      for (PassPortCode passportcode : passportcodeStatusList) {
        String providerName = passportcode.getProviderName();
        Long codeId = passportcode.getCodeId();
        List<String> codeList = groupPassPortCode.get(providerName);
        if (codeList == null) {
          codeList = new ArrayList<String>();
        }
        codeList.add(codeId.toString());
        groupPassPortCode.put(providerName, codeList);
      }
      return groupPassPortCode;
    }

    return null;
  }
 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();
 }
  private String buildOrderInfo(PassCode passCode) {
    OrdOrder ordorder = orderServiceProxy.queryOrdOrderByOrderId(passCode.getOrderId());
    // 取票人/联系人的证件号
    cardNum = ordorder.getContact().getCertNo();
    List<PayPayment> payList =
        payPaymentService.selectByObjectIdAndBizType(
            ordorder.getOrderId(), Constant.PAYMENT_BIZ_TYPE.SUPER_ORDER.name());
    for (PayPayment payment : payList) {
      if (payment.isSuccess()) {
        GugongOrder gugongorder = new GugongOrder(payment, ordorder, passCode.getSerialNo());
        return gugongorder.getJSON();
      }
    }

    return null;
  }