Sfoglia il codice sorgente

实时流量数据计算修改

master
CMM 1 mese fa
parent
commit
10ae29ffec
1 ha cambiato i file con 4 aggiunte e 2 eliminazioni
  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 Vedi File

@@ -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<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));
return vo;
}


Loading…
Annulla
Salva