TRX 1 rok temu
rodzic
commit
9efe8e53e9

+ 4 - 3
src/main/java/com/github/microservice/busInfoModel/thing/IotThingModel.java

@@ -36,9 +36,13 @@ public class IotThingModel extends SuperModel {
     @Schema(description = "设备数量")
     private Long deviceCount = 0L;
 
+    @Schema(description = "分组信息")
+    private ProjectInfoSimpleModel projectInfo;
+
     @Schema(description = "所属分组")
     private String projectCode;
 
+    @Schema(description = "分组名称")
     private String projectName;
 
     public String getProjectName() {
@@ -48,9 +52,6 @@ public class IotThingModel extends SuperModel {
         return "";
     }
 
-    @Schema(description = "分组信息")
-    private ProjectInfoSimpleModel projectInfo;
-
     //-----------------所属产品 start-----------
     @Schema(description = "所属产品数据id")
     private String iotTemplateId;

+ 7 - 3
src/main/java/com/github/microservice/busInfoModel/thing/IotThingSearch.java

@@ -1,9 +1,7 @@
 package com.github.microservice.busInfoModel.thing;
 
 import com.github.microservice.models.baseParam.SuperSearchParam;
-import com.github.microservice.types.deviceUse.DeviceState;
-import com.github.microservice.types.deviceUse.OnLineState;
-import com.github.microservice.types.deviceUse.ThingType;
+import com.github.microservice.types.deviceUse.*;
 import io.swagger.v3.oas.annotations.media.Schema;
 import lombok.Data;
 
@@ -40,6 +38,12 @@ public class IotThingSearch extends SuperSearchParam {
 
     //-----------------管理的设备类型 start ---------
 
+    @Schema(description = "设备类型")
+    private DeviceType deviceType;
+
+    @Schema(description = "设备品类")
+    private DeviceCategory deviceCategory;
+
     @Schema(description = "修改时间")
     private List<Long> updateTimes;
 

+ 21 - 0
src/main/java/com/github/microservice/busInfoModel/thing/IotThingSendParam.java

@@ -0,0 +1,21 @@
+package com.github.microservice.busInfoModel.thing;
+
+import com.github.microservice.types.FunctionType;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+/**
+ *
+ * @author TRX
+ * @date 2025/3/14
+ */
+@Data
+public class IotThingSendParam {
+
+    @Schema(description = "刷新一个属性就传 id,")
+    private String id;
+
+    @Schema(description = "所属物模型id(获取所有的就传物模型id)")
+    private String iotThingId;
+
+}

+ 7 - 6
src/main/java/com/github/microservice/dataConfig/IotIdentifierConfig.java

@@ -6,6 +6,7 @@ import com.github.microservice.types.FunctionType;
 import java.util.HashMap;
 
 /**
+ * 物联网 标识符 (常用)
  * @author TRX
  * @date 2024/10/16
  */
@@ -26,17 +27,17 @@ public class IotIdentifierConfig {
     // 单次通知网关设备权限发生变化的设备数量
     public static final int maxNoticeSize = 200;
 
+    // 下发得到属性的 服务标识符
+    public static final String getAttrs = "getAttrs";
+
     public static HashMap<String, InitIotParam> map = new HashMap<>();
 
     static {
-        map.put(permissionNotice, InitIotParam.builder()
-                .name("网关设备权限变更通知").identifier(permissionNotice).iotTopic("/device/${gateWayId}/permissionNotice").functionType(FunctionType.Server).build());
+        map.put(permissionNotice, InitIotParam.builder().name("网关设备权限变更通知").identifier(permissionNotice).iotTopic("/device/${gateWayId}/permissionNotice").functionType(FunctionType.Server).build());
 
-        map.put(queryDeviceBindUsers, InitIotParam.builder()
-                .name("查询设备权限").identifier(queryDeviceBindUsers).iotTopic("/device/${gateWayId}/queryDeviceBindUsers").functionType(FunctionType.Event).build());
+        map.put(queryDeviceBindUsers, InitIotParam.builder().name("查询设备权限").identifier(queryDeviceBindUsers).iotTopic("/device/${gateWayId}/queryDeviceBindUsers").functionType(FunctionType.Event).build());
 
-        map.put(queryDeviceUsersInfo, InitIotParam.builder()
-                .name("查询设备对应的用户信息").identifier(queryDeviceUsersInfo).iotTopic("/device/${gateWayId}/queryDeviceUsersInfo").functionType(FunctionType.Event).build());
+        map.put(queryDeviceUsersInfo, InitIotParam.builder().name("查询设备对应的用户信息").identifier(queryDeviceUsersInfo).iotTopic("/device/${gateWayId}/queryDeviceUsersInfo").functionType(FunctionType.Event).build());
 
     }
 

+ 2 - 0
src/main/java/com/github/microservice/models/iot/IotSendParam.java

@@ -20,8 +20,10 @@ import org.apache.commons.lang3.ObjectUtils;
 @NoArgsConstructor
 public class IotSendParam {
 
+    @Schema(description = "iotMain 数据id")
     private String id;
 
+    @Schema(description = "所属分组")
     private String projectInfoCode;
 
     @Schema(description = "标识数据ID, 不传自动生成")

+ 32 - 0
src/main/java/com/github/microservice/models/property/DeviceGetPropertyParam.java

@@ -0,0 +1,32 @@
+package com.github.microservice.models.property;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author TRX
+ * @date 2025/3/5
+ */
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+public class DeviceGetPropertyParam {
+
+    @Schema(description = "设备ID")
+    private String deviceId;
+
+    @Schema(description = "属性集合")
+    private List<String> propertyNames = new ArrayList<>();
+
+    public void addPropertyName(String propertyName) {
+        if (!propertyNames.contains(propertyName)) {
+            this.propertyNames.add(propertyName);
+        }
+    }
+
+}

+ 1 - 0
src/main/java/com/github/microservice/models/property/DevicePropertyParam.java

@@ -19,6 +19,7 @@ public class DevicePropertyParam {
     @Schema(description = "设备ID")
     private String deviceId;
 
+    @Schema(description = "属性集合")
     private HashMap<String, Object> params = new HashMap<>();
 
 }

+ 43 - 0
src/main/java/com/github/microservice/models/property/PostGetPropertyParam.java

@@ -0,0 +1,43 @@
+package com.github.microservice.models.property;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * 属性上传 封装
+ *
+ * @author TRX
+ * @date 2025/3/5
+ */
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+public class PostGetPropertyParam {
+
+    @Schema(description = "属性参数")
+    private List<DeviceGetPropertyParam> list = new ArrayList<DeviceGetPropertyParam>();
+
+    public void addProperty(String deviceId, String propertyName) {
+        if (deviceId != null && propertyName != null) {
+            boolean b = false;
+            for (DeviceGetPropertyParam property : list) {
+                if (property.getDeviceId().equals(deviceId)) {
+                    property.addPropertyName(propertyName);
+                    b = true;
+                    break;
+                }
+            }
+            if (!b) {
+                DeviceGetPropertyParam property = new DeviceGetPropertyParam();
+                property.setDeviceId(deviceId);
+                property.addPropertyName(propertyName);
+                list.add(property);
+            }
+        }
+    }
+}