优化95值计算单位、实际流量保留两位小数
This commit is contained in:
+4
-4
@@ -95,8 +95,8 @@ public class SpeedUtils {
|
||||
totalOutSpeedBit = totalOutSpeedBit.add(outSpeedBit);
|
||||
|
||||
// 转换为Gb并更新最大值
|
||||
BigDecimal inSpeedGb = inSpeedBit.divide(GB_DIVISOR, 0, RoundingMode.HALF_UP);
|
||||
BigDecimal outSpeedGb = outSpeedBit.divide(GB_DIVISOR, 0, RoundingMode.HALF_UP);
|
||||
BigDecimal inSpeedGb = inSpeedBit.divide(GB_DIVISOR, 2, RoundingMode.HALF_UP);
|
||||
BigDecimal outSpeedGb = outSpeedBit.divide(GB_DIVISOR, 2, RoundingMode.HALF_UP);
|
||||
|
||||
maxInSpeedGb = maxInSpeedGb.max(inSpeedGb);
|
||||
maxOutSpeedGb = maxOutSpeedGb.max(outSpeedGb);
|
||||
@@ -111,9 +111,9 @@ public class SpeedUtils {
|
||||
|
||||
// 计算Gb平均值
|
||||
BigDecimal size = new BigDecimal(list.size());
|
||||
BigDecimal avgInSpeedGb = totalInSpeedBit.divide(GB_DIVISOR, 0, RoundingMode.HALF_UP)
|
||||
BigDecimal avgInSpeedGb = totalInSpeedBit.divide(GB_DIVISOR, 2, RoundingMode.HALF_UP)
|
||||
.divide(size, 2, RoundingMode.HALF_UP);
|
||||
BigDecimal avgOutSpeedGb = totalOutSpeedBit.divide(GB_DIVISOR, 0, RoundingMode.HALF_UP)
|
||||
BigDecimal avgOutSpeedGb = totalOutSpeedBit.divide(GB_DIVISOR, 2, RoundingMode.HALF_UP)
|
||||
.divide(size, 2, RoundingMode.HALF_UP);
|
||||
|
||||
// 基于平均值的较大值确定推荐单位
|
||||
|
||||
Reference in New Issue
Block a user