diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/radar/manage/RadarManage.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/radar/manage/RadarManage.java index 79ca1bb..c96c831 100644 --- a/ningda-yw-api/src/main/java/com/ningdatech/carapi/radar/manage/RadarManage.java +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/radar/manage/RadarManage.java @@ -3,6 +3,7 @@ package com.ningdatech.carapi.radar.manage; import java.io.IOException; import java.io.InputStream; import java.math.BigDecimal; +import java.math.RoundingMode; import java.net.InetSocketAddress; import java.net.ServerSocket; import java.net.Socket; @@ -247,8 +248,9 @@ public class RadarManage { } // 计算实时流量的和 List list = radarDataList.stream().map(RadarData::getRealTimeTrafficFlow).collect(Collectors.toList()); - List decimals = list.stream().map(d -> BigDecimal.valueOf(Double.parseDouble(d))).collect(Collectors.toList()); - BigDecimal total = decimals.stream().reduce(BigDecimal.ZERO, BigDecimal::add).stripTrailingZeros(); + List decimals = list.stream().map(BigDecimal::new).collect(Collectors.toList()); + + BigDecimal total = decimals.stream().reduce(BigDecimal.ZERO, BigDecimal::add); vo.setRealTimeTrafficFlow(String.valueOf(total)); return vo; }