新增流量统计带宽详情页面,IPv4,6,Tcp,udp为条件统计
This commit is contained in:
@@ -6,15 +6,23 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import com.beust.jcommander.internal.Maps;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.nis.domain.PageLog;
|
||||
import com.nis.domain.dashboard.TrafficIpActiveStatistic;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.util.httpclient.HttpClientUtil;
|
||||
import com.nis.web.controller.BaseController;
|
||||
|
||||
@@ -97,5 +105,52 @@ public class TrafficStatisticsInfoController extends BaseController {
|
||||
}
|
||||
return m;
|
||||
}
|
||||
/**
|
||||
* 根据ip46,协议tcp,udp查询带宽 间隔5分钟数据
|
||||
*/
|
||||
@RequestMapping(value="bandwidthTrans")
|
||||
@ResponseBody
|
||||
public Map ipActiveMinuteList(@RequestParam("addrType")String addrType,@RequestParam("transType")Integer transType){
|
||||
Map<String, Object> fromJsonList = new HashMap<String, Object>();
|
||||
Map map = new HashMap();
|
||||
String url = Constants.DASHBOARD_URL+Constants.TRAFFIC_BANDWIDTH_TRANS;
|
||||
if(!StringUtil.isBlank(addrType)){
|
||||
url=url+"?addrType="+addrType;
|
||||
}
|
||||
if(transType!=null){
|
||||
url=url+"?transType="+transType;
|
||||
}
|
||||
try {
|
||||
String string = HttpClientUtil.get(url);
|
||||
Gson gson = new GsonBuilder().create();
|
||||
fromJsonList = gson.fromJson(string, new TypeToken<Map>(){}.getType());
|
||||
logger.info("带宽1小时,间隔5分钟数据"+fromJsonList);
|
||||
List list = (ArrayList) fromJsonList.get("data");
|
||||
if(!StringUtil.isEmpty(list)){
|
||||
map=(Map) list.get(0);
|
||||
}
|
||||
return map;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.error("带宽详情数据获取错误"+e);
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
@RequestMapping(value="bandwidthList")
|
||||
public String bandwidthList( HttpServletRequest request, HttpServletResponse response, Model model){
|
||||
PageLog<TrafficIpActiveStatistic> page = new PageLog<TrafficIpActiveStatistic>(request, response);
|
||||
List list = new ArrayList();
|
||||
for (int i = 1; i < 10; i++) {
|
||||
TrafficIpActiveStatistic ip = new TrafficIpActiveStatistic();
|
||||
ip.setId(i);
|
||||
ip.setIpAddr(3+i+".1.1."+i);
|
||||
ip.setAreaId("11");
|
||||
ip.setLinkNum(1212l);
|
||||
list.add(ip);
|
||||
}
|
||||
page.setList(list);
|
||||
model.addAttribute("page", page);
|
||||
return "/dashboard/trafficBandwidthList";
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user