Merge branch 'dyf-device' into 6170
This commit is contained in:
@ -47,6 +47,7 @@ public class DeviceFenceAccessRecordController extends BaseController {
|
||||
return deviceFenceAccessRecordService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 导出围栏进出记录列表
|
||||
*/
|
||||
|
||||
@ -50,6 +50,7 @@ public class DeviceGeoFenceController extends BaseController {
|
||||
return deviceGeoFenceService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 导出电子围栏列表
|
||||
*/
|
||||
|
||||
@ -0,0 +1,85 @@
|
||||
// package com.fuyuanshen.web.handler.mqtt;
|
||||
//
|
||||
// import cn.hutool.core.lang.Dict;
|
||||
// import com.fuyuanshen.common.core.constant.GlobalConstants;
|
||||
// import com.fuyuanshen.common.json.utils.JsonUtils;
|
||||
// import com.fuyuanshen.common.redis.utils.RedisUtils;
|
||||
// import com.fuyuanshen.global.mqtt.base.MqttRuleContext;
|
||||
// import com.fuyuanshen.global.mqtt.base.MqttRuleEngine;
|
||||
// import com.fuyuanshen.global.mqtt.constants.DeviceRedisKeyConstants;
|
||||
// import lombok.extern.slf4j.Slf4j;
|
||||
// import org.apache.commons.lang3.StringUtils;
|
||||
// import org.springframework.beans.factory.annotation.Autowired;
|
||||
// import org.springframework.messaging.Message;
|
||||
// import org.springframework.messaging.MessageHandler;
|
||||
// import org.springframework.messaging.MessageHeaders;
|
||||
// import org.springframework.messaging.MessagingException;
|
||||
// import org.springframework.stereotype.Service;
|
||||
//
|
||||
// import java.time.Duration;
|
||||
// import java.util.Objects;
|
||||
//
|
||||
// import static com.fuyuanshen.global.mqtt.constants.DeviceRedisKeyConstants.DEVICE_KEY_PREFIX;
|
||||
//
|
||||
// /**
|
||||
// * @author: 默苍璃
|
||||
// * @date: 2025-09-1609:28
|
||||
// */
|
||||
// @Service
|
||||
// @Slf4j
|
||||
// public class DeviceAlrmMessageHandler implements MessageHandler {
|
||||
//
|
||||
// @Autowired
|
||||
// private MqttRuleEngine ruleEngine;
|
||||
//
|
||||
// @Override
|
||||
// public void handleMessage(Message<?> message) throws MessagingException {
|
||||
//
|
||||
// // 处理新类型的消息
|
||||
// Object payload = message.getPayload();
|
||||
// MessageHeaders headers = message.getHeaders();
|
||||
// String receivedTopic = Objects.requireNonNull(headers.get("mqtt_receivedTopic")).toString();
|
||||
//
|
||||
// log.info("设备强制报警消息处理器 - MQTT payload= {} \n receivedTopic = {}", payload, receivedTopic);
|
||||
//
|
||||
// // 解析消息并执行相应逻辑
|
||||
// Dict payloadDict = JsonUtils.parseMap(payload.toString());
|
||||
// if (payloadDict != null) {
|
||||
// // 根据主题或消息内容执行不同的处理逻辑
|
||||
// processMessage(receivedTopic, payloadDict);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// private void processMessage(String topic, Dict payloadDict) {
|
||||
// // 实现具体的业务逻辑
|
||||
// // 可以根据不同的主题执行不同的操作
|
||||
// if (topic.contains("newTopic")) {
|
||||
// // 处理特定主题的消息
|
||||
// handleNewTopicMessage(payloadDict);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// private void handleNewTopicMessage(Dict payloadDict) {
|
||||
// // 实现新主题消息的具体处理逻辑
|
||||
// String deviceImei = payloadDict.getStr("imei");
|
||||
// if (StringUtils.isNotBlank(deviceImei)) {
|
||||
// // 更新设备状态到Redis
|
||||
// String deviceOnlineStatusRedisKey = GlobalConstants.GLOBAL_REDIS_KEY +
|
||||
// DEVICE_KEY_PREFIX + deviceImei + DeviceRedisKeyConstants.DEVICE_ONLINE_STATUS_KEY_PREFIX;
|
||||
// RedisUtils.setCacheObject(deviceOnlineStatusRedisKey, "1", Duration.ofSeconds(62));
|
||||
//
|
||||
// // 执行规则引擎
|
||||
// MqttRuleContext context = new MqttRuleContext();
|
||||
// context.setDeviceImei(deviceImei);
|
||||
// context.setPayloadDict(payloadDict);
|
||||
// // 设置命令类型
|
||||
// context.setCommandType((byte) 0x02); // 根据实际需要设置命令类型
|
||||
//
|
||||
// boolean ruleExecuted = ruleEngine.executeRule(context);
|
||||
// if (!ruleExecuted) {
|
||||
// log.warn("未找到匹配的规则来处理新主题消息,设备IMEI: {}", deviceImei);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
Reference in New Issue
Block a user