Esempio n. 1
0
  public void saveAuthModelList(List<AuthModel> list) {

    try {
      List<Put> putList = new ArrayList<Put>();
      for (AuthModel o : list) {
        String rowKey =
            System.currentTimeMillis()
                + ":"
                + o.getResult()
                + ":"
                + o.getCommaddr()
                + ":"
                + UUID.randomUUID().toString();
        Put put = new Put(Bytes.toBytes(rowKey));
        put.add(
            Bytes.toBytes("info"), Bytes.toBytes(o.getAkey()), Bytes.toBytes(JSON.toJSONString(o)));
        putList.add(put);
      }
      table = HBaseDataSource.getTable("TH_VEHICLE_CHECKED");
      if (table != null) {
        table.put(putList);
      } else {

        table.put(putList);
      }
    } catch (IOException e) {
      log.error("存储异常:" + e.getMessage(), e);
    }
  }
Esempio n. 2
0
  public void saveRegisterModelList(List<RegisterModel> list) {

    try {
      List<Put> putList = new ArrayList<Put>();
      for (RegisterModel o : list) {
        String rowKey =
            System.currentTimeMillis()
                + ":"
                + o.getProvinceId()
                + ":"
                + o.getCityId()
                + ":"
                + UUID.randomUUID().toString();
        Put put = new Put(Bytes.toBytes(rowKey));
        put.add(
            Bytes.toBytes("info"), Bytes.toBytes(o.getTid()), Bytes.toBytes(JSON.toJSONString(o)));
        putList.add(put);
      }

      table = HBaseDataSource.getTable("TH_TERMINAL_REGISTER");
      if (table != null) {
        table.put(putList);
      } else {
        table.put(putList);
      }
    } catch (IOException e) {
      log.error("存储异常:" + e.getMessage(), e);
    }
  }