wjli
2024-04-12 e8f0b3422d307c686b3a81269f9e9e4fb34a846e
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());