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");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -7,6 +7,9 @@
|
||||
</title>
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
|
||||
$("#searchForm [name='nasIp']").attr("placeholder","IPv4 0.0.0.0 or IPv6 ::");
|
||||
$("#searchForm [name='framedIp']").attr("placeholder","IPv4 0.0.0.0 or IPv6 ::");
|
||||
//reset
|
||||
$("#resetBtn").on("click",function(){
|
||||
$("select.selectpicker").each(function(){
|
||||
@@ -24,7 +27,7 @@
|
||||
filterActionInit();
|
||||
|
||||
|
||||
$("span[id^=close]").on("click",function(){
|
||||
$("span[id^=close]").on("click",function(){
|
||||
var closeId=$(this).attr("id");
|
||||
var openId=$(this).attr("id").replace("close","open");
|
||||
$("#"+closeId).hide();
|
||||
@@ -69,7 +72,7 @@
|
||||
</c:if>
|
||||
</c:forEach>
|
||||
</c:forEach>
|
||||
</form:select>
|
||||
</form:seleact>
|
||||
</div> --%>
|
||||
<div class="pull-left">
|
||||
<div class="input-group">
|
||||
@@ -95,6 +98,17 @@
|
||||
<button type="button" class="btn btn-default" id="filter-btn"> <spring:message code="filter"/><i class="fa fa-angle-double-down"></i></button>
|
||||
</div>
|
||||
<div class="pull-right">
|
||||
<%-- <div class="btn-group">
|
||||
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
|
||||
<i class="fa fa-wrench"></i> <spring:message code="export"></spring:message>
|
||||
<i class="fa fa-angle-down"></i>
|
||||
</button>
|
||||
<ul class="dropdown-menu pull-right">
|
||||
<li><sys:delRow url="${ctx}/log/ntc/radiusLogs/exportRadius?cfgid=" searchUrl="${ctx}/log/ntc/radiusLogs/list" id="contentTable" maxRow="10000" label="excel"></sys:delRow></li>
|
||||
<li><sys:delRow url="${ctx}/log/ntc/radiusLogs/exportRadius?cfgid=" searchUrl="${ctx}/log/ntc/radiusLogs/list" id="contentTable" maxRow="10000" label="csv"></sys:delRow></li>
|
||||
</ul>
|
||||
</div> --%>
|
||||
<sys:delRow url="${ctx}/log/ntc/radiusLogs/exportRadius?cfgid=" searchUrl="${ctx}/log/ntc/radiusLogs/list" id="contentTable" maxRow="10000" label="export"></sys:delRow>
|
||||
<a class="btn btn-icon-only btn-default setfields tooltips"
|
||||
data-container="body" data-placement="top" data-original-title=<spring:message code="custom_columns"/> href="javascript:;">
|
||||
<i class="icon-wrench"></i>
|
||||
@@ -164,11 +178,29 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-2">
|
||||
<%-- <div class="col-md-2">
|
||||
<label><spring:message code="cfg_id"></spring:message>:</label>
|
||||
<input name="cfgId" type="text" class="form-control logCfgId number" value="${log.cfgId }"/>
|
||||
</div> --%>
|
||||
<div class="col-md-2">
|
||||
<div class="form-group">
|
||||
<label><spring:message code="nas_ip"></spring:message>:</label>
|
||||
<input name="nasIp" type="text" class="form-control" value="${log.nasIp }"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<div class="form-group">
|
||||
<label><spring:message code="framed_ip"></spring:message>:</label>
|
||||
<input name="framedIp" type="text" class="form-control " value="${log.framedIp }"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<div class="form-group">
|
||||
<label><spring:message code="log_user_name"></spring:message>:</label>
|
||||
<input name="account" type="text" class="form-control " value="${log.account }"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /筛选搜索内容栏 结束-->
|
||||
</form:form>
|
||||
@@ -180,8 +212,8 @@
|
||||
<thead>
|
||||
<tr>
|
||||
<th><spring:message code="log"/></th>
|
||||
<th class="sort-column cfg_id " isVisible="false" ><spring:message code="cfg_id"/></th>
|
||||
<th class="sort-column service" isVisible="false"><spring:message code="action"/></th>
|
||||
<%-- <th class="sort-column cfg_id " isVisible="false" ><spring:message code="cfg_id"/></th>
|
||||
<th class="sort-column service" isVisible="false"><spring:message code="action"/></th> --%>
|
||||
<th class="sort-column found_time"><spring:message code="found_time"/></th>
|
||||
<th class="sort-column recv_time" isVisible="false"><spring:message code="recv_time"/></th>
|
||||
<th class="sort-column entrance_id" isVisible="false"><spring:message code="entrance_id"/></th>
|
||||
@@ -225,7 +257,7 @@
|
||||
<%-- <span id="open${status.index}" class="log-open-cfg" compileId="${log.cfgId }"> ▷ </span><span style="display: none" id="close${status.index}" > ▼ </span> --%>
|
||||
<a href="javascript:void(0)" name="viewLogInfo" ><i class="icon-book-open"></i></a>
|
||||
</td>
|
||||
<td>${log.cfgId }</td>
|
||||
<%-- <td>${log.cfgId }</td>
|
||||
<td>
|
||||
<c:set var="actions">${log.action }</c:set>
|
||||
<c:forEach items="${fns:getDictList('SERVICE_ACTION')}" var="dict">
|
||||
@@ -234,7 +266,7 @@
|
||||
</c:if>
|
||||
</c:forEach>
|
||||
<spring:message code="${actions}"/>
|
||||
</td>
|
||||
</td> --%>
|
||||
<td>${log.foundTime }</td>
|
||||
<td>${log.recvTime }</td>
|
||||
<td>
|
||||
|
||||
Reference in New Issue
Block a user