【功能新增】IoT:增加 ota 的表结构设计(100%)
This commit is contained in:
parent
7bcbe9a243
commit
8ced4a0a2c
|
@ -0,0 +1,38 @@
|
|||
package cn.iocoder.yudao.module.iot.enums.ota;
|
||||
|
||||
|
||||
import cn.iocoder.yudao.framework.common.core.ArrayValuable;
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* IoT OTA 升级记录的范围枚举
|
||||
*
|
||||
* @author haohao
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Getter
|
||||
public enum IotOtaUpgradeRecordStatusEnum implements ArrayValuable<Integer> {
|
||||
|
||||
PENDING(0), // 待推送
|
||||
PUSHED(10), // 已推送
|
||||
UPGRADING(20), // 升级中
|
||||
SUCCESS(30), // 升级成功
|
||||
FAILURE(40), // 升级失败
|
||||
CANCELED(50),; // 已取消
|
||||
|
||||
public static final Integer[] ARRAYS = Arrays.stream(values()).map(IotOtaUpgradeRecordStatusEnum::getStatus).toArray(Integer[]::new);
|
||||
|
||||
/**
|
||||
* 范围
|
||||
*/
|
||||
private final Integer status;
|
||||
|
||||
@Override
|
||||
public Integer[] array() {
|
||||
return ARRAYS;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
package cn.iocoder.yudao.module.iot.enums.ota;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.core.ArrayValuable;
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* IoT OTA 升级任务的范围枚举
|
||||
*
|
||||
* @author haohao
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Getter
|
||||
public enum IotOtaUpgradeTaskScopeEnum implements ArrayValuable<Integer> {
|
||||
|
||||
ALL(1), // 全部设备:只包括当前产品下的设备,不包括未来创建的设备
|
||||
SELECT(2); // 指定设备
|
||||
|
||||
public static final Integer[] ARRAYS = Arrays.stream(values()).map(IotOtaUpgradeTaskScopeEnum::getScope).toArray(Integer[]::new);
|
||||
|
||||
/**
|
||||
* 范围
|
||||
*/
|
||||
private final Integer scope;
|
||||
|
||||
@Override
|
||||
public Integer[] array() {
|
||||
return ARRAYS;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
package cn.iocoder.yudao.module.iot.enums.ota;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.core.ArrayValuable;
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* IoT OTA 升级任务的范围枚举
|
||||
*
|
||||
* @author haohao
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Getter
|
||||
public enum IotOtaUpgradeTaskStatusEnum implements ArrayValuable<Integer> {
|
||||
|
||||
IN_PROGRESS(10), // 进行中:升级中
|
||||
COMPLETED(20), // 已完成:已结束,全部升级完成
|
||||
INCOMPLETE(21), // 未完成:已结束,部分升级完成
|
||||
CANCELED(30),; // 已取消:一般是主动取消任务
|
||||
|
||||
public static final Integer[] ARRAYS = Arrays.stream(values()).map(IotOtaUpgradeTaskStatusEnum::getStatus).toArray(Integer[]::new);
|
||||
|
||||
/**
|
||||
* 范围
|
||||
*/
|
||||
private final Integer status;
|
||||
|
||||
@Override
|
||||
public Integer[] array() {
|
||||
return ARRAYS;
|
||||
}
|
||||
|
||||
}
|
|
@ -39,17 +39,6 @@ public class IotOtaUpgradeRecordDO extends BaseDO {
|
|||
*/
|
||||
private Long taskId;
|
||||
|
||||
/**
|
||||
* 升级状态
|
||||
*
|
||||
* TODO
|
||||
*/
|
||||
private Integer status;
|
||||
/**
|
||||
* 升级进度,百分比
|
||||
*/
|
||||
private Integer progress;
|
||||
|
||||
/**
|
||||
* 产品标识
|
||||
*
|
||||
|
@ -69,6 +58,23 @@ public class IotOtaUpgradeRecordDO extends BaseDO {
|
|||
*/
|
||||
private String deviceId;
|
||||
|
||||
/**
|
||||
* 升级状态
|
||||
*
|
||||
* 关联 {@link cn.iocoder.yudao.module.iot.enums.ota.IotOtaUpgradeRecordStatusEnum}
|
||||
*/
|
||||
private Integer status;
|
||||
/**
|
||||
* 升级进度,百分比
|
||||
*/
|
||||
private Integer progress;
|
||||
/**
|
||||
* 升级进度描述
|
||||
*
|
||||
* 注意,只记录设备最后一次的升级进度描述
|
||||
* 如果想看历史记录,可以查看 {@link cn.iocoder.yudao.module.iot.dal.dataobject.device.IotDeviceLogDO} 设备日志
|
||||
*/
|
||||
private String description;
|
||||
/**
|
||||
* 升级开始时间
|
||||
*/
|
||||
|
@ -78,6 +84,4 @@ public class IotOtaUpgradeRecordDO extends BaseDO {
|
|||
*/
|
||||
private LocalDateTime endTime;
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -47,11 +47,18 @@ public class IotOtaUpgradeTaskDO extends BaseDO {
|
|||
private Long firmwareId;
|
||||
|
||||
/**
|
||||
* 任务类型
|
||||
* 任务状态
|
||||
*
|
||||
* TODO @芋艿:1-全部、2-指定设备
|
||||
* 关联 {@link cn.iocoder.yudao.module.iot.enums.ota.IotOtaUpgradeTaskStatusEnum}
|
||||
*/
|
||||
private Integer type;
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 升级范围
|
||||
*
|
||||
* 关联 {@link cn.iocoder.yudao.module.iot.enums.ota.IotOtaUpgradeTaskScopeEnum}
|
||||
*/
|
||||
private Integer scope;
|
||||
/**
|
||||
* 选中的设备名字数组
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue