From 10ae29ffeca11ece03ffef24693047320c3cca0d Mon Sep 17 00:00:00 2001 From: CMM <2198256324@qq.com> Date: Mon, 18 Nov 2024 18:10:54 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=9E=E6=97=B6=E6=B5=81=E9=87=8F=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E8=AE=A1=E7=AE=97=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/ningdatech/carapi/radar/manage/RadarManage.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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; }