通联日志 检索条件添加和字段属性添加

This commit is contained in:
leijun
2019-01-05 21:47:07 +08:00
parent ad0a04872c
commit ff98b2e65f
4 changed files with 344 additions and 102 deletions

View File

@@ -33,7 +33,7 @@ public class BaseLogEntity<T> extends BaseEntity<T> {
protected Integer service; //配置表的serviceId
@ExcelField(title="entrance_id",dictType="ENTRANCE",sort=7)
protected Integer entranceId; //出入口编号
@ExcelField(title="deviceid",dictType="DEVICE",sort=45)
@ExcelField(title="deviceid",dictType="DEVICE",sort=50)
protected Integer deviceId; //串联设备编号
@ExcelField(title="direction",dictType="LOG_DIRECTION",sort=55)
protected Integer direction; //传输方向 0域内->域外1域外->域内从字典LOG_DIRECTION取值
@@ -74,9 +74,9 @@ public class BaseLogEntity<T> extends BaseEntity<T> {
protected String orderBy;//排序参数
//新增字段
@ExcelField(title="encap_type",dictType="ENCAP_TYPE",sort=50)
@ExcelField(title="encap_type",dictType="ENCAP_TYPE",sort=52)
protected Integer encapType;//原始二层封装格式
@ExcelField(title="link_id",dictType="LINK",sort=47)
@ExcelField(title="link_id",dictType="LINK",sort=51)
protected Integer linkId;//串联设备链路号
@ExcelField(title="inner_smac",sort=58)
protected String innerSmac;//MAC_IN_MAC的内层源MAC

View File

@@ -5,20 +5,69 @@ import com.nis.util.excel.ExcelField;
public class NtcConnRecordLog extends BaseLogEntity<NtcConnRecordLog> {
private static final long serialVersionUID = -4947912502754359817L;
@ExcelField(title = "social_app", sort = 8)
protected String appLabel;
@ExcelField(title = "c2s_pkt_num", sort = 9)
@ExcelField(title = "c2s_pkt_num", sort = 44)
protected String c2sPktNum;
@ExcelField(title = "s2c_pkt_num", sort = 10)
@ExcelField(title = "s2c_pkt_num", sort = 45)
protected String s2cPktNum;
@ExcelField(title = "c2s_byte_num", sort = 12)
@ExcelField(title = "c2s_byte_num", sort = 47)
protected String c2sByteNum;
@ExcelField(title = "s2c_byte_num", sort = 13)
@ExcelField(title = "s2c_byte_num", sort = 48)
protected String s2cByteNum;
@ExcelField(title = "APP", sort = 8)
protected String appId;
@ExcelField(title = "Web", sort = 10)
protected String webId;
@ExcelField(title = "Protocol", sort = 9)
protected String protoId;
@ExcelField(title = "Total Pkt", sort = 46)
protected String totalPkt;
@ExcelField(title = "Total Byte", sort = 49)
protected String totalByte;
public String getTotalPkt() {
return totalPkt;
}
public void setTotalPkt(String totalPkt) {
this.totalPkt = totalPkt;
}
public String getTotalByte() {
return totalByte;
}
public void setTotalByte(String totalByte) {
this.totalByte = totalByte;
}
public String getAppId() {
return appId;
}
public void setAppId(String appId) {
this.appId = appId;
}
public String getWebId() {
return webId;
}
public void setWebId(String webId) {
this.webId = webId;
}
public String getProtoId() {
return protoId;
}
public void setProtoId(String protoId) {
this.protoId = protoId;
}
public String getAppLabel() {
return appLabel;

View File

@@ -1,45 +1,31 @@
package com.nis.web.controller.log.ntc;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.Map.Entry;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.lang3.StringUtils;
import org.eclipse.jetty.util.ajax.JSON;
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.JsonObject;
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.IrSnatLog;
import com.nis.domain.log.NtcCollectRadiusLog;
import com.nis.domain.log.NtcConnRecordLog;
import com.nis.domain.log.NtcConnRecordLog;
import com.nis.domain.log.SearchReport;
import com.nis.domain.maat.LogRecvData;
import com.nis.domain.report.NtcServiceReport;
import com.nis.exceptions.MaatConvertException;
import com.nis.util.CodeDicUtils;
import com.nis.util.ConfigServiceUtil;
import com.nis.util.Constants;
import com.nis.util.DictUtils;
import com.nis.util.StringUtil;
@@ -63,11 +49,40 @@ public class NtcConnRecordLogController extends BaseController {
params.put("pageSize", page.getPageSize());
params.put("pageNo", page.getPageNo());
initLogSearchValue(log, params);
if (StringUtils.isNotBlank(log.getAppId())) {
params.put("searchAppId", log.getAppId());
}
if (StringUtils.isNotBlank(log.getProtoId())) {
params.put("searchProtoId", log.getProtoId());
}
if (StringUtils.isNotBlank(log.getWebId())) {
params.put("searchWebId", log.getWebId());
}
if (StringUtils.isNotBlank(log.getsAsn())) {
params.put("searchSAsn", log.getsAsn());
}
if (StringUtils.isNotBlank(log.getdAsn())) {
params.put("searchDAsn", log.getdAsn());
}
if (StringUtils.isNotBlank(log.getServerLocate())) {
params.put("searchServerLocate", log.getServerLocate());
}
if (StringUtils.isNotBlank(log.getClientLocate())) {
params.put("searchClientLocate", log.getClientLocate());
}
List<FunctionServiceDict> serviceList = DictUtils.getFunctionServiceDictList(log.getFunctionId());
model.addAttribute("serviceList", serviceList);
List<CodeResult> appList = CodeDicUtils.getCodeList("appCode");
List<CodeResult> protocolList = CodeDicUtils.getCodeList("protocolCode");
List<CodeResult> webList = CodeDicUtils.getCodeList("webCode");
model.addAttribute("appList", appList);
model.addAttribute("protocolList", protocolList);
model.addAttribute("webList", webList);
model.addAttribute("appList", appList);
model.addAttribute("protocolList", protocolList);
model.addAttribute("webList", webList);
String url = Constants.LOG_BASE_URL + Constants.NTC_CONN_RECORD_LOG;
String recv = HttpClientUtil.getMsg(url, params, request);
@@ -148,10 +163,36 @@ public class NtcConnRecordLogController extends BaseController {
params.put("pageSize", page.getPageSize());
params.put("pageNo", page.getPageNo());
initLogSearchValue(log, params);
if (StringUtils.isNotBlank(log.getAppId())) {
params.put("searchAppId", log.getAppId());
}
if (StringUtils.isNotBlank(log.getProtoId())) {
params.put("searchProtoId", log.getProtoId());
}
if (StringUtils.isNotBlank(log.getWebId())) {
params.put("searchWebId", log.getWebId());
}
if (StringUtils.isNotBlank(log.getsAsn())) {
params.put("searchSAsn", log.getsAsn());
}
if (StringUtils.isNotBlank(log.getdAsn())) {
params.put("searchDAsn", log.getdAsn());
}
if (StringUtils.isNotBlank(log.getServerLocate())) {
params.put("searchServerLocate", log.getServerLocate());
}
if (StringUtils.isNotBlank(log.getClientLocate())) {
params.put("searchClientLocate", log.getClientLocate());
}
List<FunctionServiceDict> serviceList = DictUtils.getFunctionServiceDictList(log.getFunctionId());
model.addAttribute("serviceList", serviceList);
List<CodeResult> appList = CodeDicUtils.getCodeList("appCode");
List<CodeResult> protocolList = CodeDicUtils.getCodeList("protocolCode");
List<CodeResult> webList = CodeDicUtils.getCodeList("webCode");
model.addAttribute("appList", appList);
model.addAttribute("protocolList", protocolList);
model.addAttribute("webList", webList);
Properties msgProp = getMsgProp();
String url = Constants.LOG_BASE_URL + Constants.NTC_CONN_RECORD_LOG;
String recv = HttpClientUtil.getMsg(url, params, request);
List<NtcConnRecordLog> list = new ArrayList<NtcConnRecordLog>();
@@ -166,8 +207,21 @@ public class NtcConnRecordLogController extends BaseController {
}
}
for (NtcConnRecordLog l : list) {
l.setFunctionId(log.getFunctionId());
setLogAction(l, serviceList);
if (StringUtils.isNotBlank(l.getAppId())) {
l.setAppId(getName(l.getAppId(),appList,msgProp));
}
if (StringUtils.isNotBlank(l.getProtoId())) {
l.setProtoId(getName(l.getProtoId(),protocolList,msgProp));
}
if (StringUtils.isNotBlank(l.getWebId())) {
l.setWebId(getName(l.getWebId(),webList,msgProp));
}
if (StringUtils.isNotBlank(l.getC2sPktNum()) && StringUtils.isNotBlank(l.getS2cPktNum()) ) {
l.setTotalPkt(String.valueOf(Integer.valueOf(l.getC2sPktNum())+Integer.valueOf(l.getS2cPktNum())));
}
if (StringUtils.isNotBlank(l.getC2sByteNum()) && StringUtils.isNotBlank(l.getS2cByteNum()) ) {
l.setTotalByte(String.valueOf(Integer.valueOf(l.getC2sByteNum())+Integer.valueOf(l.getS2cByteNum())));
}
}
titleList.add("conn_record");
classMap.put("conn_record", NtcConnRecordLog.class);
@@ -177,7 +231,7 @@ public class NtcConnRecordLogController extends BaseController {
} else {
hColumns += ",";
}
String cfgIndexInfoNoExport = ",cfg_id,action," + hColumns;
String cfgIndexInfoNoExport = ",cfg_id,action,user_region," + hColumns;
noExportMap.put("conn_record", cfgIndexInfoNoExport);
dataMap.put("conn_record", list);
String timeRange= initLogMap(log,"conn_record");
@@ -195,5 +249,16 @@ public class NtcConnRecordLogController extends BaseController {
addMessage(redirectAttributes, "error", "export_failed");
}
}
public String getName(String id,List<CodeResult> list,Properties msgProp){
String name=String.valueOf(id);
for (int i = 0; i < list.size(); i++) {
if(String.valueOf(id).equals(list.get(i).getCode())){
name=msgProp.getProperty(list.get(i).getItem(),list.get(i).getItem());
break;
}
}
return name;
}
}