puzhibing
2025-05-26 312f26c49124f355e9f78c6ddd69f71895aa73fc
ruoyi-service/ruoyi-dataInterchange/src/main/java/com/ruoyi/dataInterchange/server/WarnMsgService.java
@@ -187,18 +187,21 @@
    * 存储mqtt协议报警信息
    */
   public void saveWarnMsgService(JSONObject jsonObject) {
      SubscriptionEvent subscriptionEvent = jsonObject.getObject("", SubscriptionEvent.class);
      SubscriptionEvent subscriptionEvent = jsonObject.getObject("params", SubscriptionEvent.class);
      List<Event> events = subscriptionEvent.getEvents();
      events.forEach(event -> {
         //车牌号
         String srcName = event.getSrcName();
         Alarm data = JSONObject.parseObject(event.getData(), Alarm.class);
         if(!StringUtils.hasLength(data.getAlarmId())){
            return;
         }
         UPWarnMsgAdptInfo upWarnMsgAdptInfo = upWarnMsgAdptInfoDao.findByInfoIdIs(data.getAlarmId());
         if(null == upWarnMsgAdptInfo){
            upWarnMsgAdptInfo = new UPWarnMsgAdptInfo();
         }
         upWarnMsgAdptInfo.setVehicleNo(srcName);
         upWarnMsgAdptInfo.setVehicleColor(data.getVehicleLicenseColor());
         upWarnMsgAdptInfo.setVehicleColor(null == data.getVehicleLicenseColor() ? 0 : data.getVehicleLicenseColor());
         upWarnMsgAdptInfo.setWarnSrc(data.getSourceType() + 1);
         upWarnMsgAdptInfo.setWarnType(getAlarmType(data.getEventType()));
         upWarnMsgAdptInfo.setWarnTime(LocalDateTime.parse(data.getAlarmTime(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")).toEpochSecond(ZoneOffset.ofHours(8)));
@@ -207,11 +210,14 @@
         upWarnMsgAdptInfo.setLongitude(data.getLongitude().intValue());
         upWarnMsgAdptInfo.setLatitude(data.getLatitude().intValue());
         upWarnMsgAdptInfo.setAltitude(data.getHeight().intValue() / 10);
         upWarnMsgAdptInfo.setSpeed(data.getSpeed().intValue() / 10000);
         upWarnMsgAdptInfo.setVec2(data.getSpeed().intValue());
         upWarnMsgAdptInfo.setSpeed(data.getSpeed().intValue() / 100000);
         upWarnMsgAdptInfo.setVec2(data.getSpeed().intValue() / 100000);
         upWarnMsgAdptInfo.setStatus(data.getStatus());
         upWarnMsgAdptInfo.setDirection(data.getDirection() / 100);
         upWarnMsgAdptInfo.setInfoContent(data.getAlarmInfo());
         if(2 == upWarnMsgAdptInfo.getLevel()){
            return;
         }
         upWarnMsgAdptInfoDao.save(upWarnMsgAdptInfo);
      });
   }