Merge branch 'develop' of http://10.0.6.99/gwall/gwall.git into develop

This commit is contained in:
zhanghongqing
2018-07-18 09:24:55 +08:00
12 changed files with 486 additions and 255 deletions

View File

@@ -9,7 +9,12 @@
package com.nis.domain.report;
import java.io.UnsupportedEncodingException;
import java.lang.reflect.Type;
import java.net.URI;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map.Entry;
import javax.ws.rs.client.Client;
@@ -20,6 +25,14 @@ import javax.ws.rs.core.UriBuilder;
import com.google.common.reflect.TypeToken;
import com.google.gson.Gson;
import com.google.gson.JsonArray;
import com.google.gson.JsonDeserializationContext;
import com.google.gson.JsonDeserializer;
import com.google.gson.JsonElement;
import com.google.gson.JsonParseException;
import com.google.gson.JsonPrimitive;
import com.google.gson.JsonSerializationContext;
import com.google.gson.JsonSerializer;
import com.nis.domain.Page;
import com.nis.domain.RestfulResult;
import com.nis.domain.log.SearchReport;
@@ -66,7 +79,7 @@ public class ReportResult<T extends BaseReport> extends RestfulResult{
public void setData(Page<T> data) {
this.data = data;
}
public ReportResult<T> getReport(String reportUrl, SearchReport searchCondition) throws MaatConvertException, UnsupportedEncodingException{
public String getReport(String reportUrl, SearchReport searchCondition) throws MaatConvertException, UnsupportedEncodingException{
// if(StringUtils.isBlank(searchCondition.getSearchService())){
// throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>");
// }
@@ -74,7 +87,9 @@ public class ReportResult<T extends BaseReport> extends RestfulResult{
ReportResult<T> bean = null;
UriBuilder builder=UriBuilder.fromPath(reportUrl);
builder.queryParam("searchBusinessType",searchCondition.getSearchBusinessType());
builder.queryParam("searchService",searchCondition.getSearchService());
if(StringUtils.isNotBlank(searchCondition.getSearchService())) {
builder.queryParam("searchService",searchCondition.getSearchService());
}
if(searchCondition.getSearchCondition()!=null){
for(Entry<String, Object> e:searchCondition.getSearchCondition().entrySet()){
builder.queryParam(e.getKey(),e.getValue());
@@ -108,12 +123,10 @@ public class ReportResult<T extends BaseReport> extends RestfulResult{
Response response= header.get();
if( response.getStatus() == 200){
result= response.readEntity(String.class);
Gson gson=Constants.gsonbuilder.create();
bean = gson.fromJson(result, new TypeToken<ReportResult<T>>(){
private static final long serialVersionUID = 7963055764864141968L;}.getType());
}else{
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+response.readEntity(String.class));
}
return bean;
return result;
}
}

View File

@@ -353,8 +353,12 @@ public final class Constants {
//日志查询接口URL
public static final String LOG_BASE_URL = Configurations.getStringProperty("logBaseUrl","");
public static final String NTC_SERVICE_REPORT=Configurations.getStringProperty("ntcServiceReport","ntcServiceReport");
public static final String NTC_ATTRTYPE_REPORT=Configurations.getStringProperty("ntcAttrTypeReport","ntcAttrTypeReport");
public static final String NTC_TAG_REPORT=Configurations.getStringProperty("ntcTagReport","ntcTagReport");
public static final String NTC_PZ_REPORT=Configurations.getStringProperty("ntcPzReport","ntcPzReport");
public static final String NTC_NTC_SRCIP_REPORT=Configurations.getStringProperty("ntcSrcipDomesticReport","ntcSrcipDomesticReport");
public static final String NTC_NTC_DESTIP_REPORT=Configurations.getStringProperty("ntcDestipCountryReport","ntcDestipCountryReport");
public static final String NTC_NTC_LWHH_REPORT=Configurations.getStringProperty("ntcLwhhReport","ntcLwhhReport");
public static final String NTC_IP_LOG = Configurations.getStringProperty("ntcIpLog","");
public static final String NTC_HTTP_LOG = Configurations.getStringProperty("ntcHttpLog","");
public static final String NTC_DNS_LOG = Configurations.getStringProperty("ntcDnsLog","");

View File

@@ -3,12 +3,10 @@ package com.nis.web.controller.report;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map.Entry;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@@ -18,11 +16,12 @@ import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.nis.domain.FunctionServiceDict;
import com.nis.domain.Page;
import com.nis.domain.basics.ServiceDictInfo;
import com.nis.domain.log.SearchReport;
import com.nis.domain.report.NtcTagReport;
import com.nis.domain.report.NtcDestIpReport;
import com.nis.domain.report.ReportResult;
import com.nis.util.Constants;
import com.nis.util.DictUtils;
@@ -67,22 +66,75 @@ public class NtcDestIpReportController extends BaseController {
}
List<String> titles=this.getDateTitiles(bean);
model.addAttribute("titles", titles);
HashMap<String,List<Long>> showData=new LinkedHashMap<>();//构造数据展示集合
List<Long> line= new ArrayList<Long>();
long total=0l;
for(String title:titles){
line.add(10000l);
total+=10000l;
try {
ReportResult<NtcDestIpReport> result=new ReportResult<>();
StringBuffer url=new StringBuffer(Constants.LOG_BASE_URL+Constants.NTC_NTC_DESTIP_REPORT);
Gson gson=Constants.gsonbuilder.create();
String json=result.getReport(url.toString(), bean);
result = gson.fromJson(json, new TypeToken<ReportResult<NtcDestIpReport>>() {
}.getType());
Page<NtcDestIpReport> page=result.getData();
List<NtcDestIpReport> list=page.getList();
HashMap<String,Long> trimData=new HashMap<>();//数据累加去重
SimpleDateFormat sdf=new SimpleDateFormat(Constants.SEARCH_DATEFORMAT);
for(NtcDestIpReport report:list){
String trimStr="";
if(bean.getReportType()==Constants.REPORT_TYPE_HOUR){
trimStr=report.getDestCountry().trim()+Constants.REPORT_TRIM_CONNECTOR+
sdf.format(report.getReportTime()).substring(0,13);
}else if(bean.getReportType()==Constants.REPORT_TYPE_DAY){
trimStr=report.getDestCountry().trim()+Constants.REPORT_TRIM_CONNECTOR+
sdf.format(report.getReportTime()).substring(0,10);
}else if(bean.getReportType()==Constants.REPORT_TYPE_MONTH){
trimStr=report.getDestCountry().trim()+Constants.REPORT_TRIM_CONNECTOR+
sdf.format(report.getReportTime()).substring(0,7);
}
if(trimData.containsKey(trimStr)){
trimData.put(trimStr, trimData.get(trimStr)+report.getSum().longValue());
}else{
trimData.put(trimStr, report.getSum().longValue());
}
}
HashMap<String,List<Long>> showData=new LinkedHashMap<>();//构造数据展示集合
for(Entry<String, Long> counrty:trimData.entrySet()){
String[] keyArr=counrty.getKey().split(Constants.REPORT_TRIM_CONNECTOR);
List<Long> line= new ArrayList<Long>();
long total=0;
for(String title:titles){
if(trimData.containsKey(keyArr[0]+Constants.REPORT_TRIM_CONNECTOR+title)){
line.add(trimData.get(keyArr[0]+Constants.REPORT_TRIM_CONNECTOR+title));
total+=trimData.get(keyArr[0]+Constants.REPORT_TRIM_CONNECTOR+title).longValue();
}else{
line.add(0l);
}
}
List<Long> _line= new ArrayList<Long>();
_line.add(total);
_line.addAll(line);
showData.put(keyArr[0], _line);
}
model.addAttribute("datas", showData);
} catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
}
List<Long> _line= new ArrayList<Long>();
_line.add(total);
_line.addAll(line);
for (int i = 0; i < 40; i++) {
showData.put("巴西"+i, _line);
}
model.addAttribute("datas", showData);
// HashMap<String,List<Long>> showData=new LinkedHashMap<>();//构造数据展示集合
// List<Long> line= new ArrayList<Long>();
// long total=0l;
// for(String title:titles){
// line.add(10000l);
// total+=10000l;
// }
// List<Long> _line= new ArrayList<Long>();
// _line.add(total);
// _line.addAll(line);
// for (int i = 0; i < 40; i++) {
// showData.put("巴西"+i, _line);
// }
//
// model.addAttribute("datas", showData);
return "/report/destIp";
}
}

View File

@@ -3,12 +3,10 @@ package com.nis.web.controller.report;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map.Entry;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@@ -18,11 +16,12 @@ import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.nis.domain.FunctionServiceDict;
import com.nis.domain.Page;
import com.nis.domain.basics.ServiceDictInfo;
import com.nis.domain.log.SearchReport;
import com.nis.domain.report.NtcTagReport;
import com.nis.domain.report.NtcEntranceReport;
import com.nis.domain.report.ReportResult;
import com.nis.util.Constants;
import com.nis.util.DictUtils;
@@ -67,22 +66,75 @@ public class NtcEntranceReportController extends BaseController {
}
List<String> titles=this.getDateTitiles(bean);
model.addAttribute("titles", titles);
HashMap<String,List<Long>> showData=new LinkedHashMap<>();//构造数据展示集合
List<Long> line= new ArrayList<Long>();
long total=0l;
for(String title:titles){
line.add(10000l);
total+=10000l;
try {
ReportResult<NtcEntranceReport> result=new ReportResult<>();
StringBuffer url=new StringBuffer(Constants.LOG_BASE_URL+Constants.NTC_NTC_DESTIP_REPORT);
Gson gson=Constants.gsonbuilder.create();
String json=result.getReport(url.toString(), bean);
result = gson.fromJson(json, new TypeToken<ReportResult<NtcEntranceReport>>() {
}.getType());
Page<NtcEntranceReport> page=result.getData();
List<NtcEntranceReport> list=page.getList();
HashMap<String,Long> trimData=new HashMap<>();//数据累加去重
SimpleDateFormat sdf=new SimpleDateFormat(Constants.SEARCH_DATEFORMAT);
for(NtcEntranceReport report:list){
String trimStr="";
if(bean.getReportType()==Constants.REPORT_TYPE_HOUR){
trimStr=report.getEntranceId().intValue()+Constants.REPORT_TRIM_CONNECTOR+
sdf.format(report.getReportTime()).substring(0,13);
}else if(bean.getReportType()==Constants.REPORT_TYPE_DAY){
trimStr=report.getEntranceId().intValue()+Constants.REPORT_TRIM_CONNECTOR+
sdf.format(report.getReportTime()).substring(0,10);
}else if(bean.getReportType()==Constants.REPORT_TYPE_MONTH){
trimStr=report.getEntranceId().intValue()+Constants.REPORT_TRIM_CONNECTOR+
sdf.format(report.getReportTime()).substring(0,7);
}
if(trimData.containsKey(trimStr)){
trimData.put(trimStr, trimData.get(trimStr)+report.getSum().longValue());
}else{
trimData.put(trimStr, report.getSum().longValue());
}
}
HashMap<String,List<Long>> showData=new LinkedHashMap<>();//构造数据展示集合
for(Entry<String, Long> counrty:trimData.entrySet()){
String[] keyArr=counrty.getKey().split(Constants.REPORT_TRIM_CONNECTOR);
List<Long> line= new ArrayList<Long>();
long total=0;
for(String title:titles){
if(trimData.containsKey(keyArr[0]+Constants.REPORT_TRIM_CONNECTOR+title)){
line.add(trimData.get(keyArr[0]+Constants.REPORT_TRIM_CONNECTOR+title));
total+=trimData.get(keyArr[0]+Constants.REPORT_TRIM_CONNECTOR+title).longValue();
}else{
line.add(0l);
}
}
List<Long> _line= new ArrayList<Long>();
_line.add(total);
_line.addAll(line);
showData.put(keyArr[0], _line);
}
model.addAttribute("datas", showData);
} catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
}
List<Long> _line= new ArrayList<Long>();
_line.add(total);
_line.addAll(line);
for (int i = 0; i < 40; i++) {
showData.put(""+i, _line);
}
model.addAttribute("datas", showData);
// HashMap<String,List<Long>> showData=new LinkedHashMap<>();//构造数据展示集合
// List<Long> line= new ArrayList<Long>();
// long total=0l;
// for(String title:titles){
// line.add(10000l);
// total+=10000l;
// }
// List<Long> _line= new ArrayList<Long>();
// _line.add(total);
// _line.addAll(line);
// for (int i = 0; i < 40; i++) {
// showData.put(""+i, _line);
// }
//
// model.addAttribute("datas", showData);
return "/report/entranceId";
}
}

View File

@@ -3,8 +3,6 @@ package com.nis.web.controller.report;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
@@ -17,9 +15,10 @@ import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.nis.domain.FunctionServiceDict;
import com.nis.domain.Page;
import com.nis.domain.basics.ServiceDictInfo;
import com.nis.domain.configuration.RequestInfo;
import com.nis.domain.log.SearchReport;
import com.nis.domain.report.NtcLwhhReport;
@@ -54,8 +53,6 @@ public class NtcLwhhReportController extends BaseController {
bean.setSearchService(serviceId.toString());
}
bean.setSearchBusinessType("1");
ReportResult<NtcLwhhReport> result=new ReportResult<>();
StringBuffer url=new StringBuffer(Constants.LOG_BASE_URL+Constants.NTC_SERVICE_REPORT+"?");
bean.setPageSize(-1);
bean.setFields("lwhh,sum,reportTime");
try {
@@ -66,67 +63,73 @@ public class NtcLwhhReportController extends BaseController {
}
List<String> titles=this.getDateTitiles(bean);
model.addAttribute("titles", titles);
// try {
// result=result.getReport(url.toString(), bean);
// Page<NtcLwhhReportLog> page=result.getData();
// List<NtcLwhhReportLog> list=page.getList();
// HashMap<String,Long> trimData=new HashMap<>();//数据累加去重
// for(NtcLwhhReportLog report:list){
// String trimStr="";
// if(bean.getReportType()==Constants.REPORT_TYPE_HOUR){
// trimStr=report.getLwhh().intValue()+Constants.REPORT_TRIM_CONNECTOR+
// sdf.format(cal.getTime()).substring(0,13);
//
// }else if(bean.getReportType()==Constants.REPORT_TYPE_DAY){
// trimStr=report.getLwhh().intValue()+Constants.REPORT_TRIM_CONNECTOR+
// sdf.format(cal.getTime()).substring(0,10);
//
// }else if(bean.getReportType()==Constants.REPORT_TYPE_MONTH){
// trimStr=report.getLwhh().intValue()+Constants.REPORT_TRIM_CONNECTOR+
// sdf.format(cal.getTime()).substring(0,7);
// }
// if(trimData.containsKey(trimStr)){
// trimData.put(trimStr, trimData.get(trimStr)+report.getSum().longValue());
// }else{
// trimData.put(trimStr, report.getSum().longValue());
// }
// }
// HashMap<String,List<Long>> showData=new LinkedHashMap<>();//构造数据展示集合
// for(RequestInfo requestInfo:requestInfos){
// List<Long> line= new ArrayList<Long>();
// long total=0;
// for(String title:titles){
// if(trimData.containsKey(requestInfo.getId().longValue()+Constants.REPORT_TRIM_CONNECTOR+title)){
// line.add(trimData.get(requestInfo.getId().longValue()+Constants.REPORT_TRIM_CONNECTOR+title));
// total+=trimData.get(requestInfo.getId().longValue()+Constants.REPORT_TRIM_CONNECTOR+title).longValue();
// }else{
// line.add(0l);
// }
// }
// List<Long> _line= new ArrayList<Long>();
// _line.add(total);
// _line.addAll(line);
// showData.put(requestInfo.getId().toString(), _line);
// }
// model.addAttribute("datas", showData);
// } catch (Exception e) {
// // TODO: handle exception
// e.printStackTrace();
// }
HashMap<String,List<Long>> showData=new LinkedHashMap<>();//构造数据展示集合
for(RequestInfo requestInfo:requestInfos){
List<Long> line= new ArrayList<Long>();
long total=0l;
for(String title:titles){
line.add(10000l);
total+=10000l;
try {
ReportResult<NtcLwhhReport> result=new ReportResult<>();
StringBuffer url=new StringBuffer(Constants.LOG_BASE_URL+Constants.NTC_NTC_LWHH_REPORT);
Gson gson=Constants.gsonbuilder.create();
String json=result.getReport(url.toString(), bean);
result = gson.fromJson(json, new TypeToken<ReportResult<NtcLwhhReport>>() {
}.getType());
Page<NtcLwhhReport> page=result.getData();
List<NtcLwhhReport> list=page.getList();
HashMap<String,Long> trimData=new HashMap<>();//数据累加去重
SimpleDateFormat sdf=new SimpleDateFormat(Constants.SEARCH_DATEFORMAT);
for(NtcLwhhReport report:list){
String trimStr="";
if(bean.getReportType()==Constants.REPORT_TYPE_HOUR){
trimStr=report.getLwhh().intValue()+Constants.REPORT_TRIM_CONNECTOR+
sdf.format(report.getReportTime()).substring(0,13);
}else if(bean.getReportType()==Constants.REPORT_TYPE_DAY){
trimStr=report.getLwhh().intValue()+Constants.REPORT_TRIM_CONNECTOR+
sdf.format(report.getReportTime()).substring(0,10);
}else if(bean.getReportType()==Constants.REPORT_TYPE_MONTH){
trimStr=report.getLwhh().intValue()+Constants.REPORT_TRIM_CONNECTOR+
sdf.format(report.getReportTime()).substring(0,7);
}
if(trimData.containsKey(trimStr)){
trimData.put(trimStr, trimData.get(trimStr)+report.getSum().longValue());
}else{
trimData.put(trimStr, report.getSum().longValue());
}
}
List<Long> _line= new ArrayList<Long>();
_line.add(total);
_line.addAll(line);
showData.put(requestInfo.getId().toString(), _line);
HashMap<String,List<Long>> showData=new LinkedHashMap<>();//构造数据展示集合
for(RequestInfo requestInfo:requestInfos){
List<Long> line= new ArrayList<Long>();
long total=0;
for(String title:titles){
if(trimData.containsKey(requestInfo.getId().longValue()+Constants.REPORT_TRIM_CONNECTOR+title)){
line.add(trimData.get(requestInfo.getId().longValue()+Constants.REPORT_TRIM_CONNECTOR+title));
total+=trimData.get(requestInfo.getId().longValue()+Constants.REPORT_TRIM_CONNECTOR+title).longValue();
}else{
line.add(0l);
}
}
List<Long> _line= new ArrayList<Long>();
_line.add(total);
_line.addAll(line);
showData.put(requestInfo.getId().toString(), _line);
}
model.addAttribute("datas", showData);
} catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
}
model.addAttribute("datas", showData);
// HashMap<String,List<Long>> showData=new LinkedHashMap<>();//构造数据展示集合
// for(RequestInfo requestInfo:requestInfos){
// List<Long> line= new ArrayList<Long>();
// long total=0l;
// for(String title:titles){
// line.add(10000l);
// total+=10000l;
// }
// List<Long> _line= new ArrayList<Long>();
// _line.add(total);
// _line.addAll(line);
// showData.put(requestInfo.getId().toString(), _line);
// }
// model.addAttribute("datas", showData);
return "/report/lwhh";
}
}

View File

@@ -24,6 +24,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.nis.domain.FunctionServiceDict;
import com.nis.domain.Page;
import com.nis.domain.basics.ServiceDictInfo;
@@ -97,12 +99,15 @@ public class NtcPzReportController extends BaseController{
bean.setSearchService(serviceId.toString());
}
ReportResult<NtcPzReport> result=new ReportResult<>();
StringBuffer url=new StringBuffer(Constants.LOG_BASE_URL+Constants.NTC_PZ_REPORT+"?");
StringBuffer url=new StringBuffer(Constants.LOG_BASE_URL+Constants.NTC_PZ_REPORT);
List<String> titles=this.getDateTitiles(bean);
model.addAttribute("titles", titles);
try {
result=result.getReport(url.toString(), bean);
Gson gson=Constants.gsonbuilder.create();
String json=result.getReport(url.toString(), bean);
result = gson.fromJson(json, new TypeToken<ReportResult<NtcPzReport>>() {
}.getType());
Page<NtcPzReport> page=result.getData();
List<NtcPzReport> list=page.getList();
model.addAttribute("datas", list);

View File

@@ -1,6 +1,5 @@
package com.nis.web.controller.report;
import java.io.UnsupportedEncodingException;
import java.text.ParseException;
import java.util.HashMap;
import java.util.List;
@@ -15,12 +14,13 @@ import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.nis.domain.FunctionServiceDict;
import com.nis.domain.Page;
import com.nis.domain.log.SearchReport;
import com.nis.domain.report.NtcServiceReport;
import com.nis.domain.report.ReportResult;
import com.nis.exceptions.MaatConvertException;
import com.nis.util.Constants;
import com.nis.util.DictUtils;
import com.nis.web.controller.BaseController;
@@ -31,7 +31,7 @@ public class NtcServiceReportController extends BaseController {
@RequestMapping("/ajaxNtcServiceReport")
@ResponseBody
public Map<String, Long> report(@ModelAttribute("bean") SearchReport bean,Model model, HttpServletRequest request, HttpServletResponse response) {
Map<String, Long> data=new HashMap<>();
Map<String, Long> datas=new HashMap<>();
List<FunctionServiceDict> serviceList = DictUtils.getFunctionServiceDictList(bean.getFunctionId());
if(bean.getAction()!=null){
for(FunctionServiceDict service:serviceList){
@@ -59,25 +59,28 @@ public class NtcServiceReportController extends BaseController {
e1.printStackTrace();
}
ReportResult<NtcServiceReport> result=new ReportResult<>();
StringBuffer url=new StringBuffer(Constants.LOG_BASE_URL+Constants.NTC_SERVICE_REPORT+"?");
// try {
// result=result.getReport(url.toString(), bean);
// Page<NtcServiceReport> page=result.getData();
// List<NtcServiceReport> data=page.getList();
// for(NtcServiceReport report:data){
// if(datas.containsKey(report.getService().toString())){
// data.put(report.getService().toString(), datas.get(report.getService().toString())+report.getSum().longValue());
// }else{
// data.put(report.getService().toString(),report.getSum().longValue());
// }
// }
// } catch (Exception e) {
// // TODO Auto-generated catch block
// e.printStackTrace();
// }
if(bean.getAction()!=null){
data.put(bean.getAction().toString(), 66666666l);
}
return data;
StringBuffer url=new StringBuffer(Constants.LOG_BASE_URL+Constants.NTC_SERVICE_REPORT);
try {
Gson gson=Constants.gsonbuilder.create();
String json=result.getReport(url.toString(), bean);
result = gson.fromJson(json, new TypeToken<ReportResult<NtcServiceReport>>() {
}.getType());
Page<NtcServiceReport> page=result.getData();
List<NtcServiceReport> data=page.getList();
for(NtcServiceReport report:data){
if(datas.containsKey(report.getService().toString())){
datas.put(report.getService().toString(), datas.get(report.getService().toString())+report.getSum().longValue());
}else{
datas.put(report.getService().toString(),report.getSum().longValue());
}
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
// if(bean.getAction()!=null){
// data.put(bean.getAction().toString(), 66666666l);
// }
return datas;
}
}

View File

@@ -3,8 +3,6 @@ package com.nis.web.controller.report;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
@@ -12,15 +10,15 @@ import java.util.List;
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 com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.nis.domain.FunctionServiceDict;
import com.nis.domain.Page;
import com.nis.domain.basics.ServiceDictInfo;
import com.nis.domain.log.SearchReport;
import com.nis.domain.report.NtcSrcipDomesticReport;
import com.nis.domain.report.ReportResult;
@@ -53,8 +51,6 @@ public class NtcSrcipDomesticReportController extends BaseController {
}
bean.setSearchBusinessType("1");
ReportResult<NtcSrcipDomesticReport> result=new ReportResult<>();
StringBuffer url=new StringBuffer(Constants.LOG_BASE_URL+Constants.NTC_SERVICE_REPORT+"?");
bean.setPageSize(-1);
bean.setFields("srcProvince,srcCity,sum,reportTime");
try {
@@ -95,44 +91,84 @@ public class NtcSrcipDomesticReportController extends BaseController {
// }
// HashMap<String,List<Long>> showData=new HashMap<>();//构造数据展示集合
//
// for(String key:trimData.keySet()){
// List<Long> line= new ArrayList<Long>();
// long total=0;
// String[] keyArr=key.split(Constants.REPORT_TRIM_CONNECTOR);
// String location=keyArr[0]+Constants.REPORT_TRIM_CONNECTOR+keyArr[1];
// for(String title:titles){
// if(trimData.containsKey(location+Constants.REPORT_TRIM_CONNECTOR+title)){
// line.add(trimData.get(location+Constants.REPORT_TRIM_CONNECTOR+title));
// total+=trimData.get(location+Constants.REPORT_TRIM_CONNECTOR+title).longValue();
// }else{
// line.add(0l);
// }
// }
// List<Long> _line= new ArrayList<Long>();
// _line.add(total);
// _line.addAll(line);
// showData.put(location, _line);
// }
// model.addAttribute("datas", showData);
// } catch (Exception e) {
// // TODO: handle exception
// e.printStackTrace();
// }
HashMap<String,List<Long>> showData=new LinkedHashMap<>();//构造数据展示集合
long total=0;
List<Long> line= new ArrayList<Long>();
for(String title:titles){
line.add(10000l);
total+=10000l;
try {
ReportResult<NtcSrcipDomesticReport> result=new ReportResult<>();
StringBuffer url=new StringBuffer(Constants.LOG_BASE_URL+Constants.NTC_NTC_SRCIP_REPORT);
Gson gson=Constants.gsonbuilder.create();
String json=result.getReport(url.toString(), bean);
result = gson.fromJson(json, new TypeToken<ReportResult<NtcSrcipDomesticReport>>() {
}.getType());
Page<NtcSrcipDomesticReport> page=result.getData();
List<NtcSrcipDomesticReport> list=page.getList();
HashMap<String,Long> trimData=new HashMap<>();//数据累加去重
SimpleDateFormat sdf=new SimpleDateFormat(Constants.SEARCH_DATEFORMAT);
for(NtcSrcipDomesticReport report:list){
String trimStr="";
if(bean.getReportType()==Constants.REPORT_TYPE_HOUR){
trimStr=report.getSrcProvince().trim()+Constants.REPORT_TRIM_CONNECTOR+
report.getSrcCity().trim()+Constants.REPORT_TRIM_CONNECTOR+
sdf.format(report.getReportTime()).substring(0,13);
}else if(bean.getReportType()==Constants.REPORT_TYPE_DAY){
trimStr=report.getSrcProvince().trim()+Constants.REPORT_TRIM_CONNECTOR+
report.getSrcCity().trim()+Constants.REPORT_TRIM_CONNECTOR+
sdf.format(report.getReportTime()).substring(0,10);
}else if(bean.getReportType()==Constants.REPORT_TYPE_MONTH){
trimStr=report.getSrcProvince().trim()+Constants.REPORT_TRIM_CONNECTOR+
report.getSrcCity().trim()+Constants.REPORT_TRIM_CONNECTOR+
sdf.format(report.getReportTime()).substring(0,7);
}
if(trimData.containsKey(trimStr)){
trimData.put(trimStr, trimData.get(trimStr)+report.getSum().longValue());
}else{
trimData.put(trimStr, report.getSum().longValue());
}
}
HashMap<String,List<Long>> showData=new LinkedHashMap<>();//构造数据展示集合
for(String key:trimData.keySet()){
List<Long> line= new ArrayList<Long>();
long total=0;
String[] keyArr=key.split(Constants.REPORT_TRIM_CONNECTOR);
String location=keyArr[0]+Constants.REPORT_TRIM_CONNECTOR+keyArr[1];
for(String title:titles){
if(trimData.containsKey(location+Constants.REPORT_TRIM_CONNECTOR+title)){
line.add(trimData.get(location+Constants.REPORT_TRIM_CONNECTOR+title));
total+=trimData.get(location+Constants.REPORT_TRIM_CONNECTOR+title).longValue();
}else{
line.add(0l);
}
}
List<Long> _line= new ArrayList<Long>();
_line.add(total);
_line.addAll(line);
showData.put(location, _line);
}
model.addAttribute("splitor", Constants.REPORT_TRIM_CONNECTOR);
model.addAttribute("datas", showData);
} catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
}
List<Long> _line= new ArrayList<Long>();
_line.add(total);
_line.addAll(line);
for(int i=0;i<1000;i++){
showData.put("河北"+Constants.REPORT_TRIM_CONNECTOR+"廊坊"+i, _line);
}
model.addAttribute("splitor", Constants.REPORT_TRIM_CONNECTOR);
model.addAttribute("datas", showData);
// HashMap<String,List<Long>> showData=new LinkedHashMap<>();//构造数据展示集合
// long total=0;
// List<Long> line= new ArrayList<Long>();
// for(String title:titles){
// line.add(10000l);
// total+=10000l;
// }
// List<Long> _line= new ArrayList<Long>();
// _line.add(total);
// _line.addAll(line);
// for(int i=0;i<1000;i++){
// showData.put("河北"+Constants.REPORT_TRIM_CONNECTOR+"廊坊"+i, _line);
// }
// model.addAttribute("splitor", Constants.REPORT_TRIM_CONNECTOR);
// model.addAttribute("datas", showData);
return "/report/srcIp";
}
}

View File

@@ -3,8 +3,6 @@ package com.nis.web.controller.report;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
@@ -17,7 +15,10 @@ import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.nis.domain.FunctionServiceDict;
import com.nis.domain.Page;
import com.nis.domain.basics.ServiceDictInfo;
import com.nis.domain.log.SearchReport;
import com.nis.domain.report.NtcTagReport;
@@ -52,8 +53,7 @@ public class NtcTagReportController extends BaseController {
bean.setSearchService(serviceId.toString());
}
bean.setSearchBusinessType("1");
ReportResult<NtcTagReport> result=new ReportResult<>();
StringBuffer url=new StringBuffer(Constants.LOG_BASE_URL+Constants.NTC_SERVICE_REPORT+"?");
bean.setPageSize(-1);
bean.setFields("tag,sum,reportTime");
try {
@@ -64,67 +64,73 @@ public class NtcTagReportController extends BaseController {
}
List<String> titles=this.getDateTitiles(bean);
model.addAttribute("titles", titles);
// try {
// result=result.getReport(url.toString(), bean);
// Page<NtcTagReportLog> page=result.getData();
// List<NtcTagReportLog> list=page.getList();
// HashMap<String,Long> trimData=new HashMap<>();//数据累加去重
// for(NtcTagReportLog report:list){
// String trimStr="";
// if(bean.getReportType()==Constants.REPORT_TYPE_HOUR){
// trimStr=report.getTag().intValue()+Constants.REPORT_TRIM_CONNECTOR+
// sdf.format(cal.getTime()).substring(0,13);
//
// }else if(bean.getReportType()==Constants.REPORT_TYPE_DAY){
// trimStr=report.getTag().intValue()+Constants.REPORT_TRIM_CONNECTOR+
// sdf.format(cal.getTime()).substring(0,10);
//
// }else if(bean.getReportType()==Constants.REPORT_TYPE_MONTH){
// trimStr=report.getTag().intValue()+Constants.REPORT_TRIM_CONNECTOR+
// sdf.format(cal.getTime()).substring(0,7);
// }
// if(trimData.containsKey(trimStr)){
// trimData.put(trimStr, trimData.get(trimStr)+report.getSum().longValue());
// }else{
// trimData.put(trimStr, report.getSum().longValue());
// }
// }
// HashMap<String,List<Long>> showData=new LinkedHashMap<>();//构造数据展示集合
// for(ServiceDictInfo label:lables){
// List<Long> line= new ArrayList<Long>();
// long total=0;
// for(String title:titles){
// if(trimData.containsKey(label.getServiceDictId().intValue()+Constants.REPORT_TRIM_CONNECTOR+title)){
// line.add(trimData.get(label.getServiceDictId().intValue()+Constants.REPORT_TRIM_CONNECTOR+title));
// total+=trimData.get(label.getServiceDictId().intValue()+Constants.REPORT_TRIM_CONNECTOR+title).longValue();
// }else{
// line.add(0l);
// }
// }
// List<Long> _line= new ArrayList<Long>();
// _line.add(total);
// _line.addAll(line);
// showData.put(label.getServiceDictId().toString(), _line);
// }
// model.addAttribute("datas", showData);
// } catch (Exception e) {
// // TODO: handle exception
// e.printStackTrace();
// }
HashMap<String,List<Long>> showData=new LinkedHashMap<>();//构造数据展示集合
for(ServiceDictInfo label:labels){
List<Long> line= new ArrayList<Long>();
long total=0l;
for(String title:titles){
line.add(10000l);
total+=10000l;
try {
ReportResult<NtcTagReport> result=new ReportResult<>();
StringBuffer url=new StringBuffer(Constants.LOG_BASE_URL+Constants.NTC_TAG_REPORT);
Gson gson=Constants.gsonbuilder.create();
String json=result.getReport(url.toString(), bean);
result = gson.fromJson(json, new TypeToken<ReportResult<NtcTagReport>>() {
}.getType());
Page<NtcTagReport> page=result.getData();
List<NtcTagReport> list=page.getList();
HashMap<String,Long> trimData=new HashMap<>();//数据累加去重
SimpleDateFormat sdf=new SimpleDateFormat(Constants.SEARCH_DATEFORMAT);
for(NtcTagReport report:list){
String trimStr="";
if(bean.getReportType()==Constants.REPORT_TYPE_HOUR){
trimStr=report.getTag().intValue()+Constants.REPORT_TRIM_CONNECTOR+
sdf.format(report.getReportTime()).substring(0,13);
}else if(bean.getReportType()==Constants.REPORT_TYPE_DAY){
trimStr=report.getTag().intValue()+Constants.REPORT_TRIM_CONNECTOR+
sdf.format(report.getReportTime()).substring(0,10);
}else if(bean.getReportType()==Constants.REPORT_TYPE_MONTH){
trimStr=report.getTag().intValue()+Constants.REPORT_TRIM_CONNECTOR+
sdf.format(report.getReportTime()).substring(0,7);
}
if(trimData.containsKey(trimStr)){
trimData.put(trimStr, trimData.get(trimStr)+report.getSum().longValue());
}else{
trimData.put(trimStr, report.getSum().longValue());
}
}
List<Long> _line= new ArrayList<Long>();
_line.add(total);
_line.addAll(line);
showData.put(label.getServiceDictId().toString(), _line);
HashMap<String,List<Long>> showData=new LinkedHashMap<>();//构造数据展示集合
for(ServiceDictInfo label:labels){
List<Long> line= new ArrayList<Long>();
long total=0;
for(String title:titles){
if(trimData.containsKey(label.getServiceDictId().intValue()+Constants.REPORT_TRIM_CONNECTOR+title)){
line.add(trimData.get(label.getServiceDictId().intValue()+Constants.REPORT_TRIM_CONNECTOR+title));
total+=trimData.get(label.getServiceDictId().intValue()+Constants.REPORT_TRIM_CONNECTOR+title).longValue();
}else{
line.add(0l);
}
}
List<Long> _line= new ArrayList<Long>();
_line.add(total);
_line.addAll(line);
showData.put(label.getServiceDictId().toString(), _line);
}
model.addAttribute("datas", showData);
} catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
}
model.addAttribute("datas", showData);
// HashMap<String,List<Long>> showData=new LinkedHashMap<>();//构造数据展示集合
// for(ServiceDictInfo label:labels){
// List<Long> line= new ArrayList<Long>();
// long total=0l;
// for(String title:titles){
// line.add(10000l);
// total+=10000l;
// }
// List<Long> _line= new ArrayList<Long>();
// _line.add(total);
// _line.addAll(line);
// showData.put(label.getServiceDictId().toString(), _line);
// }
// model.addAttribute("datas", showData);
return "/report/label";
}
}

View File

@@ -3,9 +3,6 @@ package com.nis.web.controller.report;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
@@ -18,11 +15,13 @@ import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.nis.domain.FunctionServiceDict;
import com.nis.domain.Page;
import com.nis.domain.basics.ServiceDictInfo;
import com.nis.domain.log.SearchReport;
import com.nis.domain.report.NtcTagReport;
import com.nis.domain.report.NtcAttrTypeReport;
import com.nis.domain.report.ReportResult;
import com.nis.util.Constants;
import com.nis.util.DictUtils;
@@ -67,21 +66,73 @@ public class NtcXzReportController extends BaseController {
}
List<String> titles=this.getDateTitiles(bean);
model.addAttribute("titles", titles);
HashMap<String,List<Long>> showData=new LinkedHashMap<>();//构造数据展示集合
for(ServiceDictInfo xz:xzs){
List<Long> line= new ArrayList<Long>();
long total=0l;
for(String title:titles){
line.add(10000l);
total+=10000l;
try {
ReportResult<NtcAttrTypeReport> result=new ReportResult<>();
StringBuffer url=new StringBuffer(Constants.LOG_BASE_URL+Constants.NTC_ATTRTYPE_REPORT);
Gson gson=Constants.gsonbuilder.create();
String json=result.getReport(url.toString(), bean);
result = gson.fromJson(json, new TypeToken<ReportResult<NtcAttrTypeReport>>() {
}.getType());
Page<NtcAttrTypeReport> page=result.getData();
List<NtcAttrTypeReport> list=page.getList();
HashMap<String,Long> trimData=new HashMap<>();//数据累加去重
SimpleDateFormat sdf=new SimpleDateFormat(Constants.SEARCH_DATEFORMAT);
for(NtcAttrTypeReport report:list){
String trimStr="";
if(bean.getReportType()==Constants.REPORT_TYPE_HOUR){
trimStr=report.getAttrType().intValue()+Constants.REPORT_TRIM_CONNECTOR+
sdf.format(report.getReportTime()).substring(0,13);
}else if(bean.getReportType()==Constants.REPORT_TYPE_DAY){
trimStr=report.getAttrType().intValue()+Constants.REPORT_TRIM_CONNECTOR+
sdf.format(report.getReportTime()).substring(0,10);
}else if(bean.getReportType()==Constants.REPORT_TYPE_MONTH){
trimStr=report.getAttrType().intValue()+Constants.REPORT_TRIM_CONNECTOR+
sdf.format(report.getReportTime()).substring(0,7);
}
if(trimData.containsKey(trimStr)){
trimData.put(trimStr, trimData.get(trimStr)+report.getSum().longValue());
}else{
trimData.put(trimStr, report.getSum().longValue());
}
}
List<Long> _line= new ArrayList<Long>();
_line.add(total);
_line.addAll(line);
showData.put(xz.getServiceDictId().toString(), _line);
HashMap<String,List<Long>> showData=new LinkedHashMap<>();//构造数据展示集合
for(ServiceDictInfo xz:xzs){
List<Long> line= new ArrayList<Long>();
long total=0;
for(String title:titles){
if(trimData.containsKey(xz.getServiceDictId().intValue()+Constants.REPORT_TRIM_CONNECTOR+title)){
line.add(trimData.get(xz.getServiceDictId().intValue()+Constants.REPORT_TRIM_CONNECTOR+title));
total+=trimData.get(xz.getServiceDictId().intValue()+Constants.REPORT_TRIM_CONNECTOR+title).longValue();
}else{
line.add(0l);
}
}
List<Long> _line= new ArrayList<Long>();
_line.add(total);
_line.addAll(line);
showData.put(xz.getServiceDictId().toString(), _line);
}
model.addAttribute("datas", showData);
} catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
}
model.addAttribute("datas", showData);
// HashMap<String,List<Long>> showData=new LinkedHashMap<>();//构造数据展示集合
// for(ServiceDictInfo xz:xzs){
// List<Long> line= new ArrayList<Long>();
// long total=0l;
// for(String title:titles){
// line.add(10000l);
// total+=10000l;
// }
// List<Long> _line= new ArrayList<Long>();
// _line.add(total);
// _line.addAll(line);
// showData.put(xz.getServiceDictId().toString(), _line);
// }
// model.addAttribute("datas", showData);
return "/report/attrType";
}
}

View File

@@ -40,7 +40,8 @@ online_media_control=\u5728\u7EBF\u5A92\u4F53\u7BA1\u63A7
sip_ip_control=SIP\u534F\u8BAEIP\u7BA1\u63A7
domain_control_white=\u57DF\u540D\u7BA1\u63A7\u767D\u540D\u5355
ip_address_control=IP\u5730\u5740\u7BA1\u63A7
ip_control=IP
ip_control=IP\u5730\u5740
ip_redirect=IP\u91CD\u5B9A\u5411
domain_control=\u57DF\u540D\u7BA1\u63A7
dns_control=DNS
basic_configuration=\u57FA\u672C\u914D\u7F6E

View File

@@ -230,6 +230,11 @@ logBaseUrl=http://10.0.6.242:8080/galaxy/service/log/v1/
ntcPzReport=ntcPzReport
ntcServiceReport=ntcServiceReport
ntcTagReport=ntcTagReport
ntcAttrTypeReport=ntcAttrTypeReport
ntcLwhhReport=ntcLwhhReport
ntcSrcipDomesticReport=ntcSrcipDomesticReport
ntcDestipCountryReport=ntcDestipCountryReport
ntcEntranceReport=ntcEntranceReport
ntcIpLog=ntcIpLogs
ntcHttpLog=ntcHttpLogs
ntcDnsLog=ntcDnsLogs