Merge branch 'develop' of https://git.mesalab.cn/K18_NTCS_WEB/NTC.git into develop
This commit is contained in:
@@ -6,6 +6,8 @@ import java.net.URLEncoder;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@@ -94,6 +96,49 @@ public class DashboardController extends BaseController{
|
||||
}
|
||||
return list;
|
||||
}
|
||||
/**
|
||||
* 跳转活跃端口详情界面
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value="portActiveChart")
|
||||
@ResponseBody
|
||||
public List portActiveChart(String beginDate,String endDate){
|
||||
Map<String, Object> fromJsonList = new HashMap<String, Object>();
|
||||
List list = new ArrayList();
|
||||
try {
|
||||
String url=Constants.DASHBOARD_URL+Constants.TRAFFIC_PORTACTIVE_FIVEMINUTE;//+Constants.TRAFFIC_IPACTIVE_ONEHOUR;
|
||||
url=urlAddDate(url, beginDate, endDate);
|
||||
String string = HttpClientUtil.get(url);
|
||||
Gson gson = new GsonBuilder().create();
|
||||
fromJsonList = gson.fromJson(string, new TypeToken<Map>(){}.getType());
|
||||
logger.debug("活跃端口从"+beginDate+"到"+endDate+",间隔5分钟数据"+fromJsonList);
|
||||
list = (ArrayList) fromJsonList.get("data");
|
||||
return list;
|
||||
|
||||
} catch (Exception e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
logger.error("活跃端口详情界面数据获取错误"+e);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 跳转活跃端口详情界面
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value="portActiveList")
|
||||
public String portActiveList(Model model){
|
||||
// 默认当前时间一小时
|
||||
Calendar cal = Calendar. getInstance ();
|
||||
cal.setTime(new Date());
|
||||
String endDate = new SimpleDateFormat( "yyyy-MM-dd HH:mm:00" ).format(cal.getTime());//获取到完整的时间
|
||||
cal.set(Calendar.HOUR_OF_DAY, cal.get(Calendar.HOUR_OF_DAY) - 1);
|
||||
String beginDate = new SimpleDateFormat( "yyyy-MM-dd HH:mm:00" ).format(cal.getTime());
|
||||
model.addAttribute("beginDate", beginDate);
|
||||
model.addAttribute("endDate", endDate);
|
||||
return "/dashboard/trafficPortActiveList";
|
||||
}
|
||||
/**
|
||||
* 活跃IP TOP10
|
||||
*/
|
||||
@@ -194,7 +239,7 @@ public class DashboardController extends BaseController{
|
||||
return "/dashboard/trafficIpActiveList";
|
||||
}
|
||||
/**
|
||||
* 活跃IP TOP10 一小时 间隔5分钟数据
|
||||
* 活跃IP TOP10 一小时每个IP的最大值
|
||||
*/
|
||||
@RequestMapping(value="ajaxIpActiveList")
|
||||
@ResponseBody
|
||||
@@ -209,6 +254,24 @@ public class DashboardController extends BaseController{
|
||||
fromJsonList = gson.fromJson(string, new TypeToken<Map<String, Object>>(){}.getType());
|
||||
logger.debug("活跃IP1小时"+fromJsonList);
|
||||
list = gson.fromJson(fromJsonList.get("data").toString(), new TypeToken<List<TrafficIpActiveStatistic>>() {}.getType()) ;
|
||||
Collections.sort(list, new Comparator<TrafficIpActiveStatistic>() {
|
||||
|
||||
@Override
|
||||
public int compare(TrafficIpActiveStatistic o1, TrafficIpActiveStatistic o2) {
|
||||
if(o1==null&&o2!=null){
|
||||
return 1;
|
||||
}
|
||||
if(o1!=null&&o2==null){
|
||||
return -1;
|
||||
}
|
||||
if(o1==o2&&o1==null){
|
||||
return 0;
|
||||
}
|
||||
Long ob1 = o1.getC2sByteLen()+o1.getS2cByteLen();
|
||||
Long ob2 = o2.getC2sByteLen()+o2.getS2cByteLen();
|
||||
return -(ob1).compareTo(ob2);
|
||||
}
|
||||
});
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
@@ -283,19 +346,19 @@ public class DashboardController extends BaseController{
|
||||
//将数字替换为标签文字
|
||||
if(list!=null&&!list.isEmpty()){
|
||||
for (Map map : list) {
|
||||
Double value1 = Double.parseDouble(map.get("protoType").toString());
|
||||
Double value1 = Double.parseDouble(map.get("protoType").toString().trim());
|
||||
for (CodeResult code : codeList) {
|
||||
Double value2 = Double.valueOf(code.getCode());
|
||||
Double value2 = Double.valueOf(code.getCode().trim());
|
||||
if(value1.equals(value2)){
|
||||
map.put("protoType", code.getItem());
|
||||
map.put("protoType", code.getItem().trim());
|
||||
break;
|
||||
}
|
||||
}
|
||||
// 协议没匹配的匹配app码表
|
||||
for (CodeResult code : appCodeList) {
|
||||
Double value3 = Double.valueOf(code.getCode());
|
||||
Double value3 = Double.valueOf(code.getCode().trim());
|
||||
if(value1.equals(value3)){
|
||||
map.put("protoType", code.getItem());
|
||||
map.put("protoType", code.getItem().trim());
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -330,11 +393,11 @@ public class DashboardController extends BaseController{
|
||||
//将数字替换为标签文字
|
||||
if(list!=null&&!list.isEmpty()){
|
||||
for (Map map : list) {
|
||||
Double value1 = Double.parseDouble(map.get("appType").toString());
|
||||
Double value1 = Double.parseDouble(map.get("appType").toString().trim());
|
||||
for (CodeResult code : codeList) {
|
||||
Double value2 = Double.valueOf(code.getCode());
|
||||
Double value2 = Double.valueOf(code.getCode().trim());
|
||||
if(value1.equals(value2)){
|
||||
map.put("appType", code.getItem());
|
||||
map.put("appType", code.getItem().trim());
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -369,11 +432,11 @@ public class DashboardController extends BaseController{
|
||||
//将数字替换为标签文字
|
||||
if(list!=null&&!list.isEmpty()){
|
||||
for (Map map : list) {
|
||||
Double value1 = Double.parseDouble(map.get("osType").toString());
|
||||
Double value1 = Double.parseDouble(map.get("osType").toString().trim());
|
||||
for (CodeResult code : codeList) {
|
||||
Double value2 = Double.valueOf(code.getCode());
|
||||
Double value2 = Double.valueOf(code.getCode().trim());
|
||||
if(value1.equals(value2)){
|
||||
map.put("osType", code.getItem());
|
||||
map.put("osType", code.getItem().trim());
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -403,8 +466,8 @@ public class DashboardController extends BaseController{
|
||||
//将标签文字转为数字
|
||||
Integer os=null;
|
||||
for (CodeResult codeResult : codeList1) {
|
||||
if(osType.equalsIgnoreCase(codeResult.getItem())){
|
||||
os=Integer.parseInt(codeResult.getCode());
|
||||
if(osType.equalsIgnoreCase(codeResult.getItem().trim())){
|
||||
os=Integer.parseInt(codeResult.getCode().trim());
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -421,11 +484,11 @@ public class DashboardController extends BaseController{
|
||||
//将数字替换为标签文字
|
||||
if(null!=list&&!list.isEmpty()){
|
||||
for (Map map : list) {
|
||||
Double value1 = Double.parseDouble(map.get("bsType").toString());
|
||||
Double value1 = Double.parseDouble(map.get("bsType").toString().trim());
|
||||
for (CodeResult code : codeList2) {
|
||||
Double value2 = Double.valueOf(code.getCode());
|
||||
Double value2 = Double.valueOf(code.getCode().trim());
|
||||
if(value1.equals(value2)){
|
||||
map.put("bsType", code.getItem());
|
||||
map.put("bsType", code.getItem().trim());
|
||||
break;
|
||||
}
|
||||
//10个域名之外的为others 设为-1外
|
||||
@@ -465,11 +528,11 @@ public class DashboardController extends BaseController{
|
||||
//将数字替换为标签文字
|
||||
if(list!=null&&!list.isEmpty()){
|
||||
for (Map map : list) {
|
||||
Double value1 = Double.parseDouble(map.get("bsType").toString());
|
||||
Double value1 = Double.parseDouble(map.get("bsType").toString().trim());
|
||||
for (CodeResult code : codeList) {
|
||||
Double value2 = Double.valueOf(code.getCode());
|
||||
Double value2 = Double.valueOf(code.getCode().trim());
|
||||
if(value1.equals(value2)){
|
||||
map.put("bsType", code.getItem());
|
||||
map.put("bsType", code.getItem().trim());
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -499,13 +562,13 @@ public class DashboardController extends BaseController{
|
||||
//将标签文字转为数字
|
||||
Integer bs=null;
|
||||
for (CodeResult codeResult : codeList1) {
|
||||
if(bsType.equalsIgnoreCase(codeResult.getItem())){
|
||||
bs=Integer.parseInt(codeResult.getCode());
|
||||
if(bsType.equalsIgnoreCase(codeResult.getItem().trim())){
|
||||
bs=Integer.parseInt(codeResult.getCode().trim());
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(bs==null){
|
||||
bs=Integer.parseInt(bsType);//处理为匹配项编码
|
||||
bs=Integer.parseInt(bsType.trim());//处理为匹配项编码
|
||||
}
|
||||
try {
|
||||
String string = HttpClientUtil.get(Constants.DASHBOARD_URL+Constants.TRAFFIC_SYSTEM_CHART+"?bsType="+bs);
|
||||
@@ -517,16 +580,16 @@ public class DashboardController extends BaseController{
|
||||
//将数字替换为标签文字
|
||||
if(null!=list&&!list.isEmpty()){
|
||||
for (Map map : list) {
|
||||
Double value1 = Double.parseDouble(map.get("osType").toString());
|
||||
Double value1 = Double.parseDouble(map.get("osType").toString().trim());
|
||||
for (CodeResult code : codeList2) {
|
||||
Double value2 = Double.valueOf(code.getCode());
|
||||
Double value2 = Double.valueOf(code.getCode().trim());
|
||||
//10个域名之外的为others webId设为-1外
|
||||
if(map.get("osType").toString().equals("-1")){
|
||||
map.put("osType", "Others");
|
||||
break;
|
||||
}
|
||||
if(value1.equals(value2)){
|
||||
map.put("osType", code.getItem());
|
||||
map.put("osType", code.getItem().trim());
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -563,15 +626,15 @@ public class DashboardController extends BaseController{
|
||||
if(list!=null&&!list.isEmpty()){
|
||||
for (Map map : list) {
|
||||
Double value1=0d;
|
||||
if(StringUtil.isBlank(map.get("websiteServiceId").toString())){
|
||||
if(StringUtil.isBlank(map.get("websiteServiceId").toString().trim())){
|
||||
value1=268435455d;
|
||||
}else{
|
||||
value1 = Double.parseDouble(map.get("websiteServiceId").toString());
|
||||
value1 = Double.parseDouble(map.get("websiteServiceId").toString().trim());
|
||||
}
|
||||
for (SysDataDictionaryItem code : codeList) {
|
||||
Double value2 = Double.valueOf(code.getItemCode());
|
||||
Double value2 = Double.valueOf(code.getItemCode().trim());
|
||||
if(value1.equals(value2)){
|
||||
map.put("websiteService", code.getItemValue());
|
||||
map.put("websiteService", code.getItemValue().trim());
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -611,7 +674,7 @@ public class DashboardController extends BaseController{
|
||||
if(wdt!=null){
|
||||
String domain = wdt.getDomain();
|
||||
Double domainId = wdt.getId().doubleValue();
|
||||
Double webId = Double.parseDouble(dataMap.get("webId").toString());
|
||||
Double webId = Double.parseDouble(dataMap.get("webId").toString().trim());
|
||||
//10个域名之外的为others webId设为-1外
|
||||
if(dataMap.get("webId").toString().equals("-1")){
|
||||
dataMap.put("domain", "Others");
|
||||
@@ -661,12 +724,12 @@ public class DashboardController extends BaseController{
|
||||
if(StringUtil.isBlank(map.get("topicId").toString())){
|
||||
value1=268435455d;
|
||||
}else{
|
||||
value1 = Double.parseDouble(map.get("topicId").toString());
|
||||
value1 = Double.parseDouble(map.get("topicId").toString().trim());
|
||||
}
|
||||
for (SysDataDictionaryItem code : codeList) {
|
||||
Double value2 = Double.valueOf(code.getItemCode());
|
||||
Double value2 = Double.valueOf(code.getItemCode().trim());
|
||||
if(value1.equals(value2)){
|
||||
map.put("topic", code.getItemValue());
|
||||
map.put("topic", code.getItemValue().trim());
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -678,7 +741,7 @@ public class DashboardController extends BaseController{
|
||||
if(wdt!=null){
|
||||
String domain = wdt.getDomain();
|
||||
Double domainId = wdt.getId().doubleValue();
|
||||
Double webId = Double.parseDouble(dataMap.get("webId").toString());
|
||||
Double webId = Double.parseDouble(dataMap.get("webId").toString().trim());
|
||||
//10个域名之外的为others webId设为-1
|
||||
// if(dataMap.get("webId").toString().equals("-1")){
|
||||
// dataMap.put("domain", "Others");
|
||||
|
||||
Reference in New Issue
Block a user