Browse Source

kafka推送事件(AI)数据

develop
王兴琳 1 month ago
parent
commit
219099a535
  1. 7
      zc-business/src/main/java/com/zc/business/message/device/handler/DeviceMessageHandler.java

7
zc-business/src/main/java/com/zc/business/message/device/handler/DeviceMessageHandler.java

@ -8,6 +8,8 @@ import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.ruoyi.common.core.redis.RedisCache; import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.spring.SpringUtils;
import com.zc.business.constant.RedisKeyConstants; import com.zc.business.constant.RedisKeyConstants;
import com.zc.business.domain.DcDevice; import com.zc.business.domain.DcDevice;
import com.zc.business.domain.DcMeteorologicalDetectorData; import com.zc.business.domain.DcMeteorologicalDetectorData;
@ -18,6 +20,7 @@ import com.zc.business.message.device.subscribe.KafkaTopicProducer;
import com.zc.business.service.*; import com.zc.business.service.*;
import com.zc.common.core.websocket.WebSocketService; import com.zc.common.core.websocket.WebSocketService;
import com.zc.common.core.websocket.constant.WebSocketEvent; import com.zc.common.core.websocket.constant.WebSocketEvent;
import org.apache.catalina.security.SecurityUtil;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -64,8 +67,7 @@ public class DeviceMessageHandler {
@Autowired @Autowired
private IDcMeteorologicalDetectorDataService meteorologicalDetectorDataService; private IDcMeteorologicalDetectorDataService meteorologicalDetectorDataService;
@Resource
private KafkaTopicProducer kafkaTopicProducer;
/** /**
@ -359,6 +361,7 @@ public class DeviceMessageHandler {
combinedData.put("address", otherConfig);*/ combinedData.put("address", otherConfig);*/
dcWarning.setOtherConfig(otherConfig.toString()); dcWarning.setOtherConfig(otherConfig.toString());
//异常天气等级 过滤 //异常天气等级 过滤
KafkaTopicProducer kafkaTopicProducer = SpringUtils.getBean(KafkaTopicProducer.class);
if (data.getInteger("warningType") == VISIBILITY_LEVEL) { if (data.getInteger("warningType") == VISIBILITY_LEVEL) {
int WarningLevel = data.getInteger("visibilityLevel"); int WarningLevel = data.getInteger("visibilityLevel");
if (WarningLevel != UniversalEnum.ZERO.getNumber()) { if (WarningLevel != UniversalEnum.ZERO.getNumber()) {

Loading…
Cancel
Save