实时报表->事件报表(查询,界面,导出):1.事件监测 2.事件封堵 3.重点保障
This commit is contained in:
@@ -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 + "]";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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 + "]";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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<NtcEventMonitorOrBlockReport> page = new PageLog<NtcEventMonitorOrBlockReport>(request, response);
|
||||
Map<String, Object> params = new HashMap<String, Object>();
|
||||
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<NtcEventMonitorOrBlockReport> fromJson = gson.fromJson(recv,
|
||||
new TypeToken<LogRecvData<NtcEventMonitorOrBlockReport>>() {
|
||||
}.getType());
|
||||
if (fromJson.getStatus().intValue() == 200) {
|
||||
Page<NtcEventMonitorOrBlockReport> 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<String> titleList = new ArrayList<String>();
|
||||
Map<String, Class<?>> classMap = new HashMap<String, Class<?>>();
|
||||
Map<String, List> dataMap = new HashMap<String, List>();
|
||||
Map<String, String> noExportMap = new HashMap<String, String>();
|
||||
// ---------------------------
|
||||
PageLog<NtcEventMonitorOrBlockReport> page = new PageLog<NtcEventMonitorOrBlockReport>(request, response);
|
||||
Map<String, Object> params = new HashMap<String, Object>();
|
||||
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<NtcEventMonitorOrBlockReport> list = new ArrayList<>();
|
||||
if (StringUtils.isNotBlank(recv)) {
|
||||
Gson gson = new GsonBuilder().create();
|
||||
LogRecvData<NtcEventMonitorOrBlockReport> fromJson = gson.fromJson(recv,
|
||||
new TypeToken<LogRecvData<NtcEventMonitorOrBlockReport>>() {
|
||||
}.getType());
|
||||
if (fromJson.getStatus().intValue() == 200) {
|
||||
Page<NtcEventMonitorOrBlockReport> 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;
|
||||
}
|
||||
}
|
||||
@@ -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<NtcEventKeyProtectionReport> page = new PageLog<NtcEventKeyProtectionReport>(request, response);
|
||||
Map<String, Object> params = new HashMap<String, Object>();
|
||||
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<NtcEventKeyProtectionReport> fromJson = gson.fromJson(recv,
|
||||
new TypeToken<LogRecvData<NtcEventKeyProtectionReport>>() {
|
||||
}.getType());
|
||||
if (fromJson.getStatus().intValue() == 200) {
|
||||
Page<NtcEventKeyProtectionReport> 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<String> titleList = new ArrayList<String>();
|
||||
Map<String, Class<?>> classMap = new HashMap<String, Class<?>>();
|
||||
Map<String, List> dataMap = new HashMap<String, List>();
|
||||
Map<String, String> noExportMap = new HashMap<String, String>();
|
||||
// ---------------------------
|
||||
PageLog<NtcEventKeyProtectionReport> page = new PageLog<NtcEventKeyProtectionReport>(request, response);
|
||||
Map<String, Object> params = new HashMap<String, Object>();
|
||||
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<NtcEventKeyProtectionReport> list = new ArrayList<>();
|
||||
if (StringUtils.isNotBlank(recv)) {
|
||||
Gson gson = new GsonBuilder().create();
|
||||
LogRecvData<NtcEventKeyProtectionReport> fromJson = gson.fromJson(recv,
|
||||
new TypeToken<LogRecvData<NtcEventKeyProtectionReport>>() {
|
||||
}.getType());
|
||||
if (fromJson.getStatus().intValue() == 200) {
|
||||
Page<NtcEventKeyProtectionReport> 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;
|
||||
}
|
||||
}
|
||||
@@ -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<NtcEventMonitorOrBlockReport> page = new PageLog<NtcEventMonitorOrBlockReport>(request, response);
|
||||
Map<String, Object> params = new HashMap<String, Object>();
|
||||
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<NtcEventMonitorOrBlockReport> fromJson = gson.fromJson(recv,
|
||||
new TypeToken<LogRecvData<NtcEventMonitorOrBlockReport>>() {
|
||||
}.getType());
|
||||
if (fromJson.getStatus().intValue() == 200) {
|
||||
Page<NtcEventMonitorOrBlockReport> 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<String> titleList = new ArrayList<String>();
|
||||
Map<String, Class<?>> classMap = new HashMap<String, Class<?>>();
|
||||
Map<String, List> dataMap = new HashMap<String, List>();
|
||||
Map<String, String> noExportMap = new HashMap<String, String>();
|
||||
// ---------------------------
|
||||
PageLog<NtcEventMonitorOrBlockReport> page = new PageLog<NtcEventMonitorOrBlockReport>(request, response);
|
||||
Map<String, Object> params = new HashMap<String, Object>();
|
||||
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<NtcEventMonitorOrBlockReport> list = new ArrayList<>();
|
||||
if (StringUtils.isNotBlank(recv)) {
|
||||
Gson gson = new GsonBuilder().create();
|
||||
LogRecvData<NtcEventMonitorOrBlockReport> fromJson = gson.fromJson(recv,
|
||||
new TypeToken<LogRecvData<NtcEventMonitorOrBlockReport>>() {
|
||||
}.getType());
|
||||
if (fromJson.getStatus().intValue() == 200) {
|
||||
Page<NtcEventMonitorOrBlockReport> 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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user