Commit c27b02beb634aa8c702353efface531d2562d76c

Authored by YunaiV
1 parent d116e5ee

【代码评审】IoT:增加相关待定项

yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/dal/dataobject/device/IotDeviceDO.java
@@ -122,6 +122,7 @@ public class IotDeviceDO extends TenantBaseDO { @@ -122,6 +122,7 @@ public class IotDeviceDO extends TenantBaseDO {
122 */ 122 */
123 private String firmwareId; 123 private String firmwareId;
124 124
  125 + // TODO @芋艿:【待定 003】:要不要增加 username?目前 tl 有,阿里云之类的没有
125 /** 126 /**
126 * 设备密钥,用于设备认证,需安全存储 127 * 设备密钥,用于设备认证,需安全存储
127 */ 128 */
@@ -144,6 +145,7 @@ public class IotDeviceDO extends TenantBaseDO { @@ -144,6 +145,7 @@ public class IotDeviceDO extends TenantBaseDO {
144 // TODO @haohao:是不是要枚举哈 145 // TODO @haohao:是不是要枚举哈
145 private String authType; 146 private String authType;
146 147
  148 + // TODO @芋艿:【待定 002】:1)设备维护的时候,设置位置?类似 tl?;2)设备上传的时候,设置位置,类似 it?
147 /** 149 /**
148 * 设备位置的纬度 150 * 设备位置的纬度
149 */ 151 */
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/dal/tdengine/IotDevicePropertyMapper.java
@@ -32,6 +32,7 @@ public interface IotDevicePropertyMapper { @@ -32,6 +32,7 @@ public interface IotDevicePropertyMapper {
32 default void alterProductPropertySTable(String productKey, 32 default void alterProductPropertySTable(String productKey,
33 List<TDengineTableField> oldFields, 33 List<TDengineTableField> oldFields,
34 List<TDengineTableField> newFields) { 34 List<TDengineTableField> newFields) {
  35 + // TODO @芋艿:需要处理 device_key,重新发布的时候
35 oldFields.removeIf(field -> StrUtil.equalsAny(field.getField(), 36 oldFields.removeIf(field -> StrUtil.equalsAny(field.getField(),
36 TDengineTableField.FIELD_TS, "report_time")); 37 TDengineTableField.FIELD_TS, "report_time"));
37 List<TDengineTableField> addFields = newFields.stream().filter( // 新增的字段 38 List<TDengineTableField> addFields = newFields.stream().filter( // 新增的字段
@@ -51,7 +52,7 @@ public interface IotDevicePropertyMapper { @@ -51,7 +52,7 @@ public interface IotDevicePropertyMapper {
51 modifyTypeFields.add(newField); 52 modifyTypeFields.add(newField);
52 return; 53 return;
53 } 54 }
54 - if (newField.getLength()!= null) { 55 + if (newField.getLength() != null) {
55 if (newField.getLength() > oldField.getLength()) { 56 if (newField.getLength() > oldField.getLength()) {
56 modifyLengthFields.add(newField); 57 modifyLengthFields.add(newField);
57 } else if (newField.getLength() < oldField.getLength()) { 58 } else if (newField.getLength() < oldField.getLength()) {
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/service/product/IotProductServiceImpl.java
@@ -121,9 +121,9 @@ public class IotProductServiceImpl implements IotProductService { @@ -121,9 +121,9 @@ public class IotProductServiceImpl implements IotProductService {
121 // 1. 校验存在 121 // 1. 校验存在
122 validateProductExists(id); 122 validateProductExists(id);
123 123
124 - // 2. 产品是发布状态 124 + // 2. 更新为发布状态,需要创建产品超级表数据模型
  125 + // TODO @芋艿:【待定 001】1)是否需要操作后,在 redis 进行缓存,实现一个“快照”的情况,类似 tl;
125 if (Objects.equals(status, IotProductStatusEnum.PUBLISHED.getStatus())) { 126 if (Objects.equals(status, IotProductStatusEnum.PUBLISHED.getStatus())) {
126 - // 创建产品超级表数据模型  
127 devicePropertyDataService.defineDevicePropertyData(id); 127 devicePropertyDataService.defineDevicePropertyData(id);
128 } 128 }
129 129