ntc-ip日志查询(部分)

This commit is contained in:
chenjinsong
2018-06-13 14:36:58 +08:00
parent 84b36b08e3
commit a18ddf2d46
6 changed files with 363 additions and 47 deletions

View File

@@ -11,23 +11,25 @@ public class BaseLogEntity<T> extends BaseEntity<T> {
private static final long serialVersionUID = 8321337584518281424L;
private Integer cfgId;
private String foundTime; //发现时间timestamp
private String recvTime; //接收时间timestamp
private String protocol; //协议类型从字典LOG_PROTOCOL取值
private Integer addrType; //ip地址类型从字典IP_TYPE取值
private String serverIp; //服务端ip地址
private String clientIp; //客户端ip地址
private String serverPort; //服务端ip端口
private String clientPort; //客户端ip端口
private Integer serviceType; //配置表的serviceId
private Integer entranceId; //出入口编号
private Integer deviceId; //串联设备编号
private Integer direction; //传输方向 0域内->域外1域外->域内从字典LOG_DIRECTION取值
private Integer streamType; //流类型 0c2s1s2c2double从字典LOG_STREAMTYPE取值
private String cljIp; //处理机IP
private String nestAddrList; //嵌套地址列表
private String userRegion; //用户自定义
protected Integer cfgId;
protected String foundTime; //发现时间timestamp
protected String recvTime; //接收时间timestamp
protected String protocol; //协议类型从字典LOG_PROTOCOL取值
protected Integer addrType; //ip地址类型从字典IP_TYPE取值
protected String serverIp; //服务端ip地址
protected String clientIp; //客户端ip地址
protected String serverPort; //服务端ip端口
protected String clientPort; //客户端ip端口
protected Integer serviceType; //配置表的serviceId
protected Integer entranceId; //出入口编号
protected Integer deviceId; //串联设备编号
protected Integer direction; //传输方向 0域内->域外1域外->域内从字典LOG_DIRECTION取值
protected Integer streamType; //流类型 0c2s1s2c2double从字典LOG_STREAMTYPE取值
protected String cljIp; //处理机IP
protected String nestAddrList; //嵌套地址列表
protected String userRegion; //用户自定义
protected Integer functionId;
//自定义字段
protected String seltype;//选中类型,页面搜索用
@@ -35,6 +37,12 @@ public class BaseLogEntity<T> extends BaseEntity<T> {
protected String searchFoundEndTime;//结束时间,格式同上
public Integer getFunctionId() {
return functionId;
}
public void setFunctionId(Integer functionId) {
this.functionId = functionId;
}
public String getFoundTime() {
return foundTime;
}

View File

@@ -4,34 +4,4 @@ public class NtcIpLog extends BaseLogEntity<NtcIpLog> {
private static final long serialVersionUID = 4597407682545926823L;
private String version;
private String sni;
private String san;
private String ca;
public String getVersion() {
return version;
}
public void setVersion(String version) {
this.version = version;
}
public String getSni() {
return sni;
}
public void setSni(String sni) {
this.sni = sni;
}
public String getSan() {
return san;
}
public void setSan(String san) {
this.san = san;
}
public String getCa() {
return ca;
}
public void setCa(String ca) {
this.ca = ca;
}
}

View File

@@ -44,6 +44,7 @@ import com.nis.domain.configuration.IpCfgTemplate;
import com.nis.domain.configuration.NumBoundaryCfg;
import com.nis.domain.configuration.RequestInfo;
import com.nis.domain.configuration.StringCfgTemplate;
import com.nis.domain.log.BaseLogEntity;
import com.nis.util.Configurations;
//import com.nis.main.ConvertTool;
import com.nis.util.Constants;
@@ -470,4 +471,9 @@ public class BaseController {
e.printStackTrace();
}
}
public void initLogServiceType(Model model, BaseLogEntity log) {
List<FunctionServiceDict> serviceList = DictUtils.getFunctionServiceDictList(log.getFunctionId());
model.addAttribute("serviceList", serviceList);
}
}

View File

@@ -0,0 +1,68 @@
package com.nis.web.controller.log.ntc;
import java.io.File;
import java.io.IOException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
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 com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonSyntaxException;
import com.google.gson.reflect.TypeToken;
import com.nis.domain.Page;
import com.nis.domain.log.NtcIpLog;
import com.nis.domain.maat.LogRecvData;
import com.nis.web.controller.BaseController;
@Controller
@RequestMapping("${adminPath}/log/ntc/ip")
public class NtcIpLogController extends BaseController {
@RequestMapping("list")
public String list(@ModelAttribute("log") NtcIpLog log, Model model, HttpServletRequest request, HttpServletResponse response) {
//初始化action
initLogServiceType(model, log);
Page<NtcIpLog> page = new Page<NtcIpLog>(request, response);
int pageNo = page.getPageNo();
String recv = null;
try {
String path = request.getClass().getClassLoader().getResource("").getPath();
recv = FileUtil.readAsString(new File(path + "com/nis/web/test/logTest.txt"));
} catch (IOException e) {
e.printStackTrace();
}
logger.info("NTC-IP查询结果" + recv);
Gson gson = new GsonBuilder().create();
try {
LogRecvData<NtcIpLog> fromJson = gson.fromJson(recv, new TypeToken<LogRecvData<NtcIpLog>>(){}.getType());
if (fromJson.getStatus().intValue() == 200) {
logger.info("查询状态:成功");
BeanUtils.copyProperties(fromJson.getData(), page);
model.addAttribute("page", page);
}
} catch (JsonSyntaxException e) {
e.printStackTrace();
}
return "/log/ntc/ipList";
}
@RequestMapping("form")
public String form() {
return "";
}
}

View File

@@ -0,0 +1,53 @@
{
"status":200,
"businessCode":2000,
"reason":"Success",
"msg":"success",
"fromuri":"abc",
"logSource":0,
"data":{
"pageNo":2,
"pageSize":20,
"count":41,
"last":3,
"list":[
{
"cfgId":21,
"foundTime":"2018-06-10 10:10:10",
"recvTime":"2018-06-11 11:11:11",
"protocol":"L2TP",
"addrType":4,
"serverIp":"10.0.6.121",
"clientIp":"10.0.6.122",
"serverPort":"8080",
"clientPort":"8080",
"serviceType":10,
"entranceId":112,
"deviceId":2,
"direction":1,
"streamType":0,
"cljIp":"10.1.1.2",
"nestAddrList":"11111",
"userRegion":"aaa"
},{
"cfgId":22,
"foundTime":"2018-06-10 10:10:10",
"recvTime":"2018-06-11 11:11:11",
"protocol":"L2TP",
"addrType":4,
"serverIp":"10.0.6.121",
"clientIp":"10.0.6.122",
"serverPort":"8080",
"clientPort":"8080",
"serviceType":10,
"entranceId":112,
"deviceId":2,
"direction":2,
"streamType":1,
"cljIp":"10.1.1.2",
"nestAddrList":"11111",
"userRegion":"aaa"
}
]
}
}

View File

@@ -0,0 +1,211 @@
<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/WEB-INF/include/taglib.jsp"%>
<html>
<head>
<title>IP<spring:message code="log"></spring:message></title>
<script>
$(document).ready(function() {
//reset
$("#resetBtn").on("click",function(){
$("select.selectpicker").each(function(){
$(this).selectpicker('val',$(this).find('option:first').val());
$(this).find("option").attr("selected",false);
$(this).find("option:first").attr("selected",true);
});
$(".Wdate").attr("value",'');
$("#searchForm")[0].reset();
});
//筛选功能
filterActionInit();
});
</script>
</head>
<body>
<div class="page-content">
<div class="theme-panel hidden-xs hidden-sm">
</div>
<h3 class="page-title">
IP<spring:message code="log"></spring:message>
<small><spring:message code="date_list"/></small>
</h3>
<h5 class="page-header"></h5>
<div class="row">
<div class="col-md-12">
<div class="portlet">
<div class="portlet-body">
<div class="row" >
<form:form id="searchForm" modelAttribute="log" action="${ctx}/log/ntc/ip/list" method="post" class="form-search">
<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
<input id="functionId" name="functionId" type="hidden" value="${log.functionId}"/>
<!-- 筛选按钮展开状态-->
<input id="isFilterAction" name="isFilterAction" type="hidden" value="${log.isFilterAction }"/>
<!-- 搜索内容与操作按钮栏 -->
<div class="col-md-12">
<div class="pull-left">
<form:select path="protocol" class="selectpicker select2 input-small" data-live-search="true" data-live-search-placeholder="search">
<form:option value=""><spring:message code="protocol_type"/></form:option>
<c:forEach items="${fns:getDictList('LOG_PROTOCOL')}" var="protocol">
<form:option value="${protocol.itemCode}" ><spring:message code="${protocol.itemValue}"/></form:option>
</c:forEach>
</form:select>
</div>
<div class="pull-left">
<form:select path="serviceType" class="selectpicker select2 input-small">
<form:option value=""><spring:message code="action"/></form:option>
<c:forEach items="${serviceList}" var="service">
<form:option value="${service.serviceId}" ><spring:message code="${service.actionCode}"/></form:option>
</c:forEach>
</form:select>
</div>
<div class="pull-left">
<div class="input-group">
<div class="input-group-btn">
<form:select path="direction" class="selectpicker select2 input-small">
<form:option value=""><spring:message code="direct"/></form:option>
<c:forEach items="${fns:getDictList('DIRECTION')}" var="dict">
<form:option value="${dict.itemCode}"><spring:message code="${dict.itemValue}"/></form:option>
</c:forEach>
</form:select>
</div>
</div>
</div>
<div class="pull-left">
<div class="input-group">
<div class="input-group-btn">
<span class="selectpicker form-control" ><spring:message code="entrance_id"/></span>
</div>
<input id="entranceId" name="entranceId" class="form-control input-small" type="text" value="${log.entranceId}"/>
</div>
</div>
<div class="pull-left">
<div class="input-group">
<div class="input-group-btn">
<span class="selectpicker form-control" ><spring:message code="clj_ip"/></span>
</div>
<input id="cljIp" name="cljIp" class="form-control input-small" type="text" value="${log.cljIp}"/>
</div>
</div>
<div class="pull-left">
<button type="button" class="btn blue" onClick="return page()"> <i class="fa fa-search"></i> <spring:message code="search"/> </button>
<button type="button" class="btn btn-default" id="resetBtn"> <i class="fa fa-refresh"></i> <spring:message code="reset"/> </button>
<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">
<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>
</a>
</div>
</div>
<!-- 搜索内容与操作按钮栏 -->
<!-- 筛选搜索内容栏默认隐藏-->
<div class="col-md-12 filter-action-select-panle hide" >
<div class="row">
<div class="col-md-2">
<div class="form-group">
<label class="form-label"><spring:message code="begin_date"/></label>
<input name="searchFoundStartTime" type="text" readonly="readonly" maxlength="20" class="form-control Wdate"
value="${log.searchFoundStartTime}" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true});"/>
</div>
</div>
<div class="col-md-2">
<div class="form-group">
<label><spring:message code="end_date"/></label>
<input name="searchFoundEndTime" type="text" readonly="readonly" maxlength="20" class="form-control Wdate"
value="${log.searchFoundEndTime}" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true});"/>
</div>
</div>
<div class="col-md-2">
<div class="form-group">
<label><spring:message code="clientip"></spring:message></label>
<input name="clientIp" type="text" class="form-control" value="${log.clientIp }"/>
</div>
</div>
<div class="col-md-2">
<div class="form-group">
<label><spring:message code="serverip"></spring:message></label>
<input name="serverIp" type="text" class="form-control" value="${log.serverIp }"/>
</div>
</div>
</div>
</div>
<!-- /筛选搜索内容栏 结束-->
</form:form>
</div>
<div class="table-responsive">
<sys:message content="${message}"/>
<table id="contentTable" class="table table-striped table-bordered table-condensed text-nowrap">
<thead>
<tr>
<!--<th><input type="checkbox" class="i-checks" id="checkAll"></th>-->
<th><spring:message code='cfg_id'/></th>
<th>ip<spring:message code="type"/></th>
<th><spring:message code="client_ip"/></th>
<th><spring:message code="client_port"/></th>
<th><spring:message code="server_ip"/></th>
<th><spring:message code="server_port"/></th>
<th><spring:message code="protocol"/></th>
<th><spring:message code="entrance_id"/></th>
<th><spring:message code="direction"/></th>
<th><spring:message code="found_time"/></th>
<th><spring:message code="recv_time"/></th>
<th><spring:message code="device_id"/></th>
<th><spring:message code="stream_type"/></th>
<th><spring:message code="clj_ip"/></th>
<th><spring:message code="nest_addr_list"/></th>
<th><spring:message code="user_region"/></th>
</tr>
<c:forEach var="log" items="${page.list }">
<tr>
<td>${log.cfgId }</td>
<td>
<c:forEach items="${fns:getDictList('IP_TYPE')}" var="ipType">
<c:if test="${ipType.itemCode==log.addrType}">${ipType.itemValue}</c:if>
</c:forEach>
</td>
<td>${log.clientIp }</td>
<td>${log.clientPort }</td>
<td>${log.serverIp }</td>
<td>${log.serverPort }</td>
<td>
<c:forEach items="${fns:getDictList('LOG_PROTOCOL')}" var="logProtocol">
<c:if test="${logProtocol.itemCode == log.protocol}">${logProtocol.itemValue}</c:if>
</c:forEach>
</td>
<td>${log.entranceId }</td>
<td>
<c:forEach items="${fns:getDictList('DIRECTION')}" var="direction">
<c:if test="${direction.itemCode == log.direction}"><spring:message code="${direction.itemValue}"/></c:if>
</c:forEach>
</td>
<td>${log.foundTime }</td>
<td>${log.recvTime }</td>
<td>${log.deviceId }</td>
<td>
<c:forEach items="${fns:getDictList('LOG_STREAM_TYPE')}" var="streamType">
<c:if test="${streamType.itemCode == log.streamType}">${streamType.itemValue}</c:if>
</c:forEach>
</td>
<td>${log.cljIp }</td>
<td>${log.nestAddrList }</td>
<td>${log.userRegion }</td>
</tr>
</c:forEach>
</thead>
<tbody>
</tbody>
</table>
<div class="page">${page}</div>
</div>
</div>
</div>
</div>
</body>
</html>