1.增加了导出日志时日志的检索条件

This commit is contained in:
lihaochen
2018-12-17 17:10:21 +08:00
parent e793aca0e1
commit fd5da887d6
6 changed files with 77 additions and 24 deletions

View File

@@ -91,13 +91,17 @@ public class DnsLogController extends BaseController {
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<NtcDnsLog> page = new PageLog<NtcDnsLog>(request, response);
List<NtcDnsLog> list = new ArrayList<NtcDnsLog>();
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());
if (StringUtils.isNotBlank(log.getQname())) {
params.put("searchQname", log.getQname());
}
initLogSearchValue(log, params);
List<FunctionServiceDict> serviceList = DictUtils.getFunctionServiceDictList(log.getFunctionId());
@@ -105,16 +109,15 @@ public class DnsLogController extends BaseController {
String url = Constants.LOG_BASE_URL + Constants.NTC_DNS_LOG;
String recv = HttpClientUtil.getMsg(url, params, request);
List<NtcDnsLog> list = new ArrayList<NtcDnsLog>();
if (StringUtils.isNotBlank(recv)) {
Gson gson = new GsonBuilder().create();
LogRecvData<NtcDnsLog> fromJson = gson.fromJson(recv, new TypeToken<LogRecvData<NtcDnsLog>>() {
}.getType());
if (fromJson.getStatus().intValue() == 200) {
Page<NtcDnsLog> data = fromJson.getData();
list = data.getList();
}
}
for (NtcDnsLog l : list) {
l.setFunctionId(log.getFunctionId());
setLogAction(l, serviceList);
@@ -132,8 +135,8 @@ public class DnsLogController extends BaseController {
dataMap.put("DNS", list);
/* } */
if ("csv".equals(type)) {
this._exportCsv(model, request, response, redirectAttributes, "DNS", titleList, classMap,
dataMap, noExportMap);
this._exportCsv(model, request, response, redirectAttributes, "DNS", titleList, classMap, dataMap,
noExportMap);
} else {
this._export(model, request, response, redirectAttributes, "DNS", titleList, classMap, dataMap,
noExportMap);

View File

@@ -99,6 +99,9 @@ public class HttpKeyLogController extends BaseController {
Map<String, Object> params = new HashMap<String, Object>();
params.put("pageSize", page.getPageSize());
params.put("pageNo", page.getPageNo());
if (StringUtils.isNotBlank(log.getUrl())) {
params.put("searchUrl", log.getUrl());
}
initLogSearchValue(log, params);
List<FunctionServiceDict> serviceList = DictUtils.getFunctionServiceDictList(log.getFunctionId());

View File

@@ -114,6 +114,22 @@ public class HttpLogController extends BaseController {
initLogSearchValue(log, params);
List<FunctionServiceDict> serviceList = DictUtils.getFunctionServiceDictList(log.getFunctionId());
serviceList.addAll(DictUtils.getFunctionServiceDictList(635));
for (FunctionServiceDict serviceDict : serviceList) {
if (serviceDict.getFunctionId() == log.getFunctionId()) {
if (serviceDict.getAction() == Constants.MONIT_ACTION) {
serviceDict.setActionCode("log_search_http_monit");
} else if (serviceDict.getAction() == Constants.REJECT_ACTION) {
serviceDict.setActionCode("log_search_http_reject");
}
} else {
if (serviceDict.getAction() == Constants.MONIT_ACTION) {
serviceDict.setActionCode("log_search_keyword_monit");
} else if (serviceDict.getAction() == Constants.REJECT_ACTION) {
serviceDict.setActionCode("log_search_keyword_reject");
}
}
}
model.addAttribute("serviceList", serviceList);
String url = Constants.LOG_BASE_URL + Constants.NTC_HTTP_LOG;
@@ -145,8 +161,8 @@ public class HttpLogController extends BaseController {
dataMap.put("HTTP", list);
/* } */
if ("csv".equals(type)) {
this._exportCsv(model, request, response, redirectAttributes, "HTTP", titleList, classMap,
dataMap, noExportMap);
this._exportCsv(model, request, response, redirectAttributes, "HTTP", titleList, classMap, dataMap,
noExportMap);
} else {
this._export(model, request, response, redirectAttributes, "HTTP", titleList, classMap, dataMap,
noExportMap);

View File

@@ -110,6 +110,17 @@ public class MailLogController extends BaseController {
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()));
}
List<FunctionServiceDict> serviceList = DictUtils.getFunctionServiceDictList(log.getFunctionId());
model.addAttribute("serviceList", serviceList);

View File

@@ -95,21 +95,25 @@ public class SslLogController extends BaseController {
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<NtcSslLog> page = new PageLog<NtcSslLog>(request, response);
List<NtcSslLog> list = new ArrayList<NtcSslLog>();
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_LOG;
String recv = HttpClientUtil.getMsg(url, params, request);
List<NtcSslLog> list = new ArrayList<NtcSslLog>();
if (StringUtils.isNotBlank(recv)) {
Gson gson = new GsonBuilder().create();
LogRecvData<NtcSslLog> fromJson = gson.fromJson(recv, new TypeToken<LogRecvData<NtcSslLog>>() {
@@ -136,8 +140,8 @@ public class SslLogController extends BaseController {
dataMap.put("ssl_control", list);
/* } */
if ("csv".equals(type)) {
this._exportCsv(model, request, response, redirectAttributes, "ssl_control", titleList, classMap, dataMap,
noExportMap);
this._exportCsv(model, request, response, redirectAttributes, "ssl_control", titleList, classMap,
dataMap, noExportMap);
} else {
this._export(model, request, response, redirectAttributes, "ssl_control", titleList, classMap, dataMap,
noExportMap);

View File

@@ -418,6 +418,7 @@ function cancelPassOpt(url){
//导出检索条件下所有数据
}else{
var totalCount = $("#showTotalCount").html() == undefined ? '' : $("#showTotalCount").html().trim();
if (!confirmEnding(url,"excel")&&!confirmEnding(url,"csv")) {
if(totalCount > maxRow){
top.$.jBox.confirm("<spring:message code='export_confirm_message'/>"+maxRow+"!","<spring:message code='info'/>",function(v,h,f){
if(v=="ok"){
@@ -433,6 +434,21 @@ function cancelPassOpt(url){
closeTip();
$("#searchForm").attr("action",searchUrl);
}
}else{
$("#searchForm").attr("action",url);
$("#searchForm").submit();
closeTip();
$("#searchForm").attr("action",searchUrl);
}
}
}
function confirmEnding(str, target) {
var result=true;
var num=str.indexOf(target);
if (-1==num) {
result=false;
}
return result;
}
</script>