潘志宝
2025-03-18 52725f177acbe4ccf6b1fab059353890c4b55814
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/sample/PredictSampleDataConstructor.java
@@ -89,7 +89,7 @@
            }
        }
        int portIdx = 0;
        int portIdx = 1;
        //对每个爪分别进行计算
        for (ColumnItemPort entry : sampleInfo.getColumnInfo()) {
            double[][] matrix = new double[0][0];
@@ -136,28 +136,24 @@
                    try {
                        List<DataValueVO> dataEntityList = getData(entry.getColumnItemList().get(i), pointMap, planMap, indMap);
                        double adjustVal = SampleInfo.getAdjustValueFromDeviation(portIdx, i, sampleInfo.getDeviation());
                        if (adjustVal != 0) {
                            logger.info("设置调整值adjustVal:" + adjustVal);
                            for (int dataKey = 1; dataKey < dataEntityList.size(); dataKey++) {
                                DataValueVO item = dataEntityList.get(dataKey);
                                item.setDataValue(item.getDataValue() + adjustVal);
                            }
                        }
                        //补全数据
                        ColumnItem columnItem = entry.getColumnItemList().get(i);
                        dataEntityList = super.completionData(matrix.length, dataEntityList, columnItem.startTime, columnItem.endTime, columnItem.getParamType(), columnItem.getGranularity());
                        /** 如果数据取不满,把缺失的数据点放在后面 */
                        if (dataEntityList != null && dataEntityList.size() != 0) {
                            logger.info("设置matrix, i = " + i + ", size = " + dataEntityList.size());
                            for (int k = 0; k < dataEntityList.size(); k++) {
                                Double dataValue = dataEntityList.get(k).getDataValue();
                                if (null != dataValue) {
                                    matrix[k][i] = dataValue;
                                }
                        if (CollectionUtils.isEmpty(dataEntityList)) {
                            continue;
                        }
                        logger.info("设置matrix, i = " + i + ", size = " + dataEntityList.size());
                        // 调整值
                        double adjustVal = SampleInfo.getAdjustValueFromDeviation(portIdx, i + 1, sampleInfo.getDeviation());
                        for (int k = 0; k < dataEntityList.size(); k++) {
                            Double dataValue = dataEntityList.get(k).getDataValue();
                            if (null == dataValue) {
                                continue;
                            }
                            // 用BigDecimal计算,解决double精度问题
                            matrix[k][i] = BigDecimal.valueOf(dataValue).add(BigDecimal.valueOf(adjustVal)).doubleValue();
                        }
                    } catch (Exception e) {
                        e.printStackTrace();
@@ -207,7 +203,6 @@
            case NORMALITEM:
            case MERGEITEM:
                List<DataValueVO> predictValue = mmItemResultService.getPredictValue(columnItem.getParamId(), columnItem.getStartTime(), columnItem.getEndTime());
                if (CollectionUtils.isEmpty(predictValue)) {
                    break;
                }