From ec50954c8c9d244a2ff259b653aaaa7bfeabe79b Mon Sep 17 00:00:00 2001
From: 潘志宝 <979469083@qq.com>
Date: 星期五, 21 三月 2025 14:45:52 +0800
Subject: [PATCH] 数据分析页面显示预警信息 调度建议

---
 iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/impl/MmPredictAlarmMessageServiceImpl.java |   49 +++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 47 insertions(+), 2 deletions(-)

diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/impl/MmPredictAlarmMessageServiceImpl.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/impl/MmPredictAlarmMessageServiceImpl.java
index 33da851..a58b9ed 100644
--- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/impl/MmPredictAlarmMessageServiceImpl.java
+++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/impl/MmPredictAlarmMessageServiceImpl.java
@@ -1,5 +1,6 @@
 package com.iailab.module.model.mcs.pre.service.impl;
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.iailab.framework.common.pojo.PageResult;
 import com.iailab.framework.common.service.impl.BaseServiceImpl;
 import com.iailab.framework.common.util.object.BeanUtils;
@@ -8,10 +9,11 @@
 import com.iailab.module.model.mcs.pre.service.MmPredictAlarmMessageService;
 import com.iailab.module.model.mcs.pre.vo.MmPredictAlarmMessagePageReqVO;
 import com.iailab.module.model.mcs.pre.vo.MmPredictAlarmMessageSaveReqVO;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.stereotype.Service;
+import org.springframework.util.CollectionUtils;
 
-import java.util.Date;
-import java.util.UUID;
+import java.util.*;
 
 /**
  * @author PanZhibao
@@ -34,6 +36,44 @@
     }
 
     @Override
+    public MmPredictAlarmMessageEntity getLast(String alarmObj) {
+        QueryWrapper<MmPredictAlarmMessageEntity> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("alarm_obj", alarmObj)
+                .orderByDesc("alarm_time")
+                .last("limit 1");
+        return baseDao.selectOne(queryWrapper);
+    }
+
+    @Override
+    public List<MmPredictAlarmMessageEntity> getList(List<String> alarmObjList, Date predictTime) {
+        if (CollectionUtils.isEmpty(alarmObjList)) {
+            return new ArrayList<>();
+        }
+        QueryWrapper<MmPredictAlarmMessageEntity> queryWrapper = new QueryWrapper<>();
+        queryWrapper.in("alarm_obj", alarmObjList);
+        queryWrapper.eq("alarm_time", predictTime);
+        return baseDao.selectList(queryWrapper);
+    }
+
+    @Override
+    public List<MmPredictAlarmMessageEntity> getList(String alarmObj, Date alarmTime) {
+        QueryWrapper<MmPredictAlarmMessageEntity> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("alarm_obj", alarmObj)
+                .eq("alarm_time", alarmTime);
+        return baseDao.selectList(queryWrapper);
+    }
+
+    @Override
+    public List<MmPredictAlarmMessageEntity> getList(String alarmObj, Date alarmTime, String title) {
+        QueryWrapper<MmPredictAlarmMessageEntity> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("alarm_obj", alarmObj)
+                .eq("alarm_time", alarmTime)
+                .eq(StringUtils.isNotBlank(title),"title", title);
+
+        return baseDao.selectList(queryWrapper);
+    }
+
+    @Override
     public void create(MmPredictAlarmMessageSaveReqVO reqVO) {
         MmPredictAlarmMessageEntity entity = BeanUtils.toBean(reqVO, MmPredictAlarmMessageEntity.class);
         entity.setId(UUID.randomUUID().toString());
@@ -51,4 +91,9 @@
     public void delete(String id) {
         baseDao.deleteById(id);
     }
+
+    @Override
+    public void cleanAlarmMessage(Map<String, Date> tMap) {
+        baseDao.cleanAlarmMessage(tMap);
+    }
 }
\ No newline at end of file

--
Gitblit v1.9.3