forked from dyf/fys-Multi-tenant
日志配置
This commit is contained in:
@ -0,0 +1,27 @@
|
||||
package com.fuyuanshen.global.mqtt.constants;
|
||||
|
||||
/**
|
||||
* 租户常量定义类
|
||||
* 包含系统中使用的各种租户标识
|
||||
*
|
||||
* @author: 默苍璃
|
||||
* @date: 2025-08-05 10:46
|
||||
*/
|
||||
public class TenantsConstant {
|
||||
|
||||
/**
|
||||
* 晶全租户
|
||||
*/
|
||||
public static final String JING_QUAN = "014443";
|
||||
|
||||
/**
|
||||
* 富源晟租户
|
||||
*/
|
||||
public static final String FU_YUAN_SHENG = "894078";
|
||||
|
||||
/**
|
||||
* 管理员租户
|
||||
*/
|
||||
public static final String ADMIN = "000000";
|
||||
|
||||
}
|
@ -3,12 +3,14 @@ package com.fuyuanshen.web.handler.mqtt;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fuyuanshen.common.satoken.utils.LoginHelper;
|
||||
import com.fuyuanshen.equipment.domain.Device;
|
||||
import com.fuyuanshen.equipment.domain.DeviceLog;
|
||||
import com.fuyuanshen.equipment.mapper.DeviceLogMapper;
|
||||
import com.fuyuanshen.equipment.mapper.DeviceMapper;
|
||||
import com.fuyuanshen.equipment.utils.map.GetAddressFromLatUtil;
|
||||
import com.fuyuanshen.equipment.utils.map.LngLonUtil;
|
||||
import com.fuyuanshen.global.mqtt.constants.TenantsConstant;
|
||||
import com.fuyuanshen.web.enums.InstructType6170;
|
||||
import com.fuyuanshen.web.enums.LightModeEnum6170;
|
||||
import lombok.AllArgsConstructor;
|
||||
@ -52,12 +54,16 @@ public class DeviceReceiverMessageHandler implements MessageHandler {
|
||||
String receivedTopicName = (String) headers.get("mqtt_receivedTopic");
|
||||
System.out.println("消息来自主题:" + receivedTopicName);
|
||||
|
||||
// String tenantId = LoginHelper.getTenantId();
|
||||
String tenantId = TenantsConstant.FU_YUAN_SHENG;
|
||||
String payload = message.getPayload().toString();
|
||||
|
||||
if (receivedTopicName != null) {
|
||||
// 1. 提取设备ID (从主题中获取)
|
||||
String deviceImei = extractDeviceId(receivedTopicName);
|
||||
Device device = deviceMapper.selectOne(new QueryWrapper<Device>().eq("device_imei", deviceImei));
|
||||
Device device = deviceMapper.selectOne(new QueryWrapper<Device>()
|
||||
.eq("tenant_id", tenantId)
|
||||
.eq("device_imei", deviceImei));
|
||||
if (device == null) {
|
||||
log.info("不存在的设备IMEI: {}", deviceImei);
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user