优化算法

This commit is contained in:
xy
2026-01-20 14:10:13 +08:00
parent fe3c0363fb
commit 60bad4bc06

View File

@@ -24,10 +24,7 @@ import org.springframework.util.CollectionUtils;
import javax.annotation.Resource;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
/**
@@ -86,10 +83,22 @@ public class IDataLimitRateAsyncImpl implements IDataLimitRateAsync {
* 功能描述:获取influxDB -> data_v ->
* 总计算次数(用data_v中phasic_type=A,value_type=avg,quality_flag=0来参与统计)
*/
//在线监测设备会有AB、BC、CA的数据会导致数据重复计算这边根据时间去重
Map<String, List<DataVDto>> allTime = dataVAllTime.stream()
.filter(x -> PhaseType.PHASE_A.equals(x.getPhasicType()))
.filter(x -> InfluxDbSqlConstant.AVG_WEB.equalsIgnoreCase(x.getValueType()))
.collect(Collectors.groupingBy(DataVDto::getLineId));
.collect(Collectors.groupingBy(
DataVDto::getLineId,
Collectors.collectingAndThen(
Collectors.toCollection(
// 使用 TreeSet 根据时间排序并去重
() -> new TreeSet<>(
Comparator.comparing(DataVDto::getMinTime)
)
),
ArrayList::new
)
));
/**
* 功能描述:获取influxDB -> data_plt ->