diff --git a/src/main/java/com/nis/web/controller/dashboard/DashboardController.java b/src/main/java/com/nis/web/controller/dashboard/DashboardController.java index 49d44b3e4..239669b2c 100644 --- a/src/main/java/com/nis/web/controller/dashboard/DashboardController.java +++ b/src/main/java/com/nis/web/controller/dashboard/DashboardController.java @@ -263,11 +263,12 @@ public class DashboardController extends BaseController{ list = gson.fromJson(fromJsonList.get("data").toString(), new TypeToken>() {}.getType()) ; if(list.size()>0) { DecimalFormat lf = new DecimalFormat("0"); + DecimalFormat f = new DecimalFormat("0.00"); SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); //两个时间段之间的秒数 double allSeconds = DateUtils.getSecondsOfTwoDate(sdf.parse(beginDate),sdf.parse(endDate)); for(TrafficIpActiveStatistic data:list) { - data.setAvgByte(lf.format(Long.parseLong(data.get_byte())/1024/1024/1024/allSeconds)); + data.setAvgByte(f.format(Long.parseLong(data.get_byte())/1024/1024/1024/allSeconds)); data.setAvgPacket(lf.format(Long.parseLong(data.get_packet())/allSeconds)); } } diff --git a/src/main/java/com/nis/web/controller/dashboard/TrafficStatisticsInfoController.java b/src/main/java/com/nis/web/controller/dashboard/TrafficStatisticsInfoController.java index 62cc65306..b3e32c032 100644 --- a/src/main/java/com/nis/web/controller/dashboard/TrafficStatisticsInfoController.java +++ b/src/main/java/com/nis/web/controller/dashboard/TrafficStatisticsInfoController.java @@ -331,6 +331,7 @@ public class TrafficStatisticsInfoController extends BaseController { Long totalPackets=0l; Double totalGByte=0d; DecimalFormat lf = new DecimalFormat("0"); + DecimalFormat f = new DecimalFormat("0.00"); DecimalFormat df = new DecimalFormat("0.0000000000"); List appCodeList = CodeDicUtils.getCodeList("appCode"); //两个时间段之间的秒数 @@ -347,7 +348,7 @@ public class TrafficStatisticsInfoController extends BaseController { double avgPacket=Double.parseDouble(m.get("packets").toString())/allSeconds; m.put("pps",lf.format(avgPacket)); double avgByte=Double.parseDouble(m.get("GByte").toString())/allSeconds; - m.put("bps",lf.format(avgByte)); + m.put("bps",f.format(avgByte)); totalLink+=Long.parseLong( m.get("linkNum").toString()); totalPackets+=Long.parseLong(m.get("packets").toString()); // 协议没匹配的匹配app码表 @@ -418,6 +419,7 @@ public class TrafficStatisticsInfoController extends BaseController { Long totalPackets=0l; Double totalGByte=0d; DecimalFormat lf = new DecimalFormat("0"); + DecimalFormat f = new DecimalFormat("0.00"); DecimalFormat df = new DecimalFormat("0.0000000000"); //两个时间段之间的秒数 SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); @@ -436,7 +438,7 @@ public class TrafficStatisticsInfoController extends BaseController { double avgPacket=Double.parseDouble(m.get("packets").toString())/allSeconds; m.put("pps",lf.format(avgPacket)); double avgByte=Double.parseDouble(m.get("GByte").toString())/allSeconds; - m.put("bps",lf.format(avgByte)); + m.put("bps",f.format(avgByte)); } for (Object object : list) { Map m=(Map) object; @@ -540,13 +542,14 @@ public class TrafficStatisticsInfoController extends BaseController { if(list.size()>0) { //两个时间段之间的秒数 DecimalFormat dl = new DecimalFormat("0"); + DecimalFormat f = new DecimalFormat("0.00"); SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); double allSeconds = DateUtils.getSecondsOfTwoDate(sdf.parse(beginDate),sdf.parse(endDate)); for(Map m:list) { double avgPacket=Double.parseDouble(m.get("pktNum").toString())/allSeconds; m.put("pps",dl.format(avgPacket)); double avgByte=Double.parseDouble(m.get("byteNum").toString())/1024/1024/1024/allSeconds; - m.put("bps",dl.format(avgByte)); + m.put("bps",f.format(avgByte)); } } } catch (Exception e) { @@ -647,6 +650,7 @@ public class TrafficStatisticsInfoController extends BaseController { DecimalFormat df = new DecimalFormat("0.000000000"); DecimalFormat dl = new DecimalFormat("0"); DecimalFormat pf = new DecimalFormat("0.000000000"); + DecimalFormat f = new DecimalFormat("0.00"); // Double totalLink=0d; Double totalGbyte=0d; Double totalPackets=0d; @@ -665,7 +669,7 @@ public class TrafficStatisticsInfoController extends BaseController { double avgPacket=Double.parseDouble(m.get("pktCount").toString())/allSeconds; m.put("pps",dl.format(avgPacket)); double avgByte=Double.parseDouble(m.get("byteCount").toString())/1024/1024/1024/allSeconds; - m.put("bps",dl.format(avgByte)); + m.put("bps",f.format(avgByte)); } List codeList = appCfgService.getDomainDict(new WebsiteDomainTopic()); Map map = new HashMap(); @@ -735,6 +739,7 @@ public class TrafficStatisticsInfoController extends BaseController { Long totalPackets=0l; Double totalGByte=0d; DecimalFormat lf = new DecimalFormat("0"); + DecimalFormat f = new DecimalFormat("0.00"); //两个时间段之间的秒数 SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); double allSeconds = DateUtils.getSecondsOfTwoDate(sdf.parse(beginDate),sdf.parse(endDate)); @@ -747,7 +752,7 @@ public class TrafficStatisticsInfoController extends BaseController { double avgPacket=Double.parseDouble(m.get("packets").toString())/allSeconds; m.put("pps",lf.format(avgPacket)); double avgByte=Double.parseDouble(m.get("count").toString())/1024/1024/1024/allSeconds; - m.put("bps",lf.format(avgByte)); + m.put("bps",f.format(avgByte)); m.remove("domainData"); Double value1=0d; if(StringUtil.isBlank(m.get("topicId").toString())){ diff --git a/src/main/webapp/WEB-INF/views/dashboard/trafficAppTrendList.jsp b/src/main/webapp/WEB-INF/views/dashboard/trafficAppTrendList.jsp index b1b042e5f..3a9554a21 100644 --- a/src/main/webapp/WEB-INF/views/dashboard/trafficAppTrendList.jsp +++ b/src/main/webapp/WEB-INF/views/dashboard/trafficAppTrendList.jsp @@ -379,7 +379,7 @@ html += "" + data.pps + ""; html += "" + data.pktPercent + " %"; html += "" + Math.round(data.byteNum*100)/100 + ""; - html += "" + data.bps + ""; + html += "" + Math.round(data.bps*100)/100 + ""; html += "" + data.bytePercent + " %"; html += "" if(index==fileDataS.length-1){ diff --git a/src/main/webapp/WEB-INF/views/dashboard/trafficAppTypeList.jsp b/src/main/webapp/WEB-INF/views/dashboard/trafficAppTypeList.jsp index 13b9ca7f3..450d41135 100644 --- a/src/main/webapp/WEB-INF/views/dashboard/trafficAppTypeList.jsp +++ b/src/main/webapp/WEB-INF/views/dashboard/trafficAppTypeList.jsp @@ -355,7 +355,7 @@ function htmlData(fileDataS){ html+= ""+data.pps+""; html+= ""+packper+"%"+""; html+= ""+Math.round(data.GByte*100)/100+""; - html+= ""+data.bps+""; + html+= ""+Math.round(data.bps*100)/100+""; html+= ""+gbytper+"%"+""; html+="" if(index==fileDataS.length-1){ diff --git a/src/main/webapp/WEB-INF/views/dashboard/trafficHttpStatisticList.jsp b/src/main/webapp/WEB-INF/views/dashboard/trafficHttpStatisticList.jsp index ce2e2ec07..8c11df4d6 100644 --- a/src/main/webapp/WEB-INF/views/dashboard/trafficHttpStatisticList.jsp +++ b/src/main/webapp/WEB-INF/views/dashboard/trafficHttpStatisticList.jsp @@ -300,7 +300,7 @@ function htmlData(fileDataS){ html+= ""+data.pps+""; html+= ""+(data.packets/data.allPackets*100).toFixed(2)+"%"+""; html+= ""+(data.count/1073741824).toFixed(2)+""; - html+= ""+data.bps+""; + html+= ""+Math.round(data.bps*100)/100+""; html+= ""+(data.count/data.allGByte*100).toFixed(2)+"%"+""; html+="" if(index==fileDataS.length-1){ diff --git a/src/main/webapp/WEB-INF/views/dashboard/trafficIpActiveList.jsp b/src/main/webapp/WEB-INF/views/dashboard/trafficIpActiveList.jsp index 575ad1bef..795adf9a9 100644 --- a/src/main/webapp/WEB-INF/views/dashboard/trafficIpActiveList.jsp +++ b/src/main/webapp/WEB-INF/views/dashboard/trafficIpActiveList.jsp @@ -419,7 +419,7 @@ function showIpActiveChart(xData,series){ html+= ""+rs.c2sByteLen+""; html+= ""+rs.s2cByteLen+""; html+= ""+byteNum+""; - html+= ""+rs.avgByte+""; + html+= ""+Math.round(rs.avgByte*100)/100+""; html+= ""+rs.linkNum+""; html+= ""+rs.c2sPktNum+""; html+= ""+rs.s2cPktNum+""; diff --git a/src/main/webapp/WEB-INF/views/dashboard/trafficProtocolTypeList.jsp b/src/main/webapp/WEB-INF/views/dashboard/trafficProtocolTypeList.jsp index cb79f4bd5..343e628a8 100644 --- a/src/main/webapp/WEB-INF/views/dashboard/trafficProtocolTypeList.jsp +++ b/src/main/webapp/WEB-INF/views/dashboard/trafficProtocolTypeList.jsp @@ -368,7 +368,7 @@ function htmlData(fileDataS){ html+= ""+data.pps+""; html+= ""+packper+"%"+""; html+= ""+Math.round(data.GByte*100)/100+""; - html+= ""+data.bps+""; + html+= ""+Math.round(data.bps*100)/100+""; html+= ""+gbytper+"%"+""; html+="" if(index==fileDataS.length-1){ diff --git a/src/main/webapp/WEB-INF/views/dashboard/trafficWebTypeList.jsp b/src/main/webapp/WEB-INF/views/dashboard/trafficWebTypeList.jsp index fd355eb28..c9372407e 100644 --- a/src/main/webapp/WEB-INF/views/dashboard/trafficWebTypeList.jsp +++ b/src/main/webapp/WEB-INF/views/dashboard/trafficWebTypeList.jsp @@ -400,7 +400,7 @@ html += "" + data.pps + ""; html += "" + packper + " %"; html += "" + Math.round(data.Gbyte*100)/100 + ""; - html += "" + data.bps + ""; + html += "" + Math.round(data.bps*100)/100 + ""; html += "" + gbytper + " %"; html += "" if(index==fileDataS.length-1){