Преглед изворни кода

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

YunaiV пре 6 месеци
родитељ
комит
c27b02beb6

+ 2 - 0
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 {
      */
     private String firmwareId;
 
+    // TODO @芋艿:【待定 003】:要不要增加 username?目前 tl 有,阿里云之类的没有
     /**
      * 设备密钥,用于设备认证,需安全存储
      */
@@ -144,6 +145,7 @@ public class IotDeviceDO extends TenantBaseDO {
     // TODO @haohao:是不是要枚举哈
     private String authType;
 
+    // TODO @芋艿:【待定 002】:1)设备维护的时候,设置位置?类似 tl?;2)设备上传的时候,设置位置,类似 it?
     /**
      * 设备位置的纬度
      */

+ 2 - 1
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 {
     default void alterProductPropertySTable(String productKey,
                                             List<TDengineTableField> oldFields,
                                             List<TDengineTableField> newFields) {
+        // TODO @芋艿:需要处理 device_key,重新发布的时候
         oldFields.removeIf(field -> StrUtil.equalsAny(field.getField(),
                 TDengineTableField.FIELD_TS, "report_time"));
         List<TDengineTableField> addFields = newFields.stream().filter( // 新增的字段
@@ -51,7 +52,7 @@ public interface IotDevicePropertyMapper {
                 modifyTypeFields.add(newField);
                 return;
             }
-            if (newField.getLength()!= null) {
+            if (newField.getLength() != null) {
                 if (newField.getLength() > oldField.getLength()) {
                     modifyLengthFields.add(newField);
                 } else if (newField.getLength() < oldField.getLength()) {

+ 2 - 2
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 {
         // 1. 校验存在
         validateProductExists(id);
 
-        // 2. 产品是发布状态
+        // 2. 更新为发布状态,需要创建产品超级表数据模型
+        // TODO @芋艿:【待定 001】1)是否需要操作后,在 redis 进行缓存,实现一个“快照”的情况,类似 tl;
         if (Objects.equals(status, IotProductStatusEnum.PUBLISHED.getStatus())) {
-            // 创建产品超级表数据模型
             devicePropertyDataService.defineDevicePropertyData(id);
         }