From 984cecaa40100ee69e9038082a477e6af5d56aca Mon Sep 17 00:00:00 2001
From: 潘志宝 <979469083@qq.com>
Date: 星期五, 21 三月 2025 11:27:24 +0800
Subject: [PATCH] ALARM_TITLE

---
 iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/impl/MmItemResultJsonServiceImpl.java |   22 +++++++++++++++++++++-
 1 files changed, 21 insertions(+), 1 deletions(-)

diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/impl/MmItemResultJsonServiceImpl.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/impl/MmItemResultJsonServiceImpl.java
index ecb19ba..f7b9545 100644
--- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/impl/MmItemResultJsonServiceImpl.java
+++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/impl/MmItemResultJsonServiceImpl.java
@@ -40,8 +40,8 @@
         Calendar calendar = Calendar.getInstance();
         calendar.setTime(predictTime);
         valueList.forEach(value -> {
-            Object[] dv = {DateUtils.format(calendar.getTime(), timeFormat), value};
             calendar.add(Calendar.MINUTE, 1);
+            Object[] dv = {DateUtils.format(calendar.getTime(), timeFormat), value};
             result.add(dv);
         });
         return result;
@@ -72,6 +72,26 @@
     }
 
     @Override
+    public double[] getSimpleData(String outputId, Date predictTime, int predictLength) {
+        double[] result = new double[predictLength];
+        QueryWrapper<MmItemResultJsonEntity> wrapper = new QueryWrapper<>();
+        wrapper.eq("outputid", outputId)
+                .eq("predicttime", DateUtils.format(predictTime, DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND));
+        MmItemResultJsonEntity data = baseDao.selectOne(wrapper);
+        if (data == null || StringUtils.isBlank(data.getJsonvalue())) {
+            return null;
+        }
+        List<Double> valueList = JSONArray.parseArray(data.getJsonvalue(), Double.class);
+        if (CollectionUtils.isEmpty(valueList)) {
+            return result;
+        }
+        for (int i = 0; i < predictLength; i++) {
+            result[i] = valueList.get(i);
+        }
+        return result;
+    }
+
+    @Override
     public void insert(List<MmItemResultJsonEntity> resultJsonList) {
         baseDao.insertBatch(resultJsonList);
     }

--
Gitblit v1.9.3