From 8fd9f6efcb6575d68d39302efe046558d8b1534c Mon Sep 17 00:00:00 2001
From: 潘志宝 <979469083@qq.com>
Date: 星期二, 14 一月 2025 14:39:16 +0800
Subject: [PATCH] 预测值

---
 iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/api/McsApiImpl.java |   20 +++++++++++++-------
 1 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/api/McsApiImpl.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/api/McsApiImpl.java
index f78609f..ea66d6a 100644
--- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/api/McsApiImpl.java
+++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/api/McsApiImpl.java
@@ -318,10 +318,10 @@
         }
         String timeFormat = StringUtils.isBlank(reqVO.getTimeFormat()) ? DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND : reqVO.getTimeFormat();
         PreLineTypeEnum lineType = chartParams.get(CommonConstant.LINE_TYPE) == null ? PreLineTypeEnum.TN : PreLineTypeEnum.getEumByCode(chartParams.get(CommonConstant.LINE_TYPE));
-        BigDecimal rangeH = chartParams.get(CommonConstant.RANGE_H) == null ? BigDecimal.ZERO : new BigDecimal(chartParams.get(CommonConstant.RANGE_H));
-        BigDecimal rangeL = chartParams.get(CommonConstant.RANGE_L) == null ? BigDecimal.ZERO : new BigDecimal(chartParams.get(CommonConstant.RANGE_L));
-        BigDecimal limitH = chartParams.get(CommonConstant.LIMIT_H) == null ? BigDecimal.ZERO : new BigDecimal(chartParams.get(CommonConstant.LIMIT_H));
-        BigDecimal limitL = chartParams.get(CommonConstant.LIMIT_L) == null ? BigDecimal.ZERO : new BigDecimal(chartParams.get(CommonConstant.LIMIT_L));
+        BigDecimal rangeH = chartParams.get(CommonConstant.RANGE_H) == null ? null : new BigDecimal(chartParams.get(CommonConstant.RANGE_H));
+        BigDecimal rangeL = chartParams.get(CommonConstant.RANGE_L) == null ? null : new BigDecimal(chartParams.get(CommonConstant.RANGE_L));
+        BigDecimal limitH = chartParams.get(CommonConstant.LIMIT_H) == null ? null : new BigDecimal(chartParams.get(CommonConstant.LIMIT_H));
+        BigDecimal limitL = chartParams.get(CommonConstant.LIMIT_L) == null ? null : new BigDecimal(chartParams.get(CommonConstant.LIMIT_L));
         int lengthLeft = chartParams.get(CommonConstant.LENGTH_LEFT) == null ? predictItem.getPredictLength() : new BigDecimal(chartParams.get(CommonConstant.LENGTH_LEFT)).intValue();
         int lengthRight = chartParams.get(CommonConstant.LENGTH_RIGHT) == null ? predictItem.getPredictLength() : new BigDecimal(chartParams.get(CommonConstant.LENGTH_RIGHT)).intValue();
 
@@ -346,7 +346,7 @@
         } else {
             dataView.setRealData(new ArrayList<>());
         }
-        dataView.setCurData(mmItemResultJsonService.getData(outPut.getId(), predictTime, timeFormat));
+        // dataView.setCurData(mmItemResultJsonService.getData(outPut.getId(), predictTime, timeFormat));
         switch (lineType) {
             case TN:
                 dataView.setPreDataN(mmItemResultService.getData(outPut.getId(), startTime, endTime, timeFormat));
@@ -359,18 +359,24 @@
                 break;
         }
 
-        if (!CollectionUtils.isEmpty(dataView.getCurData())) {
-            List<Double> curList = dataView.getCurData().stream().map(t -> {
+        if (!CollectionUtils.isEmpty(dataView.getPreDataN())) {
+            List<Double> curList = dataView.getPreDataN().stream().map(t -> {
                 return new Double(t[1].toString());
             }).collect(Collectors.toList());
             dataView.setPreMax(new BigDecimal(curList.stream().mapToDouble(Double::doubleValue).max().getAsDouble()).setScale(2, BigDecimal.ROUND_HALF_UP));
             dataView.setPreMin(new BigDecimal(curList.stream().mapToDouble(Double::doubleValue).min().getAsDouble()).setScale(2, BigDecimal.ROUND_HALF_UP));
+            dataView.setPreLast(new BigDecimal(curList.get(curList.size() - 1)));
         }
 
         String alarmObj = chartParams.get(CommonConstant.ALARM_OBJ);
         if (StringUtils.isNotBlank(alarmObj)) {
             List<AlarmMessageRespDTO> alarmList = ConvertUtils.sourceToTarget(mmPredictAlarmMessageService.getList(alarmObj, predictTime), AlarmMessageRespDTO.class);
             dataView.setAlarmList(alarmList);
+            if (CollectionUtils.isEmpty(alarmList)) {
+                dataView.setAlarmMessage("暂无预警信息");
+            } else {
+                dataView.setAlarmMessage(alarmList.get(0).getContent());
+            }
         }
 
         result.setPredictTime(predictTime);

--
Gitblit v1.9.3