This commit is contained in:
2026-08-03 14:46:36 +08:00
parent 6be6d5d333
commit 42eae10df6
31 changed files with 170 additions and 440 deletions

View File

@@ -102,6 +102,11 @@ public class DeviceTask {
return builder(FastBeeConstant.TASK.DEVICE_TASK_HANDLER);
}
@Bean(FastBeeConstant.TASK.COMMON_DEVICE_MONITOR)
public Executor commonDeviceMonitor() {
return builder(FastBeeConstant.TASK.COMMON_DEVICE_MONITOR);
}
/*组装线程池*/
private ThreadPoolTaskExecutor builder(String threadNamePrefix) {

View File

@@ -105,6 +105,11 @@ public interface FastBeeConstant {
*/
String DEVICE_TASK_HANDLER = "deviceTaskHandler";
/**
* 其他设备接入 数据状态
*/
String COMMON_DEVICE_MONITOR = "commonDeviceMonitor";
}
interface MQTT {

View File

@@ -3,49 +3,40 @@ package com.maibu.core.business.dto;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.maibu.core.business.ProductInterface;
import com.maibu.core.domain.BaseDO;
import com.maibu.core.domain.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.List;
import java.util.Map;
@Data
public class ProductDTO extends BaseDO {
private static final long serialVersionUID = 1L;
public class ProductDTO extends BaseEntity {
private static final long serialVersionUID = 1L;
@TableId(type = IdType.AUTO)
private Long id;
@TableId(type = IdType.AUTO)
private Long id;
private String code;
private String code;
private String name;
private String name;
private String manufacturer;
private String manufacturer;
private Long categoryId;
private Long categoryId;
private String protocolCode;
private String protocolCode;
private String transport;
private String transport;
private String uploadTopic;
private String subscribeTopic;
private Integer status;
@TableField(typeHandler = JacksonTypeHandler.class)
private Map<String, Object> thingsModels;
private String uploadTopic;
private String subscribeTopic;
private Integer status;
@TableField(typeHandler = JacksonTypeHandler.class)
private Map<String, Object> thingsModels;
}

View File

@@ -56,12 +56,36 @@ public class SiteMemory {
deviceMap.put(device.getSerialNumber(), device);
}
public static void removeDevice(String deviceId) {
public void removeDevice(String deviceId) {
if (!StringUtils.isEmpty(deviceId)) {
deviceMap.remove(deviceId);
}
}
public void saveCommonDevice(IoTCommonDevice device) {
commonDeviceMap.put(device.getSn(), device);
}
public IoTCommonDevice getCommonDevice(String sn) {
if (!StringUtils.isEmpty(sn)) {
return commonDeviceMap.get(sn);
}
return null;
}
public List<IoTCommonDevice> getAllCommonDevice() {
if (!CollectionUtils.isEmpty(commonDeviceMap)) {
return (List<IoTCommonDevice>) commonDeviceMap.values();
}
return null;
}
public void removeCommonDevice(String sn) {
if (!StringUtils.isEmpty(sn)) {
commonDeviceMap.remove(sn);
}
}
public void saveDeviceRunParam(DeviceRunParam deviceRunParam) {
deviceRunParamMap.put(deviceRunParam.getDeviceId(), deviceRunParam);
}
@@ -90,7 +114,7 @@ public class SiteMemory {
// 替换已存在的记录,兼容后续保存
int index = -1;
for (int i = 0; i < list.size(); i++) {
if (Objects.equals(list.get(i).getErrorCode(), errorIdentificationStandard.getErrorCode())){
if (Objects.equals(list.get(i).getErrorCode(), errorIdentificationStandard.getErrorCode())) {
index = i;
break;
}