public Map<Date, Integer> findAppHostCount(int appId, Integer[] keyIds, Date start, Date end) { Map<Date, Integer> map = new HashMap<Date, Integer>(); for (Integer keyId : keyIds) { List<KeyValuePo> list = dao.findMonitorCountByDate(appId, keyId, start, end); for (KeyValuePo po : list) { Integer n = map.get(po.getCollectTime()); if (n == null) { map.put(po.getCollectTime(), Integer.parseInt(po.getValueStr())); } else { map.put(po.getCollectTime(), n + Integer.parseInt(po.getValueStr())); } } } return map; }
/** * 查询统计表中时间段内的数据 * * @param appId * @param keyId * @param startDate * @param endDate * @return */ public List<KeyValuePo> findMonitorCountByDate( int appId, int keyId, Date startDate, Date endDate) { return dao.findMonitorCountByDate(appId, keyId, startDate, endDate); }