/**
   * 物理读
   *
   * @param dbId
   * @param beginTime
   * @param endTime
   * @param sqlId
   * @param request
   * @param response
   * @return
   */
  @RequestMapping(
      value = "/data/diskread/{dbId}/{beginTime}/{endTime}/{sqlId}",
      method = RequestMethod.GET)
  public @ResponseBody MultipleGeneralReportDataBO diskRead(
      @PathVariable("dbId") String dbId,
      @PathVariable("beginTime") String beginTime,
      @PathVariable("endTime") String endTime,
      @PathVariable("sqlId") String sqlId,
      HttpServletRequest request,
      HttpServletResponse response) {

    DbConfigDomain dbConfigDomain = dbConfigDAO.getDataBaseConfig(dbId);

    MultipleGeneralReportDataBO dto =
        oracleHisSQLStatManager.listSQLStatReportData(
            beginTime,
            endTime,
            new String[] {
              SQLStatTypeEnum.disk_reads_total.getKey(), SQLStatTypeEnum.disk_reads_seconds.getKey()
            },
            dbConfigDomain.getOraDataBaseId(),
            dbConfigDomain.getOraInstanceId(),
            sqlId);

    dto.setReportName(
        String.format("%s[%s],物理读", dbConfigDomain.getDbName(), dbConfigDomain.getIpAddr()));

    return dto;
  }
  /**
   * MySQL的调度任务
   *
   * @param serverId
   * @return
   */
  private List<QuartzScheduleJobBO> getMySQLSchedule(String serverId) {
    List<QuartzScheduleJobBO> jobs = new ArrayList<QuartzScheduleJobBO>();
    List<DbConfigDomain> dbList =
        dbConfigDAO.listDbConfigByServerId(serverId, SysTypeEnum.MySQL.getVal().toString());
    for (DbConfigDomain domain : dbList) {
      List<DeamonScheduleconfigDomain> list =
          deamonScheduleconfigDAO.listDeamonScheduleconfigByMonitorId(
              domain.getDbId(), SysTypeEnum.MySQL.getVal());

      if (list != null && list.size() > 0) {
        for (DeamonScheduleconfigDomain scheduleDomain : list) {
          QuartzScheduleJobBO bo = convertConfigToScheduleJob(scheduleDomain);
          if (bo == null) continue;
          jobs.add(bo);
        }
      }
    }
    return jobs;
  }
  @RequestMapping(value = "/view", method = RequestMethod.GET)
  public ModelAndView mysqlQuota(HttpServletRequest request, HttpServletResponse response) {

    ModelAndView model = new ModelAndView();
    String dbId = request.getParameter("dbId");
    String sqlID = request.getParameter("sqlid");
    String sampleTime = request.getParameter("sampletime");

    if (StringUtils.isNotBlank(dbId)
        && StringUtils.isNotBlank(sqlID)
        && StringUtils.isNotBlank(sampleTime)) {
      model.addObject("sqlId", sqlID);
      model.addObject("dbId", dbId);

      String beginTime =
          DateUtils.addDate(DateUtils.StringToDate(sampleTime, "yyyy-MM-dd HH:mm:ss"), -1);
      String endTime =
          DateUtils.addDate(DateUtils.StringToDate(sampleTime, "yyyy-MM-dd HH:mm:ss"), 1);

      String now = DateUtils.getCurrentDateTime();
      if (DateUtils.compareDate(endTime, now) > 0) {
        endTime = now;
      }

      DbConfigDomain dbConfigDomain = dbConfigDAO.getDataBaseConfig(dbId);
      Long dataBaseId = dbConfigDomain.getOraDataBaseId();
      Long instanceId = dbConfigDomain.getOraInstanceId();

      if (dataBaseId != null && instanceId != null) {
        String sqlText = oraclePerformanceStatManager.getSqlText(sqlID, dataBaseId, instanceId);
        model.addObject("sqlText", sqlText);
      }

      model.addObject("beginTime", beginTime);
      model.addObject("endTime", endTime);
    }

    model.setViewName(QUOTA_REPORT_VIEWS);
    return model;
  }
  private List<QuartzScheduleJobBO> getAllDbSchedule(Integer dbType) {
    List<QuartzScheduleJobBO> jobs = new ArrayList<QuartzScheduleJobBO>();
    List<DbConfigDomain> dbList = dbConfigDAO.listNormalDbConfig(dbType);
    for (DbConfigDomain domain : dbList) {
      List<DeamonScheduleconfigDomain> list =
          deamonScheduleconfigDAO.listDbTypeDeamonScheduleconfig(domain.getDbId(), dbType);

      if (list != null && list.size() > 0) {
        for (DeamonScheduleconfigDomain scheduleDomain : list) {
          QuartzScheduleJobBO bo = convertConfigToScheduleJob(scheduleDomain);

          if (bo == null) continue;

          bo.setJobStatus(String.valueOf(scheduleDomain.getStatus()));
          bo.setServerId(domain.getServerId());
          bo.setPort(domain.getPort());
          bo.setIpAddr(domain.getIpAddr());

          jobs.add(bo);
        }
      }
    }
    return jobs;
  }