From 50084de4a140dece61019b64fd91df041d242e47 Mon Sep 17 00:00:00 2001
From: dengzedong <dengzedong@email>
Date: 星期一, 23 十二月 2024 15:28:53 +0800
Subject: [PATCH] getInfoByIds(Set<String> pointIds) 模型输入计划数据获取、补全 模型输入mergeitem存默认生成的outputid sampleInfo.setPointMap 避免重复查询point

---
 iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/sample/SampleInfoConstructor.java |   56 ++++++++++++++++++++++++++------------------------------
 1 files changed, 26 insertions(+), 30 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 f59556b..1ed6feb 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
@@ -19,6 +19,7 @@
 import java.util.Calendar;
 import java.util.Date;
 import java.util.List;
+import java.util.Map;
 
 /**
  * @author PanZhibao
@@ -46,15 +47,9 @@
      * @param predictTime
      * @return
      */
-    public SampleInfo prepareSampleInfo(String modelId, Date predictTime) {
-        SampleInfo sampleInfo = new SampleInfo();
-        //调用样本列数的方法
-        sampleInfo.setSampleColumn(getSampleColumn(modelId));
+    protected SampleInfo prepareSampleInfo(String modelId, Date predictTime) {
         //样本的列信息
-        sampleInfo.setColumnInfo(getColumnInfo(modelId, predictTime));
-        //样本的采样周期
-        sampleInfo.setSampleCycle(getSampleCycle(modelId));
-        return sampleInfo;
+        return getColumnInfo(modelId, predictTime);
     }
 
     /**
@@ -65,6 +60,24 @@
      */
     protected abstract Integer getSampleColumn(String modelId);
 
+
+    /**
+     * 样本的列信息
+     *
+     * @param modelId
+     * @param predictTime
+     * @return
+     */
+    protected abstract SampleInfo getColumnInfo(String modelId, Date predictTime);
+
+    /**
+     * 样本的采样周期
+     *
+     * @param modelId
+     * @return
+     */
+    protected abstract Integer getSampleCycle(String modelId);
+
     /**
      * 获取开始时间
      *
@@ -73,13 +86,13 @@
      * @return
      * @throws Exception
      */
-    protected Date getStartTime(ColumnItem columnItem, Date originalTime) {
+    protected Date getStartTime(ColumnItem columnItem, Date originalTime, Map<String, ApiPointDTO> pointMap) {
         Date dateTime = new Date();
         Calendar calendar = Calendar.getInstance();
         calendar.setTime(originalTime);
         switch (ModelParamType.getEumByCode(columnItem.getParamType())) {
             case DATAPOINT:
-                ApiPointDTO dataPoint = dataPointApi.getInfoById(columnItem.getParamId());
+                ApiPointDTO dataPoint = pointMap.get(columnItem.getParamId());
                 if (dataPoint == null) {
                     return null;
                 }
@@ -109,13 +122,13 @@
      * @return
      * @throws Exception
      */
-    protected Date getEndTime(ColumnItem columnItem, Date originalTime) {
+    protected Date getEndTime(ColumnItem columnItem, Date originalTime,Map<String, ApiPointDTO> pointMap) {
         Date dateTime = new Date();
         Calendar calendar = Calendar.getInstance();
         calendar.setTime(originalTime);
         switch (ModelParamType.getEumByCode(columnItem.getParamType())) {
             case DATAPOINT:
-                ApiPointDTO dataPoint = dataPointApi.getInfoById(columnItem.getParamId());
+                ApiPointDTO dataPoint = pointMap.get(columnItem.getParamId());
                 if (dataPoint == null) {
                     return null;
                 }
@@ -161,7 +174,7 @@
                 granularity = mmPredictItemService.getItemByOutPutId(columnItem.getParamId()).getGranularity();
                 break;
             case MERGEITEM:
-                granularity = mmPredictItemService.getItemById(columnItem.getParamId()).getGranularity();
+                granularity = mmPredictItemService.getItemByOutPutId(columnItem.getParamId()).getGranularity();
                 break;
             case IND:
                 ApiIndItemDTO indItemDTO = indItemApi.getInfoById(columnItem.getParamId());
@@ -176,23 +189,6 @@
         }
         return granularity;
     }
-
-    /**
-     * 样本的列信息
-     *
-     * @param modelId
-     * @param predictTime
-     * @return
-     */
-    protected abstract List<ColumnItemPort> getColumnInfo(String modelId, Date predictTime);
-
-    /**
-     * 样本的采样周期
-     *
-     * @param modelId
-     * @return
-     */
-    protected abstract Integer getSampleCycle(String modelId);
 
     /**
      * 计算取值的时间

--
Gitblit v1.9.3