动态首页调整:流量单位提取到y轴顶端;数字加单位;输出加单位;

This commit is contained in:
dongxiaoyan
2018-12-26 18:44:59 +08:00
parent b2eb6afad9
commit 9b9b76172f
2 changed files with 86 additions and 27 deletions

View File

@@ -43,13 +43,15 @@ public class DynamicIndexController extends BaseController {
String serviceIds = request.getParameter("sid");
String baseNum = request.getParameter("baseNum");
String hourStr = request.getParameter("hour");
String dropBaseNum = request.getParameter("dropBaseNum");
String serviceBaseNum = request.getParameter("serviceBaseNum");
Integer hour = null;
if(hourStr!=null &&!"".equals(hourStr)){
hour = Integer.parseInt(hourStr);
}
Object trafficAreaStat = trafficAreaStat(hour, Integer.parseInt(baseNum));
Object dropStat = dropStat(hour, Integer.parseInt(baseNum));
Object logStat = logStat(hour, serviceIds, Integer.parseInt(baseNum));
Object trafficAreaStat = trafficAreaStat(hour, Long.valueOf(baseNum));
Object dropStat = dropStat(hour, Long.valueOf(dropBaseNum));
Object logStat = logStat(hour, serviceIds, Long.valueOf(serviceBaseNum));
Gson gson = new GsonBuilder().create();
String trafficJson = gson.toJson(trafficAreaStat);
String dropJson = gson.toJson(dropStat);
@@ -94,7 +96,7 @@ public class DynamicIndexController extends BaseController {
* @param hour 取hour小时内的流量数据默认24小时
* @return
*/
public Object trafficAreaStat(Integer hour, Integer baseNum) {
public Object trafficAreaStat(Integer hour, long baseNum) {
List<Map> results = new ArrayList<>();
if (hour == null || hour <= 0) {
@@ -131,7 +133,11 @@ public class DynamicIndexController extends BaseController {
}
List<Object> point = new ArrayList<>();//每个点 [时间戳, 数值]
point.add(DateUtils.parseDate(entity.getReportTime()).getTime());
point.add(entity.getSum());
/*if(0<entity.getSum()){//1024*1024*1024=1073741824
point.add(entity.getSum()/1073741824);
}else{
point.add(entity.getSum());
}*/point.add(entity.getSum());
List<List<Object>> points = t.get(entity.getArea());//所有点
points.add(point);
@@ -171,7 +177,7 @@ public class DynamicIndexController extends BaseController {
* @param hour 取hour小时内的丢弃数据默认24小时
* @return
*/
public Object dropStat(Integer hour, Integer baseNum) {
public Object dropStat(Integer hour, long baseNum) {
List<Map> results = new ArrayList<>();
if (hour == null || hour <= 0) {
@@ -235,7 +241,7 @@ public class DynamicIndexController extends BaseController {
* @param hour 取hour小时内的日志数据默认24小时
* @return
*/
public Object logStat(Integer hour, String serviceIds, Integer baseNum) {
public Object logStat(Integer hour, String serviceIds, long baseNum) {
String[] _idsArr = serviceIds.split(",");
Long[] idsArr = new Long[5];
for (int i = 0; i < 5; i++) {