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 |    8 ++++++--
 1 files changed, 6 insertions(+), 2 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 d0cfb77..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,6 +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分插入,运行时间改为第二天
             }
             PredictResultVO predictResult;
             if (!predictItem.getStatus().equals(ItemStatus.STATUS1.getCode())) {
@@ -104,6 +105,7 @@
                 try {
                     predictResultHandler.savePredictResult(predictResult);
                 } catch (Exception e) {
+                    e.printStackTrace();
                     itemRunStatusEnum = ItemRunStatusEnum.MODELRESULTSAVEERROR;
                     throw new RuntimeException("模型结果保存异常,result:" + predictResult);
                 }
@@ -118,7 +120,7 @@
         }
     }
 
-    public void predictAdjust(ItemVO predictItem, Date predictTime, List<StAdjustDeviationDTO> deviationList, String scheduleModelId) {
+    public void predictAdjust(ItemVO predictItem, Date predictTime, List<StAdjustDeviationDTO> deviationList, String scheduleModelId, String configId) {
         Calendar calendar = Calendar.getInstance();
         calendar.setTime(predictTime);
         calendar.set(Calendar.MILLISECOND, 0);
@@ -133,9 +135,11 @@
         try {
             PredictItemHandler predictItemHandler = predictItemFactory.create(predictItem.getId());
             PredictResultVO predictResult = predictItemHandler.predictAdjust(calendar.getTime(), predictItem, deviationList);
+            predictResult.setGranularity(predictItem.getGranularity());
+            predictResult.setSaveIndex(predictItem.getSaveIndex());
 
             // 保存预测结果
-            predictResultHandler.savePredictAdjustResult(predictResult, JSONArray.toJSONString(deviationList), scheduleModelId);
+            predictResultHandler.savePredictAdjustResult(predictResult, JSONArray.toJSONString(deviationList), scheduleModelId,configId);
         } catch (Exception e) {
             e.printStackTrace();
             log.error(MessageFormat.format("预测项编号:{0},预测项名称:{1},预测失败:{2} 预测时刻:{3}",

--
Gitblit v1.9.3