日志检索模块导出问题修改

This commit is contained in:
shangguanyanfei
2019-01-11 10:00:22 +08:00
parent 55edab464d
commit bfb931747b
17 changed files with 155 additions and 110 deletions

View File

@@ -47,8 +47,8 @@ public class BaseLogEntity<T> extends BaseEntity<T> {
protected String serverLocate;// 服务端地址定位信息
@ExcelField(title="client_locate",sort=68)
protected String clientLocate;// 客户端地址定位信息
@ExcelField(title="user_region",sort=76)
protected String userRegion; //用户自定义
// @ExcelField(title="user_region",sort=76)
// protected String userRegion; //用户自定义
@ExcelField(title="s_asn",sort=70)
protected String sAsn;//客户端ASN
@ExcelField(title="d_asn",sort=71)
@@ -211,12 +211,12 @@ public class BaseLogEntity<T> extends BaseEntity<T> {
public void setAddrList(String addrList) {
this.addrList = addrList;
}
public String getUserRegion() {
/*public String getUserRegion() {
return userRegion;
}
public void setUserRegion(String userRegion) {
this.userRegion = userRegion;
}
}*/
public Integer getFunctionId() {
return functionId;
}
@@ -307,8 +307,8 @@ public class BaseLogEntity<T> extends BaseEntity<T> {
+ transProto + ", addrType=" + addrType + ", dIp=" + dIp + ", sIp=" + sIp + ", dPort=" + dPort
+ ", sPort=" + sPort + ", service=" + service + ", entranceId=" + entranceId + ", deviceId=" + deviceId
+ ", direction=" + direction + ", streamDir=" + streamDir + ", capIp=" + capIp + ", addrList="
+ addrList + ", serverLocate=" + serverLocate + ", clientLocate=" + clientLocate + ", userRegion="
+ userRegion + ", sAsn=" + sAsn + ", dAsn=" + dAsn + ", sSubscribeId=" + sSubscribeId
+ addrList + ", serverLocate=" + serverLocate + ", clientLocate=" + clientLocate + /*", userRegion="
+ userRegion +*/ ", sAsn=" + sAsn + ", dAsn=" + dAsn + ", sSubscribeId=" + sSubscribeId
+ ", dSubscribeId=" + dSubscribeId + ", sceneFile=" + sceneFile + ", functionId=" + functionId
+ ", action=" + action + ", date=" + date + ", seltype=" + seltype + ", searchFoundStartTime="
+ searchFoundStartTime + ", searchFoundEndTime=" + searchFoundEndTime + ", isLogTotalSearch="

View File

@@ -33,7 +33,7 @@ public class NtcDdosLog extends BaseLogEntity<NtcDdosLog> {
@ExcelField(title="attack_total_byte",sort=14)
@ApiModelProperty(value = "攻击累积字节数", required = true)
protected String attackTotalByte;
@ExcelField(title="is_block ",dictType="SYS_YES_NO",sort=15)
@ExcelField(title="is_block",dictType="SYS_YES_NO",sort=15)
@ApiModelProperty(value = "攻击流量是否被丢弃", required = true)
protected Integer isBlock;

View File

@@ -24,13 +24,13 @@ public class PxyHttpLog extends BaseLogEntity<NtcIpLog> {
private String contentType;
@ExcelField(title="set_cookie",sort=16)
private String setCookie;
@ExcelField(title="req_header",sort=17)
// @ExcelField(title="req_header",sort=17)
private String reqHeader;
@ExcelField(title="resp_header",sort=18)
// @ExcelField(title="resp_header",sort=18)
private String respHeader;
@ExcelField(title="req_body",sort=17)
private String reqBody;
@ExcelField(title="resp_body",sort=18)
private String resBody;
@ExcelField(title="website",sort=19)
private String website;

View File

@@ -245,13 +245,13 @@ public class CollectVoipLogController extends BaseController {
String jsonString = HttpClientUtil.getMsg(url, params, request);
GsonBuilder builder = new GsonBuilder();
builder.registerTypeAdapter(Date.class, new JsonDeserializer<Date>() {
public Date deserialize(JsonElement json, java.lang.reflect.Type typeOfT,
JsonDeserializationContext context) throws JsonParseException {
return new Date(json.getAsJsonPrimitive().getAsLong());
}
});
// builder.registerTypeAdapter(Date.class, new JsonDeserializer<Date>() {
//
// public Date deserialize(JsonElement json, java.lang.reflect.Type typeOfT,
// JsonDeserializationContext context) throws JsonParseException {
// return new Date(json.getAsJsonPrimitive().getAsLong());
// }
// });
Gson gson = builder.setDateFormat("yyyy-MM-dd HH:mm:ss").create();
// gson泛型支持
LogRecvData<NtcCollectVoipLog> fromJson = gson.fromJson(jsonString,

View File

@@ -133,6 +133,8 @@ public class MmPornAvSampleController extends BaseController {
//---------------------------
PageLog<MmAvIpLog> page = new PageLog<MmAvIpLog>(request, response);
page.setPageNo(1);
page.setPageSize(Constants.MAX_LOG_EXPORT_SIZE);
Map<String, Object> params=new HashMap<>();
params.put("pageSize", page.getPageSize());
params.put("pageNo", page.getPageNo());

View File

@@ -100,7 +100,7 @@ public class MmSampleAudioController extends BaseController{
System.out.print(log.getFunctionId());
model.addAttribute("serviceList", serviceList);
String url = Constants.LOG_BASE_URL + Constants.NTC_DDOS_LOG;
String url = Constants.LOG_BASE_URL + Constants.NTC_MMSAMPLEAUDIO_LOG;
String recv = HttpClientUtil.getMsg(url, params, request);
List<MmSampleAudioLog> list = new ArrayList<MmSampleAudioLog>();
if (StringUtils.isNotBlank(recv)) {

View File

@@ -89,6 +89,8 @@ public class MmSamplePicController extends BaseController{
Map<String, String> noExportMap = new HashMap<String, String>();
PageLog<MmSamplePicLog> page = new PageLog<MmSamplePicLog>(request,response);
page.setPageNo(1);
page.setPageSize(Constants.MAX_LOG_EXPORT_SIZE);
Map<String, Object> params = new HashMap<String,Object>();
params.put("pageSize", page.getPageSize());
params.put("pageNo", page.getPageNo());

View File

@@ -96,7 +96,7 @@ public class MmSampleVideoController extends BaseController{
System.out.print(log.getFunctionId());
model.addAttribute("serviceList", serviceList);
String url = Constants.LOG_BASE_URL + Constants.NTC_DDOS_LOG;
String url = Constants.LOG_BASE_URL + Constants.NTC_MMSAMPLEVIDEO_LOG;
String recv = HttpClientUtil.getMsg(url, params, request);
List<MmSampleVideoLog> list = new ArrayList<MmSampleVideoLog>();
if (StringUtils.isNotBlank(recv)) {

View File

@@ -95,6 +95,8 @@ public class MmSampleVoipLogController extends BaseController {
//---------------------------
PageLog<MmVoipLog> page = new PageLog<MmVoipLog>(request, response);
page.setPageNo(1);
page.setPageSize(Constants.MAX_LOG_EXPORT_SIZE);
Map<String, Object> params=new HashMap<>();
params.put("pageSize", page.getPageSize());
params.put("pageNo", page.getPageNo());

View File

@@ -104,6 +104,7 @@ public class OpenVpnLogController extends BaseController{
//radius配置导出
@RequestMapping(value = "exportNtcOpenvpnLogs")
public void exportRadius(@ModelAttribute("log") NtcOpenVpnLog log, Model model,String hColumns,String type, HttpServletRequest request, HttpServletResponse response,RedirectAttributes redirectAttributes){
String name="";
try {
//export data info
List<String> titleList=new ArrayList<String>();
@@ -142,9 +143,14 @@ public class OpenVpnLogController extends BaseController{
l.setFunctionId(log.getFunctionId());
setLogAction(l, serviceList);
}
}
if(log.getFunctionId()==214){
name="spoofing_ip_policy";
}else if(log.getFunctionId()==212){
name="ip_payload";
}
titleList.add("spoofing_ip_policy");
classMap.put("spoofing_ip_policy", NtcOpenVpnLog.class);
titleList.add(name);
classMap.put(name, NtcOpenVpnLog.class);
SysUser user =UserUtils.getUser();
if (!user.isAdmin()){
hColumns+=",scene_file,";
@@ -152,18 +158,18 @@ public class OpenVpnLogController extends BaseController{
hColumns+=",";
}
String cfgIndexInfoNoExport=","+hColumns;
noExportMap.put("spoofing_ip_policy",cfgIndexInfoNoExport);
dataMap.put("spoofing_ip_policy",list);
String timeRange= initLogMap(log,"spoofing_ip_policy");
noExportMap.put(name,cfgIndexInfoNoExport);
dataMap.put(name,list);
String timeRange= initLogMap(log,name);
noExportMap.put("timeRange", timeRange);
/*}*/
if("csv".equals(type)){
this._exportCsv(model, request, response, redirectAttributes,"spoofing_ip_policy",titleList,classMap,dataMap,noExportMap);
this._exportCsv(model, request, response, redirectAttributes,name,titleList,classMap,dataMap,noExportMap);
}else{
this._export(model, request, response, redirectAttributes,"spoofing_ip_policy",titleList,classMap,dataMap,noExportMap);
this._export(model, request, response, redirectAttributes,name,titleList,classMap,dataMap,noExportMap);
}
} catch (Exception e) {
logger.error("openVpn export failed",e);
logger.error(name+" export failed",e);
addMessage(redirectAttributes,"error","export_failed");
}
}

View File

@@ -175,7 +175,7 @@ public class PxyHttpLogController extends BaseController {
} else {
hColumns += ",";
}
String cfgIndexInfoNoExport = "," + hColumns;
String cfgIndexInfoNoExport = ",inner_smac,inner_dmac,nest_addr_list," + hColumns;
noExportMap.put(pxyName, cfgIndexInfoNoExport);
dataMap.put(pxyName, list);
String timeRange= initLogMap(log,pxyName);