日志查询-多媒体导出添加
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package com.nis.domain.log;
|
||||
|
||||
import com.nis.util.excel.ExcelField;
|
||||
import com.wordnik.swagger.annotations.ApiModelProperty;
|
||||
|
||||
/**
|
||||
@@ -11,18 +12,25 @@ import com.wordnik.swagger.annotations.ApiModelProperty;
|
||||
public class MmAvIpLog extends BaseLogEntity<MmAvIpLog> {
|
||||
|
||||
private static final long serialVersionUID = -6177790560553329386L;
|
||||
@ExcelField(title="pid",sort=8)
|
||||
@ApiModelProperty(value="节目ID", required=true)
|
||||
protected String pid;
|
||||
@ExcelField(title="access_url",sort=9)
|
||||
@ApiModelProperty(value="节目访问地址", required=true)
|
||||
protected String url;
|
||||
@ExcelField(title="log_uri",sort=10)
|
||||
@ApiModelProperty(value="封堵现场片段路径", required=true)
|
||||
protected String logUri;
|
||||
@ExcelField(title="referer",sort=11)
|
||||
@ApiModelProperty(value="入口页面", required=true)
|
||||
protected String referer;
|
||||
@ExcelField(title="harm_level",sort=12)
|
||||
@ApiModelProperty(value="有害级别", required=true)
|
||||
protected Integer level;
|
||||
@ExcelField(title="fd_type",dictType="FD_TYPE",sort=13)
|
||||
@ApiModelProperty(value="封堵类型", required=true)
|
||||
protected Integer fdType;
|
||||
@ExcelField(title="av_protocol",dictType="AV_PROTOCOL",sort=14)
|
||||
@ApiModelProperty(value="协议", required=true)
|
||||
protected String protocol;
|
||||
public String getPid() {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.nis.domain.log;
|
||||
|
||||
import com.nis.util.excel.ExcelField;
|
||||
import com.wordnik.swagger.annotations.ApiModelProperty;
|
||||
|
||||
/**
|
||||
@@ -11,20 +12,22 @@ import com.wordnik.swagger.annotations.ApiModelProperty;
|
||||
public class MmFileDigestLog extends BaseLogEntity<MmFileDigestLog> {
|
||||
|
||||
private static final long serialVersionUID = -6177790560553329386L;
|
||||
@ApiModelProperty(value="节目ID", required=true)
|
||||
protected String pid;
|
||||
@ApiModelProperty(value="节目访问地址", required=true)
|
||||
protected String url;
|
||||
@ApiModelProperty(value="封堵现场片段路径", required=true)
|
||||
protected String logUri;
|
||||
@ApiModelProperty(value="入口页面", required=true)
|
||||
protected String referer;
|
||||
@ApiModelProperty(value="有害级别", required=true)
|
||||
protected Integer level;
|
||||
@ApiModelProperty(value="封堵类型", required=true)
|
||||
protected Integer fdType;
|
||||
@ApiModelProperty(value="协议", required=true)
|
||||
protected String protocol;
|
||||
@ExcelField(title="pid",sort=8)
|
||||
private String pid;// 节目ID
|
||||
@ExcelField(title="access_url",sort=9)
|
||||
private String url;// 节目访问地址
|
||||
@ExcelField(title="log_uri",sort=10)
|
||||
private String logUri;// fd现场片段路径
|
||||
@ExcelField(title="referer",sort=11)
|
||||
private String referer;// 入口页面
|
||||
@ExcelField(title="harm_level",sort=12)
|
||||
private Integer level;// 有害级别
|
||||
@ExcelField(title="fd_type",dictType="FD_TYPE",sort=13)
|
||||
private Integer fdType;// fd类型
|
||||
@ExcelField(title="av_protocol",dictType="AV_PROTOCOL",sort=14)
|
||||
private String protocol;// 传输协议
|
||||
|
||||
|
||||
public String getPid() {
|
||||
return pid;
|
||||
}
|
||||
|
||||
@@ -1,15 +1,24 @@
|
||||
package com.nis.domain.log;
|
||||
|
||||
import com.nis.util.excel.ExcelField;
|
||||
|
||||
public class MmSampleAudioLog extends BaseLogEntity<MmSampleAudioLog>{
|
||||
|
||||
private static final long serialVersionUID = -9107324545841909071L;
|
||||
|
||||
@ExcelField(title="pid",sort=8)
|
||||
private String pid;// 节目ID
|
||||
@ExcelField(title="access_url",sort=9)
|
||||
private String url;// 节目访问地址
|
||||
@ExcelField(title="log_uri",sort=10)
|
||||
private String logUri;// fd现场片段路径
|
||||
@ExcelField(title="referer",sort=11)
|
||||
private String referer;// 入口页面
|
||||
@ExcelField(title="harm_level",sort=12)
|
||||
private Integer level;// 有害级别
|
||||
@ExcelField(title="fd_type",dictType="FD_TYPE",sort=13)
|
||||
private Integer fdType;// fd类型
|
||||
@ExcelField(title="av_protocol",dictType="AV_PROTOCOL",sort=14)
|
||||
private String protocol;// 传输协议
|
||||
|
||||
public String getPid() {
|
||||
|
||||
@@ -1,16 +1,26 @@
|
||||
package com.nis.domain.log;
|
||||
|
||||
import com.nis.util.excel.ExcelField;
|
||||
|
||||
public class MmSamplePicLog extends BaseLogEntity<MmSamplePicLog>{
|
||||
|
||||
private static final long serialVersionUID = -8851111472033278357L;
|
||||
|
||||
@ExcelField(title="pid",sort=8)
|
||||
private String pid;// 节目ID
|
||||
@ExcelField(title="access_url",sort=9)
|
||||
private String url;// 节目访问地址
|
||||
@ExcelField(title="log_uri",sort=10)
|
||||
private String logUri;// fd现场片段路径
|
||||
@ExcelField(title="referer",sort=11)
|
||||
private String referer;// 入口页面
|
||||
@ExcelField(title="harm_level",sort=12)
|
||||
private Integer level;// 有害级别
|
||||
@ExcelField(title="fd_type",dictType="FD_TYPE",sort=13)
|
||||
private Integer fdType;// fd类型
|
||||
@ExcelField(title="av_protocol",dictType="AV_PROTOCOL",sort=14)
|
||||
private String protocol;// 传输协议
|
||||
|
||||
public String getPid() {
|
||||
return pid;
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.nis.domain.log;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import com.nis.util.excel.ExcelField;
|
||||
import com.wordnik.swagger.annotations.ApiModelProperty;
|
||||
|
||||
public class NtcDdosLog extends BaseLogEntity<NtcDdosLog> {
|
||||
@@ -11,20 +12,28 @@ public class NtcDdosLog extends BaseLogEntity<NtcDdosLog> {
|
||||
*/
|
||||
private static final long serialVersionUID = 9080132009178985910L;
|
||||
|
||||
@ExcelField(title="attack_type",dictType="ATTACK_TYPE",sort=8)
|
||||
@ApiModelProperty(value = "攻击类型", required = true)
|
||||
protected Integer attackType;
|
||||
@ExcelField(title="attack_start_time",sort=9)
|
||||
@ApiModelProperty(value = "攻击起始时间", required = true)
|
||||
protected Date attackStartTime;
|
||||
@ExcelField(title="last_attack_time",sort=10)
|
||||
@ApiModelProperty(value = "最后一次攻击包时间", required = true)
|
||||
protected Date lastAttackTime;
|
||||
@ExcelField(title="attack_max_pps",sort=11)
|
||||
@ApiModelProperty(value = "攻击最大流量, 包数/秒", required = true)
|
||||
protected String attackMaxPps;
|
||||
@ExcelField(title="attack_max_bps",sort=12)
|
||||
@ApiModelProperty(value = "攻击最大流量, bit数/秒", required = true)
|
||||
protected String attackMaxBps;
|
||||
@ExcelField(title="attack_total_pkt",sort=13)
|
||||
@ApiModelProperty(value = "攻击累积包数", required = true)
|
||||
protected String attackTotalPkt;
|
||||
@ExcelField(title="attack_total_byte",sort=14)
|
||||
@ApiModelProperty(value = "攻击累积字节数", required = true)
|
||||
protected String attackTotalByte;
|
||||
@ExcelField(title="is_blcok ",dictType="SYS_YES_NO",sort=15)
|
||||
@ApiModelProperty(value = "攻击流量是否被丢弃", required = true)
|
||||
protected Integer isBlock;
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.nis.web.controller.log.ntc;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@@ -15,6 +16,7 @@ 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;
|
||||
@@ -26,13 +28,16 @@ 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.NtcCollectVoipLog;
|
||||
import com.nis.domain.log.NtcDdosLog;
|
||||
import com.nis.domain.maat.LogRecvData;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.DictUtils;
|
||||
import com.nis.util.StringUtils;
|
||||
import com.nis.util.httpclient.HttpClientUtil;
|
||||
import com.nis.web.controller.BaseController;
|
||||
import com.nis.web.security.UserUtils;
|
||||
|
||||
@Controller
|
||||
@RequestMapping(value = "${adminPath}/log/ntc/ntcDdosLogs")
|
||||
@@ -104,4 +109,69 @@ public class DdosLogController extends BaseController{
|
||||
return "/log/ntc/ddosList";
|
||||
}
|
||||
|
||||
|
||||
// Ddos配置导出
|
||||
@RequestMapping(value = "exportDdos")
|
||||
public void exportDdos(@ModelAttribute("log") NtcDdosLog log, Model model, String hColumns, String type,
|
||||
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<NtcDdosLog> page = new PageLog<NtcDdosLog>(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());
|
||||
initLogSearchValue(log, params);
|
||||
|
||||
List<FunctionServiceDict> serviceList = DictUtils.getFunctionServiceDictList(log.getFunctionId());
|
||||
System.out.print(log.getFunctionId());
|
||||
model.addAttribute("serviceList", serviceList);
|
||||
|
||||
String url = Constants.LOG_BASE_URL + Constants.NTC_DDOS_LOG;
|
||||
String recv = HttpClientUtil.getMsg(url, params, request);
|
||||
List<NtcDdosLog> list = new ArrayList<NtcDdosLog>();
|
||||
if (StringUtils.isNotBlank(recv)) {
|
||||
Gson gson = new GsonBuilder().create();
|
||||
LogRecvData<NtcDdosLog> fromJson = gson.fromJson(recv, new TypeToken<LogRecvData<NtcDdosLog>>() {
|
||||
}.getType());
|
||||
if (fromJson.getStatus().intValue() == 200) {
|
||||
Page<NtcDdosLog> data = fromJson.getData();
|
||||
list = data.getList();
|
||||
}
|
||||
}
|
||||
for (NtcDdosLog l : list) {
|
||||
l.setFunctionId(log.getFunctionId());
|
||||
setLogAction(l, serviceList);
|
||||
}
|
||||
titleList.add("target_ip_protect");
|
||||
classMap.put("target_ip_protect", NtcDdosLog.class);
|
||||
SysUser user = UserUtils.getUser();
|
||||
if (!user.isAdmin()) {
|
||||
hColumns += ",scene_file,";
|
||||
} else {
|
||||
hColumns += ",";
|
||||
}
|
||||
String cfgIndexInfoNoExport = "," + hColumns;
|
||||
noExportMap.put("target_ip_protect", cfgIndexInfoNoExport);
|
||||
dataMap.put("target_ip_protect", list);
|
||||
|
||||
if ("csv".equals(type)) {
|
||||
this._exportCsv(model, request, response, redirectAttributes, "target_ip_protect", titleList, classMap, dataMap,
|
||||
noExportMap);
|
||||
} else {
|
||||
this._export(model, request, response, redirectAttributes, "target_ip_protect", titleList, classMap, dataMap,
|
||||
noExportMap);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("DDOS export failed", e);
|
||||
addMessage(redirectAttributes, "error", "export_failed");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.nis.web.controller.log.ntc;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -14,6 +15,7 @@ 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;
|
||||
@@ -21,20 +23,24 @@ 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.MmFileDigestLog;
|
||||
import com.nis.domain.log.NtcStreamMediaLog;
|
||||
import com.nis.domain.maat.LogRecvData;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.DictUtils;
|
||||
import com.nis.util.StringUtils;
|
||||
import com.nis.util.httpclient.HttpClientUtil;
|
||||
import com.nis.web.controller.BaseController;
|
||||
import com.nis.web.security.UserUtils;
|
||||
|
||||
@Controller
|
||||
@RequestMapping(value = "${adminPath}/log/ntc/mmFileDigestLogs")
|
||||
public class MmFileDigestLogController extends BaseController{
|
||||
public class MmFileDigestLogController extends BaseController {
|
||||
|
||||
/**
|
||||
* 音视频url日志
|
||||
*
|
||||
* @param model
|
||||
* @param entry
|
||||
* @param request
|
||||
@@ -43,29 +49,32 @@ public class MmFileDigestLogController extends BaseController{
|
||||
* @throws ClientProtocolException
|
||||
* @throws IOException
|
||||
*/
|
||||
@RequestMapping(value={"list",""})
|
||||
public String list(Model model,@ModelAttribute("log")MmFileDigestLog entry,HttpServletRequest request, HttpServletResponse response) throws ClientProtocolException, IOException {
|
||||
|
||||
@RequestMapping(value = { "list", "" })
|
||||
public String list(Model model, @ModelAttribute("log") MmFileDigestLog entry, HttpServletRequest request,
|
||||
HttpServletResponse response) throws ClientProtocolException, IOException {
|
||||
|
||||
try {
|
||||
|
||||
|
||||
PageLog<MmFileDigestLog> page = new PageLog<MmFileDigestLog>(request, response);
|
||||
Map<String, Object> params=new HashMap<>();
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("pageSize", page.getPageSize());
|
||||
params.put("pageNo", page.getPageNo());
|
||||
//查询值判断
|
||||
initLogSearchValue(entry,params);
|
||||
|
||||
// 查询值判断
|
||||
initLogSearchValue(entry, params);
|
||||
|
||||
List<FunctionServiceDict> serviceList = DictUtils.getFunctionServiceDictList(entry.getFunctionId());
|
||||
model.addAttribute("serviceList", serviceList);
|
||||
|
||||
|
||||
String url = "";
|
||||
url = Constants.LOG_BASE_URL+Constants.NTC_MMFILEDIGEST_LOG;
|
||||
String jsonString = HttpClientUtil.getMsg(url,params,request);
|
||||
|
||||
url = Constants.LOG_BASE_URL + Constants.NTC_MMFILEDIGEST_LOG;
|
||||
String jsonString = HttpClientUtil.getMsg(url, params, request);
|
||||
|
||||
Gson gson = new GsonBuilder().create();
|
||||
//gson泛型支持
|
||||
LogRecvData<MmFileDigestLog> fromJson = gson.fromJson(jsonString, new TypeToken<LogRecvData<MmFileDigestLog>>(){}.getType());
|
||||
|
||||
// gson泛型支持
|
||||
LogRecvData<MmFileDigestLog> fromJson = gson.fromJson(jsonString,
|
||||
new TypeToken<LogRecvData<MmFileDigestLog>>() {
|
||||
}.getType());
|
||||
|
||||
if (fromJson.getStatus().intValue() == 200) {
|
||||
Page<MmFileDigestLog> data = fromJson.getData();
|
||||
page.setCount(data.getCount());
|
||||
@@ -74,7 +83,7 @@ public class MmFileDigestLogController extends BaseController{
|
||||
List<MmFileDigestLog> list = page.getList();
|
||||
for (MmFileDigestLog l : list) {
|
||||
l.setFunctionId(entry.getFunctionId());
|
||||
setLogAction(l,serviceList);
|
||||
setLogAction(l, serviceList);
|
||||
}
|
||||
model.addAttribute("page", page);
|
||||
logger.info("查询文件摘要日志成功");
|
||||
@@ -85,5 +94,69 @@ public class MmFileDigestLogController extends BaseController{
|
||||
}
|
||||
return "/log/ntc/mmFileDigestList";
|
||||
}
|
||||
|
||||
|
||||
// FileDigest配置导出
|
||||
@RequestMapping(value = "exportFileDigest")
|
||||
public void exportFileDigest(@ModelAttribute("log") MmFileDigestLog log, Model model, String hColumns, String type,
|
||||
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<MmFileDigestLog> page = new PageLog<MmFileDigestLog>(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());
|
||||
initLogSearchValue(log, params);
|
||||
|
||||
List<FunctionServiceDict> serviceList = DictUtils.getFunctionServiceDictList(log.getFunctionId());
|
||||
System.out.print(log.getFunctionId());
|
||||
model.addAttribute("serviceList", serviceList);
|
||||
|
||||
String url = Constants.LOG_BASE_URL + Constants.NTC_MMFILEDIGEST_LOG;
|
||||
String recv = HttpClientUtil.getMsg(url, params, request);
|
||||
List<MmFileDigestLog> list = new ArrayList<MmFileDigestLog>();
|
||||
if (StringUtils.isNotBlank(recv)) {
|
||||
Gson gson = new GsonBuilder().create();
|
||||
LogRecvData<MmFileDigestLog> fromJson = gson.fromJson(recv,
|
||||
new TypeToken<LogRecvData<MmFileDigestLog>>() {
|
||||
}.getType());
|
||||
if (fromJson.getStatus().intValue() == 200) {
|
||||
Page<MmFileDigestLog> data = fromJson.getData();
|
||||
list = data.getList();
|
||||
}
|
||||
}
|
||||
for (MmFileDigestLog l : list) {
|
||||
l.setFunctionId(log.getFunctionId());
|
||||
setLogAction(l, serviceList);
|
||||
}
|
||||
titleList.add("file_digest_control");
|
||||
classMap.put("file_digest_control", MmFileDigestLog.class);
|
||||
SysUser user = UserUtils.getUser();
|
||||
if (!user.isAdmin()) {
|
||||
hColumns += ",scene_file,";
|
||||
} else {
|
||||
hColumns += ",";
|
||||
}
|
||||
String cfgIndexInfoNoExport = ",log_uri,direction," + hColumns;
|
||||
noExportMap.put("file_digest_control", cfgIndexInfoNoExport);
|
||||
dataMap.put("file_digest_control", list);
|
||||
|
||||
if ("csv".equals(type)) {
|
||||
this._exportCsv(model, request, response, redirectAttributes, "file_digest_control", titleList, classMap, dataMap,
|
||||
noExportMap);
|
||||
} else {
|
||||
this._export(model, request, response, redirectAttributes, "file_digest_control", titleList, classMap, dataMap,
|
||||
noExportMap);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("FileDiges export failed", e);
|
||||
addMessage(redirectAttributes, "error", "export_failed");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.nis.web.controller.log.ntc;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -12,6 +13,7 @@ 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;
|
||||
@@ -19,13 +21,16 @@ 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.MmAvIpLog;
|
||||
import com.nis.domain.log.MmSampleAudioLog;
|
||||
import com.nis.domain.maat.LogRecvData;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.DictUtils;
|
||||
import com.nis.util.StringUtils;
|
||||
import com.nis.util.httpclient.HttpClientUtil;
|
||||
import com.nis.web.controller.BaseController;
|
||||
import com.nis.web.security.UserUtils;
|
||||
|
||||
@Controller
|
||||
@RequestMapping(value = "${adminPath}/log/ntc/mmSampleAudioLogs")
|
||||
@@ -71,4 +76,69 @@ public class MmSampleAudioController extends BaseController{
|
||||
|
||||
return "/log/ntc/mmSampleAudioList";
|
||||
}
|
||||
|
||||
// SampleAudio配置导出
|
||||
@RequestMapping(value = "exportSampleAudio")
|
||||
public void exportSampleAudio(@ModelAttribute("log") MmSampleAudioLog log, Model model, String hColumns, String type,
|
||||
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<MmSampleAudioLog> page = new PageLog<MmSampleAudioLog>(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());
|
||||
initLogSearchValue(log, params);
|
||||
|
||||
List<FunctionServiceDict> serviceList = DictUtils.getFunctionServiceDictList(log.getFunctionId());
|
||||
System.out.print(log.getFunctionId());
|
||||
model.addAttribute("serviceList", serviceList);
|
||||
|
||||
String url = Constants.LOG_BASE_URL + Constants.NTC_DDOS_LOG;
|
||||
String recv = HttpClientUtil.getMsg(url, params, request);
|
||||
List<MmSampleAudioLog> list = new ArrayList<MmSampleAudioLog>();
|
||||
if (StringUtils.isNotBlank(recv)) {
|
||||
Gson gson = new GsonBuilder().create();
|
||||
LogRecvData<MmSampleAudioLog> fromJson = gson.fromJson(recv, new TypeToken<LogRecvData<MmSampleAudioLog>>() {
|
||||
}.getType());
|
||||
if (fromJson.getStatus().intValue() == 200) {
|
||||
Page<MmSampleAudioLog> data = fromJson.getData();
|
||||
list = data.getList();
|
||||
}
|
||||
}
|
||||
for (MmSampleAudioLog l : list) {
|
||||
l.setFunctionId(log.getFunctionId());
|
||||
setLogAction(l, serviceList);
|
||||
}
|
||||
titleList.add("av_sample_audio_control");
|
||||
classMap.put("av_sample_audio_control", MmSampleAudioLog.class);
|
||||
SysUser user = UserUtils.getUser();
|
||||
if (!user.isAdmin()) {
|
||||
hColumns += ",scene_file,";
|
||||
} else {
|
||||
hColumns += ",";
|
||||
}
|
||||
String cfgIndexInfoNoExport = ",direction," + hColumns;
|
||||
noExportMap.put("av_sample_audio_control", cfgIndexInfoNoExport);
|
||||
dataMap.put("av_sample_audio_control", list);
|
||||
|
||||
if ("csv".equals(type)) {
|
||||
this._exportCsv(model, request, response, redirectAttributes, "av_sample_audio_control", titleList, classMap, dataMap,
|
||||
noExportMap);
|
||||
} else {
|
||||
this._export(model, request, response, redirectAttributes, "av_sample_audio_control", titleList, classMap, dataMap,
|
||||
noExportMap);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("SampleAudio export failed", e);
|
||||
addMessage(redirectAttributes, "error", "export_failed");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
|
||||
package com.nis.web.controller.log.ntc;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -13,6 +14,7 @@ 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;
|
||||
@@ -20,12 +22,15 @@ 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.MmSamplePicLog;
|
||||
import com.nis.domain.maat.LogRecvData;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.DictUtils;
|
||||
import com.nis.util.StringUtils;
|
||||
import com.nis.util.httpclient.HttpClientUtil;
|
||||
import com.nis.web.controller.BaseController;
|
||||
import com.nis.web.security.UserUtils;
|
||||
|
||||
@Controller
|
||||
@RequestMapping(value = "${adminPath}/log/ntc/mmSamplePicLogs")
|
||||
@@ -71,4 +76,64 @@ public class MmSamplePicController extends BaseController{
|
||||
|
||||
return "/log/ntc/mmSamplePicList";
|
||||
}
|
||||
|
||||
// SamplePic配置导出
|
||||
@RequestMapping(value = "exportSamplePic")
|
||||
public void exportSamplePic(@ModelAttribute("log") MmSamplePicLog log, Model model, String hColumns, String type,
|
||||
HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) {
|
||||
try {
|
||||
|
||||
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<MmSamplePicLog> page = new PageLog<MmSamplePicLog>(request,response);
|
||||
Map<String, Object> params = new HashMap<String,Object>();
|
||||
params.put("pageSize", page.getPageSize());
|
||||
params.put("pageNo", page.getPageNo());
|
||||
|
||||
// 请求参数判断
|
||||
initLogSearchValue(log, params);
|
||||
|
||||
List<FunctionServiceDict> serviceList = DictUtils.getFunctionServiceDictList(log.getFunctionId());
|
||||
model.addAttribute("serviceList", serviceList);
|
||||
List<MmSamplePicLog> list=new ArrayList<MmSamplePicLog>();
|
||||
// 请求接口
|
||||
String url = Constants.LOG_BASE_URL + Constants.NTC_MMSAMPLEPIC_LOG;
|
||||
String resJson = HttpClientUtil.getMsg(url, params, request);
|
||||
Gson gson = new GsonBuilder().create();
|
||||
LogRecvData<MmSamplePicLog> fromJson = gson.fromJson(resJson, new TypeToken<LogRecvData<MmSamplePicLog>>() {}.getType());
|
||||
if(fromJson.getStatus().intValue() == 200) {
|
||||
Page<MmSamplePicLog> data = fromJson.getData();
|
||||
list = data.getList();
|
||||
}
|
||||
for (MmSamplePicLog l : list) {
|
||||
l.setFunctionId(log.getFunctionId());
|
||||
setLogAction(l, serviceList);
|
||||
}
|
||||
titleList.add("SamplePic");
|
||||
classMap.put("SamplePic", MmSamplePicLog.class);
|
||||
SysUser user = UserUtils.getUser();
|
||||
if (!user.isAdmin()) {
|
||||
hColumns += ",scene_file,";
|
||||
} else {
|
||||
hColumns += ",";
|
||||
}
|
||||
String cfgIndexInfoNoExport = ",direction," + hColumns;
|
||||
noExportMap.put("av_sample_picture_control", cfgIndexInfoNoExport);
|
||||
dataMap.put("av_sample_picture_control", list);
|
||||
|
||||
if ("csv".equals(type)) {
|
||||
this._exportCsv(model, request, response, redirectAttributes, "av_sample_picture_control", titleList, classMap,
|
||||
dataMap, noExportMap);
|
||||
} else {
|
||||
this._export(model, request, response, redirectAttributes, "av_sample_picture_control", titleList, classMap, dataMap,
|
||||
noExportMap);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("SamplePic export failed", e);
|
||||
addMessage(redirectAttributes, "error", "export_failed");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,31 +1,32 @@
|
||||
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.springframework.beans.BeanUtils;
|
||||
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.MmSamplePicLog;
|
||||
import com.nis.domain.SysUser;
|
||||
import com.nis.domain.log.MmSampleVideoLog;
|
||||
import com.nis.domain.maat.LogRecvData;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.DictUtils;
|
||||
import com.nis.util.httpclient.HttpClientUtil;
|
||||
import com.nis.web.controller.BaseController;
|
||||
import com.nis.web.security.UserUtils;
|
||||
|
||||
@Controller
|
||||
@RequestMapping(value = "${adminPath}/log/ntc/mmSampleVideoLogs")
|
||||
@@ -71,4 +72,69 @@ public class MmSampleVideoController extends BaseController{
|
||||
|
||||
return "/log/ntc/mmSampleVideoList";
|
||||
}
|
||||
|
||||
// SampleVideo配置导出
|
||||
@RequestMapping(value = "exportSampleVideo")
|
||||
public void exportSampleVideo(@ModelAttribute("log") MmSampleVideoLog log, Model model, String hColumns, String type,
|
||||
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<MmSampleVideoLog> page = new PageLog<MmSampleVideoLog>(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());
|
||||
initLogSearchValue(log, params);
|
||||
|
||||
List<FunctionServiceDict> serviceList = DictUtils.getFunctionServiceDictList(log.getFunctionId());
|
||||
System.out.print(log.getFunctionId());
|
||||
model.addAttribute("serviceList", serviceList);
|
||||
|
||||
String url = Constants.LOG_BASE_URL + Constants.NTC_DDOS_LOG;
|
||||
String recv = HttpClientUtil.getMsg(url, params, request);
|
||||
List<MmSampleVideoLog> list = new ArrayList<MmSampleVideoLog>();
|
||||
if (StringUtils.isNotBlank(recv)) {
|
||||
Gson gson = new GsonBuilder().create();
|
||||
LogRecvData<MmSampleVideoLog> fromJson = gson.fromJson(recv, new TypeToken<LogRecvData<MmSampleVideoLog>>() {
|
||||
}.getType());
|
||||
if (fromJson.getStatus().intValue() == 200) {
|
||||
Page<MmSampleVideoLog> data = fromJson.getData();
|
||||
list = data.getList();
|
||||
}
|
||||
}
|
||||
for (MmSampleVideoLog l : list) {
|
||||
l.setFunctionId(log.getFunctionId());
|
||||
setLogAction(l, serviceList);
|
||||
}
|
||||
titleList.add("av_sample_video_control");
|
||||
classMap.put("av_sample_video_control", MmSampleVideoLog.class);
|
||||
SysUser user = UserUtils.getUser();
|
||||
if (!user.isAdmin()) {
|
||||
hColumns += ",scene_file,";
|
||||
} else {
|
||||
hColumns += ",";
|
||||
}
|
||||
String cfgIndexInfoNoExport = ",direction," + hColumns;
|
||||
noExportMap.put("av_sample_video_control", cfgIndexInfoNoExport);
|
||||
dataMap.put("av_sample_video_control", list);
|
||||
|
||||
if ("csv".equals(type)) {
|
||||
this._exportCsv(model, request, response, redirectAttributes, "av_sample_video_control", titleList, classMap, dataMap,
|
||||
noExportMap);
|
||||
} else {
|
||||
this._export(model, request, response, redirectAttributes, "av_sample_video_control", titleList, classMap, dataMap,
|
||||
noExportMap);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("SampleVideo export failed", e);
|
||||
addMessage(redirectAttributes, "error", "export_failed");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user