ntc-ip日志查询(部分)
This commit is contained in:
@@ -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; //流类型 0:c2s;1:s2c;2:double,从字典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; //流类型 0:c2s;1:s2c;2:double,从字典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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 "";
|
||||
}
|
||||
}
|
||||
53
src/main/java/com/nis/web/test/logTest.txt
Normal file
53
src/main/java/com/nis/web/test/logTest.txt
Normal 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"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user