コード例 #1
0
ファイル: HeavyReportService.java プロジェクト: ZFCISBEST/cat
  @Override
  public HeavyReport queryDailyReport(String domain, Date start, Date end) {
    HeavyReportMerger merger = new HeavyReportMerger(new HeavyReport(domain));
    long startTime = start.getTime();
    long endTime = end.getTime();
    String name = Constants.REPORT_HEAVY;

    for (; startTime < endTime; startTime = startTime + TimeHelper.ONE_DAY) {
      try {
        DailyReport report =
            m_dailyReportDao.findByDomainNamePeriod(
                domain, name, new Date(startTime), DailyReportEntity.READSET_FULL);
        HeavyReport reportModel = queryFromDailyBinary(report.getId(), domain);

        reportModel.accept(merger);
      } catch (DalNotFoundException e) {
        // ignore
      } catch (Exception e) {
        Cat.logError(e);
      }
    }
    HeavyReport heavyReport = merger.getHeavyReport();

    heavyReport.setStartTime(start);
    heavyReport.setEndTime(end);
    return heavyReport;
  }
コード例 #2
0
ファイル: HeavyReportService.java プロジェクト: ZFCISBEST/cat
  @Override
  public HeavyReport queryHourlyReport(String domain, Date start, Date end) {
    HeavyReportMerger merger = new HeavyReportMerger(new HeavyReport(domain));
    long startTime = start.getTime();
    long endTime = end.getTime();
    String name = Constants.REPORT_HEAVY;

    for (; startTime < endTime; startTime = startTime + TimeHelper.ONE_HOUR) {
      List<HourlyReport> reports = null;
      try {
        reports =
            m_hourlyReportDao.findAllByDomainNamePeriod(
                new Date(startTime), domain, name, HourlyReportEntity.READSET_FULL);
      } catch (DalException e) {
        Cat.logError(e);
      }
      if (reports != null) {
        for (HourlyReport report : reports) {
          try {
            HeavyReport reportModel = queryFromHourlyBinary(report.getId(), domain);
            reportModel.accept(merger);
          } catch (DalNotFoundException e) {
            // ignore
          } catch (Exception e) {
            Cat.logError(e);
          }
        }
      }
    }
    HeavyReport heavyReport = merger.getHeavyReport();

    heavyReport.setStartTime(start);
    heavyReport.setEndTime(new Date(end.getTime() - 1));

    return heavyReport;
  }