From f3de04db06bae67537d093017e28863ee685f8a3 Mon Sep 17 00:00:00 2001
From: 潘志宝 <979469083@qq.com>
Date: 星期五, 03 一月 2025 13:36:38 +0800
Subject: [PATCH] 修改dynamicSettings为空异常

---
 iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/sample/SampleInfoConstructor.java |   39 ++-------------------------------------
 1 files changed, 2 insertions(+), 37 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 3f8f72b..0d6431e 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
@@ -2,23 +2,18 @@
 
 import com.iailab.module.data.api.ind.IndItemApi;
 import com.iailab.module.data.api.ind.dto.ApiIndItemDTO;
-import com.iailab.module.data.api.plan.PlanItemApi;
 import com.iailab.module.data.api.plan.dto.ApiPlanItemDTO;
-import com.iailab.module.data.api.point.DataPointApi;
 import com.iailab.module.data.api.point.dto.ApiPointDTO;
 import com.iailab.module.data.enums.DataPointFreqEnum;
-import com.iailab.module.data.enums.TimeGranularityEnum;
 import com.iailab.module.data.enums.TimeGranularitySecEnum;
 import com.iailab.module.model.mcs.pre.service.MmPredictItemService;
 import com.iailab.module.model.mdk.common.enums.ModelParamType;
 import com.iailab.module.model.mdk.sample.dto.ColumnItem;
-import com.iailab.module.model.mdk.sample.dto.ColumnItemPort;
 import com.iailab.module.model.mdk.sample.dto.SampleInfo;
 import org.springframework.beans.factory.annotation.Autowired;
 
 import java.util.Calendar;
 import java.util.Date;
-import java.util.List;
 import java.util.Map;
 
 /**
@@ -27,12 +22,6 @@
  * @createTime 2024年09月03日
  */
 abstract class SampleInfoConstructor {
-
-    @Autowired
-    private DataPointApi dataPointApi;
-
-    @Autowired
-    private PlanItemApi planItemApi;
 
     @Autowired
     private IndItemApi indItemApi;
@@ -132,25 +121,17 @@
         calendar.setTime(originalTime);
         switch (ModelParamType.getEumByCode(columnItem.getParamType())) {
             case DATAPOINT:
-                ApiPointDTO dataPoint = pointMap.get(columnItem.getParamId());
-                if (dataPoint == null) {
-                    return null;
-                }
                 dateTime = calendar.getTime();
                 break;
             case NORMALITEM:
             case MERGEITEM:
-                dateTime = calendar.getTime();
+                dateTime = calculateTime(originalTime, false, columnItem.getDataLength(), 60);
                 break;
             case IND:
                 dateTime = calendar.getTime();
                 break;
             case PLAN:
-                ApiPlanItemDTO apiPlanItemDTO = planMap.get(columnItem.getParamId());
-                if (apiPlanItemDTO == null) {
-                    return null;
-                }
-                dateTime = calculateDate(originalTime, false, columnItem.getDataLength(), TimeGranularitySecEnum.getEumByCode(apiPlanItemDTO.getTimeGranularity()).getValue());
+                dateTime = calendar.getTime();
                 break;
             default:
                 break;
@@ -213,22 +194,6 @@
         calendar.set(Calendar.MILLISECOND, 0);
         // 数据长度 * 粒度
         calendar.add(Calendar.SECOND, timeLength * granularity);
-        return calendar.getTime();
-    }
-
-    public Date calculateDate(Date originalTime, Boolean backward, int dataLength, int field) {
-        int timeLength;
-        if (backward) {
-            timeLength = (-1) * dataLength;
-        } else {
-            timeLength = dataLength - 1;
-        }
-        Date desTime = originalTime;
-        Calendar calendar = Calendar.getInstance();
-        calendar.setTime(desTime);
-        calendar.set(Calendar.MILLISECOND, 0);
-        // 数据长度 * 粒度
-        calendar.add(Calendar.SECOND, timeLength);
         return calendar.getTime();
     }
 }
\ No newline at end of file

--
Gitblit v1.9.3