yzc 1 gadu atpakaļ
vecāks
revīzija
aabbb19d8c

+ 38 - 14
hx-iot/src/main/java/com/fjhx/iot/entity/tda/po/TdaDevice.java

@@ -1,8 +1,7 @@
 package com.fjhx.iot.entity.tda.po;
 
-import com.ruoyi.common.core.domain.BasePo;
 import com.baomidou.mybatisplus.annotation.TableName;
-import java.util.Date;
+import com.ruoyi.common.core.domain.BasePo;
 import lombok.Getter;
 import lombok.Setter;
 
@@ -20,33 +19,58 @@ import lombok.Setter;
 public class TdaDevice extends BasePo {
 
     /**
-     * 产品表id
+     * 设备名称
      */
-    private Long tdaProductId;
-
+    private String deviceName;
     /**
-     * 华为tda产品id
+     * 设备编号
      */
-    private String productId;
-
+    private String deviceCode;
     /**
-     * 设备节点(设备标识)
+     * 设备规格
      */
-    private String nodeId;
-
+    private String deviceSpec;
     /**
-     * 设备名称
+     * 设备出产时间
      */
-    private String deviceName;
+    private String deviceDeliveryTime;
+    /**
+     * 制造商名称
+     */
+    private String makerName;
+    /**
+     * 制造商电话
+     */
+    private String makerPhone;
+    /**
+     * 备注
+     */
+    private String remark;
+
+    //+=========================================s
 
     /**
      * 设备id
      */
     private String deviceId;
-
     /**
      * 设备密匙
      */
     private String secret;
 
+    /**
+     * 产品表id
+     */
+    private Long tdaProductId;
+
+    /**
+     * 华为tda产品id
+     */
+    private String productId;
+
+    /**
+     * 设备节点(设备标识)
+     */
+    private String nodeId;
+
 }

+ 16 - 16
hx-iot/src/main/java/com/fjhx/iot/service/tda/impl/TdaDeviceServiceImpl.java

@@ -118,22 +118,22 @@ public class TdaDeviceServiceImpl extends ServiceImpl<TdaDeviceMapper, TdaDevice
     @Transactional(rollbackFor = Exception.class)
     @Override
     public void add(TdaDeviceDto tdaDeviceDto) {
-        String nodeId = tdaDeviceDto.getNodeId();
-        String deviceName = tdaDeviceDto.getDeviceName();
-        Long tdaProductId = tdaDeviceDto.getTdaProductId();
-
-        // 查询资源所在空间和产品id
-        TdaProduct tdaProduct = tdaProductService.getById(tdaProductId);
-        String productId = tdaProduct.getProductId();
-
-        TdaApplication tdaApplication = tdaApplicationService.getById(tdaProduct.getTdaApplicationId());
-
-        // 华为ioDta添加设备
-        IoTDAUtil.DeviceKey deviceKey = IoTDAUtil.addDevice(tdaApplication.getTdaConfigId(),
-                nodeId, deviceName, tdaProduct.getAppId(), productId, tdaDeviceDto.getSecret());
-
-        tdaDeviceDto.setProductId(productId);
-        tdaDeviceDto.setDeviceId(tdaDeviceDto.getNodeId());
+//        String nodeId = tdaDeviceDto.getNodeId();
+//        String deviceName = tdaDeviceDto.getDeviceName();
+//        Long tdaProductId = tdaDeviceDto.getTdaProductId();
+//
+//        // 查询资源所在空间和产品id
+//        TdaProduct tdaProduct = tdaProductService.getById(tdaProductId);
+//        String productId = tdaProduct.getProductId();
+//
+//        TdaApplication tdaApplication = tdaApplicationService.getById(tdaProduct.getTdaApplicationId());
+//
+//        // 华为ioDta添加设备
+//        IoTDAUtil.DeviceKey deviceKey = IoTDAUtil.addDevice(tdaApplication.getTdaConfigId(),
+//                nodeId, deviceName, tdaProduct.getAppId(), productId, tdaDeviceDto.getSecret());
+//
+//        tdaDeviceDto.setProductId(productId);
+//        tdaDeviceDto.setDeviceId(tdaDeviceDto.getNodeId());
 
         // tdaDeviceDto.setSecret(deviceKey.getSecret());
 

+ 27 - 13
hx-iot/src/main/resources/mapper/tda/TdaDeviceMapper.xml

@@ -2,23 +2,37 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.fjhx.iot.mapper.tda.TdaDeviceMapper">
     <select id="getPage" resultType="com.fjhx.iot.entity.tda.vo.TdaDeviceVo">
-        select td.id,
-               td.tda_product_id,
-               td.product_id,
-               td.node_id,
-               td.device_name,
+        --         select td.id,
+--                td.tda_product_id,
+--                td.product_id,
+--                td.node_id,
+--                td.device_name,
+--                td.device_id,
+--                td.secret,
+--                td.create_user,
+--                td.create_time,
+--                td.update_user,
+--                td.update_time,
+--                tp.name        productName,
+--                tp.device_type deviceType,
+--                ta.app_name
+--         from tda_device td
+--                  left join tda_product tp on td.tda_product_id = tp.id
+--                  left join tda_application ta on tp.tda_application_id = ta.id
+        SELECT td.id,
                td.device_id,
-               td.secret,
+               td.device_name,
+               td.device_code,
+               td.device_spec,
+               td.device_delivery_time,
+               td.maker_name,
+               td.maker_phone,
+               td.remark,
                td.create_user,
                td.create_time,
                td.update_user,
-               td.update_time,
-               tp.name        productName,
-               tp.device_type deviceType,
-               ta.app_name
-        from tda_device td
-                 left join tda_product tp on td.tda_product_id = tp.id
-                 left join tda_application ta on tp.tda_application_id = ta.id
+               td.update_time
+        FROM tda_device td
             ${ew.customSqlSegment}
     </select>