diff --git a/src/main/java/com/nis/domain/report/NtcEventKeyProtectionReport.java b/src/main/java/com/nis/domain/report/NtcEventKeyProtectionReport.java new file mode 100644 index 000000000..d0f6d30dd --- /dev/null +++ b/src/main/java/com/nis/domain/report/NtcEventKeyProtectionReport.java @@ -0,0 +1,153 @@ +package com.nis.domain.report; + +import java.util.Date; + +import com.nis.util.excel.ExcelField; + +/** + * 重点保障事件实体对象 + * + * @author A.Chen + * + */ +public class NtcEventKeyProtectionReport { + + /** + * + */ + + @ExcelField(title = "task_id", sort = 1) + private String taskId; + + @ExcelField(title = "task_name", sort = 2) + private String taskName; + + @ExcelField(title = "letter_num", sort = 3) + private long letterNum; + + @ExcelField(title = "config_num", sort = 4) + private long configNum; + + @ExcelField(title = "monitor_num", sort = 5) + private long monitorNum; + + @ExcelField(title = "control_num", sort = 6) + private long controlNum; + + @ExcelField(title = "task_time", sort = 7) + private String taskTime; + + @ExcelField(title = "stat_time", sort = 8) + private String reportTime; + + private String searchReportStartTime; + private String searchReportEndTime; + private String searchTaskStartTime; + private String searchTaskEndTime; + + public String getTaskTime() { + return taskTime; + } + + public void setTaskTime(String taskTime) { + this.taskTime = taskTime; + } + + public String getTaskName() { + return taskName; + } + + public void setTaskName(String taskName) { + this.taskName = taskName; + } + + public long getLetterNum() { + return letterNum; + } + + public void setLetterNum(long letterNum) { + this.letterNum = letterNum; + } + + public long getConfigNum() { + return configNum; + } + + public void setConfigNum(long configNum) { + this.configNum = configNum; + } + + public long getMonitorNum() { + return monitorNum; + } + + public void setMonitorNum(long monitorNum) { + this.monitorNum = monitorNum; + } + + public long getControlNum() { + return controlNum; + } + + public void setControlNum(long controlNum) { + this.controlNum = controlNum; + } + + public String getSearchReportStartTime() { + return searchReportStartTime; + } + + public void setSearchReportStartTime(String searchReportStartTime) { + this.searchReportStartTime = searchReportStartTime; + } + + public String getSearchReportEndTime() { + return searchReportEndTime; + } + + public void setSearchReportEndTime(String searchReportEndTime) { + this.searchReportEndTime = searchReportEndTime; + } + + public String getSearchTaskStartTime() { + return searchTaskStartTime; + } + + public void setSearchTaskStartTime(String searchTaskStartTime) { + this.searchTaskStartTime = searchTaskStartTime; + } + + public String getSearchTaskEndTime() { + return searchTaskEndTime; + } + + public void setSearchTaskEndTime(String searchTaskEndTime) { + this.searchTaskEndTime = searchTaskEndTime; + } + + public String getTaskId() { + return taskId; + } + + public void setTaskId(String taskId) { + this.taskId = taskId; + } + + public String getReportTime() { + return reportTime; + } + + public void setReportTime(String reportTime) { + this.reportTime = reportTime; + } + + @Override + public String toString() { + return "NtcEventKeyProtectionReport [taskTime=" + taskTime + ", taskName=" + taskName + ", letterNum=" + + letterNum + ", configNum=" + configNum + ", monitorNum=" + monitorNum + ", controlNum=" + controlNum + + ", taskId=" + taskId + ", reportTime=" + reportTime + ", searchReportStartTime=" + + searchReportStartTime + ", searchReportEndTime=" + searchReportEndTime + ", searchTaskStartTime=" + + searchTaskStartTime + ", searchTaskEndTime=" + searchTaskEndTime + "]"; + } + +} diff --git a/src/main/java/com/nis/domain/report/NtcEventMonitorOrBlockReport.java b/src/main/java/com/nis/domain/report/NtcEventMonitorOrBlockReport.java new file mode 100644 index 000000000..da989e62e --- /dev/null +++ b/src/main/java/com/nis/domain/report/NtcEventMonitorOrBlockReport.java @@ -0,0 +1,167 @@ +package com.nis.domain.report; + +import com.nis.util.excel.ExcelField; + +/** + * 监测事件和封堵事件实体对象 + * + * @author A.Chen + * + */ +public class NtcEventMonitorOrBlockReport { + @ExcelField(title = "task_time", sort = 8) + private String taskTime;// 审核时间 + + @ExcelField(title = "task_name", sort = 2) + private String taskName;// 事件名称 + + @ExcelField(title = "ip_count", sort = 3) + private long ipNum;// ip数量 + + @ExcelField(title = "http_num", sort = 4) + private long httpNum;// http数量 + + @ExcelField(title = "mail_num", sort = 5) + private long mailNum;// 邮件数量 + + @ExcelField(title = "vedio_count", sort = 6) + private long vedioNum;// 视频次数 + + @ExcelField(title = "agent_count", sort = 7) + private long agentNum;// 代理次数 + + @ExcelField(title = "task_id", sort = 1) + private String taskId;// 审核ID + + @ExcelField(title = "stat_time", sort = 9) + private String reportTime;// 统计时间 + + // + private String searchReportStartTime;// 统计开始时间 + private String searchReportEndTime;// 统计结束时间 + private String searchTaskStartTime;// 审核开始时间 + private String searchTaskEndTime;// 审核结束时间 + private int reportType;// 查询类型 1.封堵 2.监测 + + public String getReportTime() { + return reportTime; + } + + public void setReportTime(String reportTime) { + this.reportTime = reportTime; + } + + public String getTaskTime() { + return taskTime; + } + + public void setTaskTime(String taskTime) { + this.taskTime = taskTime; + } + + public String getTaskName() { + return taskName; + } + + public void setTaskName(String taskName) { + this.taskName = taskName; + } + + public long getIpNum() { + return ipNum; + } + + public void setIpNum(long ipNum) { + this.ipNum = ipNum; + } + + public long getHttpNum() { + return httpNum; + } + + public void setHttpNum(long httpNum) { + this.httpNum = httpNum; + } + + public long getMailNum() { + return mailNum; + } + + public void setMailNum(long mailNum) { + this.mailNum = mailNum; + } + + public long getVedioNum() { + return vedioNum; + } + + public void setVedioNum(long vedioNum) { + this.vedioNum = vedioNum; + } + + public long getAgentNum() { + return agentNum; + } + + public void setAgentNum(long agentNum) { + this.agentNum = agentNum; + } + + public String getSearchReportStartTime() { + return searchReportStartTime; + } + + public void setSearchReportStartTime(String searchReportStartTime) { + this.searchReportStartTime = searchReportStartTime; + } + + public String getSearchReportEndTime() { + return searchReportEndTime; + } + + public void setSearchReportEndTime(String searchReportEndTime) { + this.searchReportEndTime = searchReportEndTime; + } + + public String getSearchTaskStartTime() { + return searchTaskStartTime; + } + + public void setSearchTaskStartTime(String searchTaskStartTime) { + this.searchTaskStartTime = searchTaskStartTime; + } + + public String getSearchTaskEndTime() { + return searchTaskEndTime; + } + + public void setSearchTaskEndTime(String searchTaskEndTime) { + this.searchTaskEndTime = searchTaskEndTime; + } + + public int getReportType() { + return reportType; + } + + public void setReportType(int reportType) { + this.reportType = reportType; + } + + public String getTaskId() { + return taskId; + } + + public void setTaskId(String taskId) { + this.taskId = taskId; + } + + @Override + public String toString() { + return "NtcEventMonitorOrBlockReport [taskTime=" + taskTime + ", taskName=" + taskName + ", ipNum=" + ipNum + + ", httpNum=" + httpNum + ", mailNum=" + mailNum + ", vedioNum=" + vedioNum + ", agentNum=" + agentNum + + ", searchReportStartTime=" + searchReportStartTime + ", searchReportEndTime=" + searchReportEndTime + + ", searchTaskStartTime=" + searchTaskStartTime + ", searchTaskEndTime=" + searchTaskEndTime + + ", reportType=" + reportType + ", taskId=" + taskId + ", reportTime=" + reportTime + "]"; + } + +} diff --git a/src/main/java/com/nis/web/controller/report/NtcEventBlockController.java b/src/main/java/com/nis/web/controller/report/NtcEventBlockController.java new file mode 100644 index 000000000..69f915b74 --- /dev/null +++ b/src/main/java/com/nis/web/controller/report/NtcEventBlockController.java @@ -0,0 +1,228 @@ +package com.nis.web.controller.report; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Properties; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.servlet.mvc.support.RedirectAttributes; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.reflect.TypeToken; +import com.nis.domain.Page; +import com.nis.domain.PageLog; +import com.nis.domain.maat.LogRecvData; +import com.nis.domain.report.NtcEventMonitorOrBlockReport; +import com.nis.util.Constants; +import com.nis.util.httpclient.HttpClientUtil; +import com.nis.web.controller.BaseController; + +@Controller +@RequestMapping("${adminPath}/eventBlock") +public class NtcEventBlockController extends BaseController { + + /** + * EventBlock + * + * @param log + * @param model + * @param request + * @param response + * @return + */ + @RequestMapping(value = { "/eventBlockList", "" }) + public String eventBlockList(@ModelAttribute("log") NtcEventMonitorOrBlockReport log, Model model, + HttpServletRequest request, HttpServletResponse response) { + try { + PageLog page = new PageLog(request, response); + Map params = new HashMap(); + params.put("pageSize", page.getPageSize()); + params.put("pageNo", page.getPageNo()); + + // 判断请求参数 + if (StringUtils.isNotBlank(log.getSearchReportStartTime()) + && StringUtils.isNotBlank(log.getSearchReportEndTime())) { + params.put("searchReportStartTime", log.getSearchReportStartTime()); + params.put("searchReportEndTime", log.getSearchReportEndTime()); + } + + if (StringUtils.isNotBlank(log.getSearchTaskStartTime()) + && StringUtils.isNotBlank(log.getSearchTaskEndTime())) { + params.put("searchTaskStartTime", log.getSearchTaskStartTime()); + params.put("searchTaskEndTime", log.getSearchTaskEndTime()); + } + + if (StringUtils.isNotBlank(log.getTaskName())) { + params.put("taskName", log.getTaskName()); + } + + if (StringUtils.isNotBlank(log.getTaskId())) { + params.put("taskId", log.getTaskId()); + } + + params.put("reportType", 1); + + String url = Constants.LOG_BASE_URL + Constants.NTC_EVENT_MONITOR_OR_BLOCK_Report; + // String url = + // "http://192.168.11.56:8080/galaxy-service/service/log/v1/ntcEventsMonitorOrBlock?reportType=1"; + String recv = HttpClientUtil.getMsg(url, params, request); + if (StringUtils.isNotBlank(recv)) { + Gson gson = new GsonBuilder().create(); + LogRecvData fromJson = gson.fromJson(recv, + new TypeToken>() { + }.getType()); + if (fromJson.getStatus().intValue() == 200) { + Page data = fromJson.getData(); + page.setCount(data.getCount()); + page.setLast(data.getLast()); + page.setList(data.getList()); + model.addAttribute("page", page); + } + } + } catch (Exception e) { + logger.error("查询失败", e); + addMessageLog(model, e.getMessage()); + } + + return "/report/eventBlockList"; + } + + // eventMonitorExport + @RequestMapping(value = "eventBlockExport") + public void eventBlockExport(@ModelAttribute("log") NtcEventMonitorOrBlockReport log, Model model, String hColumns, + String type, HttpServletRequest request, HttpServletResponse response, + RedirectAttributes redirectAttributes) { + try { + // export data info + List titleList = new ArrayList(); + Map> classMap = new HashMap>(); + Map dataMap = new HashMap(); + Map noExportMap = new HashMap(); + // --------------------------- + PageLog page = new PageLog(request, response); + Map params = new HashMap(); + params.put("pageSize", page.getPageSize()); + params.put("pageNo", page.getPageNo()); + + // 判断请求参数 + if (StringUtils.isNotBlank(log.getSearchReportStartTime()) + && StringUtils.isNotBlank(log.getSearchReportEndTime())) { + params.put("searchReportStartTime", log.getSearchReportStartTime()); + params.put("searchReportEndTime", log.getSearchReportEndTime()); + } + + if (StringUtils.isNotBlank(log.getSearchTaskStartTime()) + && StringUtils.isNotBlank(log.getSearchTaskEndTime())) { + params.put("searchTaskStartTime", log.getSearchTaskStartTime()); + params.put("searchTaskEndTime", log.getSearchTaskEndTime()); + } + + if (StringUtils.isNotBlank(log.getTaskName())) { + params.put("taskName", log.getTaskName()); + } + + if (StringUtils.isNotBlank(log.getTaskId())) { + params.put("taskId", log.getTaskId()); + } + + params.put("reportType", 1); + + String url = Constants.LOG_BASE_URL + Constants.NTC_EVENT_MONITOR_OR_BLOCK_Report; + // String url = + // "http://192.168.11.56:8080/galaxy-service/service/log/v1/ntcEventsMonitorOrBlock?reportType=1"; + String recv = HttpClientUtil.getMsg(url, params, request); + List list = new ArrayList<>(); + if (StringUtils.isNotBlank(recv)) { + Gson gson = new GsonBuilder().create(); + LogRecvData fromJson = gson.fromJson(recv, + new TypeToken>() { + }.getType()); + if (fromJson.getStatus().intValue() == 200) { + Page data = fromJson.getData(); + list = data.getList(); + } + } + + // + titleList.add("ntc_event_block_report"); + classMap.put("ntc_event_block_report", NtcEventMonitorOrBlockReport.class); + + String cfgIndexInfoNoExport = ""; + noExportMap.put("ntc_event_block_report", cfgIndexInfoNoExport); + + Properties msgProp = getMsgProp(); + NtcEventMonitorOrBlockReport ntcEventMonitorOrBlockReport = new NtcEventMonitorOrBlockReport(); + long ipNum = 0; + long httpNum = 0; + long mailNum = 0; + long vedioNum = 0; + long agentNum = 0; + for (NtcEventMonitorOrBlockReport entity : list) { + ipNum += entity.getIpNum(); + httpNum += entity.getHttpNum(); + mailNum += entity.getMailNum(); + vedioNum += entity.getVedioNum(); + agentNum += entity.getAgentNum(); + } + String report_total = msgProp.getProperty("report_total"); + ntcEventMonitorOrBlockReport.setIpNum(ipNum); + ntcEventMonitorOrBlockReport.setHttpNum(httpNum); + ntcEventMonitorOrBlockReport.setMailNum(mailNum); + ntcEventMonitorOrBlockReport.setVedioNum(vedioNum); + ntcEventMonitorOrBlockReport.setAgentNum(agentNum); + ntcEventMonitorOrBlockReport.setTaskId(report_total); + ntcEventMonitorOrBlockReport.setTaskName("    一   "); + ntcEventMonitorOrBlockReport.setTaskTime("    一   "); + ntcEventMonitorOrBlockReport.setReportTime("    一   "); + list.add(ntcEventMonitorOrBlockReport); + + dataMap.put("ntc_event_block_report", list); + + String timeRange = initHttpMap(log, "ntc_event_block_report"); + noExportMap.put("timeRange", timeRange); + + /* } */ + if ("csv".equals(type)) { + this._exportCsv(model, request, response, redirectAttributes, "ntc_event_block_report", titleList, + classMap, dataMap, noExportMap); + } else { + this._export(model, request, response, redirectAttributes, "ntc_event_block_report", titleList, + classMap, dataMap, noExportMap); + } + } catch (Exception e) { + logger.error("ntc_event_block_report export failed", e); + addMessage(redirectAttributes, "error", "export_failed"); + } + } + + public String initHttpMap(NtcEventMonitorOrBlockReport log, String title) { + Properties msgProp = getMsgProp(); + String logTime = msgProp.getProperty(title, title); + ; + if (StringUtils.isNotBlank(log.getSearchReportStartTime())) { + logTime += " " + msgProp.getProperty("begin_date") + ":" + log.getSearchReportStartTime(); + } + if (StringUtils.isNotBlank(log.getSearchReportEndTime())) { + logTime += " " + msgProp.getProperty("end_date") + ":" + log.getSearchReportEndTime(); + } + + if (StringUtils.isNotBlank(log.getSearchTaskStartTime())) { + logTime += " " + msgProp.getProperty("task_begin_time") + ":" + log.getSearchTaskStartTime(); + } + + if (StringUtils.isNotBlank(log.getSearchTaskEndTime())) { + logTime += " " + msgProp.getProperty("task_end_time") + ":" + log.getSearchTaskEndTime(); + } + return logTime; + } +} diff --git a/src/main/java/com/nis/web/controller/report/NtcEventKeyProtectionController.java b/src/main/java/com/nis/web/controller/report/NtcEventKeyProtectionController.java new file mode 100644 index 000000000..cde515baf --- /dev/null +++ b/src/main/java/com/nis/web/controller/report/NtcEventKeyProtectionController.java @@ -0,0 +1,221 @@ +package com.nis.web.controller.report; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Properties; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.servlet.mvc.support.RedirectAttributes; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.reflect.TypeToken; +import com.nis.domain.Page; +import com.nis.domain.PageLog; +import com.nis.domain.maat.LogRecvData; +import com.nis.domain.report.NtcEventKeyProtectionReport; +import com.nis.util.Constants; +import com.nis.util.httpclient.HttpClientUtil; +import com.nis.web.controller.BaseController; + +@Controller +@RequestMapping("${adminPath}/eventKeyProtection") +public class NtcEventKeyProtectionController extends BaseController { + + /** + * EventBlock + * + * @param log + * @param model + * @param request + * @param response + * @return + */ + @RequestMapping(value = { "/eventKeyProtectionList", "" }) + public String eventKeyProtectionList(@ModelAttribute("log") NtcEventKeyProtectionReport log, Model model, + HttpServletRequest request, HttpServletResponse response) { + try { + PageLog page = new PageLog(request, response); + Map params = new HashMap(); + params.put("pageSize", page.getPageSize()); + params.put("pageNo", page.getPageNo()); + + // 判断请求参数 + if (StringUtils.isNotBlank(log.getSearchReportStartTime()) + && StringUtils.isNotBlank(log.getSearchReportEndTime())) { + params.put("searchReportStartTime", log.getSearchReportStartTime()); + params.put("searchReportEndTime", log.getSearchReportEndTime()); + } + + if (StringUtils.isNotBlank(log.getSearchTaskStartTime()) + && StringUtils.isNotBlank(log.getSearchTaskEndTime())) { + params.put("searchTaskStartTime", log.getSearchTaskStartTime()); + params.put("searchTaskEndTime", log.getSearchTaskEndTime()); + } + + if (StringUtils.isNotBlank(log.getTaskName())) { + params.put("taskName", log.getTaskName()); + } + + if (StringUtils.isNotBlank(log.getTaskId())) { + params.put("taskId", log.getTaskId()); + } + + String url = Constants.LOG_BASE_URL + Constants.NTC_EVENT_MONITOR_OR_BLOCK_Report; + // String url = + // "http://192.168.11.56:8080/galaxy-service/service/log/v1/ntcEventKeyProtection"; + String recv = HttpClientUtil.getMsg(url, params, request); + if (StringUtils.isNotBlank(recv)) { + Gson gson = new GsonBuilder().create(); + LogRecvData fromJson = gson.fromJson(recv, + new TypeToken>() { + }.getType()); + if (fromJson.getStatus().intValue() == 200) { + Page data = fromJson.getData(); + page.setCount(data.getCount()); + page.setLast(data.getLast()); + page.setList(data.getList()); + model.addAttribute("page", page); + } + } + } catch (Exception e) { + logger.error("查询失败", e); + addMessageLog(model, e.getMessage()); + } + + return "/report/eventKeyProtectionList"; + } + + // eventMonitorExport + @RequestMapping(value = "eventKeyProtectionExport") + public void eventKeyProtectionExport(@ModelAttribute("log") NtcEventKeyProtectionReport log, Model model, + String hColumns, String type, HttpServletRequest request, HttpServletResponse response, + RedirectAttributes redirectAttributes) { + try { + // export data info + List titleList = new ArrayList(); + Map> classMap = new HashMap>(); + Map dataMap = new HashMap(); + Map noExportMap = new HashMap(); + // --------------------------- + PageLog page = new PageLog(request, response); + Map params = new HashMap(); + params.put("pageSize", page.getPageSize()); + params.put("pageNo", page.getPageNo()); + + // 判断请求参数 + if (StringUtils.isNotBlank(log.getSearchReportStartTime()) + && StringUtils.isNotBlank(log.getSearchReportEndTime())) { + params.put("searchReportStartTime", log.getSearchReportStartTime()); + params.put("searchReportEndTime", log.getSearchReportEndTime()); + } + + if (StringUtils.isNotBlank(log.getSearchTaskStartTime()) + && StringUtils.isNotBlank(log.getSearchTaskEndTime())) { + params.put("searchTaskStartTime", log.getSearchTaskStartTime()); + params.put("searchTaskEndTime", log.getSearchTaskEndTime()); + } + + if (StringUtils.isNotBlank(log.getTaskName())) { + params.put("taskName", log.getTaskName()); + } + + if (StringUtils.isNotBlank(log.getTaskId())) { + params.put("taskId", log.getTaskId()); + } + + String url = Constants.LOG_BASE_URL + Constants.NTC_EVENT_MONITOR_OR_BLOCK_Report; + // String url = + // "http://192.168.11.56:8080/galaxy-service/service/log/v1/ntcEventKeyProtection"; + String recv = HttpClientUtil.getMsg(url, params, request); + List list = new ArrayList<>(); + if (StringUtils.isNotBlank(recv)) { + Gson gson = new GsonBuilder().create(); + LogRecvData fromJson = gson.fromJson(recv, + new TypeToken>() { + }.getType()); + if (fromJson.getStatus().intValue() == 200) { + Page data = fromJson.getData(); + list = data.getList(); + } + } + + // + titleList.add("ntc_event_key_protection_report"); + classMap.put("ntc_event_key_protection_report", NtcEventKeyProtectionReport.class); + + String cfgIndexInfoNoExport = ""; + noExportMap.put("ntc_event_key_protection_report", cfgIndexInfoNoExport); + + Properties msgProp = getMsgProp(); + NtcEventKeyProtectionReport ntcEventKeyProtectionReport = new NtcEventKeyProtectionReport(); + long letterNum = 0; + long configNum = 0; + long monitorNum = 0; + long controlNum = 0; + for (NtcEventKeyProtectionReport entity : list) { + letterNum += entity.getLetterNum(); + configNum += entity.getConfigNum(); + monitorNum += entity.getMonitorNum(); + controlNum += entity.getControlNum(); + } + String report_total = msgProp.getProperty("report_total"); + ntcEventKeyProtectionReport.setLetterNum(letterNum); + ntcEventKeyProtectionReport.setConfigNum(configNum); + ntcEventKeyProtectionReport.setMonitorNum(monitorNum); + ntcEventKeyProtectionReport.setControlNum(controlNum); + ntcEventKeyProtectionReport.setTaskId(report_total); + ntcEventKeyProtectionReport.setTaskName("     一     "); + ntcEventKeyProtectionReport.setTaskTime("     一     "); + ntcEventKeyProtectionReport.setReportTime("    一     "); + list.add(ntcEventKeyProtectionReport); + + dataMap.put("ntc_event_key_protection_report", list); + + String timeRange = initHttpMap(log, "ntc_event_key_protection_report"); + noExportMap.put("timeRange", timeRange); + + /* } */ + if ("csv".equals(type)) { + this._exportCsv(model, request, response, redirectAttributes, "ntc_event_key_protection_report", + titleList, classMap, dataMap, noExportMap); + } else { + this._export(model, request, response, redirectAttributes, "ntc_event_key_protection_report", titleList, + classMap, dataMap, noExportMap); + } + } catch (Exception e) { + logger.error("ntc_event_key_protection_report export failed", e); + addMessage(redirectAttributes, "error", "export_failed"); + } + } + + public String initHttpMap(NtcEventKeyProtectionReport log, String title) { + Properties msgProp = getMsgProp(); + String logTime = msgProp.getProperty(title, title); + ; + if (StringUtils.isNotBlank(log.getSearchReportStartTime())) { + logTime += " " + msgProp.getProperty("begin_date") + ":" + log.getSearchReportStartTime(); + } + if (StringUtils.isNotBlank(log.getSearchReportEndTime())) { + logTime += " " + msgProp.getProperty("end_date") + ":" + log.getSearchReportEndTime(); + } + + if (StringUtils.isNotBlank(log.getSearchTaskStartTime())) { + logTime += " " + msgProp.getProperty("task_begin_time") + ":" + log.getSearchTaskStartTime(); + } + + if (StringUtils.isNotBlank(log.getSearchTaskEndTime())) { + logTime += " " + msgProp.getProperty("task_end_time") + ":" + log.getSearchTaskEndTime(); + } + return logTime; + } +} diff --git a/src/main/java/com/nis/web/controller/report/NtcEventMonitorController.java b/src/main/java/com/nis/web/controller/report/NtcEventMonitorController.java new file mode 100644 index 000000000..9535282ff --- /dev/null +++ b/src/main/java/com/nis/web/controller/report/NtcEventMonitorController.java @@ -0,0 +1,231 @@ +package com.nis.web.controller.report; + +import java.util.ArrayList; +import java.util.Calendar; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Properties; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.servlet.mvc.support.RedirectAttributes; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.reflect.TypeToken; +import com.nis.domain.Page; +import com.nis.domain.PageLog; +import com.nis.domain.maat.LogRecvData; +import com.nis.domain.report.BaseReport; +import com.nis.domain.report.NtcEventMonitorOrBlockReport; +import com.nis.domain.report.NtcURLReport; +import com.nis.util.Constants; +import com.nis.util.DateUtils; +import com.nis.util.httpclient.HttpClientUtil; +import com.nis.web.controller.BaseController; + +@Controller +@RequestMapping("${adminPath}/eventMonitor") +public class NtcEventMonitorController extends BaseController { + /** + * EventMonitor + * + * @param log + * @param model + * @param request + * @param response + * @return + */ + @RequestMapping(value = { "/eventMonitorList", "" }) + public String eventMonitorList(@ModelAttribute("log") NtcEventMonitorOrBlockReport log, Model model, + HttpServletRequest request, HttpServletResponse response) { + try { + PageLog page = new PageLog(request, response); + Map params = new HashMap(); + params.put("pageSize", page.getPageSize()); + params.put("pageNo", page.getPageNo()); + + // 判断请求参数 + if (StringUtils.isNotBlank(log.getSearchReportStartTime()) + && StringUtils.isNotBlank(log.getSearchReportEndTime())) { + params.put("searchReportStartTime", log.getSearchReportStartTime()); + params.put("searchReportEndTime", log.getSearchReportEndTime()); + } + + if (StringUtils.isNotBlank(log.getSearchTaskStartTime()) + && StringUtils.isNotBlank(log.getSearchTaskEndTime())) { + params.put("searchTaskStartTime", log.getSearchTaskStartTime()); + params.put("searchTaskEndTime", log.getSearchTaskEndTime()); + } + + if (StringUtils.isNotBlank(log.getTaskName())) { + params.put("taskName", log.getTaskName()); + } + + if (StringUtils.isNotBlank(log.getTaskId())) { + params.put("taskId", log.getTaskId()); + } + + params.put("reportType", 2); + + String url = Constants.LOG_BASE_URL + Constants.NTC_EVENT_MONITOR_OR_BLOCK_Report; + // String url = + // "http://192.168.11.56:8080/galaxy-service/service/log/v1/ntcEventsMonitorOrBlock?reportType=2"; + String recv = HttpClientUtil.getMsg(url, params, request); + if (StringUtils.isNotBlank(recv)) { + Gson gson = new GsonBuilder().create(); + LogRecvData fromJson = gson.fromJson(recv, + new TypeToken>() { + }.getType()); + if (fromJson.getStatus().intValue() == 200) { + Page data = fromJson.getData(); + page.setCount(data.getCount()); + page.setLast(data.getLast()); + page.setList(data.getList()); + model.addAttribute("page", page); + } + } + } catch (Exception e) { + logger.error("查询失败", e); + addMessageLog(model, e.getMessage()); + } + + return "/report/eventMonitorList"; + } + + // eventMonitorExport + @RequestMapping(value = "eventMonitorExport") + public void eventMonitorExport(@ModelAttribute("log") NtcEventMonitorOrBlockReport log, Model model, + String hColumns, String type, HttpServletRequest request, HttpServletResponse response, + RedirectAttributes redirectAttributes) { + try { + // export data info + List titleList = new ArrayList(); + Map> classMap = new HashMap>(); + Map dataMap = new HashMap(); + Map noExportMap = new HashMap(); + // --------------------------- + PageLog page = new PageLog(request, response); + Map params = new HashMap(); + params.put("pageSize", page.getPageSize()); + params.put("pageNo", page.getPageNo()); + + // 判断请求参数 + if (StringUtils.isNotBlank(log.getSearchReportStartTime()) + && StringUtils.isNotBlank(log.getSearchReportEndTime())) { + params.put("searchReportStartTime", log.getSearchReportStartTime()); + params.put("searchReportEndTime", log.getSearchReportEndTime()); + } + + if (StringUtils.isNotBlank(log.getSearchTaskStartTime()) + && StringUtils.isNotBlank(log.getSearchTaskEndTime())) { + params.put("searchTaskStartTime", log.getSearchTaskStartTime()); + params.put("searchTaskEndTime", log.getSearchTaskEndTime()); + } + + if (StringUtils.isNotBlank(log.getTaskName())) { + params.put("taskName", log.getTaskName()); + } + + if (StringUtils.isNotBlank(log.getTaskId())) { + params.put("taskId", log.getTaskId()); + } + + params.put("reportType", 2); + + String url = Constants.LOG_BASE_URL + Constants.NTC_EVENT_MONITOR_OR_BLOCK_Report; + // String url = + // "http://192.168.11.56:8080/galaxy-service/service/log/v1/ntcEventsMonitorOrBlock?reportType=2"; + String recv = HttpClientUtil.getMsg(url, params, request); + List list = new ArrayList<>(); + if (StringUtils.isNotBlank(recv)) { + Gson gson = new GsonBuilder().create(); + LogRecvData fromJson = gson.fromJson(recv, + new TypeToken>() { + }.getType()); + if (fromJson.getStatus().intValue() == 200) { + Page data = fromJson.getData(); + list = data.getList(); + } + } + + // + titleList.add("ntc_event_monitor_report"); + classMap.put("ntc_event_monitor_report", NtcEventMonitorOrBlockReport.class); + + String cfgIndexInfoNoExport = ""; + noExportMap.put("ntc_event_monitor_report", cfgIndexInfoNoExport); + + Properties msgProp = getMsgProp(); + NtcEventMonitorOrBlockReport ntcEventMonitorOrBlockReport = new NtcEventMonitorOrBlockReport(); + long ipNum = 0; + long httpNum = 0; + long mailNum = 0; + long vedioNum = 0; + long agentNum = 0; + for (NtcEventMonitorOrBlockReport entity : list) { + ipNum += entity.getIpNum(); + httpNum += entity.getHttpNum(); + mailNum += entity.getMailNum(); + vedioNum += entity.getVedioNum(); + agentNum += entity.getAgentNum(); + } + String report_total = msgProp.getProperty("report_total"); + ntcEventMonitorOrBlockReport.setIpNum(ipNum); + ntcEventMonitorOrBlockReport.setHttpNum(httpNum); + ntcEventMonitorOrBlockReport.setMailNum(mailNum); + ntcEventMonitorOrBlockReport.setVedioNum(vedioNum); + ntcEventMonitorOrBlockReport.setAgentNum(agentNum); + ntcEventMonitorOrBlockReport.setTaskId(report_total); + ntcEventMonitorOrBlockReport.setTaskName("    一   "); + ntcEventMonitorOrBlockReport.setTaskTime("    一   "); + ntcEventMonitorOrBlockReport.setReportTime("    一   "); + list.add(ntcEventMonitorOrBlockReport); + + dataMap.put("ntc_event_monitor_report", list); + + String timeRange = initHttpMap(log, "ntc_event_monitor_report"); + noExportMap.put("timeRange", timeRange); + + /* } */ + if ("csv".equals(type)) { + this._exportCsv(model, request, response, redirectAttributes, "ntc_event_monitor_report", titleList, + classMap, dataMap, noExportMap); + } else { + this._export(model, request, response, redirectAttributes, "ntc_event_monitor_report", titleList, + classMap, dataMap, noExportMap); + } + } catch (Exception e) { + logger.error("ntc_event_monitor_report export failed", e); + addMessage(redirectAttributes, "error", "export_failed"); + } + } + + public String initHttpMap(NtcEventMonitorOrBlockReport log, String title) { + Properties msgProp = getMsgProp(); + String logTime = msgProp.getProperty(title, title); + ; + if (StringUtils.isNotBlank(log.getSearchReportStartTime())) { + logTime += " " + msgProp.getProperty("begin_date") + ":" + log.getSearchReportStartTime(); + } + if (StringUtils.isNotBlank(log.getSearchReportEndTime())) { + logTime += " " + msgProp.getProperty("end_date") + ":" + log.getSearchReportEndTime(); + } + + if (StringUtils.isNotBlank(log.getSearchTaskStartTime())) { + logTime += " " + msgProp.getProperty("task_begin_time") + ":" + log.getSearchTaskStartTime(); + } + + if (StringUtils.isNotBlank(log.getSearchTaskEndTime())) { + logTime += " " + msgProp.getProperty("task_end_time") + ":" + log.getSearchTaskEndTime(); + } + return logTime; + } +} diff --git a/src/main/resources/messages/message_en.properties b/src/main/resources/messages/message_en.properties index abf94ac92..d3d7f6a34 100644 --- a/src/main/resources/messages/message_en.properties +++ b/src/main/resources/messages/message_en.properties @@ -1361,7 +1361,7 @@ nas_ip=NAS IP Address framed_ip=Framed IP Address log_user_name=User Name av_tips=The system does not support the index information of audio and video coding in the tail of the audio and video files. The system does not support video with resolution greater than 1080P. -asn_ip_group_delete=\uFF08IP configuration under this ASN group will also be deleted.) +asn_ip_group_delete=\uff08IP configuration under this ASN group will also be deleted.) keyword_log_tips=Deduplicate http body keywords log,for the control status of http body keywords is not ideal, configure the http url of the hit keyword as URL control configuration. conn_record=Connection Records bps=Gbps @@ -1415,4 +1415,19 @@ l3_header_error=Only four attribute values are allowed to be entered at most IP_HEADER=IP Header ICMP_HEADER=ICMP Header offset_expression=Offset Expression -cfg_custom=Custom Columns \ No newline at end of file +cfg_custom=Custom Columns +event_report=Event Report +ntc_event_monitor_report=Event Monitor Report +ntc_event_block_report=Event Block Report +ntc_event_key_protection_report=Event Key Protection Report +task_id=Task ID +task_begin_time=Task Begin Time +task_end_time=Task End Time +http_num=HTTP +mail_num=MAIL +vedio_count=VEDIO +agent_count=AGENT +letter_num=LETTER +config_num=CONFIG +monitor_num=MONITOR +control_num=CONTROL \ No newline at end of file diff --git a/src/main/resources/messages/message_zh_CN.properties b/src/main/resources/messages/message_zh_CN.properties index e75e2c5e2..daed5530d 100644 --- a/src/main/resources/messages/message_zh_CN.properties +++ b/src/main/resources/messages/message_zh_CN.properties @@ -1415,4 +1415,19 @@ l3_header_error=Only four attribute values are allowed to be entered at most IP_HEADER=IP Header ICMP_HEADER=ICMP Header offset_expression=Offset Expression -cfg_custom=Custom Columns \ No newline at end of file +cfg_custom=Custom Columns +event_report=\u4e8b\u4ef6\u62a5\u8868 +ntc_event_monitor_report=\u4e8b\u4ef6\u76d1\u6d4b\u62a5\u8868 +ntc_event_block_report=\u4e8b\u4ef6\u5c01\u5835\u62a5\u8868 +ntc_event_key_protection_report=\u91cd\u70b9\u4fdd\u969c\u4e8b\u4ef6\u62a5\u8868 +task_id=\u4e13\u9879ID +task_begin_time=\u62a5\u9001\u5f00\u59cb\u65f6\u95f4 +task_end_time=\u62a5\u9001\u7ed3\u675f\u65f6\u95f4 +http_num=HTTP\u6570\u91cf +mail_num=\u90ae\u4ef6\u6570\u91cf +vedio_count=\u89c6\u9891\u6b21\u6570 +agent_count=\u4ee3\u7406\u6b21\u6570 +letter_num=\u6765\u51fd\u4ef6\u6570 +config_num=\u914d\u7f6e\u603b\u6570 +monitor_num=\u76d1\u6d4b\u6570\u91cf +control_num=\u7ba1\u63a7\u6570\u91cf \ No newline at end of file diff --git a/src/main/resources/nis.properties b/src/main/resources/nis.properties index a0f0c50ac..2f6f8330f 100644 --- a/src/main/resources/nis.properties +++ b/src/main/resources/nis.properties @@ -604,4 +604,8 @@ trafficDomainTrans=trafficDomainTrans #maximum number to import import_limit=10 trafficPortActiveFiveMinute=trafficPortActiveFiveMinute -trendTotalReport=trendTotalReport \ No newline at end of file +trendTotalReport=trendTotalReport +#\u4e8b\u4ef6\u76d1\u6d4b/\u5c01\u5835 +ntcEventsMonitorOrBlockReport=ntcEventsMonitorOrBlockReport +#\u91cd\u70b9\u4fdd\u969c\u4e8b\u4ef6 +ntcEventKeyProtectionReport=ntcEventKeyProtectionReport \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/views/report/eventBlockList.jsp b/src/main/webapp/WEB-INF/views/report/eventBlockList.jsp new file mode 100644 index 000000000..a2ece1b4a --- /dev/null +++ b/src/main/webapp/WEB-INF/views/report/eventBlockList.jsp @@ -0,0 +1,202 @@ +<%@ page contentType="text/html;charset=UTF-8"%> +<%@ include file="/WEB-INF/include/taglib.jsp"%> + + + + <spring:message code="https_url_report"/> + + + + + +
+ +

+ +

+ +
+
+
+
+ + + + + +
+
+
+
+ +
+ +
+
+
+
+
+ +
+ +
+
+
+
+
+ +
+ +
+
+
+
+
+ +
+ +
+
+
+ + +
+
+
+ + +
+ href="javascript:;"> + + +
+ +
+
+
+
+
+ +
+ +
+
+
+
+
+ +
+ +
+
+
+ + +
+
+ +
+ + + + + <%-- --%> + <%-- + --%> + <%-- + + + --%> + + + + + + + + + + <%-- --%> + + + + + + + + + + + + + + + <%-- --%> + + + + +
${log.taskId }${log.taskName }${log.ipNum }${log.httpNum }${log.mailNum }${log.vedioNum }${log.agentNum }${log.taskTime }${log.reportTime }${log.reportTime}
+
${page}
+
+
+
+
+
+ + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/views/report/eventKeyProtectionList.jsp b/src/main/webapp/WEB-INF/views/report/eventKeyProtectionList.jsp new file mode 100644 index 000000000..9bb17bae4 --- /dev/null +++ b/src/main/webapp/WEB-INF/views/report/eventKeyProtectionList.jsp @@ -0,0 +1,200 @@ +<%@ page contentType="text/html;charset=UTF-8"%> +<%@ include file="/WEB-INF/include/taglib.jsp"%> + + + + <spring:message code="https_url_report"/> + + + + + +
+ +

+ +

+ +
+
+
+
+ + + + + +
+
+
+
+ +
+ +
+
+
+
+
+ +
+ +
+
+ +
+
+
+ +
+ +
+
+
+
+
+ +
+ +
+
+
+ + +
+
+
+ + +
+ href="javascript:;"> + + +
+ +
+
+
+
+
+ +
+ +
+
+
+
+
+ +
+ +
+
+
+ +
+
+ +
+ + + + + <%-- --%> + <%-- + --%> + <%-- + + + --%> + + + + + + + + + <%-- --%> + + + + + + + + + + + + + + <%-- --%> + + + + +
${log.taskId }${log.taskName }${log.letterNum }${log.configNum }${log.monitorNum }${log.controlNum }${log.taskTime }${log.reportTime }${log.reportTime}
+
${page}
+
+
+
+
+
+ + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/views/report/eventMonitorList.jsp b/src/main/webapp/WEB-INF/views/report/eventMonitorList.jsp new file mode 100644 index 000000000..e450c7cc8 --- /dev/null +++ b/src/main/webapp/WEB-INF/views/report/eventMonitorList.jsp @@ -0,0 +1,202 @@ +<%@ page contentType="text/html;charset=UTF-8"%> +<%@ include file="/WEB-INF/include/taglib.jsp"%> + + + + <spring:message code="https_url_report"/> + + + + + +
+ +

+ +

+ +
+
+
+
+ + + + + +
+
+
+
+ +
+ +
+
+
+
+
+ +
+ +
+
+
+
+
+ +
+ +
+
+
+
+
+ +
+ +
+
+
+ + +
+
+
+ + +
+ href="javascript:;"> + + +
+ +
+
+
+
+
+ +
+ +
+
+
+
+
+ +
+ +
+
+
+ + +
+
+ +
+ + + + + <%-- --%> + <%-- + --%> + <%-- + + + --%> + + + + + + + + + + <%-- --%> + + + + + + + + + + + + + + + <%-- --%> + + + + +
${log.taskId }${log.taskName }${log.ipNum }${log.httpNum }${log.mailNum }${log.vedioNum }${log.agentNum }${log.taskTime }${log.reportTime }${log.reportTime}
+
${page}
+
+
+
+
+
+ + \ No newline at end of file