radius日志增加导出
action和cfgid隐藏
This commit is contained in:
@@ -1,34 +1,53 @@
|
||||
package com.nis.domain.log;
|
||||
|
||||
import com.google.gson.annotations.Expose;
|
||||
import com.nis.domain.BaseEntity;
|
||||
import com.nis.util.excel.ExcelField;
|
||||
|
||||
public class BaseLogEntity<T> extends BaseEntity<T> {
|
||||
|
||||
private static final long serialVersionUID = 8321337584518281424L;
|
||||
|
||||
protected Integer cfgId;
|
||||
@ExcelField(title="found_time",sort=5)
|
||||
protected String foundTime; //发现时间,timestamp
|
||||
protected String recvTime; //接收时间,timestamp
|
||||
@ExcelField(title="transport_layer_protocol",dictType="LOG_PROTOCOL",sort=30)
|
||||
protected String transProto; //协议类型,从字典LOG_PROTOCOL取值
|
||||
@ExcelField(title="addr_type",dictType="IP_TYPE",sort=35)
|
||||
protected Integer addrType; //ip地址类型,从字典IP_TYPE取值
|
||||
@Expose
|
||||
@ExcelField(title="server_ip",sort=40)
|
||||
protected String dIp; //服务端ip地址
|
||||
@Expose
|
||||
@ExcelField(title="client_ip",sort=41)
|
||||
protected String sIp; //客户端ip地址
|
||||
@Expose
|
||||
@ExcelField(title="server_port",sort=42)
|
||||
protected String dPort; //服务端ip端口
|
||||
@Expose
|
||||
@ExcelField(title="client_port",sort=43)
|
||||
protected String sPort; //客户端ip端口
|
||||
protected Integer service; //配置表的serviceId
|
||||
protected Integer entranceId; //出入口编号
|
||||
protected Integer deviceId; //串联设备编号
|
||||
@ExcelField(title="direction",dictType="LOG_DIRECTION",sort=55)
|
||||
protected Integer direction; //传输方向 0:域内->域外,1:域外->域内,从字典LOG_DIRECTION取值
|
||||
@ExcelField(title="stream_type",dictType="LOG_STREAM_TYPE",sort=65)
|
||||
protected Integer streamDir; //流类型 0:c2s;1:s2c;2:double,从字典LOG_STREAMTYPE取值
|
||||
protected String capIp; //处理机IP
|
||||
@ExcelField(title="nest_addr_list",sort=66)
|
||||
protected String addrList; //嵌套地址列表
|
||||
@ExcelField(title="server_locate",sort=67)
|
||||
protected String serverLocate;// 服务端地址定位信息
|
||||
@ExcelField(title="client_locate",sort=68)
|
||||
protected String clientLocate;// 客户端地址定位信息
|
||||
protected String userRegion; //用户自定义
|
||||
protected String sAsn;//客户端ASN
|
||||
protected String dAsn;//服务端ASN
|
||||
protected String sSubscribeId;//客户端用户名
|
||||
protected String dSubscribeId;//服务端用户名
|
||||
@ExcelField(title="scene_file",sort=70)
|
||||
protected String sceneFile;//现场日志文件地址
|
||||
|
||||
protected Integer functionId;
|
||||
@@ -44,9 +63,12 @@ public class BaseLogEntity<T> extends BaseEntity<T> {
|
||||
protected String orderBy;//排序参数
|
||||
|
||||
//新增字段
|
||||
@ExcelField(title="encap_type",dictType="ENCAP_TYPE",sort=50)
|
||||
protected Integer encapType;//原始二层封装格式
|
||||
protected Integer linkId;//串联设备链路号
|
||||
@ExcelField(title="inner_smac",sort=58)
|
||||
protected String innerSmac;//MAC_IN_MAC的内层源MAC
|
||||
@ExcelField(title="inner_dmac",sort=59)
|
||||
protected String innerDmac;//MAC_IN_MAC的内层目标MAC
|
||||
|
||||
|
||||
|
||||
@@ -1,12 +1,18 @@
|
||||
package com.nis.domain.log;
|
||||
|
||||
import com.nis.util.excel.ExcelField;
|
||||
|
||||
public class NtcCollectRadiusLog extends BaseLogEntity<NtcCollectRadiusLog> {
|
||||
|
||||
private static final long serialVersionUID = -4947912502754359817L;
|
||||
|
||||
@ExcelField(title="message_type",dictType="MESSAGE_TYPE",sort=10)
|
||||
protected Integer code;
|
||||
@ExcelField(title="nas_ip",sort=15)
|
||||
protected String nasIp;
|
||||
@ExcelField(title="framed_ip",sort=20)
|
||||
protected String framedIp;
|
||||
@ExcelField(title="log_user_name",sort=25)
|
||||
protected String account;
|
||||
public Integer getCode() {
|
||||
return code;
|
||||
|
||||
@@ -40,7 +40,17 @@ public class Reflections {
|
||||
public static Object invokeGetter(Object obj, String propertyName) {
|
||||
Object object = obj;
|
||||
for (String name : StringUtils.split(propertyName, ".")){
|
||||
String getterMethodName = GETTER_PREFIX + StringUtils.capitalize(name);
|
||||
String getName=StringUtils.capitalize(name);
|
||||
if(getName.equals("SIp")){
|
||||
getName="sIp";
|
||||
}else if(getName.equals("DIp")){
|
||||
getName="dIp";
|
||||
}else if(getName.equals("DPort")){
|
||||
getName="dPort";
|
||||
}else if(getName.equals("SPort")){
|
||||
getName="sPort";
|
||||
}
|
||||
String getterMethodName = GETTER_PREFIX + getName;
|
||||
object = invokeMethod(object, getterMethodName, new Class[] {}, new Object[] {});
|
||||
}
|
||||
return object;
|
||||
|
||||
@@ -1997,7 +1997,7 @@ public class ExportExcel {
|
||||
val = getBasicInfo(ef.dictType(),map,valStr);
|
||||
}else{
|
||||
//字典数据已做国际化处理
|
||||
String dict=DictUtils.getDictLabel(ef.dictType(), valStr, "");
|
||||
String dict=DictUtils.getDictLabel(ef.dictType(), valStr, valStr);
|
||||
//如果找不到字典国际化值,把字典本身作为默认值放进去,不然导出就是空了
|
||||
val = msgProp.getProperty(dict,dict);
|
||||
}
|
||||
|
||||
@@ -1,26 +1,24 @@
|
||||
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.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.FunctionServiceDict;
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.PageLog;
|
||||
import com.nis.domain.log.IrDnatLog;
|
||||
import com.nis.domain.log.IrSnatLog;
|
||||
import com.nis.domain.log.NtcCollectRadiusLog;
|
||||
import com.nis.domain.maat.LogRecvData;
|
||||
import com.nis.util.Constants;
|
||||
@@ -33,14 +31,21 @@ import com.nis.web.controller.BaseController;
|
||||
public class NtcCollectRadiusLogController extends BaseController {
|
||||
|
||||
@RequestMapping(value = {"list", ""})
|
||||
public String list(@ModelAttribute("log") IrSnatLog log, Model model, HttpServletRequest request, HttpServletResponse response) {
|
||||
public String list(@ModelAttribute("log") NtcCollectRadiusLog log, Model model, HttpServletRequest request, HttpServletResponse response) {
|
||||
try {
|
||||
PageLog<NtcCollectRadiusLog> page = new PageLog<NtcCollectRadiusLog>(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.getNasIp())) {
|
||||
params.put("searchNasIp", log.getNasIp());
|
||||
}else if(StringUtils.isNotBlank(log.getFramedIp())) {
|
||||
params.put("searchFramedIp", log.getFramedIp());
|
||||
}else if(StringUtils.isNotBlank(log.getAccount())) {
|
||||
params.put("searchAccount", log.getAccount());
|
||||
}
|
||||
List<FunctionServiceDict> serviceList = DictUtils.getFunctionServiceDictList(log.getFunctionId());
|
||||
model.addAttribute("serviceList", serviceList);
|
||||
|
||||
@@ -71,4 +76,53 @@ public class NtcCollectRadiusLogController extends BaseController {
|
||||
return "/log/ntc/radiusLogList";
|
||||
}
|
||||
|
||||
//bgp配置导出
|
||||
@RequestMapping(value = "exportRadius")
|
||||
public void exportbgp(@ModelAttribute("log") NtcCollectRadiusLog log, Model model, 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<NtcCollectRadiusLog> page = new PageLog<NtcCollectRadiusLog>(request, response);
|
||||
page.setPageNo(1);
|
||||
page.setPageSize(Constants.MAX_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.getNasIp())) {
|
||||
params.put("searchNasIp", log.getNasIp());
|
||||
}else if(StringUtils.isNotBlank(log.getFramedIp())) {
|
||||
params.put("searchFramedIp", log.getFramedIp());
|
||||
}else if(StringUtils.isNotBlank(log.getAccount())) {
|
||||
params.put("searchAccount", log.getAccount());
|
||||
}
|
||||
List<NtcCollectRadiusLog> list=new ArrayList<NtcCollectRadiusLog>();
|
||||
String url =Constants.LOG_BASE_URL + Constants.NTC_COLLECT_RADIUS_LOG;
|
||||
String recv = HttpClientUtil.getMsg(url, params, request);
|
||||
if (StringUtils.isNotBlank(recv)) {
|
||||
Gson gson = new GsonBuilder().create();
|
||||
LogRecvData<NtcCollectRadiusLog> fromJson = gson.fromJson(recv, new TypeToken<LogRecvData<NtcCollectRadiusLog>>(){}.getType());
|
||||
if (fromJson.getStatus().intValue() == 200) {
|
||||
Page<NtcCollectRadiusLog> data = fromJson.getData();
|
||||
list= data.getList();
|
||||
}
|
||||
}
|
||||
titleList.add("radius_log");
|
||||
classMap.put("radius_log", NtcCollectRadiusLog.class);
|
||||
String cfgIndexInfoNoExport="";
|
||||
noExportMap.put("radius_log",cfgIndexInfoNoExport);
|
||||
dataMap.put("radius_log",list);
|
||||
/*}*/
|
||||
this._export(model, request, response, redirectAttributes,"radius_log",titleList,classMap,dataMap,noExportMap);
|
||||
} catch (Exception e) {
|
||||
logger.error("radius export failed",e);
|
||||
addMessage(redirectAttributes,"error","export_failed");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user