From 5ec28f53fbb3f5b23f06130a184ad2f8fd8d9d0e Mon Sep 17 00:00:00 2001
From: dengzedong <dengzedong@email>
Date: 星期四, 20 三月 2025 08:52:24 +0800
Subject: [PATCH] 数据补全bug

---
 iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/sample/SampleInfoConstructor.java |   55 ++++++++++++++++++++++++-------------------------------
 1 files changed, 24 insertions(+), 31 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 ce370a3..75f2d1a 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
@@ -76,31 +76,22 @@
      * @return
      * @throws Exception
      */
-    protected Date getStartTime(ColumnItem columnItem, Date originalTime, Map<String, ApiPointDTO> pointMap, Map<String, ApiPlanItemDTO> planMap) {
+    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:
-                ApiPointDTO dataPoint = pointMap.get(columnItem.getParamId());
-                if (dataPoint == null) {
-                    return null;
-                }
-                dateTime = calculateTime(originalTime, true, columnItem.getDataLength(), DataPointFreqEnum.getEumByCode(dataPoint.getMinfreqid()).getValue());
+                dateTime = calculateTime(originalTime, true, columnItem.getDataLength(), columnItem.getGranularity());
+                break;
+            case PLAN:
+                dateTime = calculateTime(originalTime, true, columnItem.getDataLength() + 1, columnItem.getGranularity());
+                break;
+            case IND:
+            case IND_ASCII:
+                dateTime = calculateTime(originalTime, true, columnItem.getDataLength() - 1, columnItem.getGranularity());
                 break;
             case NORMALITEM:
             case MERGEITEM:
-                dateTime = calendar.getTime();
-                break;
-            case IND:
-                dateTime = calculateTime(originalTime, true, columnItem.getDataLength(), 60);
-                break;
-            case PLAN:
-                ApiPlanItemDTO apiPlanItemDTO = planMap.get(columnItem.getParamId());
-                if (apiPlanItemDTO == null) {
-                    return null;
-                }
-                dateTime = calculateTime(originalTime, true, columnItem.getDataLength(), TimeGranularitySecEnum.getEumByCode(apiPlanItemDTO.getTimeGranularity()).getValue());
+                dateTime = calculateTime(originalTime, false, 1, columnItem.getGranularity());
                 break;
             default:
                 break;
@@ -116,23 +107,24 @@
      * @return
      * @throws Exception
      */
-    protected Date getEndTime(ColumnItem columnItem, Date originalTime,Map<String, ApiPointDTO> pointMap, Map<String, ApiPlanItemDTO> planMap) {
+    protected Date getEndTime(ColumnItem columnItem, Date originalTime) {
         Date dateTime = new Date();
         Calendar calendar = Calendar.getInstance();
         calendar.setTime(originalTime);
         switch (ModelParamType.getEumByCode(columnItem.getParamType())) {
             case DATAPOINT:
-                dateTime = calendar.getTime();
+                dateTime = calculateTime(originalTime, true, 1, columnItem.getGranularity());
+                break;
+            case PLAN:
+                dateTime = calculateTime(originalTime, true, 1, columnItem.getGranularity());
+                break;
+            case IND:
+            case IND_ASCII:
+                dateTime = originalTime;
                 break;
             case NORMALITEM:
             case MERGEITEM:
-                dateTime = calculateTime(originalTime, false, columnItem.getDataLength(), 60);
-                break;
-            case IND:
-                dateTime = calendar.getTime();
-                break;
-            case PLAN:
-                dateTime = calendar.getTime();
+                dateTime = calculateTime(originalTime, false, columnItem.getDataLength() + 1, columnItem.getGranularity());
                 break;
             default:
                 break;
@@ -147,7 +139,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())) {
@@ -160,7 +152,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:
@@ -187,7 +180,7 @@
         if (backward) {
             timeLength = (-1) * dataLength;
         } else {
-            timeLength = dataLength - 1;
+            timeLength = dataLength;
         }
         Date desTime = originalTime;
         Calendar calendar = Calendar.getInstance();

--
Gitblit v1.9.3