2018-07-11 19:05:08 +08:00
|
|
|
|
package com.nis.web.controller.dashboard;
|
|
|
|
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
2018-08-01 12:59:29 +08:00
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
2018-07-11 19:05:08 +08:00
|
|
|
|
|
|
|
|
|
|
import org.springframework.stereotype.Controller;
|
2018-08-01 12:59:29 +08:00
|
|
|
|
import org.springframework.ui.Model;
|
|
|
|
|
|
import org.springframework.web.bind.annotation.ModelAttribute;
|
2018-07-11 19:05:08 +08:00
|
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
|
|
|
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
|
|
|
|
|
|
|
|
|
import com.google.gson.Gson;
|
|
|
|
|
|
import com.google.gson.GsonBuilder;
|
|
|
|
|
|
import com.google.gson.reflect.TypeToken;
|
2018-08-01 12:59:29 +08:00
|
|
|
|
import com.nis.domain.Page;
|
2018-07-11 19:05:08 +08:00
|
|
|
|
import com.nis.util.CodeDicUtils;
|
2018-07-13 19:36:37 +08:00
|
|
|
|
import com.nis.util.Constants;
|
2018-07-11 19:05:08 +08:00
|
|
|
|
import com.nis.util.StringUtil;
|
|
|
|
|
|
import com.nis.util.httpclient.HttpClientUtil;
|
|
|
|
|
|
import com.nis.web.controller.BaseController;
|
|
|
|
|
|
import com.nis.web.dao.dashboard.codedic.CodeResult;
|
|
|
|
|
|
@SuppressWarnings("rawtypes")
|
|
|
|
|
|
@Controller
|
|
|
|
|
|
@RequestMapping(value = "${adminPath}/dashboard")
|
|
|
|
|
|
public class DashboardController extends BaseController{
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-07-13 19:36:37 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* 跳转到图表界面
|
|
|
|
|
|
* @return
|
|
|
|
|
|
*/
|
2018-07-11 19:05:08 +08:00
|
|
|
|
@RequestMapping(value="logChart")
|
|
|
|
|
|
public String logChart(){
|
|
|
|
|
|
|
|
|
|
|
|
return "/dashboard/dashBoardIndex";
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 活跃IP TOP10
|
|
|
|
|
|
*/
|
|
|
|
|
|
@RequestMapping(value="ipActive")
|
|
|
|
|
|
@ResponseBody
|
|
|
|
|
|
public List ipActive(){
|
|
|
|
|
|
Map<String, Object> fromJsonList = new HashMap<String, Object>();
|
|
|
|
|
|
List list = new ArrayList();
|
|
|
|
|
|
try {
|
2018-07-13 19:36:37 +08:00
|
|
|
|
String string = HttpClientUtil.get(Constants.DASHBOARD_URL+Constants.TRAFFIC_IPACTIVE);
|
2018-07-11 19:05:08 +08:00
|
|
|
|
Gson gson = new GsonBuilder().create();
|
|
|
|
|
|
fromJsonList = gson.fromJson(string, new TypeToken<Map>(){}.getType());
|
|
|
|
|
|
list = (ArrayList) fromJsonList.get("data");
|
|
|
|
|
|
logger.info("活跃IP数据"+fromJsonList);
|
|
|
|
|
|
return list;
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
e.printStackTrace();
|
2018-07-13 19:36:37 +08:00
|
|
|
|
logger.error("活跃IP错误"+e);
|
2018-07-11 19:05:08 +08:00
|
|
|
|
}
|
|
|
|
|
|
return list;
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 协议统计
|
|
|
|
|
|
*/
|
|
|
|
|
|
@RequestMapping(value="protocol")
|
|
|
|
|
|
@ResponseBody
|
|
|
|
|
|
public List protocolChart(){
|
|
|
|
|
|
Map<String, Object> fromJsonList = new HashMap<String, Object>();
|
|
|
|
|
|
List<Map> list = new ArrayList<Map>();
|
|
|
|
|
|
List<Map> resultList = new ArrayList<Map>();
|
|
|
|
|
|
try {
|
2018-07-13 19:36:37 +08:00
|
|
|
|
String string = HttpClientUtil.get(Constants.DASHBOARD_URL+Constants.TRAFFIC_PROTOCOL);
|
2018-07-11 19:05:08 +08:00
|
|
|
|
Gson gson = new GsonBuilder().create();
|
|
|
|
|
|
fromJsonList = gson.fromJson(string, new TypeToken<Map>(){}.getType());
|
|
|
|
|
|
list = (List<Map>) fromJsonList.get("data");
|
|
|
|
|
|
//标签集合
|
|
|
|
|
|
List<CodeResult> codeList = CodeDicUtils.getCodeList("protocolCode");
|
|
|
|
|
|
//将数字替换为标签文字
|
2018-07-13 19:36:37 +08:00
|
|
|
|
if(list!=null&&!list.isEmpty()){
|
2018-07-11 19:05:08 +08:00
|
|
|
|
for (Map map : list) {
|
|
|
|
|
|
Double value1 = Double.parseDouble(map.get("protoType").toString());
|
|
|
|
|
|
for (CodeResult code : codeList) {
|
|
|
|
|
|
Double value2 = Double.valueOf(code.getCode());
|
|
|
|
|
|
if(value1.equals(value2)){
|
|
|
|
|
|
map.put("protoType", code.getItem());
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
resultList.add(map);
|
|
|
|
|
|
}
|
|
|
|
|
|
logger.info("协议统计"+fromJsonList);
|
|
|
|
|
|
return resultList;
|
2018-07-13 19:36:37 +08:00
|
|
|
|
}
|
2018-07-11 19:05:08 +08:00
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
|
logger.error("协议统计错误"+e);
|
|
|
|
|
|
}
|
|
|
|
|
|
return resultList;
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
|
|
|
* app流量分析
|
|
|
|
|
|
*/
|
|
|
|
|
|
@RequestMapping(value="app")
|
|
|
|
|
|
@ResponseBody
|
|
|
|
|
|
public List appChart(){
|
|
|
|
|
|
Map<String, Object> fromJsonList = new HashMap<String, Object>();
|
|
|
|
|
|
List<Map> list = new ArrayList<Map>();
|
|
|
|
|
|
List<Map> resultList = new ArrayList<Map>();
|
|
|
|
|
|
try {
|
2018-07-13 19:36:37 +08:00
|
|
|
|
String string = HttpClientUtil.get(Constants.DASHBOARD_URL+Constants.TRAFFIC_APP);
|
2018-07-11 19:05:08 +08:00
|
|
|
|
Gson gson = new GsonBuilder().create();
|
|
|
|
|
|
fromJsonList = gson.fromJson(string, new TypeToken<Map>(){}.getType());
|
|
|
|
|
|
list = (List<Map>) fromJsonList.get("data");
|
|
|
|
|
|
//标签集合
|
|
|
|
|
|
List<CodeResult> codeList = CodeDicUtils.getCodeList("appCode");
|
|
|
|
|
|
//将数字替换为标签文字
|
2018-07-13 19:36:37 +08:00
|
|
|
|
if(list!=null&&!list.isEmpty()){
|
2018-07-11 19:05:08 +08:00
|
|
|
|
for (Map map : list) {
|
|
|
|
|
|
Double value1 = Double.parseDouble(map.get("appType").toString());
|
|
|
|
|
|
for (CodeResult code : codeList) {
|
|
|
|
|
|
Double value2 = Double.valueOf(code.getCode());
|
|
|
|
|
|
if(value1.equals(value2)){
|
|
|
|
|
|
map.put("appType", code.getItem());
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
resultList.add(map);
|
|
|
|
|
|
}
|
|
|
|
|
|
logger.info("app流量分析"+fromJsonList);
|
|
|
|
|
|
return resultList;
|
2018-07-13 19:36:37 +08:00
|
|
|
|
}
|
2018-07-11 19:05:08 +08:00
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
|
logger.error("app流量分析错误"+e);
|
|
|
|
|
|
}
|
|
|
|
|
|
return resultList;
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 终端用户-操作系统列表
|
|
|
|
|
|
*/
|
|
|
|
|
|
@RequestMapping(value="osList")
|
|
|
|
|
|
@ResponseBody
|
|
|
|
|
|
public List osList(){
|
|
|
|
|
|
Map<String, Object> fromJsonList = new HashMap<String, Object>();
|
|
|
|
|
|
List<Map> list = new ArrayList<Map>();
|
|
|
|
|
|
List<Map> resultList = new ArrayList<Map>();
|
|
|
|
|
|
try {
|
2018-07-13 19:36:37 +08:00
|
|
|
|
String string = HttpClientUtil.get(Constants.DASHBOARD_URL+Constants.TRAFFIC_OSLIST);
|
2018-07-11 19:05:08 +08:00
|
|
|
|
Gson gson = new GsonBuilder().create();
|
|
|
|
|
|
fromJsonList = gson.fromJson(string, new TypeToken<Map>(){}.getType());
|
|
|
|
|
|
list = (List<Map>) fromJsonList.get("data");
|
|
|
|
|
|
//标签集合
|
|
|
|
|
|
List<CodeResult> codeList = CodeDicUtils.getCodeList("osCode");
|
|
|
|
|
|
//将数字替换为标签文字
|
2018-07-13 19:36:37 +08:00
|
|
|
|
if(list!=null&&!list.isEmpty()){
|
2018-07-11 19:05:08 +08:00
|
|
|
|
for (Map map : list) {
|
|
|
|
|
|
Double value1 = Double.parseDouble(map.get("osType").toString());
|
|
|
|
|
|
for (CodeResult code : codeList) {
|
|
|
|
|
|
Double value2 = Double.valueOf(code.getCode());
|
|
|
|
|
|
if(value1.equals(value2)){
|
|
|
|
|
|
map.put("osType", code.getItem());
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
resultList.add(map);
|
|
|
|
|
|
}
|
|
|
|
|
|
logger.info("终端用户-获取操作系统列表"+fromJsonList);
|
|
|
|
|
|
return resultList;
|
2018-07-13 19:36:37 +08:00
|
|
|
|
}
|
2018-07-11 19:05:08 +08:00
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
|
logger.error("终端用户-获取操作系统列表错误"+e);
|
|
|
|
|
|
}
|
|
|
|
|
|
return resultList;
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 终端用户-指定操作系统下浏览器分类流量统计
|
|
|
|
|
|
*/
|
|
|
|
|
|
@RequestMapping(value="browserChart")
|
|
|
|
|
|
@ResponseBody
|
|
|
|
|
|
public List browserChart(@RequestParam("osType") String osType){
|
|
|
|
|
|
Map<String, Object> fromJsonList = new HashMap<String, Object>();
|
|
|
|
|
|
List<Map> list = new ArrayList<Map>();
|
|
|
|
|
|
List<Map> resultList = new ArrayList<Map>();
|
|
|
|
|
|
//标签集合
|
|
|
|
|
|
List<CodeResult> codeList1 = CodeDicUtils.getCodeList("osCode");
|
|
|
|
|
|
//将标签文字转为数字
|
|
|
|
|
|
Integer os=null;
|
|
|
|
|
|
for (CodeResult codeResult : codeList1) {
|
|
|
|
|
|
if(osType.equalsIgnoreCase(codeResult.getItem())){
|
|
|
|
|
|
os=Integer.parseInt(codeResult.getCode());
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2018-07-13 19:36:37 +08:00
|
|
|
|
if(os==null){
|
|
|
|
|
|
os=Integer.parseInt(osType);//处理为匹配项编码
|
|
|
|
|
|
}
|
2018-07-11 19:05:08 +08:00
|
|
|
|
try {
|
2018-07-13 19:36:37 +08:00
|
|
|
|
String string = HttpClientUtil.get(Constants.DASHBOARD_URL+Constants.TRAFFIC_BROWSER_CHART+"?osType="+os);
|
2018-07-11 19:05:08 +08:00
|
|
|
|
Gson gson = new GsonBuilder().create();
|
|
|
|
|
|
fromJsonList = gson.fromJson(string, new TypeToken<Map>(){}.getType());
|
|
|
|
|
|
list = (List<Map>) fromJsonList.get("data");
|
|
|
|
|
|
//标签集合
|
|
|
|
|
|
List<CodeResult> codeList2 = CodeDicUtils.getCodeList("browserCode");
|
|
|
|
|
|
//将数字替换为标签文字
|
|
|
|
|
|
if(null!=list&&!list.isEmpty()){
|
|
|
|
|
|
for (Map map : list) {
|
|
|
|
|
|
Double value1 = Double.parseDouble(map.get("bsType").toString());
|
|
|
|
|
|
for (CodeResult code : codeList2) {
|
|
|
|
|
|
Double value2 = Double.valueOf(code.getCode());
|
|
|
|
|
|
if(value1.equals(value2)){
|
|
|
|
|
|
map.put("bsType", code.getItem());
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
resultList.add(map);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
logger.info("终端用户-获取操作系统下浏览器类型"+fromJsonList);
|
|
|
|
|
|
return resultList;
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
|
logger.error("终端用户-获取操作系统下浏览器类型错误"+e);
|
|
|
|
|
|
}
|
|
|
|
|
|
return resultList;
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 终端用户-浏览器列表
|
|
|
|
|
|
*/
|
|
|
|
|
|
@RequestMapping(value="bsList")
|
|
|
|
|
|
@ResponseBody
|
|
|
|
|
|
public List bsList(){
|
|
|
|
|
|
Map<String, Object> fromJsonList = new HashMap<String, Object>();
|
|
|
|
|
|
List<Map> list = new ArrayList<Map>();
|
|
|
|
|
|
List<Map> resultList = new ArrayList<Map>();
|
|
|
|
|
|
try {
|
2018-07-13 19:36:37 +08:00
|
|
|
|
String string = HttpClientUtil.get(Constants.DASHBOARD_URL+Constants.TRAFFIC_BSLISTL);
|
2018-07-11 19:05:08 +08:00
|
|
|
|
Gson gson = new GsonBuilder().create();
|
|
|
|
|
|
fromJsonList = gson.fromJson(string, new TypeToken<Map>(){}.getType());
|
|
|
|
|
|
list = (List<Map>) fromJsonList.get("data");
|
|
|
|
|
|
//标签集合
|
|
|
|
|
|
List<CodeResult> codeList = CodeDicUtils.getCodeList("browserCode");
|
|
|
|
|
|
//将数字替换为标签文字
|
2018-07-13 19:36:37 +08:00
|
|
|
|
if(list!=null&&!list.isEmpty()){
|
2018-07-11 19:05:08 +08:00
|
|
|
|
for (Map map : list) {
|
|
|
|
|
|
Double value1 = Double.parseDouble(map.get("bsType").toString());
|
|
|
|
|
|
for (CodeResult code : codeList) {
|
|
|
|
|
|
Double value2 = Double.valueOf(code.getCode());
|
|
|
|
|
|
if(value1.equals(value2)){
|
|
|
|
|
|
map.put("bsType", code.getItem());
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
resultList.add(map);
|
2018-07-13 19:36:37 +08:00
|
|
|
|
}
|
2018-07-11 19:05:08 +08:00
|
|
|
|
}
|
|
|
|
|
|
logger.info("终端用户-获取浏览器列表"+fromJsonList);
|
|
|
|
|
|
return resultList;
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
|
logger.error("终端用户-获取浏览器列表错误"+e);
|
|
|
|
|
|
}
|
|
|
|
|
|
return resultList;
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 终端用户-指定操作系统下浏览器分类流量统计
|
|
|
|
|
|
*/
|
|
|
|
|
|
@RequestMapping(value="systemChart")
|
|
|
|
|
|
@ResponseBody
|
|
|
|
|
|
public List systemChart(@RequestParam("bsType") String bsType){
|
|
|
|
|
|
Map<String, Object> fromJsonList = new HashMap<String, Object>();
|
|
|
|
|
|
List<Map> list = new ArrayList<Map>();
|
|
|
|
|
|
List<Map> resultList = new ArrayList<Map>();
|
|
|
|
|
|
//标签集合
|
2018-07-13 19:36:37 +08:00
|
|
|
|
List<CodeResult> codeList1 = CodeDicUtils.getCodeList("browserCode");
|
2018-07-11 19:05:08 +08:00
|
|
|
|
//将标签文字转为数字
|
|
|
|
|
|
Integer bs=null;
|
|
|
|
|
|
for (CodeResult codeResult : codeList1) {
|
|
|
|
|
|
if(bsType.equalsIgnoreCase(codeResult.getItem())){
|
|
|
|
|
|
bs=Integer.parseInt(codeResult.getCode());
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2018-07-13 19:36:37 +08:00
|
|
|
|
if(bs==null){
|
|
|
|
|
|
bs=Integer.parseInt(bsType);//处理为匹配项编码
|
|
|
|
|
|
}
|
2018-07-11 19:05:08 +08:00
|
|
|
|
try {
|
2018-07-17 09:13:19 +08:00
|
|
|
|
String string = HttpClientUtil.get(Constants.DASHBOARD_URL+Constants.TRAFFIC_SYSTEM_CHART+"?bsType="+bs);
|
2018-07-11 19:05:08 +08:00
|
|
|
|
Gson gson = new GsonBuilder().create();
|
|
|
|
|
|
fromJsonList = gson.fromJson(string, new TypeToken<Map>(){}.getType());
|
|
|
|
|
|
list = (List<Map>) fromJsonList.get("data");
|
|
|
|
|
|
//标签集合
|
|
|
|
|
|
List<CodeResult> codeList2 = CodeDicUtils.getCodeList("osCode");
|
|
|
|
|
|
//将数字替换为标签文字
|
|
|
|
|
|
if(null!=list&&!list.isEmpty()){
|
|
|
|
|
|
for (Map map : list) {
|
|
|
|
|
|
Double value1 = Double.parseDouble(map.get("osType").toString());
|
|
|
|
|
|
for (CodeResult code : codeList2) {
|
|
|
|
|
|
Double value2 = Double.valueOf(code.getCode());
|
|
|
|
|
|
if(value1.equals(value2)){
|
|
|
|
|
|
map.put("osType", code.getItem());
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
resultList.add(map);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
logger.info("终端用户-获取浏览器下操作系统类型"+fromJsonList);
|
|
|
|
|
|
return resultList;
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
|
logger.error("终端用户-获取浏览器下操作系统类型错误"+e);
|
|
|
|
|
|
}
|
|
|
|
|
|
return resultList;
|
|
|
|
|
|
}
|
2018-07-13 19:36:37 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* http网站统计
|
|
|
|
|
|
*/
|
|
|
|
|
|
@RequestMapping(value="websiteList")
|
|
|
|
|
|
@ResponseBody
|
|
|
|
|
|
public List websiteList(){
|
|
|
|
|
|
Map<String, Object> fromJsonList = new HashMap<String, Object>();
|
|
|
|
|
|
List<Map> list = new ArrayList<Map>();
|
|
|
|
|
|
List<Map> resultList = new ArrayList<Map>();
|
|
|
|
|
|
try {
|
|
|
|
|
|
String string = HttpClientUtil.get(Constants.DASHBOARD_URL+Constants.TRAFFIC_WEBSITELIST);
|
|
|
|
|
|
Gson gson = new GsonBuilder().create();
|
|
|
|
|
|
fromJsonList = gson.fromJson(string, new TypeToken<Map>(){}.getType());
|
|
|
|
|
|
list = (List<Map>) fromJsonList.get("data");
|
|
|
|
|
|
//标签集合
|
|
|
|
|
|
List<CodeResult> codeList = CodeDicUtils.getCodeList("webCode");
|
|
|
|
|
|
//将数字替换为标签文字
|
|
|
|
|
|
if(list!=null&&!list.isEmpty()){
|
|
|
|
|
|
for (Map map : list) {
|
|
|
|
|
|
Double value1 = Double.parseDouble(map.get("webId").toString());
|
|
|
|
|
|
for (CodeResult code : codeList) {
|
|
|
|
|
|
Double value2 = Double.valueOf(code.getCode());
|
|
|
|
|
|
if(value1.equals(value2)){
|
|
|
|
|
|
map.put("webId", code.getItem());
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
resultList.add(map);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
logger.info("http网站流量分析数据:"+fromJsonList);
|
|
|
|
|
|
return resultList;
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
|
logger.error("http网站流量分析数据错误:"+e);
|
|
|
|
|
|
}
|
|
|
|
|
|
return resultList;
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
|
|
|
* http网站-某个网站的分类统计
|
|
|
|
|
|
*/
|
|
|
|
|
|
@RequestMapping(value="webTypeChart")
|
|
|
|
|
|
@ResponseBody
|
|
|
|
|
|
public List webTypeChart(@RequestParam("webId") String webId){
|
|
|
|
|
|
Map<String, Object> fromJsonList = new HashMap<String, Object>();
|
|
|
|
|
|
List<Map> list = new ArrayList<Map>();
|
|
|
|
|
|
List<Map> resultList = new ArrayList<Map>();
|
|
|
|
|
|
//标签集合
|
|
|
|
|
|
List<CodeResult> codeList1 = CodeDicUtils.getCodeList("webCode");
|
|
|
|
|
|
//将标签文字转为数字
|
|
|
|
|
|
Integer web=null;
|
|
|
|
|
|
for (CodeResult codeResult : codeList1) {
|
|
|
|
|
|
if(webId.equalsIgnoreCase(codeResult.getItem())){
|
|
|
|
|
|
web=Integer.parseInt(codeResult.getCode());
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
if(web==null){
|
|
|
|
|
|
web=Integer.parseInt(webId);//处理为匹配项编码
|
|
|
|
|
|
}
|
|
|
|
|
|
try {
|
2018-07-17 09:13:19 +08:00
|
|
|
|
String string = HttpClientUtil.get(Constants.DASHBOARD_URL+Constants.TRAFFIC_WEBTYPECHART+"?webId="+web);
|
2018-07-13 19:36:37 +08:00
|
|
|
|
Gson gson = new GsonBuilder().create();
|
|
|
|
|
|
fromJsonList = gson.fromJson(string, new TypeToken<Map>(){}.getType());
|
|
|
|
|
|
list = (List<Map>) fromJsonList.get("data");
|
|
|
|
|
|
//标签集合
|
|
|
|
|
|
List<CodeResult> codeList2 = CodeDicUtils.getCodeList("webCode");//网站分类字典-未定义?
|
|
|
|
|
|
//将数字替换为标签文字
|
|
|
|
|
|
if(null!=list&&!list.isEmpty()){
|
|
|
|
|
|
for (Map map : list) {
|
|
|
|
|
|
Double value1 = Double.parseDouble(map.get("webType").toString());
|
|
|
|
|
|
for (CodeResult code : codeList2) {
|
|
|
|
|
|
Double value2 = Double.valueOf(code.getCode());
|
|
|
|
|
|
if(value1.equals(value2)){
|
|
|
|
|
|
map.put("webType", code.getItem());
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
resultList.add(map);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
logger.info("http某个网站分类流量统计"+fromJsonList);
|
|
|
|
|
|
return resultList;
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
|
logger.error("http某个网站分类流量统计错误"+e);
|
|
|
|
|
|
}
|
|
|
|
|
|
return resultList;
|
|
|
|
|
|
}
|
2018-08-01 12:59:29 +08:00
|
|
|
|
|
|
|
|
|
|
@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;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
2018-07-11 19:05:08 +08:00
|
|
|
|
}
|