潘志宝
2025-03-17 82e98b24e0871366a5fc8bddab07bbabfc321eb3
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/sample/PredictSampleDataConstructor.java
@@ -140,19 +140,20 @@
                        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());
                            // 调整值
                            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) {
                                    // 用BigDecimal计算,解决double精度问题
                                    matrix[k][i] = BigDecimal.valueOf(dataValue).add(BigDecimal.valueOf(adjustVal)).doubleValue();
                                }
                        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();
@@ -201,8 +202,12 @@
                break;
            case NORMALITEM:
            case MERGEITEM:
                List<DataValueVO> predictValue = mmItemResultService.getPredictValue(columnItem.getParamId(), columnItem.getStartTime(), columnItem.getEndTime());
                List<DataValueVO> predictValue = new ArrayList<>();
                if (columnItem.getStartTime().getTime() == columnItem.getEndTime().getTime()) {
                    predictValue = mmItemResultService.getPredictValueLast(columnItem.getParamId(), columnItem.getStartTime(), 2);
                } else {
                    predictValue = mmItemResultService.getPredictValue(columnItem.getParamId(), columnItem.getStartTime(), columnItem.getEndTime());
                }
                if (CollectionUtils.isEmpty(predictValue)) {
                    break;
                }