日志导出 首行添加标题和时间范围
This commit is contained in:
@@ -1,19 +1,27 @@
|
||||
package com.nis.domain.log;
|
||||
|
||||
import com.nis.util.excel.ExcelField;
|
||||
|
||||
public class IrDnatLog extends BaseLogEntity<IrDnatLog> {
|
||||
|
||||
private static final long serialVersionUID = 5860838446015457328L;
|
||||
|
||||
@ExcelField(title = "user", sort = 8)
|
||||
protected String userId;// 用户名
|
||||
@ExcelField(title = "nat_ip", sort = 9)
|
||||
protected String natIp;// 复用的ip地址
|
||||
@ExcelField(title = "creat_time", sort = 10)
|
||||
protected String creatTime;// 链接建立时间
|
||||
@ExcelField(title = "close_time", sort = 11)
|
||||
protected String closeTime;// 链接结束时间
|
||||
protected String c2sPktNum;// c2s包数
|
||||
protected String s2cPktNum;// s2c包数
|
||||
protected String c2sByteNum;// c2s字节数
|
||||
protected String s2cByteNum;// s2c字节数
|
||||
|
||||
|
||||
@ExcelField(title = "c2s_pkt_num", sort = 12)
|
||||
protected String c2sPktNum;
|
||||
@ExcelField(title = "s2c_pkt_num", sort = 13)
|
||||
protected String s2cPktNum;
|
||||
@ExcelField(title = "c2s_byte_num", sort = 14)
|
||||
protected String c2sByteNum;
|
||||
@ExcelField(title = "s2c_byte_num", sort = 15)
|
||||
protected String s2cByteNum;
|
||||
|
||||
public String getUserId() {
|
||||
return userId;
|
||||
|
||||
@@ -1,17 +1,25 @@
|
||||
package com.nis.domain.log;
|
||||
|
||||
import com.nis.util.excel.ExcelField;
|
||||
|
||||
public class IrSnatLog extends BaseLogEntity<IrSnatLog> {
|
||||
|
||||
private static final long serialVersionUID = 5860838446015457328L;
|
||||
|
||||
@ExcelField(title = "nat_ip", sort = 9)
|
||||
protected String natIp;// 复用的ip地址
|
||||
@ExcelField(title = "creat_time", sort = 10)
|
||||
protected String creatTime;// 链接建立时间
|
||||
@ExcelField(title = "close_time", sort = 11)
|
||||
protected String closeTime;// 链接结束时间
|
||||
protected String c2sPktNum;// c2s包数
|
||||
protected String s2cPktNum;// s2c包数
|
||||
protected String c2sByteNum;// c2s字节数
|
||||
protected String s2cByteNum;// s2c字节数
|
||||
|
||||
@ExcelField(title = "c2s_pkt_num", sort = 12)
|
||||
protected String c2sPktNum;
|
||||
@ExcelField(title = "s2c_pkt_num", sort = 13)
|
||||
protected String s2cPktNum;
|
||||
@ExcelField(title = "c2s_byte_num", sort = 14)
|
||||
protected String c2sByteNum;
|
||||
@ExcelField(title = "s2c_byte_num", sort = 15)
|
||||
protected String s2cByteNum;
|
||||
|
||||
public String getNatIp() {
|
||||
return natIp;
|
||||
|
||||
@@ -225,14 +225,14 @@ public class ExcelCsv {
|
||||
for (int i = 0; i < replaceStr.length; i++) {
|
||||
String [] fields=replaceStr[i].split(":");
|
||||
if(fields[0].equals(titleStr)){
|
||||
titleStr=msgProp.getProperty(fields[1]);
|
||||
titleStr=msgProp.getProperty(fields[1],fields[1]);
|
||||
flag=false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(flag){
|
||||
titleStr=msgProp.getProperty(titleStr)==null?titleStr:msgProp.getProperty(titleStr);
|
||||
titleStr=msgProp.getProperty(titleStr)==null?titleStr:msgProp.getProperty(titleStr,titleStr);
|
||||
}
|
||||
headerList.add(titleStr);
|
||||
commentList.add(commentStr);
|
||||
|
||||
@@ -2227,14 +2227,14 @@ public class ExportExcel {
|
||||
for (int i = 0; i < replaceStr.length; i++) {
|
||||
String [] fields=replaceStr[i].split(":");
|
||||
if(fields[0].equals(titleStr)){
|
||||
titleStr=msgProp.getProperty(fields[1]);
|
||||
titleStr=msgProp.getProperty(fields[1],fields[1]);
|
||||
flag=false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(flag){
|
||||
titleStr=msgProp.getProperty(titleStr)==null?titleStr:msgProp.getProperty(titleStr);
|
||||
titleStr=msgProp.getProperty(titleStr)==null?titleStr:msgProp.getProperty(titleStr,titleStr);
|
||||
}
|
||||
headerList.add(titleStr);
|
||||
commentList.add(commentStr);
|
||||
|
||||
@@ -2031,7 +2031,17 @@ public class BaseController {
|
||||
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||
ExcelCsv.writeCSVFile(response,titleList,headMap,dataList,fileName,titleTime,msgProp);
|
||||
}
|
||||
|
||||
public String initLogMap(BaseLogEntity log,String title){
|
||||
Properties msgProp = getMsgProp();
|
||||
String logTime=msgProp.getProperty(title,title);;
|
||||
if(log.getSearchFoundStartTime()!=null){
|
||||
logTime+=" "+msgProp.getProperty("begin_date")+":"+log.getSearchFoundStartTime();
|
||||
}
|
||||
if(log.getSearchFoundEndTime()!=null){
|
||||
logTime+=" "+msgProp.getProperty("end_date")+":"+log.getSearchFoundStartTime();
|
||||
}
|
||||
return logTime;
|
||||
}
|
||||
|
||||
public String initTimeMap(BaseCfg cfg){
|
||||
Properties msgProp = getMsgProp();
|
||||
|
||||
@@ -186,7 +186,8 @@ public class DkBehaviorLogController extends BaseController{
|
||||
String cfgIndexInfoNoExport = "," + hColumns;
|
||||
noExportMap.put(name, cfgIndexInfoNoExport);
|
||||
dataMap.put(name, list);
|
||||
|
||||
String timeRange= initLogMap(entry,name);
|
||||
noExportMap.put("timeRange", timeRange);
|
||||
if ("csv".equals(type)) {
|
||||
this._exportCsv(model, request, response, redirectAttributes, name, titleList, classMap,
|
||||
dataMap, noExportMap);
|
||||
|
||||
@@ -124,6 +124,8 @@ public class BgpLogController extends BaseController {
|
||||
String cfgIndexInfoNoExport = "," + hColumns;
|
||||
noExportMap.put("bgp_control", cfgIndexInfoNoExport);
|
||||
dataMap.put("bgp_control", list);
|
||||
String timeRange= initLogMap(log,"bgp_control");
|
||||
noExportMap.put("timeRange", timeRange);
|
||||
/* } */
|
||||
if ("csv".equals(types)) {
|
||||
this._exportCsv(model, request, response, redirectAttributes, "bgp_control", titleList, classMap,
|
||||
|
||||
@@ -7,6 +7,7 @@ import java.util.Date;
|
||||
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;
|
||||
@@ -31,6 +32,7 @@ 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.BaseLogEntity;
|
||||
import com.nis.domain.log.NtcBGPLog;
|
||||
import com.nis.domain.log.NtcCollectRadiusLog;
|
||||
import com.nis.domain.log.NtcCollectVoipLog;
|
||||
@@ -278,6 +280,8 @@ public class CollectVoipLogController extends BaseController {
|
||||
String cfgIndexInfoNoExport = ",cfg_id,action," + hColumns;
|
||||
noExportMap.put("collect_voip", cfgIndexInfoNoExport);
|
||||
dataMap.put("collect_voip", list);
|
||||
String timeRange= initLogVoipMap(entry,"collect_voip");
|
||||
noExportMap.put("timeRange", timeRange);
|
||||
/* } */
|
||||
if ("csv".equals(type)) {
|
||||
this._exportCsv(model, request, response, redirectAttributes, "collect_voip", titleList, classMap,
|
||||
@@ -291,6 +295,20 @@ public class CollectVoipLogController extends BaseController {
|
||||
addMessage(redirectAttributes, "error", "export_failed");
|
||||
}
|
||||
}
|
||||
|
||||
public String initLogVoipMap(NtcCollectVoipLog log,String title){
|
||||
Properties msgProp = getMsgProp();
|
||||
String logTime=msgProp.getProperty(title,title);;
|
||||
if(log.getSearchFoundStartTime()!=null){
|
||||
logTime+=" "+msgProp.getProperty("begin_date")+":"+log.getSearchFoundStartTime();
|
||||
}
|
||||
if(log.getSearchFoundEndTime()!=null){
|
||||
logTime+=" "+msgProp.getProperty("end_date")+":"+log.getSearchFoundStartTime();
|
||||
}
|
||||
return logTime;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public List<NtcCollectVoipLog> getList() {
|
||||
List<NtcCollectVoipLog> list = new ArrayList<NtcCollectVoipLog>();
|
||||
|
||||
@@ -170,7 +170,8 @@ public class DdosLogController extends BaseController{
|
||||
String cfgIndexInfoNoExport = "," + hColumns;
|
||||
noExportMap.put("target_ip_protect", cfgIndexInfoNoExport);
|
||||
dataMap.put("target_ip_protect", list);
|
||||
|
||||
String timeRange= initLogMap(log,"target_ip_protect");
|
||||
noExportMap.put("timeRange", timeRange);
|
||||
if ("csv".equals(type)) {
|
||||
this._exportCsv(model, request, response, redirectAttributes, "target_ip_protect", titleList, classMap, dataMap,
|
||||
noExportMap);
|
||||
|
||||
@@ -133,6 +133,8 @@ public class DnsLogController extends BaseController {
|
||||
String cfgIndexInfoNoExport = "," + hColumns;
|
||||
noExportMap.put("DNS", cfgIndexInfoNoExport);
|
||||
dataMap.put("DNS", list);
|
||||
String timeRange= initLogMap(log,"DNS");
|
||||
noExportMap.put("timeRange", timeRange);
|
||||
/* } */
|
||||
if ("csv".equals(type)) {
|
||||
this._exportCsv(model, request, response, redirectAttributes, "DNS", titleList, classMap, dataMap,
|
||||
|
||||
@@ -144,6 +144,8 @@ public class FtpLogController extends BaseController {
|
||||
String cfgIndexInfoNoExport = "," + hColumns;
|
||||
noExportMap.put("ftp_control", cfgIndexInfoNoExport);
|
||||
dataMap.put("ftp_control", list);
|
||||
String timeRange= initLogMap(log,"ftp_control");
|
||||
noExportMap.put("timeRange", timeRange);
|
||||
/* } */
|
||||
if ("csv".equals(type)) {
|
||||
this._exportCsv(model, request, response, redirectAttributes, "ftp_control", titleList, classMap,
|
||||
|
||||
@@ -147,8 +147,8 @@ public class HttpKeyLogController extends BaseController {
|
||||
String cfgIndexInfoNoExport = "," + hColumns;
|
||||
noExportMap.put("http_keyword", cfgIndexInfoNoExport);
|
||||
dataMap.put("http_keyword", list);
|
||||
// String timeRange= initLogMap(log,"http_keyword");
|
||||
// noExportMap.put("timeRange", timeRange);
|
||||
String timeRange= initLogMap(log,"http_keyword");
|
||||
noExportMap.put("timeRange", timeRange);
|
||||
/* } */
|
||||
if ("csv".equals(type)) {
|
||||
this._exportCsv(model, request, response, redirectAttributes, "http_keyword", titleList, classMap,
|
||||
|
||||
@@ -143,8 +143,8 @@ public class HttpLogController extends BaseController {
|
||||
String cfgIndexInfoNoExport = "," + hColumns;
|
||||
noExportMap.put("HTTP", cfgIndexInfoNoExport);
|
||||
dataMap.put("HTTP", list);
|
||||
/*String timeRange= initLogMap(log,"HTTP");
|
||||
noExportMap.put("timeRange", timeRange);*/
|
||||
String timeRange= initLogMap(log,"HTTP");
|
||||
noExportMap.put("timeRange", timeRange);
|
||||
/* } */
|
||||
if ("csv".equals(type)) {
|
||||
this._exportCsv(model, request, response, redirectAttributes, "HTTP", titleList, classMap, dataMap,
|
||||
|
||||
@@ -1,25 +1,18 @@
|
||||
package com.nis.web.controller.log.ntc;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
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.lang3.StringUtils;
|
||||
import org.aspectj.util.FileUtil;
|
||||
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.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
@@ -27,11 +20,8 @@ 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.NtcHttpLog;
|
||||
import com.nis.domain.log.NtcIpLog;
|
||||
import com.nis.domain.log.NtcIpLog;
|
||||
import com.nis.domain.maat.LogRecvData;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.DictUtils;
|
||||
import com.nis.util.httpclient.HttpClientUtil;
|
||||
@@ -138,7 +128,6 @@ public class IpLogController extends BaseController {
|
||||
List<FunctionServiceDict> serviceList = DictUtils.getFunctionServiceDictList(log.getFunctionId());
|
||||
model.addAttribute("serviceList", serviceList);
|
||||
|
||||
|
||||
String url = Constants.LOG_BASE_URL + Constants.NTC_IP_LOG;
|
||||
String recv = HttpClientUtil.getMsg(url, params, request);
|
||||
List<NtcIpLog> list = new ArrayList<NtcIpLog>();
|
||||
@@ -156,8 +145,8 @@ public class IpLogController extends BaseController {
|
||||
setLogAction(l, serviceList);
|
||||
}
|
||||
|
||||
titleList.add("Ip");
|
||||
classMap.put("Ip", NtcIpLog.class);
|
||||
titleList.add("ip_control");
|
||||
classMap.put("ip_control", NtcIpLog.class);
|
||||
SysUser user = UserUtils.getUser();
|
||||
if (!user.isAdmin()) {
|
||||
hColumns += ",scene_file,";
|
||||
@@ -165,14 +154,15 @@ public class IpLogController extends BaseController {
|
||||
hColumns += ",";
|
||||
}
|
||||
String cfgIndexInfoNoExport = "," + hColumns;
|
||||
noExportMap.put("Ip", cfgIndexInfoNoExport);
|
||||
dataMap.put("Ip", list);
|
||||
|
||||
noExportMap.put("ip_control", cfgIndexInfoNoExport);
|
||||
dataMap.put("ip_control", list);
|
||||
String timeRange= initLogMap(log,"ip_control");
|
||||
noExportMap.put("timeRange", timeRange);
|
||||
if ("csv".equals(type)) {
|
||||
this._exportCsv(model, request, response, redirectAttributes, "Ip", titleList, classMap,
|
||||
this._exportCsv(model, request, response, redirectAttributes, "ip_control", titleList, classMap,
|
||||
dataMap, noExportMap);
|
||||
} else {
|
||||
this._export(model, request, response, redirectAttributes, "Ip", titleList, classMap, dataMap,
|
||||
this._export(model, request, response, redirectAttributes, "ip_control", titleList, classMap, dataMap,
|
||||
noExportMap);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.nis.web.controller.log.ntc;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -12,6 +13,7 @@ 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;
|
||||
@@ -19,13 +21,14 @@ 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.IrDnatLog;
|
||||
import com.nis.domain.log.NtcIpsecLog;
|
||||
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/irDnatLogs")
|
||||
@@ -70,4 +73,69 @@ public class IrDnatLogController extends BaseController {
|
||||
return "/log/ntc/irDnatLogList";
|
||||
}
|
||||
|
||||
|
||||
// Ip配置导出
|
||||
@RequestMapping(value = "exportDnat")
|
||||
public void exportIp(@ModelAttribute("log") IrDnatLog 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>();
|
||||
// ---------------------------
|
||||
List<IrDnatLog> list = new ArrayList<IrDnatLog>();
|
||||
PageLog<IrDnatLog> page = new PageLog<IrDnatLog>(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);
|
||||
|
||||
List<FunctionServiceDict> serviceList = DictUtils.getFunctionServiceDictList(log.getFunctionId());
|
||||
model.addAttribute("serviceList", serviceList);
|
||||
|
||||
String url = Constants.LOG_BASE_URL + Constants.IR_DNAT_LOG;
|
||||
String recv = HttpClientUtil.getMsg(url, params, request);
|
||||
|
||||
if (StringUtils.isNotBlank(recv)) {
|
||||
Gson gson = new GsonBuilder().create();
|
||||
LogRecvData<IrDnatLog> fromJson = gson.fromJson(recv, new TypeToken<LogRecvData<IrDnatLog>>(){}.getType());
|
||||
if (fromJson.getStatus().intValue() == 200) {
|
||||
Page<IrDnatLog> data = fromJson.getData();
|
||||
list = data.getList();
|
||||
}
|
||||
}
|
||||
for (IrDnatLog l : list) {
|
||||
l.setFunctionId(log.getFunctionId());
|
||||
setLogAction(l,serviceList);
|
||||
}
|
||||
titleList.add("dnat_multiplex");
|
||||
classMap.put("dnat_multiplex", IrDnatLog.class);
|
||||
SysUser user = UserUtils.getUser();
|
||||
if (!user.isAdmin()) {
|
||||
hColumns += ",scene_file,";
|
||||
} else {
|
||||
hColumns += ",";
|
||||
}
|
||||
String cfgIndexInfoNoExport = "," + hColumns;
|
||||
noExportMap.put("dnat_multiplex", cfgIndexInfoNoExport);
|
||||
dataMap.put("dnat_multiplex", list);
|
||||
String timeRange= initLogMap(log,"dnat_multiplex");
|
||||
noExportMap.put("timeRange", timeRange);
|
||||
if ("csv".equals(type)) {
|
||||
this._exportCsv(model, request, response, redirectAttributes, "dnat_multiplex", titleList, classMap,
|
||||
dataMap, noExportMap);
|
||||
} else {
|
||||
this._export(model, request, response, redirectAttributes, "dnat_multiplex", titleList, classMap, dataMap,
|
||||
noExportMap);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("dnat_multiplex export failed", e);
|
||||
addMessage(redirectAttributes, "error", "export_failed");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.nis.web.controller.log.ntc;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -12,6 +13,7 @@ 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;
|
||||
@@ -19,13 +21,14 @@ 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.log.IrDnatLog;
|
||||
import com.nis.domain.SysUser;
|
||||
import com.nis.domain.log.IrSnatLog;
|
||||
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/irSnatLogs")
|
||||
@@ -71,4 +74,70 @@ public class IrSnatLogController extends BaseController {
|
||||
return "/log/ntc/irSnatLogList";
|
||||
}
|
||||
|
||||
// Ip配置导出
|
||||
@RequestMapping(value = "exportSnat")
|
||||
public void exportIp(@ModelAttribute("log") IrSnatLog 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>();
|
||||
// ---------------------------
|
||||
List<IrSnatLog> list = new ArrayList<IrSnatLog>();
|
||||
PageLog<IrSnatLog> page = new PageLog<IrSnatLog>(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);
|
||||
|
||||
List<FunctionServiceDict> serviceList = DictUtils.getFunctionServiceDictList(log.getFunctionId());
|
||||
model.addAttribute("serviceList", serviceList);
|
||||
|
||||
String url = Constants.LOG_BASE_URL + Constants.IR_SNAT_LOG;
|
||||
String recv = HttpClientUtil.getMsg(url, params, request);
|
||||
|
||||
if (StringUtils.isNotBlank(recv)) {
|
||||
Gson gson = new GsonBuilder().create();
|
||||
LogRecvData<IrSnatLog> fromJson = gson.fromJson(recv, new TypeToken<LogRecvData<IrSnatLog>>(){}.getType());
|
||||
if (fromJson.getStatus().intValue() == 200) {
|
||||
Page<IrSnatLog> data = fromJson.getData();
|
||||
list = data.getList();
|
||||
}
|
||||
}
|
||||
for (IrSnatLog l : list) {
|
||||
l.setFunctionId(log.getFunctionId());
|
||||
setLogAction(l,serviceList);
|
||||
}
|
||||
|
||||
titleList.add("snat_multiplex");
|
||||
classMap.put("snat_multiplex", IrSnatLog.class);
|
||||
SysUser user = UserUtils.getUser();
|
||||
if (!user.isAdmin()) {
|
||||
hColumns += ",scene_file,";
|
||||
} else {
|
||||
hColumns += ",";
|
||||
}
|
||||
String cfgIndexInfoNoExport = "," + hColumns;
|
||||
noExportMap.put("snat_multiplex", cfgIndexInfoNoExport);
|
||||
dataMap.put("snat_multiplex", list);
|
||||
String timeRange= initLogMap(log,"snat_multiplex");
|
||||
noExportMap.put("timeRange", timeRange);
|
||||
if ("csv".equals(type)) {
|
||||
this._exportCsv(model, request, response, redirectAttributes, "snat_multiplex", titleList, classMap,
|
||||
dataMap, noExportMap);
|
||||
} else {
|
||||
this._export(model, request, response, redirectAttributes, "snat_multiplex", titleList, classMap, dataMap,
|
||||
noExportMap);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("snat_multiplex export failed", e);
|
||||
addMessage(redirectAttributes, "error", "export_failed");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -151,6 +151,8 @@ public class MailLogController extends BaseController {
|
||||
String cfgIndexInfoNoExport = "," + hColumns;
|
||||
noExportMap.put("mail_control", cfgIndexInfoNoExport);
|
||||
dataMap.put("mail_control", list);
|
||||
String timeRange= initLogMap(log,"mail_control");
|
||||
noExportMap.put("timeRange", timeRange);
|
||||
/* } */
|
||||
if ("csv".equals(type)) {
|
||||
this._exportCsv(model, request, response, redirectAttributes, "mail_control", titleList, classMap,
|
||||
|
||||
@@ -147,6 +147,8 @@ public class MmAvUrlLogController extends BaseController {
|
||||
String cfgIndexInfoNoExport = "," + hColumns;
|
||||
noExportMap.put("streaming_media", cfgIndexInfoNoExport);
|
||||
dataMap.put("streaming_media", list);
|
||||
String timeRange= initLogMap(log,"streaming_media");
|
||||
noExportMap.put("timeRange", timeRange);
|
||||
/* } */
|
||||
if ("csv".equals(type)) {
|
||||
this._exportCsv(model, request, response, redirectAttributes, "streaming_media", titleList, classMap,
|
||||
|
||||
@@ -146,7 +146,8 @@ public class MmFileDigestLogController extends BaseController {
|
||||
String cfgIndexInfoNoExport = ",log_uri,direction," + hColumns;
|
||||
noExportMap.put("file_digest_control", cfgIndexInfoNoExport);
|
||||
dataMap.put("file_digest_control", list);
|
||||
|
||||
String timeRange= initLogMap(log,"file_digest_control");
|
||||
noExportMap.put("timeRange", timeRange);
|
||||
if ("csv".equals(type)) {
|
||||
this._exportCsv(model, request, response, redirectAttributes, "file_digest_control", titleList, classMap, dataMap,
|
||||
noExportMap);
|
||||
|
||||
@@ -169,6 +169,8 @@ public class MmPornAvSampleController extends BaseController {
|
||||
String cfgIndexInfoNoExport=","+hColumns;
|
||||
noExportMap.put("av_sample_video_porn_control",cfgIndexInfoNoExport);
|
||||
dataMap.put("av_sample_video_porn_control",list);
|
||||
String timeRange= initLogMap(log,"av_sample_video_porn_control");
|
||||
noExportMap.put("timeRange", timeRange);
|
||||
/*}*/
|
||||
if("csv".equals(type)){
|
||||
this._exportCsv(model, request, response, redirectAttributes,"av_sample_video_porn_control",titleList,classMap,dataMap,noExportMap);
|
||||
|
||||
@@ -127,7 +127,8 @@ public class MmSampleAudioController extends BaseController{
|
||||
String cfgIndexInfoNoExport = ",direction," + hColumns;
|
||||
noExportMap.put("av_sample_audio_control", cfgIndexInfoNoExport);
|
||||
dataMap.put("av_sample_audio_control", list);
|
||||
|
||||
String timeRange= initLogMap(log,"av_sample_audio_control");
|
||||
noExportMap.put("timeRange", timeRange);
|
||||
if ("csv".equals(type)) {
|
||||
this._exportCsv(model, request, response, redirectAttributes, "av_sample_audio_control", titleList, classMap, dataMap,
|
||||
noExportMap);
|
||||
|
||||
@@ -112,8 +112,8 @@ public class MmSamplePicController extends BaseController{
|
||||
l.setFunctionId(log.getFunctionId());
|
||||
setLogAction(l, serviceList);
|
||||
}
|
||||
titleList.add("SamplePic");
|
||||
classMap.put("SamplePic", MmSamplePicLog.class);
|
||||
titleList.add("av_sample_picture_control");
|
||||
classMap.put("av_sample_picture_control", MmSamplePicLog.class);
|
||||
SysUser user = UserUtils.getUser();
|
||||
if (!user.isAdmin()) {
|
||||
hColumns += ",scene_file,";
|
||||
@@ -123,7 +123,8 @@ public class MmSamplePicController extends BaseController{
|
||||
String cfgIndexInfoNoExport = ",direction," + hColumns;
|
||||
noExportMap.put("av_sample_picture_control", cfgIndexInfoNoExport);
|
||||
dataMap.put("av_sample_picture_control", list);
|
||||
|
||||
String timeRange= initLogMap(log,"av_sample_picture_control");
|
||||
noExportMap.put("timeRange", timeRange);
|
||||
if ("csv".equals(type)) {
|
||||
this._exportCsv(model, request, response, redirectAttributes, "av_sample_picture_control", titleList, classMap,
|
||||
dataMap, noExportMap);
|
||||
|
||||
@@ -123,7 +123,8 @@ public class MmSampleVideoController extends BaseController{
|
||||
String cfgIndexInfoNoExport = ",direction," + hColumns;
|
||||
noExportMap.put("av_sample_video_control", cfgIndexInfoNoExport);
|
||||
dataMap.put("av_sample_video_control", list);
|
||||
|
||||
String timeRange= initLogMap(log,"av_sample_video_control");
|
||||
noExportMap.put("timeRange", timeRange);
|
||||
if ("csv".equals(type)) {
|
||||
this._exportCsv(model, request, response, redirectAttributes, "av_sample_video_control", titleList, classMap, dataMap,
|
||||
noExportMap);
|
||||
|
||||
@@ -131,6 +131,8 @@ public class MmSampleVoipLogController extends BaseController {
|
||||
String cfgIndexInfoNoExport=","+hColumns;
|
||||
noExportMap.put("av_sample_voip_control",cfgIndexInfoNoExport);
|
||||
dataMap.put("av_sample_voip_control",list);
|
||||
String timeRange= initLogMap(log,"av_sample_voip_control");
|
||||
noExportMap.put("timeRange", timeRange);
|
||||
/*}*/
|
||||
if("csv".equals(type)){
|
||||
this._exportCsv(model, request, response, redirectAttributes,"av_sample_voip_control",titleList,classMap,dataMap,noExportMap);
|
||||
|
||||
@@ -142,6 +142,8 @@ public class MmVoipIpLogController extends BaseController {
|
||||
String cfgIndexInfoNoExport = "," + hColumns;
|
||||
noExportMap.put("av_voip_control", cfgIndexInfoNoExport);
|
||||
dataMap.put("av_voip_control", list);
|
||||
String timeRange= initLogMap(log,"av_voip_control");
|
||||
noExportMap.put("timeRange", timeRange);
|
||||
/* } */
|
||||
if ("csv".equals(type)) {
|
||||
this._exportCsv(model, request, response, redirectAttributes, "av_voip_control", titleList, classMap,
|
||||
|
||||
@@ -127,6 +127,9 @@ public class NtcCollectRadiusLogController extends BaseController {
|
||||
String cfgIndexInfoNoExport=",cfg_id,action,"+hColumns;
|
||||
noExportMap.put("radius_log",cfgIndexInfoNoExport);
|
||||
dataMap.put("radius_log",list);
|
||||
String timeRange= initLogMap(log,"radius_log");
|
||||
noExportMap.put("timeRange", timeRange);
|
||||
|
||||
/*}*/
|
||||
if("csv".equals(type)){
|
||||
this._exportCsv(model, request, response, redirectAttributes,"radius_log",titleList,classMap,dataMap,noExportMap);
|
||||
|
||||
@@ -180,6 +180,8 @@ public class NtcConnRecordLogController extends BaseController {
|
||||
String cfgIndexInfoNoExport = ",cfg_id,action," + hColumns;
|
||||
noExportMap.put("conn_record", cfgIndexInfoNoExport);
|
||||
dataMap.put("conn_record", list);
|
||||
String timeRange= initLogMap(log,"conn_record");
|
||||
noExportMap.put("timeRange", timeRange);
|
||||
/* } */
|
||||
if ("csv".equals(type)) {
|
||||
this._exportCsv(model, request, response, redirectAttributes, "conn_record", titleList, classMap,
|
||||
|
||||
@@ -122,8 +122,8 @@ public class OpenVpnLogController extends BaseController{
|
||||
list= data.getList();
|
||||
}
|
||||
}
|
||||
titleList.add("openVpn_log");
|
||||
classMap.put("openVpn_log", NtcOpenVpnLog.class);
|
||||
titleList.add("spoofing_ip_policy");
|
||||
classMap.put("spoofing_ip_policy", NtcOpenVpnLog.class);
|
||||
SysUser user =UserUtils.getUser();
|
||||
if (!user.isAdmin()){
|
||||
hColumns+=",scene_file,";
|
||||
@@ -131,13 +131,15 @@ public class OpenVpnLogController extends BaseController{
|
||||
hColumns+=",";
|
||||
}
|
||||
String cfgIndexInfoNoExport=",cfg_id,action,"+hColumns;
|
||||
noExportMap.put("openVpn_log",cfgIndexInfoNoExport);
|
||||
dataMap.put("openVpn_log",list);
|
||||
noExportMap.put("spoofing_ip_policy",cfgIndexInfoNoExport);
|
||||
dataMap.put("spoofing_ip_policy",list);
|
||||
String timeRange= initLogMap(log,"spoofing_ip_policy");
|
||||
noExportMap.put("timeRange", timeRange);
|
||||
/*}*/
|
||||
if("csv".equals(type)){
|
||||
this._exportCsv(model, request, response, redirectAttributes,"openVpn_log",titleList,classMap,dataMap,noExportMap);
|
||||
this._exportCsv(model, request, response, redirectAttributes,"spoofing_ip_policy",titleList,classMap,dataMap,noExportMap);
|
||||
}else{
|
||||
this._export(model, request, response, redirectAttributes,"openVpn_log",titleList,classMap,dataMap,noExportMap);
|
||||
this._export(model, request, response, redirectAttributes,"spoofing_ip_policy",titleList,classMap,dataMap,noExportMap);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("openVpn export failed",e);
|
||||
|
||||
@@ -128,6 +128,8 @@ public class P2pLogController extends BaseController {
|
||||
String cfgIndexInfoNoExport = "," + hColumns;
|
||||
noExportMap.put("p2p_control", cfgIndexInfoNoExport);
|
||||
dataMap.put("p2p_control", list);
|
||||
String timeRange= initLogMap(log,"p2p_control");
|
||||
noExportMap.put("timeRange", timeRange);
|
||||
/* } */
|
||||
if ("csv".equals(type)) {
|
||||
this._exportCsv(model, request, response, redirectAttributes, "p2p_control", titleList, classMap,
|
||||
|
||||
@@ -138,6 +138,8 @@ public class SslLogController extends BaseController {
|
||||
String cfgIndexInfoNoExport = "," + hColumns;
|
||||
noExportMap.put("ssl_control", cfgIndexInfoNoExport);
|
||||
dataMap.put("ssl_control", list);
|
||||
String timeRange= initLogMap(log,"ssl_control");
|
||||
noExportMap.put("timeRange", timeRange);
|
||||
/* } */
|
||||
if ("csv".equals(type)) {
|
||||
this._exportCsv(model, request, response, redirectAttributes, "ssl_control", titleList, classMap,
|
||||
|
||||
@@ -178,8 +178,8 @@ public class PxyHttpLogController extends BaseController {
|
||||
String cfgIndexInfoNoExport = "," + hColumns;
|
||||
noExportMap.put(pxyName, cfgIndexInfoNoExport);
|
||||
dataMap.put(pxyName, list);
|
||||
/*String timeRange= initLogMap(log,pxyName);
|
||||
noExportMap.put("timeRange", timeRange);*/
|
||||
String timeRange= initLogMap(log,pxyName);
|
||||
noExportMap.put("timeRange", timeRange);
|
||||
if ("csv".equals(type)) {
|
||||
this._exportCsv(model, request, response, redirectAttributes, pxyName, titleList, classMap,
|
||||
dataMap, noExportMap);
|
||||
|
||||
Reference in New Issue
Block a user