@Override
 public CCPCBankResponsePage queryCCPCBank(
     CCPCBankCondition condition, int startIndex, int pageSize) {
   CCPCBankResponsePage ccpcBankResponsePage = new CCPCBankResponsePage();
   ccpcBankResponsePage.setStartIndex(startIndex + "");
   ccpcBankResponsePage.setPageSize(pageSize + "");
   Page<CCPCBank> pages = ccpcBankService.queryCCPCBank(condition, startIndex, pageSize);
   List<CCPCBankResponse> lists = new ArrayList<CCPCBankResponse>();
   SysParaConfig sysParaConfig = sysParaConfigService.findValueByKey("BANK_UPD_TIME");
   if (pages != null && pages.getTotalCount() > 0) {
     List<CCPCBank> ccpcBanks = pages.getItems();
     for (CCPCBank temp : ccpcBanks) {
       // lists.add(new CCPCBankResponse(temp.getCnaps(), temp.getBankName()));
       lists.add(new CCPCBankResponse(temp));
     }
     ccpcBankResponsePage.setTotalSize(pages.getTotalCount() + "");
     if (sysParaConfig != null) {
       ccpcBankResponsePage.setServerBankUpdTime(sysParaConfig.getValue());
     }
     ccpcBankResponsePage.setBankInfos(lists);
   } else {
     ccpcBankResponsePage.setTotalSize("0");
     ccpcBankResponsePage.setBankInfos(lists);
   }
   return ccpcBankResponsePage;
 }
  @Override
  public PayInfoResponsePage queryPayCCPC(
      PayCCPCCondition condition, int startIndex, int pageSize) {
    PayInfoResponsePage payInfoResponsePage = new PayInfoResponsePage();
    payInfoResponsePage.setStartIndex(startIndex + "");
    payInfoResponsePage.setPageSize(pageSize + "");

    Page<PayCCPC> page = payCCPCService.queryPayCCPC(condition, startIndex, pageSize);
    List<PayInfoResponse> payInfos = new ArrayList<PayInfoResponse>();
    if (page != null) {
      BigDecimal totalAmt = payCCPCService.countTotalAmount(condition);
      payInfoResponsePage.setTotalSize(page.getTotalCount() + "");
      payInfoResponsePage.setTotalAmount(totalAmt.toPlainString());
      List<PayCCPC> lists = page.getItems();
      for (PayCCPC temp : lists) {
        payInfos.add(payCCPCToPayInfoResponse(temp));
      }
      payInfoResponsePage.setPayInfos(payInfos);
    } else {
      payInfoResponsePage.setTotalSize("0");
      payInfoResponsePage.setTotalAmount("0.00");
      payInfoResponsePage.setPayInfos(payInfos);
    }
    return payInfoResponsePage;
  }
  @Override
  public void insertUpmpFlow(SendFlowCondition condition) {

    logger.info("[开始将t_pay_upmp 表中的流水写入到t_history表中!]");
    // 查出payupmp表中满足条件的数据
    PayUpmpCondition payUpmpCondition = new PayUpmpCondition();
    payUpmpCondition.setTransBeginDate(condition.getStartDate());
    payUpmpCondition.setTransEndDate(condition.getEndDate());
    payUpmpCondition.setTransType(condition.getTransType());

    Page<PayUpmp> payUpmpPage =
        payUpmpService.queryPayUpmpByCondition(payUpmpCondition, 0, EVERY_PAGE_NUMBER);
    int startIndexUpmp = 0;
    int totalUpmp = payUpmpPage.getTotalCount();
    int countTimeUpmp =
        totalUpmp % EVERY_PAGE_NUMBER > 0
            ? (totalUpmp / EVERY_PAGE_NUMBER) + 1
            : (totalUpmp / EVERY_PAGE_NUMBER);

    if (totalUpmp <= 0) {
      logger.error(
          "[将t_pay_upmp 表中的流水写入到t_history表失败,指定查询周期("
              + condition.getStartDate()
              + ")到("
              + condition.getEndDate()
              + ") t_pay_upmp表 中无流水记录!]");
      return;
    }
    // 分页查询
    for (int i = 0; i < countTimeUpmp; i++) {
      List<PayUpmp> payUpmpList = new ArrayList<PayUpmp>();
      List<SendFlow> flowList = new LinkedList<SendFlow>();
      payUpmpList =
          payUpmpService
              .queryPayUpmpByCondition(payUpmpCondition, startIndexUpmp, EVERY_PAGE_NUMBER)
              .getItems();
      flowList = insertPayUpmp(payUpmpList);
      startIndexUpmp = startIndexUpmp + EVERY_PAGE_NUMBER;
      sendFlowDao.saveAll(flowList);
      logger.info("[payUpmp分页第" + (i + 1) + "页同步完成...]");
    }
    logger.info("[将t_pay_upmp 表中的流水写入到t_history表完成!]");
  }
  @Override
  public void insertPayCupsFlow(SendFlowCondition condition) {

    logger.info("[开始将t_pay_cups 表中的流水写入到t_history表中!]");
    // 查出paycup表中满足条件的数据
    PayCupsCondition payCupsCondition = new PayCupsCondition();
    payCupsCondition.setBeginDate(condition.getStartDate());
    payCupsCondition.setEndDate(condition.getEndDate());
    payCupsCondition.setTransType(condition.getTransType());
    // 分页的参数
    Page<PayCups> payCupsPage =
        payCupsService.queryPayCupsByCondition(payCupsCondition, 0, EVERY_PAGE_NUMBER);
    int startIndexCups = 0;
    int totalCups = payCupsPage.getTotalCount();
    int countTimeCups =
        totalCups % EVERY_PAGE_NUMBER > 0
            ? (totalCups / EVERY_PAGE_NUMBER) + 1
            : (totalCups / EVERY_PAGE_NUMBER);

    if (totalCups <= 0) {
      logger.error(
          "[将t_pay_cups 表中的流水写入到t_history表失败,指定查询周期("
              + condition.getStartDate()
              + ")到("
              + condition.getEndDate()
              + ") t_pay_cups 中无流水记录!]");
      return;
    }
    // 分页查询
    for (int i = 0; i < countTimeCups; i++) {
      List<PayCups> payCupsList = new ArrayList<PayCups>();
      List<SendFlow> flowList = new LinkedList<SendFlow>();
      payCupsList =
          payCupsService
              .queryPayCupsByCondition(payCupsCondition, startIndexCups, EVERY_PAGE_NUMBER)
              .getItems();
      flowList = insertPayCups(payCupsList);
      startIndexCups = startIndexCups + EVERY_PAGE_NUMBER;
      sendFlowDao.saveAll(flowList);
      logger.info("[payCups分页第" + (i + 1) + "页同步完成...]");
    }
    logger.info("[将t_pay_cups 表中的流水写入到t_history表完成!]");
  }
  @Override
  public BeneficiaryAccountResponsePage queryCCPCAccount(
      CCPCAccountCondition condition, int startIndex, int pageSize) {
    BeneficiaryAccountResponsePage bnyAccountResponsePage = new BeneficiaryAccountResponsePage();
    bnyAccountResponsePage.setStartIndex(startIndex + "");
    bnyAccountResponsePage.setPageSize(pageSize + "");

    Page<CCPCAccount> page = cCPCAccountService.queryCCPCAccount(condition, startIndex, pageSize);
    List<BeneficiaryAccountResponse> bnyAccounts = new ArrayList<BeneficiaryAccountResponse>();
    if (page != null) {
      bnyAccountResponsePage.setTotalSize(page.getTotalCount() + "");
      List<CCPCAccount> lists = page.getItems();
      for (CCPCAccount temp : lists) {
        bnyAccounts.add(ccpcAccountToBnyAccountResponse(temp));
      }
      bnyAccountResponsePage.setBnyAccounts(bnyAccounts);
    } else {
      bnyAccountResponsePage.setTotalSize("0");
      bnyAccountResponsePage.setBnyAccounts(bnyAccounts);
    }
    return bnyAccountResponsePage;
  }