Esempio n. 1
0
  /**
   * Frame 跳转专用
   *
   * @param mapping
   * @param form
   * @param request
   * @param response
   * @return
   * @throws Exception
   */
  public ActionForward alertRuleFwd(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {
    String alertId = request.getParameter("alertId");

    try {
      init();
      if (alertId != null && (!alertId.equals(""))) {
        AlertInfoBO alertInfobo = alertService.getByIdAlertService(Integer.parseInt(alertId));
        if (alertInfobo != null) {
          request.setAttribute("alertInfobo", alertInfobo);
          String fusion = alertInfobo.getFusioin();
          int fusionCount = 0;
          List fustionTimeList = new ArrayList();
          if (fusion != null && fusion.trim().length() > 0) {
            String strs[] = fusion.split(",");
            if (strs != null && strs.length > 0) {
              fusionCount = strs.length;
              for (String string : strs) {
                fustionTimeList.add(string);
              }
            }
          }
          request.setAttribute("fusionCount", fusionCount);
          request.setAttribute("fustionTimeAll", fustionTimeList);
          if (alertInfobo.getStatus() != null && alertInfobo.getStatus() == 1) {
            // 如果状态是未读  就更新状态为只读
            alertInfobo.setStatus(0);
            alertService.updateAlertService(alertInfobo);
          }
          if (alertInfobo.getIfnew() != null && alertInfobo.getIfnew() == 1) {
            alertInfobo.setIfnew(0);
            alertService.updateAlertService(alertInfobo);
          }
          if (alertInfobo != null && alertInfobo.getDomain_id() != null) {
            Integer domain_id = alertInfobo.getDomain_id();
            Domain domain = domainService.findById(domain_id);
            request.setAttribute("department", domain);
          }
          // 触发规则列表
          List alertRuleList = new ArrayList();
          if (alertInfobo.getRule() != null && alertInfobo.getRule().trim().length() != 0) {
            String strs[] = alertInfobo.getRule().split(",");
            for (int i = 0; i < strs.length; i++) {
              AlertRuleBO rule =
                  alertRuleService.getByIdAlertRuleService(Integer.parseInt(strs[i]));
              alertRuleList.add(rule);
            }
          }
          request.setAttribute("alertruleList", alertRuleList);
        }
      }
      log.setUsername(username);
      log.setRoleName(rolenames);
      log.setTime(new Timestamp(new Date().getTime()));
      log.setModuleName(SystemModelInfo.MOD_AIM);
      log.setOperationDesc("查询告警类型信息详情");
      log.setControl("成功");
      systemlogService.saveSystemLog(log);
      return mapping.findForward("alertLinkage");
    } catch (Exception e) {
      log.setUsername(username);
      log.setRoleName(rolenames);
      log.setTime(new Timestamp(new Date().getTime()));
      log.setModuleName(SystemModelInfo.MOD_AIM);
      log.setOperationDesc("查询告警类型信息详情");
      log.setControl("失败");
      systemlogService.saveSystemLog(log);
      return null;
    }
  }
Esempio n. 2
0
  /**
   * 多条件查询告警信息 并且分页显示
   *
   * @param mapping
   * @param form
   * @param request
   * @param response
   * @return
   * @throws Exception
   */
  public ActionForward getListPageAlertAction(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {
    AlertForm alertForm = (AlertForm) form;
    HttpSession session = request.getSession();
    Page page = new Page();
    request.setAttribute("alertinfoQuery", alertForm.getAlertquer());
    try {
      init();
      log.setUsername(username);
      log.setRoleName(rolenames);
      log.setTime(new Timestamp(new Date().getTime()));
      log.setModuleName(SystemModelInfo.MOD_AIM);
      log.setOperationDesc("多条件查询告警信息 并且分页显示");
      log.setControl("成功");
      systemlogService.saveSystemLog(log);
      // 根据类型查找子类型
      List<AlertTypeBO> subTypeList = new ArrayList();
      if (alertForm.getAlertquer().getAlertType() != null
          && alertForm.getAlertquer().getAlertType().trim().length() > 0) {
        subTypeList =
            alertDwrService.getSubTypeByNameService(alertForm.getAlertquer().getAlertType());
      }
      request.setAttribute("subTypeList", subTypeList);

      // 获得当前页
      String curpage =
          request.getParameter("curpage") != null && (!request.getParameter("curpage").equals(""))
              ? request.getParameter("curpage")
              : "1";
      if (request.getParameter("pageSize") != null
          && (!request.getParameter("pageSize").equals(""))) {
        int pagesize = Integer.parseInt(request.getParameter("pageSize"));
        request.setAttribute("pageSize", request.getParameter("pageSize"));
        page.setEveryPage(pagesize);
      } else {
        page.setEveryPage(10);
      }
      // 如果第一次进来就初始化条件为NULL

      if (request.getParameter("first") != null) {
        alertForm.setAlertquer(new AlertQueryVO());
        request.setAttribute("subTypeList", null);
        request.setAttribute("alertinfoQuery", null);
      }
      // 设置当前页跟开始位置
      page.setCurrentPage(Integer.parseInt(curpage));
      page.setBeginIndex((page.getCurrentPage() - 1) * page.getEveryPage());
      OperatorDetails user = SecurityUserHolder.getCurrentUser();
      if (user.getUsername().equals("admin")) {
        PageResult result = alertService.getListPageAlertService(page, alertForm.getAlertquer());
        request.setAttribute("page", result.getPage());
        request.setAttribute("list", result.getPageList());
      } else {
        List<Domain> listDomain = user.getDomainList();
        PageResult result =
            alertService.getListPageAlertService(page, alertForm.getAlertquer(), listDomain);
        if (result != null) {
          request.setAttribute("page", result.getPage());
          request.setAttribute("list", result.getPageList());
        }
      }
      // 告警浏览
      if (request.getParameter("home") != null && request.getParameter("home").trim().equals("1")) {
        AlertFusionRuleBO alertFusionRuleBO = alertFusionRuleServices.getAlertFusionRuleServices();
        request.setAttribute("alertFusionRuleBO", alertFusionRuleBO);
        session.setAttribute("topcss", "alertIndex");
        return mapping.findForward("alertHome");
      }
      // 弹出告警监控 小窗口
      if (request.getParameter("MinWindow") != null) {
        if (request.getSession().getAttribute("altypeList") == null) {
          this.getListAlertType(mapping, alertForm, request, response);
        }
        AlertFusionRuleBO alertFusionRuleBO = alertFusionRuleServices.getAlertFusionRuleServices();
        request.setAttribute("alertFusionRuleBO", alertFusionRuleBO);
        request.setAttribute("monitorTime", new Timestamp(System.currentTimeMillis()));
        return mapping.findForward("AlertMinWindow");
      }
      session.setAttribute("topcss", "alertIndex");
      return mapping.findForward("alertIndex");
    } catch (Exception e) {
      log.setUsername(username);
      log.setRoleName(rolenames);
      log.setTime(new Timestamp(new Date().getTime()));
      log.setModuleName(SystemModelInfo.MOD_AIM);
      log.setOperationDesc("多条件查询告警信息 并且分页显示");
      log.setControl("失败");
      systemlogService.saveSystemLog(log);
      return null;
    }
  }