流量统计详情增加表格导出excel ,csv ,表格后增加total统计列,图片打印。

This commit is contained in:
zhanghongqing
2018-12-20 21:09:48 +08:00
parent 74c978286a
commit c7b86b08c6
12 changed files with 316 additions and 166 deletions

View File

@@ -67,10 +67,6 @@ public class TrafficStatisticsInfoController extends BaseController {
HashMap<String, Object> m = new HashMap<String, Object>();
List list = new ArrayList();
try {
String string = HttpClientUtil.get(Constants.DASHBOARD_URL+Constants.NTC_TOTAL_REPORT);
Gson gson = new GsonBuilder().create();
fromJsonList = gson.fromJson(string, new TypeToken<Map>(){}.getType());
list = (ArrayList) fromJsonList.get("data");
Random r = new Random();
Double rejectNum=0d;
Double dropConnNum=0d;
@@ -81,7 +77,11 @@ public class TrafficStatisticsInfoController extends BaseController {
Double inoctetsNum=0d;
Double outoctetsNum=0d;
Double bandwidth=0d;
if(list!=null&&list.size()>0){
String string = HttpClientUtil.get(Constants.DASHBOARD_URL+Constants.NTC_TOTAL_REPORT);
Gson gson = new GsonBuilder().create();
fromJsonList = gson.fromJson(string, new TypeToken<Map>(){}.getType());
list = (ArrayList) fromJsonList.get("data");
if(fromJsonList!=null&&list!=null&&list.size()>0){
Map map = (Map) list.get(0);
rejectNum = (Double) map.get("rejectNum") ;
monitorNum = (Double) map.get("monitorNum");
@@ -265,8 +265,6 @@ public class TrafficStatisticsInfoController extends BaseController {
Map<String, Object> fromJsonList = new HashMap<String, Object>();
Map map = new HashMap();
//String url = Constants.DASHBOARD_URL+Constants.TRAFFIC_BANDWIDTH_TRANS_TWO;
//String url="http://192.168.11.78:8080/galaxy/service/log/v1/"+Constants.TRAFFIC_BANDWIDTH_TRANS_THREE;
//String url="http://192.168.11.78:8080/galaxy/service/log/v1/"+Constants.TRAFFIC_BANDWIDTH_TRANS_FOUR;
String url=Constants.DASHBOARD_URL+Constants.TRAFFIC_BANDWIDTH_TRANS_THREE;
//String url=Constants.DASHBOARD_URL+Constants.TRAFFIC_BANDWIDTH_TRANS_FOUR;
try {
@@ -502,9 +500,9 @@ public class TrafficStatisticsInfoController extends BaseController {
logger.debug("website接口数据"+fromJsonList);
list = (ArrayList) fromJsonList.get("data");
BigDecimal divisor=new BigDecimal(1024*1024*1024);
DecimalFormat df = new DecimalFormat("0.00");
DecimalFormat df = new DecimalFormat("0.000000000");
DecimalFormat dl = new DecimalFormat("0");
DecimalFormat pf = new DecimalFormat("0.00%");
DecimalFormat pf = new DecimalFormat("0.000000000");
// Double totalLink=0d;
Double totalGbyte=0d;
Double totalPackets=0d;
@@ -528,10 +526,10 @@ public class TrafficStatisticsInfoController extends BaseController {
Map m=(Map)object;
// Double perLink = ((Double)m.get("linkNum"))/totalLink;
// m.put("perLink",pf.format(perLink));
Double perPackets = ((Double)m.get("pktCount"))/totalPackets;
m.put("perPackets", pf.format(perPackets));
Double perGbyte = ((Double)m.get("byteCount"))/totalGbyte;
m.put("perGbyte", pf.format(perGbyte));
// Double perPackets = ((Double)m.get("pktCount"))/totalPackets;
m.put("totalPackets", pf.format(totalPackets));
// Double perGbyte = ((Double)m.get("byteCount"))/totalGbyte;
m.put("totalGbyte", pf.format(totalGbyte/1024/1024/1024));
if(map.containsKey(Long.parseLong(dl.format(m.get("webId"))))){
m.put("website", map.get(Long.parseLong(dl.format(m.get("webId")))));
}else{