From 77a8b19575fe2afa6a479918d5fc6aafb3a6a320 Mon Sep 17 00:00:00 2001
From: dengzedong <dengzedong@email>
Date: 星期三, 26 三月 2025 15:16:51 +0800
Subject: [PATCH] 模型运行参数 PLAN 未来数据

---
 iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/sample/SampleInfoConstructor.java |   37 ++++++++++++++++++++++---------------
 1 files changed, 22 insertions(+), 15 deletions(-)

diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/sample/SampleInfoConstructor.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/sample/SampleInfoConstructor.java
index 45273aa..430c810 100644
--- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/sample/SampleInfoConstructor.java
+++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/sample/SampleInfoConstructor.java
@@ -1,6 +1,5 @@
 package com.iailab.module.model.mdk.sample;
 
-import com.iailab.module.data.api.ind.IndItemApi;
 import com.iailab.module.data.api.ind.dto.ApiIndItemDTO;
 import com.iailab.module.data.api.plan.dto.ApiPlanItemDTO;
 import com.iailab.module.data.api.point.dto.ApiPointDTO;
@@ -25,9 +24,6 @@
 abstract class SampleInfoConstructor {
 
     @Autowired
-    private IndItemApi indItemApi;
-
-    @Autowired
     private MmPredictItemService mmPredictItemService;
 
     /**
@@ -39,7 +35,9 @@
      */
     protected SampleInfo prepareSampleInfo(String modelId, Date predictTime, Map<Integer, Integer> dynamicDataLength) {
         //样本的列信息
-        return getColumnInfo(modelId, predictTime, dynamicDataLength);
+        SampleInfo sampleInfo = getColumnInfo(modelId, predictTime, dynamicDataLength);
+        sampleInfo.setPredictTime(predictTime);
+        return sampleInfo;
     }
 
     /**
@@ -78,17 +76,20 @@
      */
     protected Date getStartTime(ColumnItem columnItem, Date originalTime) {
         Date dateTime = new Date();
-        Calendar calendar = Calendar.getInstance();
-        calendar.setTime(originalTime);
         switch (ModelParamType.getEumByCode(columnItem.getParamType())) {
             case DATAPOINT:
-            case IND:
-            case PLAN:
                 dateTime = calculateTime(originalTime, true, columnItem.getDataLength(), columnItem.getGranularity());
+                break;
+            case PLAN:
+                dateTime = originalTime;
+                break;
+            case IND:
+            case IND_ASCII:
+                dateTime = calculateTime(originalTime, true, columnItem.getDataLength() - 1, columnItem.getGranularity());
                 break;
             case NORMALITEM:
             case MERGEITEM:
-                dateTime = calendar.getTime();
+                dateTime = calculateTime(originalTime, false, 1, columnItem.getGranularity());
                 break;
             default:
                 break;
@@ -110,13 +111,18 @@
         calendar.setTime(originalTime);
         switch (ModelParamType.getEumByCode(columnItem.getParamType())) {
             case DATAPOINT:
-            case IND:
+                dateTime = calculateTime(originalTime, true, 1, columnItem.getGranularity());
+                break;
             case PLAN:
-                dateTime = calendar.getTime();
+                dateTime = calculateTime(originalTime, false, columnItem.getDataLength()-1, columnItem.getGranularity());
+                break;
+            case IND:
+            case IND_ASCII:
+                dateTime = originalTime;
                 break;
             case NORMALITEM:
             case MERGEITEM:
-                dateTime = calculateTime(originalTime, false, columnItem.getDataLength(), columnItem.getGranularity());
+                dateTime = calculateTime(originalTime, false, columnItem.getDataLength() + 1, columnItem.getGranularity());
                 break;
             default:
                 break;
@@ -131,7 +137,7 @@
      * @return
      * @throws Exception
      */
-    protected Integer getGranularity(ColumnItem columnItem,Map<String, ApiPointDTO> pointMap, Map<String, ApiPlanItemDTO> planMap) {
+    protected Integer getGranularity(ColumnItem columnItem,Map<String, ApiPointDTO> pointMap, Map<String, ApiPlanItemDTO> planMap,Map<String, ApiIndItemDTO> indMap) {
         // 默认60s
         Integer granularity = 60;
         switch (ModelParamType.getEumByCode(columnItem.getParamType())) {
@@ -144,7 +150,8 @@
                 granularity = mmPredictItemService.getItemByOutPutId(columnItem.getParamId()).getGranularity();
                 break;
             case IND:
-                ApiIndItemDTO indItemDTO = indItemApi.getInfoById(columnItem.getParamId());
+            case IND_ASCII:
+                ApiIndItemDTO indItemDTO = indMap.get(columnItem.getParamId());
                 granularity = TimeGranularitySecEnum.getEumByCode(indItemDTO.getTimeGranularity()).getValue();;
                 break;
             case PLAN:

--
Gitblit v1.9.3