From 97d38f7b7f7d95fe38cdbb79960106c15454b6ba Mon Sep 17 00:00:00 2001
From: 潘志宝 <979469083@qq.com>
Date: 星期二, 19 十一月 2024 15:23:51 +0800
Subject: [PATCH] 预警信息

---
 iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/sample/SampleInfoConstructor.java |   31 ++++++++++++++++++++-----------
 1 files changed, 20 insertions(+), 11 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 f32b9be..cd5f3f0 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,13 +1,16 @@
 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.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.factory.ItemEntityFactory;
 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;
@@ -28,10 +31,13 @@
     private DataPointApi dataPointApi;
 
     @Autowired
-    private ItemEntityFactory itemEntityFactory;
+    private PlanItemApi planItemApi;
 
     @Autowired
-    private PlanItemApi planItemApi;
+    private IndItemApi indItemApi;
+
+    @Autowired
+    private MmPredictItemService mmPredictItemService;
 
     /**
      * prepareSampleInfo
@@ -142,20 +148,23 @@
      * @throws Exception
      */
     protected Integer getGranularity(ColumnItem columnItem) {
+        // 默认60s
         Integer granularity = 60;
-        switch (columnItem.getParamType()) {
-            case "DATAPOINT":
+        switch (ModelParamType.getEumByCode(columnItem.getParamType())) {
+            case DATAPOINT:
                 ApiPointDTO dataPoint = dataPointApi.getInfoById(columnItem.getParamId());
                 granularity = DataPointFreqEnum.getEumByCode(dataPoint.getMinfreqid()).getValue();
                 break;
-            case "PREDICTITEM":
-                granularity = itemEntityFactory.getItemById(columnItem.getParamId()).getGranularity();
+            case PREDICTITEM:
+                granularity = mmPredictItemService.getItemById(columnItem.getParamId()).getGranularity();
                 break;
-            case "IND-HIS":
-                granularity = 60;
+            case IND:
+                ApiIndItemDTO indItemDTO = indItemApi.getInfoById(columnItem.getParamId());
+                granularity = TimeGranularitySecEnum.getEumByCode(indItemDTO.getTimeGranularity()).getValue();;
                 break;
-            case "IND-PLAN":
-                granularity = 60;
+            case PLAN:
+                ApiPlanItemDTO apiPlanItemDTO = planItemApi.getInfoById(columnItem.getParamId());
+                granularity = TimeGranularitySecEnum.getEumByCode(apiPlanItemDTO.getTimeGranularity()).getValue();
                 break;
             default:
                 break;

--
Gitblit v1.9.3