出省流量统计增加立即执行、增加占比总计、不同运营商也统计.
磁盘统计HDD改为所有磁盘、速率单位改为 MB/s、流量图开始时间修正。 流量95值收益优化
This commit is contained in:
+9
-2
@@ -183,8 +183,15 @@ public class EchartsDataUtils {
|
||||
|
||||
// 1. 查询开始时间到数据开始时间(稀疏间隔)
|
||||
if (queryStart.before(dataStart)) {
|
||||
List<Date> beforeSeries = generateTimeSeries(queryStart, dataStart, sparseInterval, false);
|
||||
timeSeries.addAll(beforeSeries);
|
||||
long timeDiff = dataStart.getTime() - queryStart.getTime();
|
||||
long thresholdMinutes = 5; // 定义阈值(分钟)
|
||||
long thresholdMs = thresholdMinutes * 60 * 1000;
|
||||
|
||||
// 只有当时间差超过5分钟时才补充时间序列
|
||||
if (timeDiff > thresholdMs) {
|
||||
List<Date> beforeSeries = generateTimeSeries(queryStart, dataStart, sparseInterval, false);
|
||||
timeSeries.addAll(beforeSeries);
|
||||
}
|
||||
}
|
||||
|
||||
// 2. 数据时间范围内的处理
|
||||
|
||||
+9
-2
@@ -193,8 +193,15 @@ public class EchartsMoreDataUtils {
|
||||
|
||||
// 1. 开始时间到数据开始时间(稀疏间隔)
|
||||
if (startDate.before(actualStartTime)) {
|
||||
List<Date> beforeSeries = generateTimeSeries(startDate, actualStartTime, sparseInterval);
|
||||
fullTimeSeries.addAll(beforeSeries);
|
||||
long timeDiff = actualStartTime.getTime() - startDate.getTime();
|
||||
long thresholdMinutes = 5; // 定义阈值(分钟)
|
||||
long thresholdMs = thresholdMinutes * 60 * 1000;
|
||||
|
||||
// 只有当时间差超过5分钟时才补充时间序列
|
||||
if (timeDiff > thresholdMs) {
|
||||
List<Date> beforeSeries = generateTimeSeries(startDate, actualStartTime, sparseInterval);
|
||||
fullTimeSeries.addAll(beforeSeries);
|
||||
}
|
||||
}
|
||||
|
||||
// 2. 数据开始时间到数据结束时间(正常间隔)
|
||||
|
||||
+7
-4
@@ -385,25 +385,28 @@ public class SpeedUtils {
|
||||
}
|
||||
public static String determineUnitByValue(Long value) {
|
||||
if (value == null || value == 0) {
|
||||
return "Kb";
|
||||
return "KB";
|
||||
}
|
||||
|
||||
// 注意:这里使用二进制单位(1024)
|
||||
if (value >= 1024L * 1024 * 1024) { // >= 1GB
|
||||
return "Gb";
|
||||
return "GB";
|
||||
} else if (value >= 1024L * 1024) { // >= 1MB
|
||||
return "Mb";
|
||||
return "MB";
|
||||
} else {
|
||||
return "Kb";
|
||||
return "KB";
|
||||
}
|
||||
}
|
||||
// 工具方法:获取单位换算除数
|
||||
public static BigDecimal get1024Divisor(String unit) {
|
||||
switch (unit) {
|
||||
case "GB":
|
||||
case "Gb":
|
||||
return new BigDecimal(1024L * 1024 * 1024); // 1GB = 1024^3
|
||||
case "MB":
|
||||
case "Mb":
|
||||
return new BigDecimal(1024L * 1024); // 1MB = 1024^2
|
||||
case "KB":
|
||||
case "Kb":
|
||||
return new BigDecimal(1024); // 1KB = 1024
|
||||
default:
|
||||
|
||||
+5
-5
@@ -170,22 +170,22 @@ public class UnitChangeUtil {
|
||||
}
|
||||
public static String convertUnitByValue(Long value) {
|
||||
if (value == null || value == 0) {
|
||||
return "0 Kb";
|
||||
return "0 KB";
|
||||
}
|
||||
|
||||
// 注意:这里使用二进制单位(1024)
|
||||
if (value >= 1024L * 1024 * 1024 * 1024) {
|
||||
double result = value / (1024.0 * 1024 * 1024 * 1024);
|
||||
return String.format("%.2f Tb", result);
|
||||
return String.format("%.2f TB", result);
|
||||
} else if (value >= 1024L * 1024 * 1024) { // >= 1GB
|
||||
double result = value / (1024.0 * 1024 * 1024);
|
||||
return String.format("%.2f Gb", result);
|
||||
return String.format("%.2f GB", result);
|
||||
} else if (value >= 1024L * 1024) { // >= 1MB
|
||||
double result = value / (1024.0 * 1024);
|
||||
return String.format("%.2f Mb", result);
|
||||
return String.format("%.2f MB", result);
|
||||
} else {
|
||||
double result = value / 1024.0;
|
||||
return String.format("%.2f Kb", result);
|
||||
return String.format("%.2f KB", result);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user