From e8f0b3422d307c686b3a81269f9e9e4fb34a846e Mon Sep 17 00:00:00 2001
From: wjli <591616088@qq.com>
Date: 星期五, 12 四月 2024 10:49:46 +0800
Subject: [PATCH] 指纹登陆返回客户端加密信息

---
 xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/util/MQTT.java |   26 ++++++++++++++++----------
 1 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/util/MQTT.java b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/util/MQTT.java
index 551aa74..aab6372 100644
--- a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/util/MQTT.java
+++ b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/util/MQTT.java
@@ -6,6 +6,7 @@
 import cn.exrick.xboot.your.service.IAlarmService;
 import cn.exrick.xboot.your.service.ICarService;
 import cn.exrick.xboot.your.service.IEventLogService;
+import cn.hutool.core.date.DateUtil;
 import cn.hutool.json.JSONArray;
 import cn.hutool.json.JSONObject;
 import cn.hutool.json.JSONUtil;
@@ -15,6 +16,7 @@
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
+import java.util.Date;
 import java.util.List;
 
 
@@ -110,16 +112,6 @@
                                         return;
                                     }
 
-                                    String format = alarmTime.substring(0,17);
-                                    QueryWrapper<Alarm> awrapper = new QueryWrapper<>();
-                                    awrapper.between("create_time",format+"00",format+"59");
-                                    awrapper.eq("car_no",car.getCarNo());
-                                    awrapper.eq("type",1);
-                                    List<Alarm> list = iAlarmService.list(awrapper);
-                                    if(list.size()>0){
-                                        return;
-                                    }
-
                                     Alarm alarm = new Alarm();
                                     if(eventType.equals("132371")){
                                         alarm.setType(1);
@@ -140,6 +132,20 @@
                                         return;
                                     }
 
+                                    Date date1 = new Date();
+                                    long time = date1.getTime()-2*60*1000;
+                                    Date date = new Date(time);
+                                    String format1 = DateUtil.format(date,"yyyy-MM-dd HH:mm:ss");
+                                    String format2 = DateUtil.format(date1,"yyyy-MM-dd HH:mm:ss");
+                                    QueryWrapper<Alarm> awrapper = new QueryWrapper<>();
+                                    awrapper.between("create_time",format1,format2);
+                                    awrapper.eq("car_no",car.getCarNo());
+                                    awrapper.eq("type",alarm.getType());
+                                    List<Alarm> list = iAlarmService.list(awrapper);
+                                    if(list.size()>0){
+                                        return;
+                                    }
+
                                     alarm.setAlarmId(alarmId);
                                     alarm.setCarId(car.getId());
                                     alarm.setCarNo(car.getCarNo());

--
Gitblit v1.9.1