From 9bcefe6dd1c1634c48f5eb1a7e6fb13c8a2ac8ce Mon Sep 17 00:00:00 2001
From: 潘志宝 <979469083@qq.com>
Date: 星期三, 02 四月 2025 00:20:04 +0800
Subject: [PATCH] 如果小于天粒度,则从下个时间粒度开始

---
 iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/predict/PredictModuleHandler.java |    2 +-
 iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/predict/PredictResultHandler.java |   11 ++++++++---
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/predict/PredictModuleHandler.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/predict/PredictModuleHandler.java
index 0ec88c9..b0c6ac6 100644
--- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/predict/PredictModuleHandler.java
+++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/predict/PredictModuleHandler.java
@@ -69,7 +69,7 @@
             } else if (PredGranularityEnum.D1.getCode().equals(predictItem.getGranularity())) {
                 calendar.set(Calendar.MINUTE, 0);
                 calendar.set(Calendar.HOUR_OF_DAY, 0);
-                calendar.add(Calendar.DAY_OF_YEAR, 1);//天粒度数据23:58分插入,运行时间改为第二天
+                // calendar.add(Calendar.DAY_OF_YEAR, 1);//天粒度数据23:58分插入,运行时间改为第二天
             }
             PredictResultVO predictResult;
             if (!predictItem.getStatus().equals(ItemStatus.STATUS1.getCode())) {
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 bea9b0a..d8548a3 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
@@ -3,6 +3,7 @@
 import com.baomidou.dynamic.datasource.annotation.DSTransactional;
 import com.iailab.module.model.common.enums.CommonDict;
 import com.iailab.module.model.mcs.pre.entity.MmItemOutputEntity;
+import com.iailab.module.model.mcs.pre.enums.PredGranularityEnum;
 import com.iailab.module.model.mcs.pre.service.MmItemResultService;
 import com.iailab.module.model.mcs.sche.service.StAdjustResultService;
 import com.iailab.module.model.mdk.factory.ItemEntityFactory;
@@ -41,14 +42,18 @@
             List<DataValueVO> predictDataList = new ArrayList<>();
             Calendar calendar = Calendar.getInstance();
             calendar.setTime(predictResult.getPredictTime());
-            for (Integer i = 0; i < rows; i++) {
-                // 从下个时间粒度开始
-                calendar.add(Calendar.SECOND, predictResult.getGranularity());
 
+            if (predictResult.getGranularity() < PredGranularityEnum.D1.getCode()) {
+                // 如果小于天粒度,则从下个时间粒度开始
+                calendar.add(Calendar.SECOND, predictResult.getGranularity());
+            }
+            for (Integer i = 0; i < rows; i++) {
                 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);

--
Gitblit v1.9.3