新增:iot 产品

This commit is contained in:
安浩浩
2024-08-17 19:41:42 +08:00
parent 3f01ba7538
commit 36a828866b
19 changed files with 868 additions and 12 deletions

View File

@ -0,0 +1,15 @@
package cn.iocoder.yudao.module.iot.enums;
import cn.iocoder.yudao.framework.common.exception.ErrorCode;
/**
* iot 错误码枚举类
* <p>
* iot 系统,使用 1-050-000-000 段
*/
public interface ErrorCodeConstants {
// ========== 产品相关 1-050-001-000 ============
ErrorCode PRODUCT_NOT_EXISTS = new ErrorCode(1_050_001_000, "产品不存在");
ErrorCode PRODUCT_IDENTIFICATION_EXISTS = new ErrorCode(1_050_001_001, "产品标识已经存在");
}

View File

@ -0,0 +1,37 @@
package cn.iocoder.yudao.module.iot.enums;
import cn.iocoder.yudao.framework.common.core.IntArrayValuable;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.util.Arrays;
/**
* 产品数据格式枚举类
* 1. 标准数据格式JSON2. 透传/自定义
*/
@AllArgsConstructor
@Getter
public enum ProductDataFormatEnum implements IntArrayValuable {
JSON(1, "标准数据格式JSON"),
SCRIPT(2, "透传/自定义");
/**
* 类型
*/
private final Integer type;
/**
* 描述
*/
private final String description;
public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(ProductDataFormatEnum::getType).toArray();
@Override
public int[] array() {
return ARRAYS;
}
}

View File

@ -0,0 +1,13 @@
package cn.iocoder.yudao.module.iot.enums;
/**
* 产品设备类型常量
*/
public interface ProductDeviceTypeConstants {
// ========== 产品设备类型 ============
String DEVICE = "device"; // 直连设备
String GATEWAY = "gateway"; // 网关设备
String GATEWAY_SUB = "gateway_sub"; // 网关子设备
}

View File

@ -0,0 +1,13 @@
package cn.iocoder.yudao.module.iot.enums;
/**
* 产品传输协议类型常量
*/
public interface ProductProtocolTypeConstants {
// ========== 产品传输协议类型 ============
String MQTT = "mqtt"; // MQTT
String COAP = "coap"; // COAP
String HTTP = "http"; // HTTP
String HTTPS = "https"; // HTTPS
}

View File

@ -0,0 +1,34 @@
package cn.iocoder.yudao.module.iot.enums;
import cn.iocoder.yudao.framework.common.core.IntArrayValuable;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* 产品状态枚举类
* 禁用 启用
*/
@AllArgsConstructor
@Getter
public enum ProductStatusEnum implements IntArrayValuable {
DISABLE(0, "禁用"),
ENABLE(1, "启用");
/**
* 类型
*/
private final Integer type;
/**
* 描述
*/
private final String description;
public static final int[] ARRAYS = {1, 2};
@Override
public int[] array() {
return ARRAYS;
}
}