日志查询-多媒体导出添加
This commit is contained in:
@@ -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