提交误覆盖
This commit is contained in:
@@ -58,8 +58,15 @@ public class DashboardController extends BaseController{
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@RequestMapping(value="logChart")
|
@RequestMapping(value="logChart")
|
||||||
public String logChart(){
|
public String logChart(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/dashBoardIndex";
|
return "/dashboard/dashBoardIndex";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,15 @@
|
|||||||
package com.nis.web.controller.dashboard;
|
package com.nis.web.controller.dashboard;
|
||||||
|
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.net.URISyntaxException;
|
import java.net.URISyntaxException;
|
||||||
import java.net.URLEncoder;
|
import java.net.URLEncoder;
|
||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Comparator;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -35,6 +38,7 @@ import com.google.gson.JsonParseException;
|
|||||||
import com.google.gson.LongSerializationPolicy;
|
import com.google.gson.LongSerializationPolicy;
|
||||||
import com.google.gson.reflect.TypeToken;
|
import com.google.gson.reflect.TypeToken;
|
||||||
import com.nis.domain.PageLog;
|
import com.nis.domain.PageLog;
|
||||||
|
import com.nis.domain.configuration.WebsiteDomainTopic;
|
||||||
import com.nis.domain.dashboard.TrafficIpActiveStatistic;
|
import com.nis.domain.dashboard.TrafficIpActiveStatistic;
|
||||||
import com.nis.util.CodeDicUtils;
|
import com.nis.util.CodeDicUtils;
|
||||||
import com.nis.util.Constants;
|
import com.nis.util.Constants;
|
||||||
@@ -385,4 +389,99 @@ public class TrafficStatisticsInfoController extends BaseController {
|
|||||||
}
|
}
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* 网址类型列表
|
||||||
|
*/
|
||||||
|
@RequestMapping("webTypeList")
|
||||||
|
public String webTypeList(Model model){
|
||||||
|
Calendar cal = Calendar. getInstance ();
|
||||||
|
cal.setTime(new Date());
|
||||||
|
String now = 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 oneHoursAgo = new SimpleDateFormat( "yyyy-MM-dd HH:mm:00" ).format(cal.getTime());
|
||||||
|
model.addAttribute("beginDate", oneHoursAgo);
|
||||||
|
model.addAttribute("endDate", now);
|
||||||
|
return "/dashboard/trafficWebTypeList";
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 网站统计图跟表
|
||||||
|
*/
|
||||||
|
@RequestMapping(value="websiteList")
|
||||||
|
@ResponseBody
|
||||||
|
public List websiteList(Model model,@RequestParam(required=false)String beginDate,@RequestParam(required=false)String endDate){
|
||||||
|
Map<String, Object> fromJsonList = new HashMap<String, Object>();
|
||||||
|
List list = new ArrayList();
|
||||||
|
String url = Constants.DASHBOARD_URL+Constants.TRAFFIC_WEBSITELIST;
|
||||||
|
// String url = "http://192.168.11.87:8088/galaxy-service/service/log/v1/"+Constants.TRAFFIC_WEBSITELIST;
|
||||||
|
try {
|
||||||
|
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("website接口数据"+fromJsonList);
|
||||||
|
list = (ArrayList) fromJsonList.get("data");
|
||||||
|
BigDecimal divisor=new BigDecimal(1024*1024*1024);
|
||||||
|
DecimalFormat df = new DecimalFormat("0.00");
|
||||||
|
DecimalFormat dl = new DecimalFormat("0");
|
||||||
|
DecimalFormat pf = new DecimalFormat("0.00%");
|
||||||
|
Double totalLink=0d;
|
||||||
|
Double totalGbyte=0d;
|
||||||
|
Double totalPackets=0d;
|
||||||
|
for (Object object : list) {
|
||||||
|
Map m=(Map)object;
|
||||||
|
Double count=(Double)m.get("count");
|
||||||
|
totalGbyte+=count;
|
||||||
|
totalLink+=(Double)m.get("linkNum");
|
||||||
|
totalPackets+=(Double)m.get("packets");
|
||||||
|
String format = df.format(count/1024/1024/1024);
|
||||||
|
m.put("Gbyte", format);
|
||||||
|
}
|
||||||
|
List<WebsiteDomainTopic> codeList = appCfgService.getDomainDict(new WebsiteDomainTopic());
|
||||||
|
Map<Long, String> map = new HashMap<Long,String>();
|
||||||
|
for (WebsiteDomainTopic websiteDomainTopic : codeList) {
|
||||||
|
if(!map.containsKey(websiteDomainTopic.getWebsiteServiceId())){
|
||||||
|
map.put(websiteDomainTopic.getId(),websiteDomainTopic.getDomain());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (Object object : list) {
|
||||||
|
Map m=(Map)object;
|
||||||
|
Double perLink = ((Double)m.get("linkNum"))/totalLink;
|
||||||
|
m.put("perLink",pf.format(perLink));
|
||||||
|
Double perPackets = ((Double)m.get("packets"))/totalPackets;
|
||||||
|
m.put("perPackets", pf.format(perPackets));
|
||||||
|
Double perGbyte = ((Double)m.get("count"))/totalGbyte;
|
||||||
|
m.put("perGbyte", pf.format(perGbyte));
|
||||||
|
if(map.containsKey(Long.parseLong(dl.format(m.get("webId"))))){
|
||||||
|
m.put("website", map.get(Long.parseLong(dl.format(m.get("webId")))));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Collections.sort(list, new Comparator<Object>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int compare(Object o1, Object o2) {
|
||||||
|
if(o1==null&&o2!=null){
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
if(o1!=null&&o2==null){
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
if(o1==null&&o2==null){
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
Map m1=(Map)o1;
|
||||||
|
Map m2=(Map)o2;
|
||||||
|
if((Double)m1.get("count")==(Double)m2.get("count")){
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
int result=((Double)m1.get("count")-(Double)m2.get("count"))>0?-1:1;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
logger.error("网站域名数据获取错误"+e);
|
||||||
|
list.add(Maps.newHashMap("error","request_service_failed"));
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -154,6 +154,8 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<input id="beginDateh" type="hidden" value="${beginDate}"/>
|
||||||
|
<input id="endDateh" type="hidden" value="${endDate}"/>
|
||||||
<!--header结束-->
|
<!--header结束-->
|
||||||
<!-- 第一行 -->
|
<!-- 第一行 -->
|
||||||
<div class="data_main">
|
<div class="data_main">
|
||||||
@@ -163,10 +165,10 @@
|
|||||||
<spring:message code="traffic_ipactive_chart"/> <a href="${ctx}/dashboard/ipActiveList"><i class="fa fa-line-chart"></i></a> <a href="javascipt:void(0)" onclick="ipActiveList();return false;"><i class="fa fa-refresh"></i></a>
|
<spring:message code="traffic_ipactive_chart"/> <a href="${ctx}/dashboard/ipActiveList"><i class="fa fa-line-chart"></i></a> <a href="javascipt:void(0)" onclick="ipActiveList();return false;"><i class="fa fa-refresh"></i></a>
|
||||||
</div>
|
</div>
|
||||||
<div style="margin-left:150px;margin-top:19px;position:absolute;z-index:1000;">
|
<div style="margin-left:150px;margin-top:19px;position:absolute;z-index:1000;">
|
||||||
<input id="iPBeginDate" name="beginDate" type="text" readonly="readonly" class="Wdate" style="font-size:10px;width:125px;background-color: #424242;border:0;color:#fff"
|
<input id="ipBeginDate" name="beginDate" type="text" readonly="readonly" class="Wdate" style="font-size:10px;width:125px;background-color: #424242;border:0;color:#fff"
|
||||||
value="" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true,maxDate:'#F{$dp.$D(\'iPEndDate\')}'});"/>
|
value="" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true,maxDate:'#F{$dp.$D(\'ipEndDate\')}'});"/>
|
||||||
<input id="iPEndDate" name="endDate" type="text" readonly="readonly" class="Wdate" style="font-size:10px;width:125px;background-color: #424242;border:0;color:#fff""
|
<input id="ipEndDate" name="endDate" type="text" readonly="readonly" class="Wdate" style="font-size:10px;width:125px;background-color: #424242;border:0;color:#fff""
|
||||||
value="" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true,minDate:'#F{$dp.$D(\'iPBeginDate\')}'});"/>
|
value="" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true,minDate:'#F{$dp.$D(\'ipBeginDate\')}'});"/>
|
||||||
</div>
|
</div>
|
||||||
<!-- 活跃IP图 --> <div id="chart_main" style="width:100%;height:400px;"></div>
|
<!-- 活跃IP图 --> <div id="chart_main" style="width:100%;height:400px;"></div>
|
||||||
</div>
|
</div>
|
||||||
@@ -225,7 +227,7 @@
|
|||||||
<div class="main_center1 fl">
|
<div class="main_center1 fl">
|
||||||
<div class="bottom_web fl">
|
<div class="bottom_web fl">
|
||||||
<div class="main_title_web">
|
<div class="main_title_web">
|
||||||
<spring:message code="traffic_website_list"/> <%-- <a href="${ctx}/dashboard/webTypeList"><i class="fa fa-list-ul"></i></a> --%>
|
<spring:message code="traffic_website_list"/> <a href="${ctx}/dashboard/traffic/webTypeList"><i class="fa fa-line-chart"></i></a>
|
||||||
<a href="javascipt:void(0)" onclick="websiteList();return false;"><i class="fa fa-refresh"></i></a>
|
<a href="javascipt:void(0)" onclick="websiteList();return false;"><i class="fa fa-refresh"></i></a>
|
||||||
</div>
|
</div>
|
||||||
<div class="main_table_web">
|
<div class="main_table_web">
|
||||||
@@ -438,7 +440,10 @@ $(document).ready(function(){
|
|||||||
uaSelectChange();
|
uaSelectChange();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
var starth=$("#beginDateh").val();
|
||||||
|
var endh=$("#endDateh").val();
|
||||||
|
$("#ipBeginDate").val(starth);
|
||||||
|
$("#ipEndDate").val(endh);
|
||||||
});
|
});
|
||||||
//获取数据info
|
//获取数据info
|
||||||
function ajaxinfo(){
|
function ajaxinfo(){
|
||||||
@@ -574,8 +579,8 @@ function protocolList(){
|
|||||||
}
|
}
|
||||||
//活跃IP统计
|
//活跃IP统计
|
||||||
function ipActiveList(){
|
function ipActiveList(){
|
||||||
var begin=$("#iPBeginDate").val();
|
var begin=$("#ipBeginDate").val();
|
||||||
var end=$("#iPEndDate").val();
|
var end=$("#ipEndDate").val();
|
||||||
loading();
|
loading();
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: '${ctx}/dashboard/ipActive',
|
url: '${ctx}/dashboard/ipActive',
|
||||||
|
|||||||
Reference in New Issue
Block a user