@Override
  //	public void insertFlow(SendFlowCondition condition) {
  //		//查出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);
  //
  //
  //
  //
  //		logger.info("[开始查询payCups渠道流水...]");
  //		if(0 == countTimeCups){
  //			insertPayCups(null);
  //		}
  //		//分页查询
  //		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("[开始查询payUpmp渠道流水...]");
  //		//查出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(0 == countTimeCups){
  //			insertPayUpmp(null);
  //		}
  //		//分页查询
  //		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("[流水同步完毕...]");
  //	}
  /** 分页查询PayCups表 */
  public List<SendFlow> insertPayCups(List<PayCups> payCupsList) {
    List<SendFlow> flowList = new LinkedList<SendFlow>();
    for (PayCups payCups : payCupsList) {
      SendFlow sendFlow = new SendFlow();
      String transCode = null;
      // 交易类型判断
      switch (payCups.getTransType()) {
        case 1:
          transCode = "S00"; // 签到
          break;
        case 2:
          transCode = "S22"; // 消费
          break;
        case 3:
          transCode = "V52"; // 消费撤销
          break;
        case 4:
          transCode = "R22"; // 消费冲正
          break;
        case 5:
          transCode = "R22"; // 撤销冲正
          break;
        case 6:
          transCode = "S00"; // 余额查询
          break;
        case 7:
          transCode = "S22"; // 北京渠道-转账
          break;
        case 8:
          transCode = "V52"; // 北京渠道-转账撤销
          break;
        case 9:
          transCode = "S00"; // 生活服务-余额查询
          break;
        case 10:
          transCode = "S22"; // 生活服务-卡卡转账
          break;
        case 11:
          transCode = "S22"; // 生活服务-信用卡还款
          break;
        case 12:
          transCode = "S22"; // 生活服务-手机充值
          break;
        case 13:
          transCode = "I00"; // IC卡脚本上送
          break;
        case 14:
          transCode = "E23"; // 退货
          break;
        default:
          break;
      }
      sendFlow.setPayNo(payCups.getPayNo()); // 本地增值流水ID
      sendFlow.setAccountNo(payCups.getCardNo()); // 主账号2
      sendFlow.setProcessCode(payCups.getProcessCode()); // 交易处理码3
      sendFlow.setAmount(payCups.getTransAmt()); // 交易金额4
      if ("S22".equals(transCode) || "V52".equals(transCode) || "S00".equals(transCode)) {
        // 消费、撤销、查询、生活服务0200
        sendFlow.setMsgType("0200");
      }
      if ("R22".equals(transCode)) {
        // 冲正交易送0400
        sendFlow.setMsgType("0400");
      }
      if ("I00".equals(transCode)) {
        // IC卡脚本上送 0620
        sendFlow.setMsgType("0620");
      }
      if ("E23".equals(transCode)) {
        // 退货送0220
        sendFlow.setMsgType("0220");
      }
      // 消息类型
      sendFlow.setSystraceNo(payCups.getTrmnlFlowNo()); // 受卡方系统跟踪号11
      sendFlow.setTransDate(payCups.getTransDate()); // 受卡方所在地日期13
      sendFlow.setTransTime(payCups.getTransTime()); // 受卡方所在地时间12
      sendFlow.setSettleDate(payCups.getSettlementDate()); // 清算日期15
      sendFlow.setEntryMode(payCups.getPosEntryMode()); // 服务点输入方式码 22
      sendFlow.setCardSeq(payCups.getCardSeqNum()); // 服务点输入方式码 23
      sendFlow.setPointOfService(payCups.getServiceCode()); // 服务点条件码 25
      sendFlow.setAcqOrgId(payCups.getAcquiringCode()); // 受理机构标识码32
      sendFlow.setReferCode(payCups.getTrmnlReferNo()); // 检索参考号37
      sendFlow.setAuthCode(payCups.getAuthCode()); // 授权标识应答码 38
      sendFlow.setRespCode(payCups.getRespCode()); // 应答码 39
      sendFlow.setTermId(payCups.getTrmnlNo()); // 受卡机终端标识码 41
      sendFlow.setTermIdt(payCups.getTrmnlMrchNo()); // 受卡方标识码 42
      sendFlow.setAddRespData(payCups.getAdditionalRespcode044()); // 附加响应数据 44
      sendFlow.setAddData(payCups.getSelfdefined048()); // 附加数据-私有 48
      sendFlow.setCurCode(payCups.getCurrency()); // 交易货币代码 49
      sendFlow.setSafeCtrlInfo(payCups.getSecurityInfo()); // 安全控制信息 53
      sendFlow.setIcData(payCups.getIcData()); // IC卡数据域 55
      sendFlow.setReservedPrivate1(payCups.getSelfDefined060()); // 自定义域1 60
      sendFlow.setOrgMessage(payCups.getSelfDefined061()); // 原始信息域 61
      sendFlow.setReservedPrivate2(payCups.getSelfDefined062()); // 自定义域2 62
      sendFlow.setReservedPrivate3(payCups.getSelfDefined063()); // 自定义域3 63
      sendFlow.setTransCode(transCode); // 交易代码
      sendFlow.setMcc(payCups.getTrmnlMrchNo().substring(7, 11)); // 商户类型(MCC码)

      CardBin cardBin = null;
      String cardType = null;
      // 卡bin非空
      if (null != (payCups.getCardNo())
          && !("".equals((payCups.getCardNo())))
          && (payCups.getCardNo()).length() > 6) {
        cardBin = cardBinService.findByCardNo((payCups.getCardNo()));
      }
      if (null != cardBin) {
        cardType = cardBin.getCardType();
        sendFlow.setCardType(cardType); // 卡性质
      }
      sendFlow.setBrancStructure("100200"); // 所属分支结构(江苏)
      String acqCode = payCups.getAcquiringCode(); // 受理机构标识码
      String mercInstitution = null;
      if (null != acqCode) {
        acqCode = acqCode.trim();
      }
      // 根据受理机构标识码判断商户所属机构
      if ("48023010".equals(acqCode)) {
        mercInstitution = "100200"; // 南京
      }
      if ("48023070".equals(acqCode)) {
        mercInstitution = "100201"; // 连云港
      }
      if ("48023140".equals(acqCode)) {
        mercInstitution = "100202"; // 镇江
      }
      if ("48023110".equals(acqCode)) {
        mercInstitution = "100203"; // 盐城
      }
      if ("48023060".equals(acqCode)) {
        mercInstitution = "100204"; // 南通
      }
      if ("48023050".equals(acqCode)) {
        mercInstitution = "100205"; // 苏州
      }
      if ("48023020".equals(acqCode)) {
        mercInstitution = "100206"; // 无锡
      }
      if ("48023040".equals(acqCode)) {
        mercInstitution = "100207"; // 常州
      }
      if ("48023120".equals(acqCode)) {
        mercInstitution = "100208"; // 扬州
      }
      if ("48023160".equals(acqCode)) {
        mercInstitution = "100209"; // 泰州
      }
      if ("48023030".equals(acqCode)) {
        mercInstitution = "100210"; // 徐州
      }
      if ("48023080".equals(acqCode)) {
        mercInstitution = "100211"; // 淮安
      }
      if ("48023180".equals(acqCode)) {
        mercInstitution = "100212"; // 宿迁
      }
      sendFlow.setMercInstitution(mercInstitution); // 商户所属机构
      if (!"S22".equals(transCode)) {
        sendFlow.setOrgAmount(payCups.getTransAmt()); // 原始交易金额送交易金额
      }
      // 前置渠道 &支付通道
      String channel = payCups.getSubChannel().trim();

      sendFlow.setLeadChannel(channel); // 前置渠道
      sendFlow.setPaymentChannel(channel); // 支付通道

      // 业务类型&产品编码&统一后业务类型
      String serviceType = "";
      String productCoding = "";
      String finalServiceType = "";
      if ((2 == (payCups.getTransType())) && "ulinkTraditon".equals(channel)) {
        // upmp收单
        serviceType = "5A02";
        productCoding = "5A02";
        finalServiceType = "02";
      }
      if ((2 == (payCups.getTransType())) && "ULINKPLUS".equals(channel)) {
        // 总部T+0转账
        serviceType = "5053";
        productCoding = "5053";
        finalServiceType = "53";
      }
      if ((2 == (payCups.getTransType())) && "jsumsPayCups".equals(channel)) {
        // cups银联二代收单
        serviceType = "5A02";
        productCoding = "5A02";
        finalServiceType = "02";
      }
      if ((2 == (payCups.getTransType()) || 7 == (payCups.getTransType()))
          && "bjumsPayCups".equals(channel)) {
        // 北京渠道收单
        serviceType = "5A02";
        productCoding = "5A02";
        finalServiceType = "02";
      }

      if ((10 == (payCups.getTransType())) && "ULINKPLUS".equals(channel)) {
        // 生活服务卡卡转账(总公司T+0)
        serviceType = "5025";
        productCoding = "5025";
        finalServiceType = "25";
      }
      if ((11 == (payCups.getTransType())) && "ULINKPLUS".equals(channel)) {
        // 生活服务信用卡还款(总公司T+0)
        serviceType = "5022";
        productCoding = "5022";
        finalServiceType = "22";
      }
      if ((12 == (payCups.getTransType())) && "ULINKPLUS".equals(channel)) {
        // 生活服务手机充值(总公司T+0)
        serviceType = "5830";
        productCoding = "5830";
        finalServiceType = "30";
      }
      if ((3 == (payCups.getTransType()) || 14 == (payCups.getTransType()))) {
        // 撤销与退货类的交易算收单交易
        // 北京渠道收单
        serviceType = "5A02";
        productCoding = "5A02";
        finalServiceType = "02";
      }
      sendFlow.setServiceType(serviceType); // 业务类型
      sendFlow.setProductCoding(productCoding); // 产品编码
      sendFlow.setFinalServiceType(finalServiceType); // 统一后业务类型
      sendFlow.setAccpMercNo(payCups.getTrmnlMrchNo()); // 受理点商户编号
      sendFlow.setAccpTermNo(payCups.getTrmnlNo()); // 受理点终端编号
      sendFlow.setInitTerm("11"); // 发起终端(移动pos)
      sendFlow.setTransOccrrenceTime(payCups.getCreTime()); // 交易发生时间
      sendFlow.setCreTime(new Date()); // 获得创建日期
      // 放入List
      flowList.add(sendFlow);
    }
    return flowList;
  }
  /**
   * 分页查询PayUpmp表
   *
   * @return
   */
  public List<SendFlow> insertPayUpmp(List<PayUpmp> payUpmpList) {
    List<SendFlow> flowList = new LinkedList<SendFlow>();
    for (PayUpmp payUpmp : payUpmpList) {
      SendFlow sendFlow = new SendFlow();
      String transCode = null;
      // 交易类型判断
      switch ((payUpmp.getTransType())) {
        case 1:
          transCode = "S00"; // 签到
          break;
        case 2:
          transCode = "S22"; // 消费
          break;
        case 3:
          transCode = "V52"; // 消费撤销
          break;
        case 4:
          transCode = "R22"; // 消费冲正
          break;
        case 5:
          transCode = "R22"; // 撤销冲正
          break;
        case 6:
          transCode = "S00"; // 余额查询
          break;
        case 7:
          transCode = "S22"; // 北京渠道-转账
          break;
        case 8:
          transCode = "V52"; // 北京渠道-转账撤销
          break;
        case 9:
          transCode = "S00"; // 生活服务-余额查询
          break;
        case 10:
          transCode = "S22"; // 生活服务-卡卡转账
          break;
        case 11:
          transCode = "S22"; // 生活服务-信用卡还款
          break;
        case 12:
          transCode = "S22"; // 生活服务-手机充值
          break;
        case 13:
          transCode = "I00"; // IC卡脚本上送
          break;
        case 14:
          transCode = "E23"; // 退货
          break;
        default:
          break;
      }
      sendFlow.setPayNo(payUpmp.getPayNo()); // 本地增值流水ID
      sendFlow.setAccountNo(payUpmp.getCardNo()); // 主账号 2
      sendFlow.setAmount(payUpmp.getTransAmt()); // 交易金额 4
      if ("S22".equals(transCode) || "V52".equals(transCode) || "S00".equals(transCode)) {
        // 消费、撤销、查询、生活服务0200
        sendFlow.setMsgType("0200");
      }
      if ("R22".equals(transCode)) {
        // 冲正交易送0400
        sendFlow.setMsgType("0400");
      }
      if ("I00".equals(transCode)) {
        // IC卡脚本上送 0620
        sendFlow.setMsgType("0620");
      }
      if ("E23".equals(transCode)) {
        // 退货送0220
        sendFlow.setMsgType("0220");
      }
      // 消息类型
      sendFlow.setSettleDate(payUpmp.getSettlementDate()); // 清算日期 15
      sendFlow.setAcqOrgId(payUpmp.getAcqCode()); // 受理机构标识码 32
      sendFlow.setRespCode(payUpmp.getRespCode()); // 应答码 39
      /*List<CupsTrmnl> cupsTrmnlList = cupsTrmnlService.findByMrchNo(payUpmp.getMrchNo());
      if(null != cupsTrmnlList){
      	sendFlow.setTermId(cupsTrmnlList.get(0).getTrmnlNo());//终端编号 41
      }*/
      sendFlow.setTermId("01080209");
      sendFlow.setTermIdt(payUpmp.getMrchNo()); // 受卡方标识码 42 (商户编号)
      sendFlow.setTransCode(transCode); // 交易代码
      sendFlow.setMcc(payUpmp.getMrchNo().substring(7, 11)); // 商户类型(MCC码)

      CardBin cardBin = null;
      String cardType = null;
      if (null != (payUpmp.getCardNo())
          && !("".equals((payUpmp.getCardNo())) && payUpmp.getCardNo().length() > 6)) {
        cardBin = cardBinService.findByCardNo((payUpmp.getCardNo()));
      }
      if (null != cardBin) {
        cardType = cardBin.getCardType();
        sendFlow.setCardType(cardType); // 卡性质
      }

      sendFlow.setBrancStructure("100200"); // 所属分支结构(江苏)
      String acqCode = payUpmp.getAcqCode(); // 受理机构标识码
      String mercInstitution = null;
      if (null != acqCode) {
        acqCode = acqCode.trim();
      }
      // 根据受理机构标识码判断商户所属机构
      if ("48023010".equals(acqCode)) {
        mercInstitution = "100200"; // 南京
      }
      if ("48023070".equals(acqCode)) {
        mercInstitution = "100201"; // 连云港
      }
      if ("48023140".equals(acqCode)) {
        mercInstitution = "100202"; // 镇江
      }
      if ("48023110".equals(acqCode)) {
        mercInstitution = "100203"; // 盐城
      }
      if ("48023060".equals(acqCode)) {
        mercInstitution = "100204"; // 南通
      }
      if ("48023050".equals(acqCode)) {
        mercInstitution = "100205"; // 苏州
      }
      if ("48023020".equals(acqCode)) {
        mercInstitution = "100206"; // 无锡
      }
      if ("48023040".equals(acqCode)) {
        mercInstitution = "100207"; // 常州
      }
      if ("48023120".equals(acqCode)) {
        mercInstitution = "100208"; // 扬州
      }
      if ("48023160".equals(acqCode)) {
        mercInstitution = "100209"; // 泰州
      }
      if ("48023030".equals(acqCode)) {
        mercInstitution = "100210"; // 徐州
      }
      if ("48023080".equals(acqCode)) {
        mercInstitution = "100211"; // 淮安
      }
      if ("48023180".equals(acqCode)) {
        mercInstitution = "100212"; // 宿迁
      }
      sendFlow.setMercInstitution(mercInstitution); // 商户所属机构
      if (!"S22".equals(transCode)) {
        // 冲正类交易
        sendFlow.setOrgAmount(payUpmp.getTransAmt()); // 原始交易金额送交易金额
      }

      sendFlow.setLeadChannel("ulinkTraditon"); // 前置渠道默认upmp
      sendFlow.setPaymentChannel("ulinkTraditon"); // 支付通道默认upmp

      // 业务类型&产品编码&统一后业务类型
      String serviceType = null;
      String productCoding = null;
      String finalServiceType = null;
      if (2 == (payUpmp.getTransType())) {
        // upmp收单
        serviceType = "5A02";
        productCoding = "5A02";
        finalServiceType = "02";
      }
      sendFlow.setServiceType(serviceType); // 业务类型
      sendFlow.setProductCoding(productCoding); // 产品编码
      sendFlow.setFinalServiceType(finalServiceType); // 统一后业务类型
      List<CupsTrmnl> cupsTrmnlList = cupsTrmnlService.findByMrchNo(payUpmp.getMrchNo());
      if (null != cupsTrmnlList) {
        sendFlow.setAccpTermNo(cupsTrmnlList.get(0).getTrmnlNo()); // 受理点终端编号
      }
      sendFlow.setAccpMercNo(payUpmp.getMrchNo()); // 受理点商户编号
      sendFlow.setInitTerm("11"); // 发起终端(移动pos)
      sendFlow.setUpmpTransStatus(payUpmp.getTransStatus() + ""); // UPMP交易状态
      sendFlow.setTransOccrrenceTime(payUpmp.getCreTime()); // 交易发生时间
      sendFlow.setCreTime(new Date()); // 获得创建日期
      // 放入List
      flowList.add(sendFlow);
    }
    return flowList;
  }