xucaiqin 2 роки тому
батько
коміт
066d1c4ab2

+ 27 - 27
iot-module/iot-module-manage/iot-module-manage-biz/src/main/java/com/middle/platform/manage/biz/domain/vo/IotProductDetailVo.java

@@ -1,13 +1,9 @@
 package com.middle.platform.manage.biz.domain.vo;
 
-import com.fasterxml.jackson.annotation.JsonFormat;
 import com.middle.platform.mybatis.core.dataobject.BaseVO;
 import lombok.Getter;
 import lombok.Setter;
 
-import java.math.BigDecimal;
-import java.time.LocalDateTime;
-
 /**
  * 产品
  *
@@ -20,60 +16,64 @@ public class IotProductDetailVo extends BaseVO {
     private Long id;
 
     /**
-     * 所属产品
+     * 产品编码
      */
-    private Long productId;
+    private String code;
 
     /**
-     * 设备名称
+     * 产品名称
      */
     private String name;
 
     /**
-     * 设备sn码
+     * 密匙(未知作用)
      */
-    private String sn;
+    private String secret;
 
     /**
-     * 设备guid
+     * 节点类型:1网关、2子设备
      */
-    private String guid;
+    private Integer nodeType;
+    private String nodeTypeLabel;
 
     /**
-     * 备注名称
+     * 联网类型
      */
-    private String subtitle;
+    private Integer networkType;
+    private String networkTypeLabel;
 
     /**
-     * 经度
+     * 上报协议
      */
-    private BigDecimal lon;
-
+    private Integer reportProtocol;
+    private String reportProtocolLabel;
     /**
-     * 纬度
+     * 设备厂商
      */
-    private BigDecimal lat;
+    private Integer vendors;
+    private String vendorsLabel;
 
     /**
-     * 所属区域
+     * 数据格式
      */
-    private String address;
+    private Integer dataFormat;
+    private String dataFormatLabel;
 
     /**
-     * 最后在线时间
+     * 认证方式
      */
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
-    private LocalDateTime onlineTime;
+    private Integer authType;
+    private String authTypeLabel;
 
     /**
-     * 设备状态 1-在线 0-离线
+     * 产品标签
      */
-    private Integer status;
+    private String tag;
 
     /**
-     * 启用状态 1-启用 0-禁用
+     * 设备数
      */
-    private Integer enableFlag;
+    private Integer size;
 
     /**
      * 备注

+ 0 - 38
iot-module/iot-module-manage/iot-module-manage-biz/src/main/java/com/middle/platform/manage/biz/domain/vo/IotProductVo.java

@@ -25,50 +25,12 @@ public class IotProductVo extends BaseVO {
      */
     private String name;
 
-    /**
-     * 密匙(未知作用)
-     */
-    private String secret;
-
     /**
      * 节点类型:1网关、2子设备
      */
     private Integer nodeType;
     private String nodeTypeLabel;
 
-    /**
-     * 联网类型
-     */
-    private Integer networkType;
-    private String networkTypeLabel;
-
-    /**
-     * 上报协议
-     */
-    private Integer reportProtocol;
-    private String reportProtocolLabel;
-    /**
-     * 设备厂商
-     */
-    private Integer vendors;
-    private String vendorsLabel;
-
-    /**
-     * 数据格式
-     */
-    private Integer dataFormat;
-    private String dataFormatLabel;
-
-    /**
-     * 认证方式
-     */
-    private Integer authType;
-    private String authTypeLabel;
-
-    /**
-     * 产品标签
-     */
-    private String tag;
 
     /**
      * 设备数

+ 8 - 6
iot-module/iot-module-manage/iot-module-manage-biz/src/main/java/com/middle/platform/manage/biz/service/IotProductService.java

@@ -69,13 +69,7 @@ public class IotProductService {
         iotProductVos.forEach(u -> {
             Optional.ofNullable(userApi.queryUser(u.getCreateBy())).ifPresent(userCache -> u.setCreateByLabel(userCache.getName()));
             Optional.ofNullable(userApi.queryUser(u.getUpdateBy())).ifPresent(userCache -> u.setUpdateByLabel(userCache.getName()));
-            Optional.ofNullable(dictApi.query(DictType.AUTH_TYPE, String.valueOf(u.getAuthType()))).ifPresent(cache -> u.setAuthTypeLabel(cache.getLabel()));
             Optional.ofNullable(dictApi.query(DictType.NODE_TYPE, String.valueOf(u.getNodeType()))).ifPresent(cache -> u.setNodeTypeLabel(cache.getLabel()));
-            Optional.ofNullable(dictApi.query(DictType.NETWORK_TYPE, String.valueOf(u.getNetworkType()))).ifPresent(cache -> u.setNetworkTypeLabel(cache.getLabel()));
-            Optional.ofNullable(dictApi.query(DictType.REPORT_PROTOCOL_TYPE, String.valueOf(u.getReportProtocol()))).ifPresent(cache -> u.setReportProtocolLabel(cache.getLabel()));
-            Optional.ofNullable(dictApi.query(DictType.VENDORS_TYPE, String.valueOf(u.getVendors()))).ifPresent(cache -> u.setVendorsLabel(cache.getLabel()));
-            Optional.ofNullable(dictApi.query(DictType.DATA_FORMAT_TYPE, String.valueOf(u.getDataFormat()))).ifPresent(cache -> u.setDataFormatLabel(cache.getLabel()));
-
         });
         return new PageRes<>(pageInfo, iotProductVos);
     }
@@ -151,6 +145,14 @@ public class IotProductService {
         }
         IotProductDetailVo iotProductDetailVo = new IotProductDetailVo();
         BeanUtils.copyProperties(iotProduct, iotProductDetailVo);
+        Optional.ofNullable(dictApi.query(DictType.AUTH_TYPE, String.valueOf(iotProductDetailVo.getAuthType()))).ifPresent(cache -> iotProductDetailVo.setAuthTypeLabel(cache.getLabel()));
+        Optional.ofNullable(dictApi.query(DictType.NODE_TYPE, String.valueOf(iotProductDetailVo.getNodeType()))).ifPresent(cache -> iotProductDetailVo.setNodeTypeLabel(cache.getLabel()));
+        Optional.ofNullable(dictApi.query(DictType.NETWORK_TYPE, String.valueOf(iotProductDetailVo.getNetworkType()))).ifPresent(cache -> iotProductDetailVo.setNetworkTypeLabel(cache.getLabel()));
+        Optional.ofNullable(dictApi.query(DictType.REPORT_PROTOCOL_TYPE, String.valueOf(iotProductDetailVo.getReportProtocol()))).ifPresent(cache -> iotProductDetailVo.setReportProtocolLabel(cache.getLabel()));
+        Optional.ofNullable(dictApi.query(DictType.VENDORS_TYPE, String.valueOf(iotProductDetailVo.getVendors()))).ifPresent(cache -> iotProductDetailVo.setVendorsLabel(cache.getLabel()));
+        Optional.ofNullable(dictApi.query(DictType.DATA_FORMAT_TYPE, String.valueOf(iotProductDetailVo.getDataFormat()))).ifPresent(cache -> iotProductDetailVo.setDataFormatLabel(cache.getLabel()));
+        Optional.ofNullable(userApi.queryUser(iotProductDetailVo.getCreateBy())).ifPresent(userCache -> iotProductDetailVo.setCreateByLabel(userCache.getName()));
+        Optional.ofNullable(userApi.queryUser(iotProductDetailVo.getUpdateBy())).ifPresent(userCache -> iotProductDetailVo.setUpdateByLabel(userCache.getName()));
         return iotProductDetailVo;
     }