Browse Source

实时流量数据计算修改

master
CMM 1 month ago
parent
commit
10ae29ffec
1 changed files with 4 additions and 2 deletions
  1. +4
    -2
      ningda-yw-api/src/main/java/com/ningdatech/carapi/radar/manage/RadarManage.java

+ 4
- 2
ningda-yw-api/src/main/java/com/ningdatech/carapi/radar/manage/RadarManage.java View File

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

BigDecimal total = decimals.stream().reduce(BigDecimal.ZERO, BigDecimal::add);
vo.setRealTimeTrafficFlow(String.valueOf(total)); vo.setRealTimeTrafficFlow(String.valueOf(total));
return vo; return vo;
} }


Loading…
Cancel
Save