asnRecord
ipRange urlreport 三个报表功能提交 增加service国际化
This commit is contained in:
@@ -1,15 +1,39 @@
|
||||
package com.nis.web.controller.report;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
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.Page;
|
||||
import com.nis.domain.PageLog;
|
||||
import com.nis.domain.SysUser;
|
||||
import com.nis.domain.log.SearchReport;
|
||||
import com.nis.domain.maat.LogRecvData;
|
||||
import com.nis.domain.report.NtcAsnRecord;
|
||||
import com.nis.domain.report.NtcIpRangeReport;
|
||||
import com.nis.domain.report.NtcURLReport;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.DateUtils;
|
||||
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("${adminPath}/report")
|
||||
@@ -19,4 +43,170 @@ public class ReportController extends BaseController {
|
||||
initReportCondition(model, bean);
|
||||
return "/report/list";
|
||||
}
|
||||
//asn
|
||||
@RequestMapping(value = {"/asnConnList", ""})
|
||||
public String asnConnLists(@ModelAttribute("log") NtcAsnRecord log, Model model, HttpServletRequest request, HttpServletResponse response) {
|
||||
try {
|
||||
PageLog<NtcAsnRecord> page = new PageLog<NtcAsnRecord>(request, response);
|
||||
Map<String, Object> params = new HashMap<String, Object>();
|
||||
params.put("pageSize", page.getPageSize());
|
||||
params.put("pageNo", page.getPageNo());
|
||||
//判断请求参数
|
||||
if (StringUtils.isNotBlank(log.getSearchFoundStartTime())
|
||||
&& StringUtils.isNotBlank(log.getSearchFoundEndTime())) {
|
||||
params.put("searchFoundStartTime", log.getSearchFoundStartTime());
|
||||
params.put("searchFoundEndTime", log.getSearchFoundEndTime());
|
||||
} else {
|
||||
Calendar time = Calendar.getInstance();
|
||||
String searchEndTime = DateUtils.formatDateTime(time.getTime());
|
||||
time.add(Calendar.HOUR_OF_DAY, -1);
|
||||
String searchStartTime = DateUtils.formatDateTime(time.getTime());
|
||||
|
||||
params.put("searchFoundStartTime", searchStartTime);
|
||||
params.put("searchFoundEndTime", searchEndTime);
|
||||
log.setSearchFoundStartTime(searchStartTime);
|
||||
log.setSearchFoundEndTime(searchEndTime);
|
||||
}
|
||||
|
||||
String url =Constants.LOG_BASE_URL + Constants.NTC_ASN_RECORD;
|
||||
String recv = HttpClientUtil.getMsg(url, params, request);
|
||||
// String recv="{\"status\":200,\"businessCode\":2001000,\"reason\":\"数据获取操作成功\",\"msg\":\"ASN通联关系(源,目的)检索成功\",\"fromuri\":\"/galaxy-service/service/log/v1/ntcAsnRecord\",\"logSource\":0,\"traceCode\":\"2018121609404451375322\",\"data\":"
|
||||
// +"{\"pageNo\":1,\"pageSize\":30,\"count\":66564,\"last\":2219,\"list\":[{\"bps\":\"8.56\",\"pps\":\"0.07\",\"sAsn\":\"9198\",\"dAsn\":\"40545_26836\"},"+
|
||||
// "{\"bps\":\"3.68\",\"pps\":\"0.12\",\"sAsn\":\"9198\",\"dAsn\":\"19506\"},{\"bps\":\"1.77\",\"pps\":\"0.08\",\"sAsn\":\"38266\",\"dAsn\":\"N/A\"},"+
|
||||
// "{\"bps\":\"493.55\",\"pps\":\"0.76\",\"sAsn\":\"30922\",\"dAsn\":\"29555\"},{\"bps\":\"26.63\",\"pps\":\"0.04\",\"sAsn\":\"44546\",\"dAsn\":\"197482\"},"+
|
||||
// "{\"bps\":\"25.43\",\"pps\":\"0.45\",\"sAsn\":\"44391\",\"dAsn\":\"9198\"},{\"bps\":\"52.96\",\"pps\":\"0.08\",\"sAsn\":\"29555\",\"dAsn\":\"14080\"}]}}";
|
||||
|
||||
if (StringUtils.isNotBlank(recv)) {
|
||||
Gson gson = new GsonBuilder().create();
|
||||
LogRecvData<NtcAsnRecord> fromJson = gson.fromJson(recv, new TypeToken<LogRecvData<NtcAsnRecord>>(){}.getType());
|
||||
if (fromJson.getStatus().intValue() == 200) {
|
||||
Page<NtcAsnRecord> data = fromJson.getData();
|
||||
page.setCount(data.getCount());
|
||||
page.setLast(data.getLast());
|
||||
page.setList(data.getList());
|
||||
/*List<NtcCollectRadiusLog> list = page.getList();
|
||||
for (NtcConnRecordLog l : list) {
|
||||
l.setFunctionId(log.getFunctionId());
|
||||
setLogAction(l,serviceList);
|
||||
}*/
|
||||
model.addAttribute("page", page);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("查询失败", e);
|
||||
addMessageLog(model, e.getMessage());
|
||||
}
|
||||
|
||||
return "/report/asnRecordList";
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
@RequestMapping(value = {"/httpsUrlList", ""})
|
||||
public String httpsUrlLists(@ModelAttribute("log") NtcURLReport log, Model model, HttpServletRequest request, HttpServletResponse response) {
|
||||
try {
|
||||
PageLog<NtcURLReport> page = new PageLog<NtcURLReport>(request, response);
|
||||
Map<String, Object> params = new HashMap<String, Object>();
|
||||
params.put("pageSize", page.getPageSize());
|
||||
params.put("pageNo", page.getPageNo());
|
||||
//判断请求参数
|
||||
if (StringUtils.isNotBlank(log.getSearchReportStartTime())
|
||||
&& StringUtils.isNotBlank(log.getSearchReportEndTime())) {
|
||||
params.put("searchReportStartTime", log.getSearchReportStartTime());
|
||||
params.put("searchReportEndTime", log.getSearchReportEndTime());
|
||||
} else {
|
||||
Calendar time = Calendar.getInstance();
|
||||
String searchEndTime = DateUtils.formatDateTime(time.getTime());
|
||||
time.add(Calendar.HOUR_OF_DAY, -1);
|
||||
String searchStartTime = DateUtils.formatDateTime(time.getTime());
|
||||
|
||||
params.put("searchReportStartTime", searchStartTime);
|
||||
params.put("searchReportEndTime", searchEndTime);
|
||||
log.setSearchReportStartTime(searchStartTime);
|
||||
log.setSearchReportEndTime(searchEndTime);
|
||||
}
|
||||
//url参数
|
||||
if (StringUtils.isNotBlank(log.getSearchUrl())) {
|
||||
params.put("searchUrl", log.getSearchUrl());
|
||||
}
|
||||
|
||||
String url =Constants.LOG_BASE_URL + Constants.NTC_URL_REPORT;
|
||||
String recv = HttpClientUtil.getMsg(url, params, request);
|
||||
// String recv="{\"status\":200,\"businessCode\":2001000,\"reason\":\"数据获取操作成功\",\"msg\":\"URL统计查询成功\",\"fromuri\":\"/galaxy-service/service/log/v1/ntcURLReport\",\"logSource\":0,\"traceCode\":\"2018121610374649425419\",\"data\":{\"pageNo\":1,\"pageSize\":30,\"count\":174,\"last\":6,\"list\":[{\"url\":\"142.44.167.226/eventproxy/v1/bulk\",\"urlCount\":1686,\"dataList\":[{\"sum\":1686,\"ipAddr\":\"100.101.129.6\"}]},{\"url\":\"188.0.145.98/YZ/e1cib/dlist?cmd=query\",\"urlCount\":2652,\"dataList\":[{\"sum\":1248,\"ipAddr\":\"188.0.145.98\"},{\"sum\":1404,\"ipAddr\":\"89.218.9.2\"}]},{\"url\":\"cdn7.alpha-ag.ru/1c1233923d1a6/c51e872ab5861be256408f6cafa99ed8/luckypatcher_v7.5.9.apk\",\"urlCount\":882,\"dataList\":[{\"sum\":882,\"ipAddr\":\"100.81.118.193\"}]}]}}";
|
||||
|
||||
if (StringUtils.isNotBlank(recv)) {
|
||||
Gson gson = new GsonBuilder().create();
|
||||
LogRecvData<NtcURLReport> fromJson = gson.fromJson(recv, new TypeToken<LogRecvData<NtcURLReport>>(){}.getType());
|
||||
if (fromJson.getStatus().intValue() == 200) {
|
||||
Page<NtcURLReport> data = fromJson.getData();
|
||||
page.setCount(data.getCount());
|
||||
page.setLast(data.getLast());
|
||||
page.setList(data.getList());
|
||||
/*List<NtcCollectRadiusLog> list = page.getList();
|
||||
for (NtcConnRecordLog l : list) {
|
||||
l.setFunctionId(log.getFunctionId());
|
||||
setLogAction(l,serviceList);
|
||||
}*/
|
||||
model.addAttribute("page", page);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("查询失败", e);
|
||||
addMessageLog(model, e.getMessage());
|
||||
}
|
||||
|
||||
return "/report/urlReportList";
|
||||
}
|
||||
|
||||
|
||||
//IP范围统计
|
||||
@RequestMapping(value = {"/ipRangeList", ""})
|
||||
public String ipRangeLists(@ModelAttribute("log") NtcIpRangeReport log, Model model, HttpServletRequest request, HttpServletResponse response) {
|
||||
try {
|
||||
PageLog<NtcIpRangeReport> page = new PageLog<NtcIpRangeReport>(request, response);
|
||||
Map<String, Object> params = new HashMap<String, Object>();
|
||||
params.put("pageSize", page.getPageSize());
|
||||
params.put("pageNo", page.getPageNo());
|
||||
//判断请求参数
|
||||
//查询国家
|
||||
if (StringUtils.isNotBlank(log.getSearchCountry())) {
|
||||
params.put("searchCountry", log.getSearchCountry());
|
||||
}
|
||||
//查询开始IP
|
||||
if (StringUtils.isNotBlank(log.getSearchStartIp())) {
|
||||
params.put("searchStartIp", log.getSearchStartIp());
|
||||
}
|
||||
//查询结束IP
|
||||
if (StringUtils.isNotBlank(log.getSearchEndIp())) {
|
||||
params.put("searchEndIp", log.getSearchEndIp());
|
||||
}
|
||||
|
||||
String url =Constants.LOG_BASE_URL + Constants.NTC_IP_RANGE_REPORT;
|
||||
String recv = HttpClientUtil.getMsg(url, params, request);
|
||||
// String recv="{\"status\":200,\"businessCode\":2001000,\"reason\":\"数据获取操作成功\",\"msg\":\"URL统计查询成功\",\"fromuri\":\"/galaxy-service/service/log/v1/ntcIpRangeReport\",\"logSource\":0,\"traceCode\":\"2018121616062785920271\",\"data\":{\"pageNo\":1,\"pageSize\":30,\"count\":0,\"last\":1,\"list\":[{\"ipStart\":\"192.168.10.121\",\"ipEnd\":\"192.168.10.122\",\"ipStartNum\":3232238201,\"ipEndNum\":3232238202,\"ipSub\":\"255.255.255.252\"}]}}";
|
||||
|
||||
if (StringUtils.isNotBlank(recv)) {
|
||||
Gson gson = new GsonBuilder().create();
|
||||
LogRecvData<NtcIpRangeReport> fromJson = gson.fromJson(recv, new TypeToken<LogRecvData<NtcIpRangeReport>>(){}.getType());
|
||||
if (fromJson.getStatus().intValue() == 200) {
|
||||
Page<NtcIpRangeReport> data = fromJson.getData();
|
||||
page.setCount(data.getCount());
|
||||
page.setLast(data.getLast());
|
||||
page.setList(data.getList());
|
||||
/*List<NtcCollectRadiusLog> list = page.getList();
|
||||
for (NtcConnRecordLog l : list) {
|
||||
l.setFunctionId(log.getFunctionId());
|
||||
setLogAction(l,serviceList);
|
||||
}*/
|
||||
model.addAttribute("page", page);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("查询失败", e);
|
||||
addMessageLog(model, e.getMessage());
|
||||
}
|
||||
|
||||
return "/report/ipRangeReportList";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user