From 9dcb7a6b3f3f8d650a0f45f6a22b1ec593db94e0 Mon Sep 17 00:00:00 2001
From: 101captain <237651143@qq.com>
Date: 星期一, 13 九月 2021 14:39:02 +0800
Subject: [PATCH] 修改netty相关配置

---
 springcloud_k8s_panzhihuazhihuishequ/service_property/src/main/java/com/panzhihua/service_property/message/AlarmMessage.java |   35 +++++++++++++++++++++++++++++++++++
 1 files changed, 35 insertions(+), 0 deletions(-)

diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_property/src/main/java/com/panzhihua/service_property/message/AlarmMessage.java b/springcloud_k8s_panzhihuazhihuishequ/service_property/src/main/java/com/panzhihua/service_property/message/AlarmMessage.java
index 92f8c47..15d4c87 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_property/src/main/java/com/panzhihua/service_property/message/AlarmMessage.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_property/src/main/java/com/panzhihua/service_property/message/AlarmMessage.java
@@ -1,4 +1,39 @@
 package com.panzhihua.service_property.message;
 
+import cn.hutool.core.date.DateUtil;
+import com.panzhihua.service_property.dao.ComPropertyAlarmDao;
+import com.panzhihua.service_property.entity.ComPropertyAlarm;
+import com.panzhihua.service_property.entity.ComPropertyEquipment;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.amqp.rabbit.annotation.RabbitListener;
+import org.springframework.data.redis.core.StringRedisTemplate;
+import org.springframework.stereotype.Component;
+
+import javax.annotation.Resource;
+
+@Component
+@Slf4j
 public class AlarmMessage {
+
+    private final static String DELAY_QUEUE="delayed.queue";
+    @Resource
+    private StringRedisTemplate stringRedisTemplate;
+    @Resource
+    private ComPropertyAlarmDao comPropertyAlarmDao;
+
+    @RabbitListener(queues=DELAY_QUEUE)
+    public void delayAlarm(ComPropertyEquipment comPropertyEquipment){
+        log.info("消息队列开始消费");
+        if(!stringRedisTemplate.hasKey(comPropertyEquipment.getSerialNo())){
+            ComPropertyAlarm comPropertyAlarm=new ComPropertyAlarm();
+            comPropertyAlarm.setCreateTime(DateUtil.date());
+            comPropertyAlarm.setSerialNo(comPropertyEquipment.getSerialNo());
+            comPropertyAlarm.setType(ComPropertyAlarm.type.one);
+            comPropertyAlarm.setCommunityId(comPropertyEquipment.getCommunityId());
+            comPropertyAlarm.setName(comPropertyEquipment.getUsername());
+            comPropertyAlarm.setStatus(ComPropertyAlarm.status.dcl);
+            comPropertyAlarmDao.insert(comPropertyAlarm);
+        }
+    }
+
 }

--
Gitblit v1.7.1