潘志宝
2025-02-20 fdcde13df2173fdbb0a2e9e942c2400ec2006c3c
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/sample/PredictSampleDataConstructor.java
@@ -30,6 +30,7 @@
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
import java.math.BigDecimal;
import java.util.*;
import java.util.stream.Collectors;
@@ -76,6 +77,8 @@
        Map<String, ApiPointDTO> pointMap = sampleInfo.getPointMap();
        Map<String, ApiPlanItemDTO> planMap = sampleInfo.getPlanMap();
        Map<String, ApiIndItemDTO> indMap = sampleInfo.getIndMap();
        int deviationIndex = 0;
        //对每个爪分别进行计算
        for (ColumnItemPort entry : sampleInfo.getColumnInfo()) {
            //先依据爪内数据项的modelParamOrder进行排序——重写comparator匿名函数
@@ -94,11 +97,31 @@
                }
            }
            //找出对应的调整值
            double[] deviationItem = null;
            if (sampleInfo.getDeviation() != null && sampleInfo.getDeviation().length > 0) {
                deviationItem = sampleInfo.getDeviation()[deviationIndex];
            }
            deviationIndex ++;
            //对每一项依次进行数据查询,然后将查询出的值赋给matrix对应的位置
            for (int i = 0; i < entry.getColumnItemList().size(); i++) {
                try {
                    List<DataValueVO> dataEntityList = getData(entry.getColumnItemList().get(i), pointMap, planMap,indMap);
                    //补全数据
                    //设置调整值
                    if (deviationItem != null && deviationItem.length > 0) {
                        logger.info("设置调整值, i = " + i);
                        if (deviationItem[i] <= 0) {
                            continue;
                        }
                        for(int dataKey = 1; dataKey < dataEntityList.size(); dataKey ++) {
                            DataValueVO item = dataEntityList.get(dataKey);
                            item.setDataValue(item.getDataValue() + deviationItem[i]);
                        }
                    }
                    // 补全数据
                    ColumnItem columnItem = entry.getColumnItemList().get(i);
                    dataEntityList = super.completionData(matrix.length, dataEntityList, columnItem.startTime, columnItem.endTime, columnItem.getParamType(),columnItem.getGranularity());