diff --git a/zc-business/src/main/java/com/zc/business/domain/OnlineSum.java b/zc-business/src/main/java/com/zc/business/domain/OnlineSum.java index 93a030d1..2146b6f2 100644 --- a/zc-business/src/main/java/com/zc/business/domain/OnlineSum.java +++ b/zc-business/src/main/java/com/zc/business/domain/OnlineSum.java @@ -3,6 +3,8 @@ package com.zc.business.domain; import com.fasterxml.jackson.annotation.JsonFormat; import org.springframework.format.annotation.DateTimeFormat; +import java.math.BigDecimal; +import java.math.RoundingMode; import java.util.Date; public class OnlineSum implements java.io.Serializable { @@ -169,7 +171,9 @@ public class OnlineSum implements java.io.Serializable { this.receiveCount += onlineLog.getReceiveCount(); this.lossCount += onlineLog.getLossCount(); this.lossRate = String.format("%.2f%%", (this.sendCount==0?0:(double)this.lossCount/this.sendCount)*100); - this.rttAvg = this.sendCount==0?0:rtt/this.sendCount; + BigDecimal bd = new BigDecimal(Double.toString(this.sendCount==0?0:rtt/this.sendCount)); + bd = bd.setScale(2, RoundingMode.HALF_UP); + this.rttAvg =bd.doubleValue(); if(this.rttAvg > 0 && this.rttAvg <= 30){ this.networkQuality = OnlineLog.NetworkQuality.GOOD.getValue(); }else if(this.rttAvg >30 && this.rttAvg <= 100){