| | |
| | | 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; |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | |
| | |
| | | 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); |
| | |
| | | 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()); |