1.修改日志邮件界面,CfgId查询条件不能为0
2.新增日志邮件泛收界面(cfg_id=0),进行查询和导出 3.新增日志SSL泛收界面,进行查询和导出
This commit is contained in:
131
src/main/java/com/nis/domain/log/NtcSslRecordLog.java
Normal file
131
src/main/java/com/nis/domain/log/NtcSslRecordLog.java
Normal file
@@ -0,0 +1,131 @@
|
||||
package com.nis.domain.log;
|
||||
|
||||
import com.nis.util.excel.ExcelField;
|
||||
|
||||
public class NtcSslRecordLog extends BaseLogEntity<NtcSslRecordLog> {
|
||||
|
||||
private static final long serialVersionUID = 533266057780162781L;
|
||||
|
||||
// @ExcelField(title = "log_id", sort = 8)
|
||||
private String logId;
|
||||
|
||||
@ExcelField(title = "version", sort = 8)
|
||||
private String version;// 版本号
|
||||
|
||||
@ExcelField(title = "SNI", sort = 9)
|
||||
private String sni;// SNI
|
||||
|
||||
@ExcelField(title = "SAN", sort = 10)
|
||||
private String san;// SAN
|
||||
|
||||
@ExcelField(title = "CN", sort = 11)
|
||||
private String cn;// CN
|
||||
|
||||
// @ExcelField(title = "individual_cert_file", sort = 12)
|
||||
private String individualCertFile;
|
||||
|
||||
// @ExcelField(title = "middle_cert_file", sort = 13)
|
||||
private String middleCertFile;
|
||||
|
||||
// @ExcelField(title = "root_cert_file", sort = 14)
|
||||
private String rootCertFile;
|
||||
|
||||
// @ExcelField(title = "chain_cert_file", sort = 15)
|
||||
private String chainCertFile;
|
||||
|
||||
public String getLogId() {
|
||||
return logId;
|
||||
}
|
||||
|
||||
public void setLogId(String logId) {
|
||||
this.logId = logId;
|
||||
}
|
||||
|
||||
public String getVersion() {
|
||||
return version;
|
||||
}
|
||||
|
||||
public void setVersion(String version) {
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
public String getSni() {
|
||||
return sni;
|
||||
}
|
||||
|
||||
public void setSni(String sni) {
|
||||
this.sni = sni;
|
||||
}
|
||||
|
||||
public String getSan() {
|
||||
return san;
|
||||
}
|
||||
|
||||
public void setSan(String san) {
|
||||
this.san = san;
|
||||
}
|
||||
|
||||
public String getCn() {
|
||||
return cn;
|
||||
}
|
||||
|
||||
public void setCn(String cn) {
|
||||
this.cn = cn;
|
||||
}
|
||||
|
||||
public String getIndividualCertFile() {
|
||||
return individualCertFile;
|
||||
}
|
||||
|
||||
public void setIndividualCertFile(String individualCertFile) {
|
||||
this.individualCertFile = individualCertFile;
|
||||
}
|
||||
|
||||
public String getMiddleCertFile() {
|
||||
return middleCertFile;
|
||||
}
|
||||
|
||||
public void setMiddleCertFile(String middleCertFile) {
|
||||
this.middleCertFile = middleCertFile;
|
||||
}
|
||||
|
||||
public String getRootCertFile() {
|
||||
return rootCertFile;
|
||||
}
|
||||
|
||||
public void setRootCertFile(String rootCertFile) {
|
||||
this.rootCertFile = rootCertFile;
|
||||
}
|
||||
|
||||
public String getChainCertFile() {
|
||||
return chainCertFile;
|
||||
}
|
||||
|
||||
public void setChainCertFile(String chainCertFile) {
|
||||
this.chainCertFile = chainCertFile;
|
||||
}
|
||||
|
||||
public static long getSerialversionuid() {
|
||||
return serialVersionUID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "NtcSslRecordLog [logId=" + logId + ", version=" + version + ", sni=" + sni + ", san=" + san + ", cn="
|
||||
+ cn + ", individualCertFile=" + individualCertFile + ", middleCertFile=" + middleCertFile
|
||||
+ ", rootCertFile=" + rootCertFile + ", chainCertFile=" + chainCertFile + ", cfgId=" + cfgId
|
||||
+ ", foundTime=" + foundTime + ", recvTime=" + recvTime + ", transProto=" + transProto + ", addrType="
|
||||
+ addrType + ", dIp=" + dIp + ", sIp=" + sIp + ", dPort=" + dPort + ", sPort=" + sPort + ", service="
|
||||
+ service + ", entranceId=" + entranceId + ", deviceId=" + deviceId + ", direction=" + direction
|
||||
+ ", streamDir=" + streamDir + ", capIp=" + capIp + ", addrList=" + addrList + ", serverLocate="
|
||||
+ serverLocate + ", clientLocate=" + clientLocate + ", sAsn=" + sAsn + ", dAsn=" + dAsn
|
||||
+ ", sSubscribeId=" + sSubscribeId + ", dSubscribeId=" + dSubscribeId + ", sceneFile=" + sceneFile
|
||||
+ ", functionId=" + functionId + ", action=" + action + ", date=" + date + ", seltype=" + seltype
|
||||
+ ", searchFoundStartTime=" + searchFoundStartTime + ", searchFoundEndTime=" + searchFoundEndTime
|
||||
+ ", isLogTotalSearch=" + isLogTotalSearch + ", orderBy=" + orderBy + ", encapType=" + encapType
|
||||
+ ", linkId=" + linkId + ", innerSmac=" + innerSmac + ", innerDmac=" + innerDmac + ", id=" + id
|
||||
+ ", currentUser=" + currentUser + ", page=" + page + ", pageLog=" + pageLog + ", sqlMap=" + sqlMap
|
||||
+ ", isNewRecord=" + isNewRecord + ", isFilterAction=" + isFilterAction + "]";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -805,4 +805,9 @@ public final class Constants {
|
||||
|
||||
//配置启停服务接口方法
|
||||
public static final String CONFIG_START_STOP_UPDATE=Configurations.getStringProperty("configStartStop", "configStartStop");
|
||||
|
||||
/**
|
||||
* 流量日志的SSL泛收接口URL
|
||||
*/
|
||||
public static final String NTC_SSL_RECORD_LOG = Configurations.getStringProperty("ntcSslRecordLog","");
|
||||
}
|
||||
|
||||
@@ -0,0 +1,171 @@
|
||||
package com.nis.web.controller.log.ntc;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.commons.lang.StringEscapeUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
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.FunctionServiceDict;
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.PageLog;
|
||||
import com.nis.domain.SysUser;
|
||||
import com.nis.domain.log.NtcIpLog;
|
||||
import com.nis.domain.log.NtcMailLog;
|
||||
import com.nis.domain.log.NtcMailLog;
|
||||
import com.nis.domain.maat.LogRecvData;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.DictUtils;
|
||||
import com.nis.util.httpclient.HttpClientUtil;
|
||||
import com.nis.web.controller.BaseController;
|
||||
import com.nis.web.security.UserUtils;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("${adminPath}/log/ntc/mailRecord")
|
||||
public class MailRecordLogController extends BaseController {
|
||||
|
||||
@RequestMapping(value = { "list", "" })
|
||||
public String list(@ModelAttribute("log") NtcMailLog log, Model model, HttpServletRequest request,
|
||||
HttpServletResponse response) {
|
||||
try {
|
||||
PageLog<NtcMailLog> page = new PageLog<NtcMailLog>(request, response);
|
||||
Map<String, Object> params = new HashMap<String, Object>();
|
||||
params.put("pageSize", page.getPageSize());
|
||||
params.put("pageNo", page.getPageNo());
|
||||
initLogSearchValue(log, params);
|
||||
|
||||
// 增加收/发件人、邮件主题查询
|
||||
if (StringUtils.isNotBlank(log.getMailTo())) {
|
||||
params.put("searchMailTo", StringEscapeUtils.unescapeHtml(log.getMailTo()));
|
||||
}
|
||||
if (StringUtils.isNotBlank(log.getMailFrom())) {
|
||||
params.put("searchMailFrom", StringEscapeUtils.unescapeHtml(log.getMailFrom()));
|
||||
}
|
||||
if (StringUtils.isNotBlank(log.getSubject())) {
|
||||
params.put("searchSubject", StringEscapeUtils.unescapeHtml(log.getSubject()));
|
||||
}
|
||||
|
||||
params.put("searchCfgId", "0");// 邮件泛收 cfg_id=0
|
||||
List<FunctionServiceDict> serviceList = DictUtils.getFunctionServiceDictList(log.getFunctionId());
|
||||
model.addAttribute("serviceList", serviceList);
|
||||
|
||||
String url = Constants.LOG_BASE_URL + Constants.NTC_MAIL_LOG;
|
||||
String recv = HttpClientUtil.getMsg(url, params, request);
|
||||
|
||||
if (StringUtils.isNotBlank(recv)) {
|
||||
Gson gson = new GsonBuilder().create();
|
||||
LogRecvData<NtcMailLog> fromJson = gson.fromJson(recv, new TypeToken<LogRecvData<NtcMailLog>>() {
|
||||
}.getType());
|
||||
if (fromJson.getStatus().intValue() == 200) {
|
||||
Page<NtcMailLog> data = fromJson.getData();
|
||||
page.setCount(data.getCount());
|
||||
page.setLast(data.getLast());
|
||||
page.setList(data.getList());
|
||||
List<NtcMailLog> list = page.getList();
|
||||
for (NtcMailLog l : list) {
|
||||
l.setFunctionId(log.getFunctionId());
|
||||
setLogAction(l, serviceList);
|
||||
}
|
||||
model.addAttribute("page", page);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("查询失败", e);
|
||||
addMessageLog(model, e.getMessage());
|
||||
}
|
||||
|
||||
return "/log/ntc/mailRecordList";
|
||||
}
|
||||
|
||||
// Mail泛收导出
|
||||
@RequestMapping(value = "exportMail")
|
||||
public void exportMail(@ModelAttribute("log") NtcMailLog log, Model model, String hColumns, String type,
|
||||
HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) {
|
||||
System.out.println("进来了Mail泛收");
|
||||
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<NtcMailLog> page = new PageLog<NtcMailLog>(request, response);
|
||||
page.setPageNo(1);
|
||||
page.setPageSize(Constants.MAX_LOG_EXPORT_SIZE);
|
||||
Map<String, Object> params = new HashMap<String, Object>();
|
||||
params.put("pageSize", page.getPageSize());
|
||||
params.put("pageNo", page.getPageNo());
|
||||
initLogSearchValue(log, params);
|
||||
|
||||
// 增加收/发件人、邮件主题查询
|
||||
if (StringUtils.isNotBlank(log.getMailTo())) {
|
||||
params.put("searchMailTo", StringEscapeUtils.unescapeHtml(log.getMailTo()));
|
||||
}
|
||||
if (StringUtils.isNotBlank(log.getMailFrom())) {
|
||||
params.put("searchMailFrom", StringEscapeUtils.unescapeHtml(log.getMailFrom()));
|
||||
}
|
||||
if (StringUtils.isNotBlank(log.getSubject())) {
|
||||
params.put("searchSubject", StringEscapeUtils.unescapeHtml(log.getSubject()));
|
||||
}
|
||||
|
||||
params.put("searchCfgId", "0");// 邮件泛收 cfg_id=0
|
||||
List<FunctionServiceDict> serviceList = DictUtils.getFunctionServiceDictList(log.getFunctionId());
|
||||
model.addAttribute("serviceList", serviceList);
|
||||
|
||||
String url = Constants.LOG_BASE_URL + Constants.NTC_MAIL_LOG;
|
||||
String recv = HttpClientUtil.getMsg(url, params, request);
|
||||
List<NtcMailLog> list = new ArrayList<NtcMailLog>();
|
||||
if (StringUtils.isNotBlank(recv)) {
|
||||
Gson gson = new GsonBuilder().create();
|
||||
LogRecvData<NtcMailLog> fromJson = gson.fromJson(recv, new TypeToken<LogRecvData<NtcMailLog>>() {
|
||||
}.getType());
|
||||
if (fromJson.getStatus().intValue() == 200) {
|
||||
Page<NtcMailLog> data = fromJson.getData();
|
||||
list = data.getList();
|
||||
}
|
||||
}
|
||||
for (NtcMailLog l : list) {
|
||||
l.setFunctionId(log.getFunctionId());
|
||||
setLogAction(l, serviceList);
|
||||
}
|
||||
titleList.add("mail_record");
|
||||
classMap.put("mail_record", NtcMailLog.class);
|
||||
SysUser user = UserUtils.getUser();
|
||||
if (!user.isAdmin()) {
|
||||
hColumns += ",scene_file,";
|
||||
} else {
|
||||
hColumns += ",";
|
||||
}
|
||||
String cfgIndexInfoNoExport = "," + hColumns;
|
||||
noExportMap.put("mail_record", cfgIndexInfoNoExport);
|
||||
dataMap.put("mail_record", list);
|
||||
String timeRange = initLogMap(log, "mail_record");
|
||||
noExportMap.put("timeRange", timeRange);
|
||||
/* } */
|
||||
if ("csv".equals(type)) {
|
||||
this._exportCsv(model, request, response, redirectAttributes, "mail_record", titleList, classMap,
|
||||
dataMap, noExportMap);
|
||||
} else {
|
||||
this._export(model, request, response, redirectAttributes, "mail_record", titleList, classMap, dataMap,
|
||||
noExportMap);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("mail_record export failed", e);
|
||||
addMessage(redirectAttributes, "error", "export_failed");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,158 @@
|
||||
package com.nis.web.controller.log.ntc;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.springframework.beans.BeanUtils;
|
||||
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.JsonSyntaxException;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.nis.domain.FunctionServiceDict;
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.PageLog;
|
||||
import com.nis.domain.SysUser;
|
||||
import com.nis.domain.log.NtcSslRecordLog;
|
||||
import com.nis.domain.log.NtcSshLog;
|
||||
import com.nis.domain.log.NtcSslRecordLog;
|
||||
import com.nis.domain.maat.LogRecvData;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.DictUtils;
|
||||
import com.nis.util.StringUtils;
|
||||
import com.nis.util.httpclient.HttpClientUtil;
|
||||
import com.nis.web.controller.BaseController;
|
||||
import com.nis.web.security.UserUtils;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("${adminPath}/log/ntc/sslRecord")
|
||||
@SuppressWarnings("all")
|
||||
public class SslRecordLogController extends BaseController {
|
||||
|
||||
@RequestMapping(value = { "list", "" })
|
||||
public String list(HttpServletRequest request, HttpServletResponse response, Model model,
|
||||
@ModelAttribute("log") NtcSslRecordLog NtcSslRecordLog) {
|
||||
|
||||
PageLog<NtcSslRecordLog> page = new PageLog<NtcSslRecordLog>(request, response);
|
||||
Map<String, Object> params = new HashMap<String, Object>();
|
||||
params.put("pageSize", page.getPageSize());
|
||||
params.put("pageNo", page.getPageNo());
|
||||
|
||||
// 请求参数判断
|
||||
initLogSearchValue(NtcSslRecordLog, params);
|
||||
if (StringUtils.isNotBlank(NtcSslRecordLog.getSni())) {
|
||||
params.put("SearchSni", NtcSslRecordLog.getSni());
|
||||
}
|
||||
|
||||
List<FunctionServiceDict> serviceList = DictUtils.getFunctionServiceDictList(NtcSslRecordLog.getFunctionId());
|
||||
model.addAttribute("serviceList", serviceList);
|
||||
|
||||
try {
|
||||
// 请求接口
|
||||
String url = Constants.LOG_BASE_URL + Constants.NTC_SSL_RECORD_LOG;
|
||||
String resJson = HttpClientUtil.getMsg(url, params, request);
|
||||
Gson gson = new GsonBuilder().create();
|
||||
LogRecvData<NtcSslRecordLog> fromJson = gson.fromJson(resJson,
|
||||
new TypeToken<LogRecvData<NtcSslRecordLog>>() {
|
||||
}.getType());
|
||||
if (fromJson.getStatus().intValue() == 200) {
|
||||
Page<NtcSslRecordLog> data = fromJson.getData();
|
||||
page.setCount(data.getCount());
|
||||
page.setLast(data.getLast());
|
||||
page.setList(data.getList());
|
||||
List<NtcSslRecordLog> list = page.getList();
|
||||
for (NtcSslRecordLog log : list) {
|
||||
log.setFunctionId(NtcSslRecordLog.getFunctionId());
|
||||
setLogAction(log, serviceList);
|
||||
}
|
||||
model.addAttribute("page", page);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("SSL泛收日志查询失败", e);
|
||||
addMessageLog(model, e.getMessage());
|
||||
}
|
||||
|
||||
return "/log/ntc/sslRecordLogList";
|
||||
}
|
||||
|
||||
// Ssl泛收配置导出
|
||||
@RequestMapping(value = "exportSsl")
|
||||
public void exportSsl(@ModelAttribute("log") NtcSslRecordLog log, Model model, String hColumns, String type,
|
||||
HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) {
|
||||
System.out.println("进来了ssl泛收");
|
||||
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<NtcSslRecordLog> page = new PageLog<NtcSslRecordLog>(request, response);
|
||||
List<NtcSslRecordLog> list = new ArrayList<NtcSslRecordLog>();
|
||||
page.setPageNo(1);
|
||||
page.setPageSize(Constants.MAX_LOG_EXPORT_SIZE);
|
||||
// ---------------------------
|
||||
Map<String, Object> params = new HashMap<String, Object>();
|
||||
params.put("pageSize", page.getPageSize());
|
||||
params.put("pageNo", page.getPageNo());
|
||||
// 请求参数判断
|
||||
initLogSearchValue(log, params);
|
||||
if (StringUtils.isNotBlank(log.getSni())) {
|
||||
params.put("SearchSni", log.getSni());
|
||||
}
|
||||
|
||||
List<FunctionServiceDict> serviceList = DictUtils.getFunctionServiceDictList(log.getFunctionId());
|
||||
model.addAttribute("serviceList", serviceList);
|
||||
|
||||
String url = Constants.LOG_BASE_URL + Constants.NTC_SSL_RECORD_LOG;
|
||||
String recv = HttpClientUtil.getMsg(url, params, request);
|
||||
if (StringUtils.isNotBlank(recv)) {
|
||||
Gson gson = new GsonBuilder().create();
|
||||
LogRecvData<NtcSslRecordLog> fromJson = gson.fromJson(recv,
|
||||
new TypeToken<LogRecvData<NtcSslRecordLog>>() {
|
||||
}.getType());
|
||||
if (fromJson.getStatus().intValue() == 200) {
|
||||
Page<NtcSslRecordLog> data = fromJson.getData();
|
||||
list = data.getList();
|
||||
}
|
||||
}
|
||||
for (NtcSslRecordLog l : list) {
|
||||
l.setFunctionId(log.getFunctionId());
|
||||
setLogAction(l, serviceList);
|
||||
}
|
||||
titleList.add("ssl_record");
|
||||
classMap.put("ssl_record", NtcSslRecordLog.class);
|
||||
SysUser user = UserUtils.getUser();
|
||||
if (!user.isAdmin()) {
|
||||
hColumns += ",scene_file,";
|
||||
} else {
|
||||
hColumns += ",";
|
||||
}
|
||||
String cfgIndexInfoNoExport = "," + hColumns;
|
||||
noExportMap.put("ssl_record", cfgIndexInfoNoExport);
|
||||
dataMap.put("ssl_record", list);
|
||||
String timeRange = initLogMap(log, "ssl_record");
|
||||
noExportMap.put("timeRange", timeRange);
|
||||
/* } */
|
||||
if ("csv".equals(type)) {
|
||||
this._exportCsv(model, request, response, redirectAttributes, "ssl_record", titleList, classMap,
|
||||
dataMap, noExportMap);
|
||||
} else {
|
||||
this._export(model, request, response, redirectAttributes, "ssl_record", titleList, classMap, dataMap,
|
||||
noExportMap);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("ssl_record export failed", e);
|
||||
addMessage(redirectAttributes, "error", "export_failed");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user