谐波监测-区域:畸变率异常bug

This commit is contained in:
wr
2023-04-21 16:38:38 +08:00
parent 3396829401
commit deb28da155

View File

@@ -29,7 +29,6 @@ import com.njcn.harmonic.service.THDistortionService;
import com.njcn.harmonic.utils.PubUtils; import com.njcn.harmonic.utils.PubUtils;
import com.njcn.influxdb.utils.InfluxDbUtils; import com.njcn.influxdb.utils.InfluxDbUtils;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import org.influxdb.dto.QueryResult;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
@@ -266,8 +265,9 @@ public class THDistortionServiceImpl implements THDistortionService {
); );
if (CollUtil.isNotEmpty(info)) { if (CollUtil.isNotEmpty(info)) {
//根据id分组先乘以100.在取平均值,在四舍五入 //根据id分组先乘以100.在取平均值,在四舍五入
Map<String, List<BigDecimal>> collect = info.stream().filter(x -> x.getVThd() != null).collect(Collectors.groupingBy(RStatDataVD::getLineId, Collectors.mapping(RStatDataVD::getVThd, Collectors.toList())));
Map<String, Double> vthdMap = info.stream().filter(x -> x.getVThd() != null).collect(Collectors.groupingBy(RStatDataVD::getLineId, Map<String, Double> vthdMap = info.stream().filter(x -> x.getVThd() != null).collect(Collectors.groupingBy(RStatDataVD::getLineId,
Collectors.averagingDouble(x -> x.getVThd().multiply(new BigDecimal(100)).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue()))); Collectors.averagingDouble(x -> x.getVThd().setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue())));
PublicDTO publicDTO; PublicDTO publicDTO;
for (Map.Entry<String, Double> entry : vthdMap.entrySet()) { for (Map.Entry<String, Double> entry : vthdMap.entrySet()) {
publicDTO = new PublicDTO(); publicDTO = new PublicDTO();