From b270a07828a9627f1a42e254a430c9921fec4e95 Mon Sep 17 00:00:00 2001
From: 潘志宝 <979469083@qq.com>
Date: 星期三, 26 三月 2025 16:14:37 +0800
Subject: [PATCH] Merge branch 'master' of http://dlindusit.com:53929/r/iailab-plat

---
 iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/predict/PredictResultHandler.java |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/predict/PredictResultHandler.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/predict/PredictResultHandler.java
index a6cac8e..bea9b0a 100644
--- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/predict/PredictResultHandler.java
+++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/predict/PredictResultHandler.java
@@ -42,12 +42,13 @@
             Calendar calendar = Calendar.getInstance();
             calendar.setTime(predictResult.getPredictTime());
             for (Integer i = 0; i < rows; i++) {
+                // 从下个时间粒度开始
+                calendar.add(Calendar.SECOND, predictResult.getGranularity());
+
                 DataValueVO predictData = new DataValueVO();
                 predictData.setDataTime(calendar.getTime());
                 predictData.setDataValue(Double.valueOf(entry.getValue()[i]));
                 predictDataList.add(predictData);
-
-                calendar.add(Calendar.SECOND, predictResult.getGranularity());
             }
             resultMap.put(entry.getKey().getId(), predictDataList);
             predictLists.put(entry.getKey().getResultstr(), predictDataList);
@@ -59,7 +60,7 @@
                     // 时间 预测时间+预测长度*粒度
                     Calendar calendar = Calendar.getInstance();
                     calendar.setTime(predictResult.getPredictTime());
-                    calendar.add(Calendar.SECOND, predictResult.getGranularity() * (rows - 1));
+                    calendar.add(Calendar.SECOND, predictResult.getGranularity() * rows);
                     predictData.setDataTime(calendar.getTime());
                     //值 所有值相加/除数
                     BigDecimal sum = BigDecimal.valueOf(Arrays.stream(entry.getValue()).sum());
@@ -85,12 +86,13 @@
             Calendar calendar = Calendar.getInstance();
             calendar.setTime(predictResult.getPredictTime());
             for (Integer i = 0; i < rows; i++) {
+                // 从下个时间粒度开始
+                calendar.add(Calendar.SECOND, predictResult.getGranularity());
+
                 DataValueVO predictData = new DataValueVO();
                 predictData.setDataTime(calendar.getTime());
                 predictData.setDataValue(Double.valueOf(entry.getValue()[i]));
                 predictDataList.add(predictData);
-
-                calendar.add(Calendar.SECOND, predictResult.getGranularity());
             }
             predictLists.put(entry.getKey().getResultstr(), predictDataList);
         }

--
Gitblit v1.9.3