1.修改日志邮件界面,CfgId查询条件不能为0
2.新增日志邮件泛收界面(cfg_id=0),进行查询和导出 3.新增日志SSL泛收界面,进行查询和导出
This commit is contained in:
@@ -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