LideaLogDAO { public LideaLogResp get(LideaLogReq req) { log.info("req : {}", JSON.toJSONString(req)); LideaLogResp resp = new LideaLogResp(); resp.setAppName(req.getAppName()); resp.setServiceName(req.getServiceName()); resp.setMethodName(req.getMethodName()); List<LideaLogBO> data = hbaseTemplate.execute(Const.LIDEA_LOG_TABLE, (table) -> { String base = StringUtil.format("{}{}{}", req.getAppName(), req.getServiceName(), req.getMethodName()); byte[] rowKey = LideaLogEntry.makeRowKey(MD5Util.encrypt(base), req.getFrom()); Get get = new Get(rowKey); Result result = table.get(get); LideaLogBO bo = LideaLogResultsExtractor.map(result); return Collections.singletonList(bo); }); resp.setData(data); return resp; }  void put(LideaLogBO bo); LideaLogResp scan(LideaLogReq req); LideaLogResp get(LideaLogReq req);  }
@Test public void testGet() { LideaLogReq req = new LideaLogReq(); req.setAppName("cabinet-base-server"); req.setServiceName("com.fcbox.edms.terminal.api.CabinetServiceFacade"); req.setMethodName("getCabinetInfo"); req.setFrom(TimeUtil.stringToLong("2019-08-05 14:26:39")); req.setTo(TimeUtil.stringToLong("2019-08-05 14:26:39")); LideaLogResp resp = lideaLogDAO.get(req); System.out.println("=========================================================================================="); System.out.println(JSON.toJSONString(resp)); }
@Test public void testGet1() { LideaLogReq req = new LideaLogReq(); req.setAppName("cabinet-base-server"); req.setServiceName("com.fcbox.edms.terminal.api.CabinetServiceFacade"); req.setMethodName("getCabinetInfo"); System.out.println(TimeUtil.timestampToString(1565266170000L, TimeUtil.yyyyMMddHHmmssSSS)); req.setFrom(1565266170000L); req.setTo(1565266170000L); LideaLogResp resp = lideaLogDAO.get(req); System.out.println("=========================================================================================="); System.out.println(JSON.toJSONString(resp)); }