图表调整

This commit is contained in:
zhanghongqing
2018-08-01 12:59:29 +08:00
parent 170249033b
commit 80b2623cc5
7 changed files with 445 additions and 37 deletions

View File

@@ -5,8 +5,12 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
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.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
@@ -14,6 +18,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.reflect.TypeToken;
import com.nis.domain.Page;
import com.nis.util.CodeDicUtils;
import com.nis.util.Constants;
import com.nis.util.StringUtil;
@@ -400,4 +405,113 @@ public class DashboardController extends BaseController{
}
return resultList;
}
@RequestMapping(value="ipActiveList")
public String ipActiveList( HttpServletRequest request, HttpServletResponse response, Model model){
Page<TrafficIpActiveStatistic> page = new Page<TrafficIpActiveStatistic>(request, response);
TrafficIpActiveStatistic ip = new TrafficIpActiveStatistic();
ip.setIpAddr("1.1.1.1");
ip.setAreaId("11");
ip.setLinkNum(1212);
List list = new ArrayList();
list.add(ip);
page.setList(list);
model.addAttribute("page", page);
return "/dashboard/trafficIpActiveList";
}
@RequestMapping(value="showChart")
public String showChart(@ModelAttribute("entry") TrafficIpActiveStatistic entry, Model model){
String ipAddr="1.1.1.1";
TrafficIpActiveStatistic ip=new TrafficIpActiveStatistic();
ArrayList list = new ArrayList();
// chartMap.put("ipAddr", ip.getIpAddr());
HashMap map1 = new HashMap();
HashMap map2 = new HashMap();
HashMap map3 = new HashMap();
HashMap map4 = new HashMap();
map1.put("name", "c2sPktNum");
map1.put("y", ip.getC2sPktNum());
map2.put("name", "s2cPktNum");
map2.put("y", ip.getS2cPktNum());
map3.put("name", "c2sByteLen");
map3.put("y", ip.getC2sByteLen());
map4.put("name", "s2cByteLen");
map4.put("y", ip.getS2cByteLen());
list.add(ip.getC2sPktNum());
list.add(ip.getS2cPktNum());
list.add(ip.getC2sByteLen());
list.add(ip.getS2cByteLen());
// String json = new Gson().toJson();
model.addAttribute("ipAddr",ipAddr);
model.addAttribute("chartMap",list);
return "/dashboard/trafficIpActiveChart";
}
public class TrafficIpActiveStatistic{
String ipAddr="10.1.1.2";
String areaId="1045";
Integer linkNum=3121;
Integer c2sPktNum=1352;
Integer s2cPktNum=2234;
Integer c2sByteLen=31;
Integer s2cByteLen=23323;
String statTime;
public String getStatTime() {
return statTime;
}
public void setStatTime(String statTime) {
this.statTime = statTime;
}
public TrafficIpActiveStatistic(){
super();
}
public String getIpAddr() {
return ipAddr;
}
public void setIpAddr(String ipAddr) {
this.ipAddr = ipAddr;
}
public String getAreaId() {
return areaId;
}
public void setAreaId(String areaId) {
this.areaId = areaId;
}
public Integer getLinkNum() {
return linkNum;
}
public void setLinkNum(Integer linkNum) {
this.linkNum = linkNum;
}
public Integer getC2sPktNum() {
return c2sPktNum;
}
public void setC2sPktNum(Integer c2sPktNum) {
this.c2sPktNum = c2sPktNum;
}
public Integer getS2cPktNum() {
return s2cPktNum;
}
public void setS2cPktNum(Integer s2cPktNum) {
this.s2cPktNum = s2cPktNum;
}
public Integer getC2sByteLen() {
return c2sByteLen;
}
public void setC2sByteLen(Integer c2sByteLen) {
this.c2sByteLen = c2sByteLen;
}
public Integer getS2cByteLen() {
return s2cByteLen;
}
public void setS2cByteLen(Integer s2cByteLen) {
this.s2cByteLen = s2cByteLen;
}
}
}