private BugReport queryHourlyReportsByDuration(String name, String domain, Date start, Date end) { long startTime = start.getTime(); long endTime = end.getTime(); BugReportMerger merger = new BugReportMerger(new BugReport(domain)); for (; startTime < endTime; startTime = startTime + TimeUtil.ONE_HOUR) { Date date = new Date(startTime); BugReport reportModel = m_reportService.queryBugReport( domain, date, new Date(date.getTime() + TimeUtil.ONE_HOUR)); reportModel.accept(merger); } com.dianping.cat.home.bug.entity.BugReport bugReport = merger.getBugReport(); return bugReport; }
private BugReport queryDailyReportsByDuration(String domain, Date start, Date end) { long startTime = start.getTime(); long endTime = end.getTime(); HistoryBugReportMerger merger = new HistoryBugReportMerger(new BugReport(domain)); for (; startTime < endTime; startTime += TimeUtil.ONE_DAY) { try { BugReport reportModel = m_reportService.queryBugReport( domain, new Date(startTime), new Date(startTime + TimeUtil.ONE_DAY)); reportModel.accept(merger); } catch (Exception e) { Cat.logError(e); } } BugReport bugReport = merger.getBugReport(); bugReport.setStartTime(start); bugReport.setEndTime(end); return bugReport; }