修改小时报、日报、月报数据直接从接口查询

This commit is contained in:
leijun
2018-08-28 18:52:15 +08:00
parent f05696e7d5
commit 2b14a7db2b
7 changed files with 65 additions and 45 deletions

View File

@@ -52,7 +52,14 @@ public class NtcDestIpReportController extends BaseController {
} }
bean.setSearchService(serviceId.toString()); bean.setSearchService(serviceId.toString());
} }
bean.setSearchBusinessType("1"); //根据reportType获取小时、日报、月报
if(bean.getReportType()==Constants.REPORT_TYPE_HOUR){
bean.setSearchBusinessType("2");
}else if(bean.getReportType()==Constants.REPORT_TYPE_DAY){
bean.setSearchBusinessType("3");
}else if(bean.getReportType()==Constants.REPORT_TYPE_MONTH){
bean.setSearchBusinessType("4");
}
// 调用服务接口... // 调用服务接口...
@@ -69,14 +76,13 @@ public class NtcDestIpReportController extends BaseController {
try { try {
StringBuffer url=new StringBuffer(Constants.LOG_BASE_URL+Constants.NTC_NTC_DESTIP_REPORT); StringBuffer url=new StringBuffer(Constants.LOG_BASE_URL+Constants.NTC_NTC_DESTIP_REPORT);
String json=ConfigServiceUtil.getReport(url.toString(), bean); String json=ConfigServiceUtil.getReport(url.toString(), bean);
HashMap<String,Long> trimData=new HashMap<>();//数据累加去重 HashMap<String,Long> trimData=new HashMap<>();
// SimpleDateFormat sdf=new SimpleDateFormat(Constants.SEARCH_DATEFORMAT); // SimpleDateFormat sdf=new SimpleDateFormat(Constants.SEARCH_DATEFORMAT);
for(NtcDestIpReport report:getList(json)){ for(NtcDestIpReport report:getList(json)){
String trimStr=""; String trimStr="";
if(bean.getReportType()==Constants.REPORT_TYPE_HOUR){ if(bean.getReportType()==Constants.REPORT_TYPE_HOUR){
trimStr=report.getDestCountry().trim()+Constants.REPORT_TRIM_CONNECTOR+ trimStr=report.getDestCountry().trim()+Constants.REPORT_TRIM_CONNECTOR+
report.getReportTime().substring(0,13); report.getReportTime().substring(0,13);
}else if(bean.getReportType()==Constants.REPORT_TYPE_DAY){ }else if(bean.getReportType()==Constants.REPORT_TYPE_DAY){
trimStr=report.getDestCountry().trim()+Constants.REPORT_TRIM_CONNECTOR+ trimStr=report.getDestCountry().trim()+Constants.REPORT_TRIM_CONNECTOR+
report.getReportTime().substring(0,10); report.getReportTime().substring(0,10);
@@ -85,11 +91,8 @@ public class NtcDestIpReportController extends BaseController {
trimStr=report.getDestCountry().trim()+Constants.REPORT_TRIM_CONNECTOR+ trimStr=report.getDestCountry().trim()+Constants.REPORT_TRIM_CONNECTOR+
report.getReportTime().substring(0,7); report.getReportTime().substring(0,7);
} }
if(trimData.containsKey(trimStr)){ trimData.put(trimStr, report.getSum().longValue());
trimData.put(trimStr, trimData.get(trimStr)+report.getSum().longValue());
}else{
trimData.put(trimStr, report.getSum().longValue());
}
} }
HashMap<String,List<Long>> showData=new LinkedHashMap<>();//构造数据展示集合 HashMap<String,List<Long>> showData=new LinkedHashMap<>();//构造数据展示集合
for(Entry<String, Long> counrty:trimData.entrySet()){ for(Entry<String, Long> counrty:trimData.entrySet()){

View File

@@ -52,8 +52,14 @@ public class NtcEntranceReportController extends BaseController {
} }
bean.setSearchService(serviceId.toString()); bean.setSearchService(serviceId.toString());
} }
bean.setSearchBusinessType("1"); //根据reportType获取小时、日报、月报
if(bean.getReportType()==Constants.REPORT_TYPE_HOUR){
bean.setSearchBusinessType("2");
}else if(bean.getReportType()==Constants.REPORT_TYPE_DAY){
bean.setSearchBusinessType("3");
}else if(bean.getReportType()==Constants.REPORT_TYPE_MONTH){
bean.setSearchBusinessType("4");
}
// 调用服务接口... // 调用服务接口...
bean.setPageSize(-1); bean.setPageSize(-1);
@@ -85,11 +91,7 @@ public class NtcEntranceReportController extends BaseController {
trimStr=report.getEntranceId().intValue()+Constants.REPORT_TRIM_CONNECTOR+ trimStr=report.getEntranceId().intValue()+Constants.REPORT_TRIM_CONNECTOR+
report.getReportTime().substring(0,7); report.getReportTime().substring(0,7);
} }
if(trimData.containsKey(trimStr)){ trimData.put(trimStr, report.getSum().longValue());
trimData.put(trimStr, trimData.get(trimStr)+report.getSum().longValue());
}else{
trimData.put(trimStr, report.getSum().longValue());
}
} }
HashMap<String,List<Long>> showData=new LinkedHashMap<>();//构造数据展示集合 HashMap<String,List<Long>> showData=new LinkedHashMap<>();//构造数据展示集合
for(Entry<String, Long> counrty:trimData.entrySet()){ for(Entry<String, Long> counrty:trimData.entrySet()){

View File

@@ -52,7 +52,14 @@ public class NtcLwhhReportController extends BaseController {
} }
bean.setSearchService(serviceId.toString()); bean.setSearchService(serviceId.toString());
} }
bean.setSearchBusinessType("1"); //根据reportType获取小时、日报、月报
if(bean.getReportType()==Constants.REPORT_TYPE_HOUR){
bean.setSearchBusinessType("2");
}else if(bean.getReportType()==Constants.REPORT_TYPE_DAY){
bean.setSearchBusinessType("3");
}else if(bean.getReportType()==Constants.REPORT_TYPE_MONTH){
bean.setSearchBusinessType("4");
}
bean.setPageSize(-1); bean.setPageSize(-1);
bean.setFields("lwhh,sum,reportTime"); bean.setFields("lwhh,sum,reportTime");
try { try {
@@ -66,7 +73,7 @@ public class NtcLwhhReportController extends BaseController {
try { try {
StringBuffer url=new StringBuffer(Constants.LOG_BASE_URL+Constants.NTC_NTC_LWHH_REPORT); StringBuffer url=new StringBuffer(Constants.LOG_BASE_URL+Constants.NTC_NTC_LWHH_REPORT);
String json=ConfigServiceUtil.getReport(url.toString(), bean); String json=ConfigServiceUtil.getReport(url.toString(), bean);
HashMap<String,Long> trimData=new HashMap<>();//数据累加去重 HashMap<String,Long> trimData=new HashMap<>();
// SimpleDateFormat sdf=new SimpleDateFormat(Constants.SEARCH_DATEFORMAT); // SimpleDateFormat sdf=new SimpleDateFormat(Constants.SEARCH_DATEFORMAT);
for(NtcLwhhReport report:getList(json)){ for(NtcLwhhReport report:getList(json)){
String trimStr=""; String trimStr="";
@@ -82,11 +89,7 @@ public class NtcLwhhReportController extends BaseController {
trimStr=report.getLwhh().intValue()+Constants.REPORT_TRIM_CONNECTOR+ trimStr=report.getLwhh().intValue()+Constants.REPORT_TRIM_CONNECTOR+
report.getReportTime().substring(0,7); report.getReportTime().substring(0,7);
} }
if(trimData.containsKey(trimStr)){ trimData.put(trimStr, report.getSum().longValue());
trimData.put(trimStr, trimData.get(trimStr)+report.getSum().longValue());
}else{
trimData.put(trimStr, report.getSum().longValue());
}
} }
HashMap<String,List<Long>> showData=new LinkedHashMap<>();//构造数据展示集合 HashMap<String,List<Long>> showData=new LinkedHashMap<>();//构造数据展示集合
for(RequestInfo requestInfo:requestInfos){ for(RequestInfo requestInfo:requestInfos){

View File

@@ -50,7 +50,14 @@ public class NtcServiceReportController extends BaseController {
} }
} }
bean.setSearchService(serviceId.toString()); bean.setSearchService(serviceId.toString());
bean.setSearchBusinessType("1"); //根据reportType获取小时、日报、月报
if(bean.getReportType()==Constants.REPORT_TYPE_HOUR){
bean.setSearchBusinessType("2");
}else if(bean.getReportType()==Constants.REPORT_TYPE_DAY){
bean.setSearchBusinessType("3");
}else if(bean.getReportType()==Constants.REPORT_TYPE_MONTH){
bean.setSearchBusinessType("4");
}
bean.setPageSize(-1); bean.setPageSize(-1);
try { try {
this.setReportSearchTime(bean); this.setReportSearchTime(bean);
@@ -60,15 +67,12 @@ public class NtcServiceReportController extends BaseController {
} }
StringBuffer url=new StringBuffer(Constants.LOG_BASE_URL+Constants.NTC_SERVICE_REPORT); StringBuffer url=new StringBuffer(Constants.LOG_BASE_URL+Constants.NTC_SERVICE_REPORT);
try { try {
//bean.setSearchReportEndTime("2018-08-27 00:00:00");
String json=ConfigServiceUtil.getReport(url.toString(), bean); String json=ConfigServiceUtil.getReport(url.toString(), bean);
List<NtcServiceReport> data=getList(json); List<NtcServiceReport> data=getList(json);
Map<Integer, Long> dataMap=new HashMap<>(); Map<Integer, Long> dataMap=new HashMap<>();
for(NtcServiceReport report:data){ for(NtcServiceReport report:data){
if(dataMap.containsKey(report.getService())){ dataMap.put(report.getService(),report.getSum().longValue());
dataMap.put(report.getService(), dataMap.get(report.getService())+report.getSum().longValue());
}else{
dataMap.put(report.getService(),report.getSum().longValue());
}
} }
for(Entry<Integer, Long> e:dataMap.entrySet()) { for(Entry<Integer, Long> e:dataMap.entrySet()) {
Map<String, Object> _data=new HashMap<>(); Map<String, Object> _data=new HashMap<>();

View File

@@ -51,7 +51,14 @@ public class NtcSrcipDomesticReportController extends BaseController {
bean.setSearchService(serviceId.toString()); bean.setSearchService(serviceId.toString());
} }
bean.setSearchBusinessType("1"); //根据reportType获取小时、日报、月报
if(bean.getReportType()==Constants.REPORT_TYPE_HOUR){
bean.setSearchBusinessType("2");
}else if(bean.getReportType()==Constants.REPORT_TYPE_DAY){
bean.setSearchBusinessType("3");
}else if(bean.getReportType()==Constants.REPORT_TYPE_MONTH){
bean.setSearchBusinessType("4");
}
bean.setPageSize(-1); bean.setPageSize(-1);
bean.setFields("srcProvince,srcCity,sum,reportTime"); bean.setFields("srcProvince,srcCity,sum,reportTime");
try { try {
@@ -120,11 +127,7 @@ public class NtcSrcipDomesticReportController extends BaseController {
report.getSrcCity().trim()+Constants.REPORT_TRIM_CONNECTOR+ report.getSrcCity().trim()+Constants.REPORT_TRIM_CONNECTOR+
report.getReportTime().substring(0,7); report.getReportTime().substring(0,7);
} }
if(trimData.containsKey(trimStr)){ trimData.put(trimStr, report.getSum().longValue());
trimData.put(trimStr, trimData.get(trimStr)+report.getSum().longValue());
}else{
trimData.put(trimStr, report.getSum().longValue());
}
} }
HashMap<String,List<Long>> showData=new LinkedHashMap<>();//构造数据展示集合 HashMap<String,List<Long>> showData=new LinkedHashMap<>();//构造数据展示集合
for(String key:trimData.keySet()){ for(String key:trimData.keySet()){

View File

@@ -52,8 +52,14 @@ public class NtcTagReportController extends BaseController {
} }
bean.setSearchService(serviceId.toString()); bean.setSearchService(serviceId.toString());
} }
bean.setSearchBusinessType("1"); //根据reportType获取小时、日报、月报
if(bean.getReportType()==Constants.REPORT_TYPE_HOUR){
bean.setSearchBusinessType("2");
}else if(bean.getReportType()==Constants.REPORT_TYPE_DAY){
bean.setSearchBusinessType("3");
}else if(bean.getReportType()==Constants.REPORT_TYPE_MONTH){
bean.setSearchBusinessType("4");
}
bean.setPageSize(-1); bean.setPageSize(-1);
bean.setFields("tag,sum,reportTime"); bean.setFields("tag,sum,reportTime");
try { try {
@@ -84,11 +90,7 @@ public class NtcTagReportController extends BaseController {
trimStr=report.getTag().intValue()+Constants.REPORT_TRIM_CONNECTOR+ trimStr=report.getTag().intValue()+Constants.REPORT_TRIM_CONNECTOR+
report.getReportTime().substring(0,7); 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()); trimData.put(trimStr, report.getSum().longValue());
}
} }
HashMap<String,List<Long>> showData=new LinkedHashMap<>();//构造数据展示集合 HashMap<String,List<Long>> showData=new LinkedHashMap<>();//构造数据展示集合
for(ServiceDictInfo label:labels){ for(ServiceDictInfo label:labels){

View File

@@ -53,7 +53,14 @@ public class NtcXzReportController extends BaseController {
} }
bean.setSearchService(serviceId.toString()); bean.setSearchService(serviceId.toString());
} }
bean.setSearchBusinessType("1"); //根据reportType获取小时、日报、月报
if(bean.getReportType()==Constants.REPORT_TYPE_HOUR){
bean.setSearchBusinessType("2");
}else if(bean.getReportType()==Constants.REPORT_TYPE_DAY){
bean.setSearchBusinessType("3");
}else if(bean.getReportType()==Constants.REPORT_TYPE_MONTH){
bean.setSearchBusinessType("4");
}
// 调用服务接口... // 调用服务接口...
@@ -88,11 +95,7 @@ public class NtcXzReportController extends BaseController {
trimStr=report.getAttrType().intValue()+Constants.REPORT_TRIM_CONNECTOR+ trimStr=report.getAttrType().intValue()+Constants.REPORT_TRIM_CONNECTOR+
report.getReportTime().substring(0,7); 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()); trimData.put(trimStr, report.getSum().longValue());
}
} }
HashMap<String,List<Long>> showData=new LinkedHashMap<>();//构造数据展示集合 HashMap<String,List<Long>> showData=new LinkedHashMap<>();//构造数据展示集合
for(ServiceDictInfo xz:xzs){ for(ServiceDictInfo xz:xzs){