Kaynağa Gözat

设备同步代码提交

jingyuanchao 11 ay önce
ebeveyn
işleme
96cb4d9f7a
16 değiştirilmiş dosya ile 198 ekleme ve 58 silme
  1. 50 41
      project_data/sql/1.0.11/soc.sql
  2. 1 1
      soc-api/soc-api-system/src/main/java/com/xunmei/system/api/RemoteHostService.java
  3. 2 0
      soc-common/soc-common-core/src/main/java/com/xunmei/common/core/domain/iot/domain/IotServerProduct.java
  4. 2 0
      soc-modules/soc-modules-host/src/main/java/com/xunmei/host/iot/mapper/IotDeviceInfoExtendMapper.java
  5. 6 0
      soc-modules/soc-modules-host/src/main/java/com/xunmei/host/iot/mapper/IotDeviceInfoMapper.java
  6. 2 0
      soc-modules/soc-modules-host/src/main/java/com/xunmei/host/iot/service/IIotDeviceInfoExtendService.java
  7. 5 0
      soc-modules/soc-modules-host/src/main/java/com/xunmei/host/iot/service/impl/IotDeviceInfoExtendServiceImpl.java
  8. 79 8
      soc-modules/soc-modules-host/src/main/java/com/xunmei/host/iot/service/impl/IotDeviceInfoServiceImpl.java
  9. 1 1
      soc-modules/soc-modules-host/src/main/java/com/xunmei/host/north/controller/HostController.java
  10. 8 0
      soc-modules/soc-modules-host/src/main/java/com/xunmei/host/websocket/constant/WebSocketConstants.java
  11. 4 7
      soc-modules/soc-modules-host/src/main/java/com/xunmei/host/websocket/service/impl/WebsocketServiceImpl.java
  12. 3 0
      soc-modules/soc-modules-host/src/main/resources/mapper/IotDeviceInfoExtendMapper.xml
  13. 12 0
      soc-modules/soc-modules-host/src/main/resources/mapper/IotDeviceInfoMapper.xml
  14. 7 0
      soc-modules/soc-modules-iot/src/main/java/com/xunmei/iot/mapper/IotDeviceInfoMapper.java
  15. 7 0
      soc-modules/soc-modules-iot/src/main/java/com/xunmei/iot/service/impl/IotDeviceInfoServiceImpl.java
  16. 9 0
      soc-modules/soc-modules-iot/src/main/resources/mapper/IotDeviceInfoMapper.xml

+ 50 - 41
project_data/sql/1.0.11/soc.sql

@@ -31,49 +31,58 @@ DROP PROCEDURE IF EXISTS schema_change ??
 CREATE PROCEDURE schema_change()
 BEGIN
 
-    IF NOT EXISTS(SELECT *
-                  FROM information_schema.columns
-                  WHERE table_schema = DATABASE()
-                    AND table_name = 'iot_server_product'
-                    AND column_name = 'models') THEN
-        ALTER TABLE  `iot_server_product`
-            ADD COLUMN `models` varchar(255) NULL AFTER `categories`;
-        delete from iot_server_product;
-        INSERT INTO `iot_server_product`(`id`, `name`, `display_name`, `enabled`, `categories`, `models`) VALUES ('01e50bb0-17cd-24bf-3db9-3a141541ea12', 'FSU_Theft', 'FSU 防盗传感器', 1, '[\r\n  \"FSU\"\r\n]', '[\r\n  \"Normal\"\r\n]');
-        INSERT INTO `iot_server_product`(`id`, `name`, `display_name`, `enabled`, `categories`, `models`) VALUES ('055e9571-52b0-06ab-c359-3a14623b2d8d', 'FSU_DoPowerCollection', 'FSU 回路通电状态', 1, '[\r\n  \"FSU\"\r\n]', '[\r\n  \"Normal\"\r\n]');
-        INSERT INTO `iot_server_product`(`id`, `name`, `display_name`, `enabled`, `categories`, `models`) VALUES ('06f8fc23-26c8-edc1-bd8b-3a141540c0fb', 'FSU_AirConditioner', 'FSU 空调', 1, '[\r\n  \"FSU\"\r\n]', '[\r\n  \"Normal\"\r\n]');
-        INSERT INTO `iot_server_product`(`id`, `name`, `display_name`, `enabled`, `categories`, `models`) VALUES ('0f26e066-9e07-beb3-55bd-3a147bd0d913', 'FSU_DoPowerControlBoxButton', 'FSU DO8小时控电箱按钮', 1, '[\r\n  \"FSU\"\r\n]', '[\r\n  \"Normal\"\r\n]');
-        INSERT INTO `iot_server_product`(`id`, `name`, `display_name`, `enabled`, `categories`, `models`) VALUES ('15367b47-d383-48aa-99ea-a1c5dc573056', 'FSU_DoPowerControl', 'FSU DO8小时控电', 1, '[\r\n  \"FSU\"\r\n]', '[\r\n  \"Normal\"\r\n]');
-        INSERT INTO `iot_server_product`(`id`, `name`, `display_name`, `enabled`, `categories`, `models`) VALUES ('19ed86f7-780d-29ec-4bc7-3a13a7097ea1', 'VGSII_Hik', '海康视频存储设备2023年入围设备', 1, '[\r\n  \"Dvs\"\r\n]', '[\r\n  \"Hik\"\r\n]');
-        INSERT INTO `iot_server_product`(`id`, `name`, `display_name`, `enabled`, `categories`, `models`) VALUES ('1b7adc13-af87-fe22-7d49-3a141540fad9', 'FSU_Water', 'FSU 水浸传感器', 1, '[\r\n  \"FSU\"\r\n]', '[\r\n  \"Normal\"\r\n]');
-        INSERT INTO `iot_server_product`(`id`, `name`, `display_name`, `enabled`, `categories`, `models`) VALUES ('2369b2eb-f0ae-7f68-f49c-3a0ad342f60a', 'InAnter_BM1600NTSmall', '英安特BM1600NTSmall报警主机', 1, '[\r\n  \"AlarmHost\"\r\n]', '[\r\n  \"GlobalNT2/NT3\"\r\n]');
-        INSERT INTO `iot_server_product`(`id`, `name`, `display_name`, `enabled`, `categories`, `models`) VALUES ('2f7b0f00-43b1-07b2-dfcd-3a0bba6d4ccb', 'Hik_DS19A', 'Hik_DS19A系列报警主机', 1, '[\r\n  \"AlarmHost\"\r\n]', '[\r\n  \"DS-19A\"\r\n]');
-        INSERT INTO `iot_server_product`(`id`, `name`, `display_name`, `enabled`, `categories`, `models`) VALUES ('384287b5-f556-b9cc-e84e-3a1057095e04', 'HikModule', '海康报警网络模块', 1, '[\r\n  \"AlarmHost\"\r\n]', '[\r\n  \"Mta120\",\r\n	\"Mta128\"\r\n]');
-        INSERT INTO `iot_server_product`(`id`, `name`, `display_name`, `enabled`, `categories`, `models`) VALUES ('51a1f179-8fcf-ea4f-988c-3a13f9904a04', 'FSU_Gateway', 'FSU主机', 1, '[\r\n  \"FSU\"\r\n]', '[\r\n  \"GXX-ZMAF-3100\"\r\n]');
-        INSERT INTO `iot_server_product`(`id`, `name`, `display_name`, `enabled`, `categories`, `models`) VALUES ('54eb3a1c-8f7d-4b9e-9a5c-2e8f66750000', 'FSU_SmartMeter', 'FSU 智能电表', 1, '[\r\n  \"FSU\"\r\n]', '[\r\n  \"Normal\"\r\n]');
-        INSERT INTO `iot_server_product`(`id`, `name`, `display_name`, `enabled`, `categories`, `models`) VALUES ('649e9822-b487-6b9f-865b-3a0ad341b9c0', 'FengYe_H402', '枫叶HD402报警主机', 1, '[\r\n  \"AlarmHost\"\r\n]', '[\r\n  \"HD402\"\r\n]');
-        INSERT INTO `iot_server_product`(`id`, `name`, `display_name`, `enabled`, `categories`, `models`) VALUES ('6acce932-9e54-e3d3-5241-3a13d1d3584a', 'DetectionHost', '物联网主机产品,VIMD服务', 1, '[\r\n  \"DetectionHost\"\r\n]', '[\r\n  \"DetectionHost\"\r\n]');
-        INSERT INTO `iot_server_product`(`id`, `name`, `display_name`, `enabled`, `categories`, `models`) VALUES ('6acce932-9e54-e3d3-5d4a-3a13d1d3584a', 'IoTServer', 'IoT内置产品,IoT服务', 1, '[\r\n  \"IoT\",\r\n  \"IoTServer\"\r\n]', '[\r\n  \"IoTServer\"\r\n]');
-        INSERT INTO `iot_server_product`(`id`, `name`, `display_name`, `enabled`, `categories`, `models`) VALUES ('6ba7b810-9dad-11d1-80b4-00c04fd430c8', 'FSU_Infrared', 'FSU 红外传感器', 1, '[\r\n  \"FSU\"\r\n]', '[\r\n  \"Normal\"\r\n]');
-        INSERT INTO `iot_server_product`(`id`, `name`, `display_name`, `enabled`, `categories`, `models`) VALUES ('73af892b-2bee-4126-b498-7460c483509d', 'FSU_ThreePhaseACVoltage', 'FSU 三相电电压传感器', 1, '[\r\n  \"FSU\"\r\n]', '[\r\n  \"Normal\"\r\n]');
-        INSERT INTO `iot_server_product`(`id`, `name`, `display_name`, `enabled`, `categories`, `models`) VALUES ('783bb246-6ebe-7e69-e055-3a14adfe10c9', 'VGSII_DaHua_V1', '大华视频存储设备(通用设备)', 1, '[\r\n  \"Dvs\"\r\n]', '[\r\n  \"Normal\"\r\n]');
-        INSERT INTO `iot_server_product`(`id`, `name`, `display_name`, `enabled`, `categories`, `models`) VALUES ('7a5f5e54-17d7-4c2e-99b2-e4d6181f8b62', 'FSU_Gas', 'FSU 燃气传感器', 1, '[\r\n  \"FSU\"\r\n]', '[\r\n  \"Normal\"\r\n]');
-        INSERT INTO `iot_server_product`(`id`, `name`, `display_name`, `enabled`, `categories`, `models`) VALUES ('85659b02-4fe7-cb85-6b00-3a14153fec6e', 'FSU_Smoke', 'FSU 烟雾传感器', 1, '[\r\n  \"FSU\"\r\n]', '[\r\n  \"Normal\"\r\n]');
-        INSERT INTO `iot_server_product`(`id`, `name`, `display_name`, `enabled`, `categories`, `models`) VALUES ('92467897-92ef-647f-e55e-3a13b7f3ca9a', 'VGSII_DaHua', '大华视频存储设备2023年入围设备', 1, '[\r\n  \"Dvs\"\r\n]', '[\r\n  \"DaHua\"\r\n]');
-        INSERT INTO `iot_server_product`(`id`, `name`, `display_name`, `enabled`, `categories`, `models`) VALUES ('98308508-be46-8eb3-ff40-3a14153f55f9', 'FSU_TemperatureAndHumidity', 'FSU 温湿度传感器', 1, '[\r\n  \"FSU\"\r\n]', '[\r\n  \"Normal\"\r\n]');
-        INSERT INTO `iot_server_product`(`id`, `name`, `display_name`, `enabled`, `categories`, `models`) VALUES ('a1ae8610-70d1-b856-5bdf-3a141540732d', 'FSU_Ups', 'UPS', 1, '[\r\n  \"FSU\"\r\n]', '[\r\n  \"Normal\"\r\n]');
-        INSERT INTO `iot_server_product`(`id`, `name`, `display_name`, `enabled`, `categories`, `models`) VALUES ('abce638c-33c6-bc91-39dd-3a1415401bcd', 'FSU_DoorMagnetic', 'FSU 门磁传感器', 1, '[\r\n  \"FSU\"\r\n]', '[\r\n  \"Normal\"\r\n]');
-        INSERT INTO `iot_server_product`(`id`, `name`, `display_name`, `enabled`, `categories`, `models`) VALUES ('bed76841-d3ee-2fd0-64ed-3a0d374167a5', 'HengTong_CKWU01C', '恒通CKWU01C报警主机', 1, '[\r\n  \"AlarmHost\"\r\n]', '[\r\n  \"CKWU01C\"\r\n]');
-        INSERT INTO `iot_server_product`(`id`, `name`, `display_name`, `enabled`, `categories`, `models`) VALUES ('ce00cabd-b2c2-8532-f56f-3a10556f2bfe', 'MtaOCX', '迈特安网络报警模块', 1, '[\r\n  \"AlarmHost\"\r\n]', '[\r\n  \"Mta120\",\r\n	\"Mta128\"\r\n]');
-        INSERT INTO `iot_server_product`(`id`, `name`, `display_name`, `enabled`, `categories`, `models`) VALUES ('cead84cb-7d99-1b7f-b309-3a0ca885fbe5', 'CrossProcessDemo', 'CrossProcessDemo', 0, '[\r\n  \"AlarmHost\"\r\n]', NULL);
-        INSERT INTO `iot_server_product`(`id`, `name`, `display_name`, `enabled`, `categories`, `models`) VALUES ('e9d22150-a123-c88d-568e-3a0cd6d1b434', 'HoneywellOCX_IPM', 'HoneywellOCX_IPM', 1, '[\r\n  \"AlarmHost\"\r\n]', '[\r\n  \"Standard\",\r\n  \"PT_23\",\r\n  \"Vista120\",\r\n  \"Vista10P\",\r\n  \"Vista20P\",\r\n  \"Super_23\",\r\n  \"Vista_Super\"\r\n]');
-        INSERT INTO `iot_server_product`(`id`, `name`, `display_name`, `enabled`, `categories`, `models`) VALUES ('f6a73ea2-1cc7-d7ff-8018-3a0ad3408d98', 'DaHuaAlarmHost', 'DaHua报警主机', 1, '[\r\n  \"AlarmHost\"\r\n]', '[\r\n  \"ARC2008\",\r\n  \"ARC2016C\",\r\n  \"ARC2016C_V3\",\r\n  \"ARC9016C\",\r\n  \"ARC9016C_V3\"\r\n]');
-        INSERT INTO `iot_server_product`(`id`, `name`, `display_name`, `enabled`, `categories`, `models`) VALUES ('f81d4fae-7dec-11d0-a765-00a0c91e6bf6', 'FSU_RollingShutterDoor', 'FSU 卷帘门传感器', 1, '[\r\n  \"FSU\"\r\n]', '[\r\n  \"Normal\"\r\n]');
-        INSERT INTO `iot_server_product`(`id`, `name`, `display_name`, `enabled`, `categories`, `models`) VALUES ('f9c5d636-dac4-d515-dfbe-3a0d3da7d805', 'BOSCH_CMS', 'BOSCH_CMS报警主机', 1, '[\r\n  \"AlarmHost\"\r\n]', '[\r\n  \"CMS40\",\r\n	\"CMS41\"\r\n]');
-    end if;
-
+        IF NOT EXISTS(SELECT *
+                      FROM information_schema.columns
+                      WHERE table_schema = DATABASE()
+                        AND table_name = 'iot_server_product'
+                        AND column_name = 'models') THEN
+            ALTER TABLE  `iot_server_product`
+                ADD COLUMN `models` varchar(125) NULL AFTER `categories`;
+        END IF;
 
+        IF NOT EXISTS(SELECT *
+                      FROM information_schema.columns
+                      WHERE table_schema = DATABASE()
+                        AND table_name = 'iot_server_product'
+                        AND column_name = 'producer') THEN
+            ALTER TABLE  `iot_server_product`
+                ADD COLUMN `producer` varchar(125) NULL AFTER `models`;
+        END IF;
 
+        delete from iot_server_product;
+        INSERT INTO `iot_server_product`(`id`, `name`, `display_name`, `enabled`, `categories`, `models`, `producer`) VALUES ('01e50bb0-17cd-24bf-3db9-3a141541ea12', 'FSU_Theft', 'FSU 防盗传感器', 1, '[\r\n  \"FSU\"\r\n]', '[\r\n  \"Normal\"\r\n]', NULL);
+        INSERT INTO `iot_server_product`(`id`, `name`, `display_name`, `enabled`, `categories`, `models`, `producer`) VALUES ('055e9571-52b0-06ab-c359-3a14623b2d8d', 'FSU_DoPowerCollection', 'FSU 回路通电状态', 1, '[\r\n  \"FSU\"\r\n]', '[\r\n  \"Normal\"\r\n]', NULL);
+        INSERT INTO `iot_server_product`(`id`, `name`, `display_name`, `enabled`, `categories`, `models`, `producer`) VALUES ('06f8fc23-26c8-edc1-bd8b-3a141540c0fb', 'FSU_AirConditioner', 'FSU 空调', 1, '[\r\n  \"FSU\"\r\n]', '[\r\n  \"Normal\"\r\n]', NULL);
+        INSERT INTO `iot_server_product`(`id`, `name`, `display_name`, `enabled`, `categories`, `models`, `producer`) VALUES ('0a3fa02d-c677-4f8a-a053-4e30e592df7e', 'TALK_HOST', '对讲主机', 1, '[\r\n  \"Host_Talk\"\r\n]', '[\r\n  \"Normal\"\r\n]', NULL);
+        INSERT INTO `iot_server_product`(`id`, `name`, `display_name`, `enabled`, `categories`, `models`, `producer`) VALUES ('0f26e066-9e07-beb3-55bd-3a147bd0d913', 'FSU_DoPowerControlBoxButton', 'FSU DO8小时控电箱按钮', 1, '[\r\n  \"FSU\"\r\n]', '[\r\n  \"Normal\"\r\n]', NULL);
+        INSERT INTO `iot_server_product`(`id`, `name`, `display_name`, `enabled`, `categories`, `models`, `producer`) VALUES ('15367b47-d383-48aa-99ea-a1c5dc573056', 'FSU_DoPowerControl', 'FSU DO8小时控电', 1, '[\r\n  \"FSU\"\r\n]', '[\r\n  \"Normal\"\r\n]', NULL);
+        INSERT INTO `iot_server_product`(`id`, `name`, `display_name`, `enabled`, `categories`, `models`, `producer`) VALUES ('19ed86f7-780d-29ec-4bc7-3a13a7097ea1', 'VGSII_Hik', '海康视频存储设备2023年入围设备', 1, '[\r\n  \"Dvs\"\r\n]', '[\r\n  \"Hik\"\r\n]', '海康');
+        INSERT INTO `iot_server_product`(`id`, `name`, `display_name`, `enabled`, `categories`, `models`, `producer`) VALUES ('1b7adc13-af87-fe22-7d49-3a141540fad9', 'FSU_Water', 'FSU 水浸传感器', 1, '[\r\n  \"FSU\"\r\n]', '[\r\n  \"Normal\"\r\n]', NULL);
+        INSERT INTO `iot_server_product`(`id`, `name`, `display_name`, `enabled`, `categories`, `models`, `producer`) VALUES ('20fa2a1a-a069-4975-8d64-091a39539e02', 'DOOR_HOST', '门禁主机', 1, '[\r\n  \"Host_Door\"\r\n]', '[\r\n  \"Normal\"\r\n]', NULL);
+        INSERT INTO `iot_server_product`(`id`, `name`, `display_name`, `enabled`, `categories`, `models`, `producer`) VALUES ('2369b2eb-f0ae-7f68-f49c-3a0ad342f60a', 'InAnter_BM1600NTSmall', '英安特BM1600NTSmall报警主机', 1, '[\r\n  \"AlarmHost\"\r\n]', '[\r\n  \"GlobalNT2/NT3\"\r\n]', '英安特');
+        INSERT INTO `iot_server_product`(`id`, `name`, `display_name`, `enabled`, `categories`, `models`, `producer`) VALUES ('2f7b0f00-43b1-07b2-dfcd-3a0bba6d4ccb', 'Hik_DS19A', 'Hik_DS19A系列报警主机', 1, '[\r\n  \"AlarmHost\"\r\n]', '[\r\n  \"DS-19A\"\r\n]', '海康');
+        INSERT INTO `iot_server_product`(`id`, `name`, `display_name`, `enabled`, `categories`, `models`, `producer`) VALUES ('384287b5-f556-b9cc-e84e-3a1057095e04', 'HikModule', '海康报警网络模块', 1, '[\r\n  \"AlarmHost\"\r\n]', '[\r\n  \"Mta120\",\r\n	\"Mta128\"\r\n]', '海康报警网络模块');
+        INSERT INTO `iot_server_product`(`id`, `name`, `display_name`, `enabled`, `categories`, `models`, `producer`) VALUES ('51a1f179-8fcf-ea4f-988c-3a13f9904a04', 'FSU_Gateway', 'FSU主机', 1, '[\r\n  \"FSU\"\r\n]', '[\r\n  \"GXX-ZMAF-3100\"\r\n]', NULL);
+        INSERT INTO `iot_server_product`(`id`, `name`, `display_name`, `enabled`, `categories`, `models`, `producer`) VALUES ('54eb3a1c-8f7d-4b9e-9a5c-2e8f66750000', 'FSU_SmartMeter', 'FSU 智能电表', 1, '[\r\n  \"FSU\"\r\n]', '[\r\n  \"Normal\"\r\n]', NULL);
+        INSERT INTO `iot_server_product`(`id`, `name`, `display_name`, `enabled`, `categories`, `models`, `producer`) VALUES ('649e9822-b487-6b9f-865b-3a0ad341b9c0', 'FengYe_H402', '枫叶HD402报警主机', 1, '[\r\n  \"AlarmHost\"\r\n]', '[\r\n  \"HD402\"\r\n]', '枫叶');
+        INSERT INTO `iot_server_product`(`id`, `name`, `display_name`, `enabled`, `categories`, `models`, `producer`) VALUES ('6acce932-9e54-e3d3-5241-3a13d1d3584a', 'DetectionHost', '物联网主机产品,VIMD服务', 1, '[\r\n  \"DetectionHost\"\r\n]', '[\r\n  \"DetectionHost\"\r\n]', NULL);
+        INSERT INTO `iot_server_product`(`id`, `name`, `display_name`, `enabled`, `categories`, `models`, `producer`) VALUES ('6acce932-9e54-e3d3-5d4a-3a13d1d3584a', 'IoTServer', 'IoT内置产品,IoT服务', 1, '[\r\n  \"IoT\",\r\n  \"IoTServer\"\r\n]', '[\r\n  \"IoTServer\"\r\n]', NULL);
+        INSERT INTO `iot_server_product`(`id`, `name`, `display_name`, `enabled`, `categories`, `models`, `producer`) VALUES ('6ba7b810-9dad-11d1-80b4-00c04fd430c8', 'FSU_Infrared', 'FSU 红外传感器', 1, '[\r\n  \"FSU\"\r\n]', '[\r\n  \"Normal\"\r\n]', NULL);
+        INSERT INTO `iot_server_product`(`id`, `name`, `display_name`, `enabled`, `categories`, `models`, `producer`) VALUES ('73af892b-2bee-4126-b498-7460c483509d', 'FSU_ThreePhaseACVoltage', 'FSU 三相电电压传感器', 1, '[\r\n  \"FSU\"\r\n]', '[\r\n  \"Normal\"\r\n]', NULL);
+        INSERT INTO `iot_server_product`(`id`, `name`, `display_name`, `enabled`, `categories`, `models`, `producer`) VALUES ('783bb246-6ebe-7e69-e055-3a14adfe10c9', 'VGSII_DaHua_V1', '大华视频存储设备(通用设备)', 1, '[\r\n  \"Dvs\"\r\n]', '[\r\n  \"Normal\"\r\n]', '大华');
+        INSERT INTO `iot_server_product`(`id`, `name`, `display_name`, `enabled`, `categories`, `models`, `producer`) VALUES ('7a5f5e54-17d7-4c2e-99b2-e4d6181f8b62', 'FSU_Gas', 'FSU 燃气传感器', 1, '[\r\n  \"FSU\"\r\n]', '[\r\n  \"Normal\"\r\n]', NULL);
+        INSERT INTO `iot_server_product`(`id`, `name`, `display_name`, `enabled`, `categories`, `models`, `producer`) VALUES ('85659b02-4fe7-cb85-6b00-3a14153fec6e', 'FSU_Smoke', 'FSU 烟雾传感器', 1, '[\r\n  \"FSU\"\r\n]', '[\r\n  \"Normal\"\r\n]', NULL);
+        INSERT INTO `iot_server_product`(`id`, `name`, `display_name`, `enabled`, `categories`, `models`, `producer`) VALUES ('92467897-92ef-647f-e55e-3a13b7f3ca9a', 'VGSII_DaHua', '大华视频存储设备2023年入围设备', 1, '[\r\n  \"Dvs\"\r\n]', '[\r\n  \"DaHua\"\r\n]', '大华');
+        INSERT INTO `iot_server_product`(`id`, `name`, `display_name`, `enabled`, `categories`, `models`, `producer`) VALUES ('98308508-be46-8eb3-ff40-3a14153f55f9', 'FSU_TemperatureAndHumidity', 'FSU 温湿度传感器', 1, '[\r\n  \"FSU\"\r\n]', '[\r\n  \"Normal\"\r\n]', NULL);
+        INSERT INTO `iot_server_product`(`id`, `name`, `display_name`, `enabled`, `categories`, `models`, `producer`) VALUES ('a1ae8610-70d1-b856-5bdf-3a141540732d', 'FSU_Ups', 'UPS', 1, '[\r\n  \"FSU\"\r\n]', '[\r\n  \"Normal\"\r\n]', NULL);
+        INSERT INTO `iot_server_product`(`id`, `name`, `display_name`, `enabled`, `categories`, `models`, `producer`) VALUES ('abce638c-33c6-bc91-39dd-3a1415401bcd', 'FSU_DoorMagnetic', 'FSU 门磁传感器', 1, '[\r\n  \"FSU\"\r\n]', '[\r\n  \"Normal\"\r\n]', NULL);
+        INSERT INTO `iot_server_product`(`id`, `name`, `display_name`, `enabled`, `categories`, `models`, `producer`) VALUES ('bed76841-d3ee-2fd0-64ed-3a0d374167a5', 'HengTong_CKWU01C', '恒通CKWU01C报警主机', 1, '[\r\n  \"AlarmHost\"\r\n]', '[\r\n  \"CKWU01C\"\r\n]', '恒通');
+        INSERT INTO `iot_server_product`(`id`, `name`, `display_name`, `enabled`, `categories`, `models`, `producer`) VALUES ('ce00cabd-b2c2-8532-f56f-3a10556f2bfe', 'MtaOCX', '迈特安网络报警模块', 1, '[\r\n  \"AlarmHost\"\r\n]', '[\r\n  \"Mta120\",\r\n	\"Mta128\"\r\n]', '迈特安网络报警模块');
+        INSERT INTO `iot_server_product`(`id`, `name`, `display_name`, `enabled`, `categories`, `models`, `producer`) VALUES ('cead84cb-7d99-1b7f-b309-3a0ca885fbe5', 'CrossProcessDemo', 'CrossProcessDemo', 0, '[\r\n  \"AlarmHost\"\r\n]', NULL, NULL);
+        INSERT INTO `iot_server_product`(`id`, `name`, `display_name`, `enabled`, `categories`, `models`, `producer`) VALUES ('e9d22150-a123-c88d-568e-3a0cd6d1b434', 'HoneywellOCX_IPM', 'HoneywellOCX_IPM', 1, '[\r\n  \"AlarmHost\"\r\n]', '[\r\n  \"Standard\",\r\n  \"PT_23\",\r\n  \"Vista120\",\r\n  \"Vista10P\",\r\n  \"Vista20P\",\r\n  \"Super_23\",\r\n  \"Vista_Super\"\r\n]', '霍尼韦尔');
+        INSERT INTO `iot_server_product`(`id`, `name`, `display_name`, `enabled`, `categories`, `models`, `producer`) VALUES ('f6a73ea2-1cc7-d7ff-8018-3a0ad3408d98', 'DaHuaAlarmHost', 'DaHua报警主机', 1, '[\r\n  \"AlarmHost\"\r\n]', '[\r\n  \"ARC2008\",\r\n  \"ARC2016C\",\r\n  \"ARC2016C_V3\",\r\n  \"ARC9016C\",\r\n  \"ARC9016C_V3\"\r\n]', '大华');
+        INSERT INTO `iot_server_product`(`id`, `name`, `display_name`, `enabled`, `categories`, `models`, `producer`) VALUES ('f81d4fae-7dec-11d0-a765-00a0c91e6bf6', 'FSU_RollingShutterDoor', 'FSU 卷帘门传感器', 1, '[\r\n  \"FSU\"\r\n]', '[\r\n  \"Normal\"\r\n]', NULL);
+        INSERT INTO `iot_server_product`(`id`, `name`, `display_name`, `enabled`, `categories`, `models`, `producer`) VALUES ('f9c5d636-dac4-d515-dfbe-3a0d3da7d805', 'BOSCH_CMS', 'BOSCH_CMS报警主机', 1, '[\r\n  \"AlarmHost\"\r\n]', '[\r\n  \"CMS40\",\r\n	\"CMS41\"\r\n]', '博世');
 
         IF NOT EXISTS(SELECT *
                       FROM information_schema.columns

+ 1 - 1
soc-api/soc-api-system/src/main/java/com/xunmei/system/api/RemoteHostService.java

@@ -62,6 +62,6 @@ public interface RemoteHostService {
     @PostMapping("/syncRule/{id}")
     AjaxResult syncAlarmRuleToHost(@PathVariable("id") Long id);
 
-    @PostMapping("/syncDevice/{id}")
+    @GetMapping("/syncDevice/{id}")
     AjaxResult syncDeviceToHost(@PathVariable("id") Long id);
 }

+ 2 - 0
soc-common/soc-common-core/src/main/java/com/xunmei/common/core/domain/iot/domain/IotServerProduct.java

@@ -43,5 +43,7 @@ public class IotServerProduct implements Serializable {
     @TableField("models")
     private String Models;
 
+    @TableField("producer")
+    private String producer;
 
 }

+ 2 - 0
soc-modules/soc-modules-host/src/main/java/com/xunmei/host/iot/mapper/IotDeviceInfoExtendMapper.java

@@ -8,4 +8,6 @@ public interface IotDeviceInfoExtendMapper extends BaseMapper<IotDeviceInfoExten
     IotDeviceInfoExtend selectByProductDeviceNameAndToken(@Param("token") String token, @Param("deviceTypeCode") String deviceTypeCode, @Param("deviceName") String deviceName);
 
     void deleteDeviceExtendByTokenAndDeviceType(@Param("token") String token,@Param("deviceType") String deviceType);
+
+    void deletedExtendByDeviceId(@Param("deviceId") Long deviceId);
 }

+ 6 - 0
soc-modules/soc-modules-host/src/main/java/com/xunmei/host/iot/mapper/IotDeviceInfoMapper.java

@@ -1,6 +1,7 @@
 package com.xunmei.host.iot.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.xunmei.common.core.domain.device.domain.SysMultiLayerDictionary;
 import com.xunmei.system.api.domain.iot.IotDeviceInfo;
 import org.apache.ibatis.annotations.Param;
 
@@ -13,4 +14,9 @@ public interface IotDeviceInfoMapper extends BaseMapper<IotDeviceInfo> {
     void batchUpdate(@Param("list") List<IotDeviceInfo> collect);
 
     List<IotDeviceInfo> selectLoopList(@Param("orgId") Long orgId);
+
+    SysMultiLayerDictionary selectSysMultiLayerDictionaryById(@Param("id") Long id);
+
+    void updateDvsAndChannelDeleted(@Param("iotCode") String iotCode, @Param("deviceCode") String deviceCode);
+
 }

+ 2 - 0
soc-modules/soc-modules-host/src/main/java/com/xunmei/host/iot/service/IIotDeviceInfoExtendService.java

@@ -39,4 +39,6 @@ public interface IIotDeviceInfoExtendService extends IService<IotDeviceInfoExten
 
     IotDeviceInfoExtend selectByProductDeviceNameAndToken(String token, String deviceTypeCode, String deviceName);
 
+    void deletedExtendByDeviceId(Long deviceId);
+
 }

+ 5 - 0
soc-modules/soc-modules-host/src/main/java/com/xunmei/host/iot/service/impl/IotDeviceInfoExtendServiceImpl.java

@@ -91,4 +91,9 @@ public class IotDeviceInfoExtendServiceImpl extends ServiceImpl<IotDeviceInfoExt
     public IotDeviceInfoExtend selectByProductDeviceNameAndToken(String token, String deviceTypeCode, String deviceName) {
         return baseMapper.selectByProductDeviceNameAndToken(token,deviceTypeCode,deviceName);
     }
+
+    @Override
+    public void deletedExtendByDeviceId(Long deviceId) {
+        baseMapper.deletedExtendByDeviceId(deviceId);
+    }
 }

+ 79 - 8
soc-modules/soc-modules-host/src/main/java/com/xunmei/host/iot/service/impl/IotDeviceInfoServiceImpl.java

@@ -9,8 +9,10 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.baomidou.mybatisplus.core.toolkit.IdWorker;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.google.common.collect.Lists;
 import com.xunmei.common.core.constant.Constants;
 import com.xunmei.common.core.constant.ErrorMsgConstants;
+import com.xunmei.common.core.domain.device.domain.SysMultiLayerDictionary;
 import com.xunmei.common.core.domain.iot.domain.IotAlarmDefenceArea;
 import com.xunmei.common.core.domain.iot.domain.IotAlarmSubsystem;
 import com.xunmei.common.core.domain.iot.domain.IotServerInfo;
@@ -71,7 +73,6 @@ public class IotDeviceInfoServiceImpl extends ServiceImpl<IotDeviceInfoMapper, I
 
     @Autowired
     private IIotDeviceInfoExtendService iIotDeviceInfoExtendService;
-
     @Autowired
     private IotServerInfoService iotServerInfoService;
     @Autowired
@@ -348,6 +349,7 @@ public class IotDeviceInfoServiceImpl extends ServiceImpl<IotDeviceInfoMapper, I
         result.add(WebSocketConstants.DEVICES_EVENT);
         //设备状态数据
         result.add(WebSocketConstants.DEVICES_STATUS_EVENT);
+        result.add(WebSocketConstants.INCREMENT_DEVICES_EVENT);
         return result.toString();
     }
 
@@ -379,6 +381,12 @@ public class IotDeviceInfoServiceImpl extends ServiceImpl<IotDeviceInfoMapper, I
                     List<DeviceStatusInfo> statusInfos = dataArray.toJavaList(DeviceStatusInfo.class);
                     deviceStatusChange(statusInfos, serverInfo);
                     break;
+                case WebSocketConstants.INCREMENT_DEVICES_EVENT:
+                    List<DvsBaseInfo> list = dataArray.toJavaList(DvsBaseInfo.class);
+
+                    List<IotDeviceInfo> syncDeviceList = new ArrayList<>();
+                    handleIncrementDevices(list, serverInfo, syncDeviceList);
+                    break;
                 default:
                     return WebsocketResult.replyError(req, ErrorMsgConstants.ERROR_ROUTE);
             }
@@ -389,6 +397,58 @@ public class IotDeviceInfoServiceImpl extends ServiceImpl<IotDeviceInfoMapper, I
         return WebsocketResult.replySuccess(req);
     }
 
+    private void handleIncrementDevices(List<DvsBaseInfo> list, IotServerInfo serverInfo, List<IotDeviceInfo> syncToAssetDeviceList) {
+        //添加通道类设备集合
+        List<IotDeviceInfo> addChnnelList = new ArrayList<>();
+        //更新通道类设备集合
+        List<IotDeviceInfo> updateChnnelList = new ArrayList<>();
+        for (DvsBaseInfo baseInfo : list) {
+            baseMapper.updateDvsAndChannelDeleted(serverInfo.getIotCode(), baseInfo.getDeviceCode());
+            String code = BaseDeviceTypeEnum.valueOf(baseInfo.getType()).getCode();
+            IotDeviceInfo hostInfo = selectByTypeAndCode(serverInfo.getIotCode(), code, baseInfo.getProductName(), baseInfo.getDeviceCode());
+            if (ObjectUtil.isNull(hostInfo)) {
+                hostInfo = createHostInfo(baseInfo, serverInfo, code);
+                save(hostInfo);
+            } else {
+                updateHostInfo(baseInfo, hostInfo, code);
+                updateById(hostInfo);
+            }
+            updateCache(hostInfo, 1);
+            //删除主机扩展信息
+            iIotDeviceInfoExtendService.deletedExtendByDeviceId(hostInfo.getId());
+
+            IotDeviceInfoExtend extend = iIotDeviceInfoExtendService.selectByProductDeviceNameAndToken(serverInfo.getIotCode(), code, baseInfo.getDeviceCode());
+            if (extend == null) {
+                final IotDeviceInfoExtend infoExtend = createIotDeviceInfoExtend(baseInfo, hostInfo.getId(), serverInfo.getIotCode());
+                iIotDeviceInfoExtendService.save(infoExtend);
+            } else {
+                dealDvsExtend(baseInfo, extend);
+                iIotDeviceInfoExtendService.updateById(extend);
+            }
+            syncToAssetDeviceList.add(hostInfo);
+            List<SubDeviceInfo> subDeviceList = baseInfo.getSubDevices();
+            if (ObjectUtil.isEmpty(subDeviceList)) {
+                continue;
+            }
+
+            //处理通道信息
+            for (SubDeviceInfo subDeviceInfo : subDeviceList) {
+                IotDeviceInfo channelInfo = selectByTypeAndHostAndCode(serverInfo.getIotCode(), subDeviceInfo.getParentCode(), baseInfo.getProductName(), subDeviceInfo.getDeviceCode());
+                if (ObjectUtil.isNull(channelInfo)) {
+                    channelInfo = createChannelInfo(subDeviceInfo, serverInfo, hostInfo);
+                    addChnnelList.add(channelInfo);
+                } else {
+                    updateChannelInfo(subDeviceInfo, channelInfo, hostInfo);
+                    updateChnnelList.add(channelInfo);
+                }
+                updateCache(channelInfo, 2);
+            }
+        }
+        batchDealIotDeviceInfo(Lists.newLinkedList(), addChnnelList, true);
+        batchDealIotDeviceInfo(Lists.newLinkedList(), updateChnnelList, false);
+    }
+
+
     private void handelAssetDeviceInfo(List<IotDeviceInfo> syncToAssetDeviceList) {
         if (syncToAssetDeviceList.isEmpty()) {
             return;
@@ -904,7 +964,7 @@ public class IotDeviceInfoServiceImpl extends ServiceImpl<IotDeviceInfoMapper, I
                 break;
             case Host_Talk:
             case Host_Door:
-                param = getNetDeviceJson(deviceInfo,deviceTypeEnum);
+                param = getNetDeviceJson(deviceInfo, deviceTypeEnum);
                 break;
             default:
                 break;
@@ -913,7 +973,7 @@ public class IotDeviceInfoServiceImpl extends ServiceImpl<IotDeviceInfoMapper, I
             return;
         }
         final String topic = TopicTypeEnums.formatUrl(TopicTypeEnums.PRODUCT_SERVICE_INVOKE.getUrl(), WebSocketConstants.DETECTION_HOST, WebSocketConstants.DETECTION_HOST_DEVICE);
-        final WebsocketResult result = WebsocketResult.invokeHostServer(topic, new JSONObject(), WebSocketConstants.GET_DEVICES_SERVICES, param);
+        final WebsocketResult result = WebsocketResult.invokeHostServer(topic, new JSONObject(), WebSocketConstants.PUSH_DEVICES_SERVICES, param);
         final Set<String> set = websocketService.getAllIotCode();
         if (set.isEmpty()) {
             return;
@@ -926,10 +986,21 @@ public class IotDeviceInfoServiceImpl extends ServiceImpl<IotDeviceInfoMapper, I
 
     private JSONObject getDvsJson(IotDeviceInfo deviceInfo) {
         final IotDeviceInfoExtend extend = iIotDeviceInfoExtendService.selectByDeviceId(deviceInfo.getId());
-        final JSONObject obj = JSONObject.parseObject(JSON.toJSONString(deviceInfo));
-        obj.put("deviceType", BaseDeviceTypeEnum.Dvs.name());
-        obj.put("extend", extend);
-        return obj;
+        return deviceInfoToJSB(deviceInfo, extend);
+    }
+
+    private JSONObject deviceInfoToJSB(IotDeviceInfo iotDeviceInfo, IotDeviceInfoExtend extend) {
+        JSONObject jsonObject = new JSONObject();
+        jsonObject.put("deviceType", BaseDeviceTypeEnum.Dvs.name());
+        jsonObject.put("deviceProduct", iotDeviceInfo.getDeviceProduct());
+        final SysMultiLayerDictionary dictionary = baseMapper.selectSysMultiLayerDictionaryById(iotDeviceInfo.getDeviceBrand());
+        jsonObject.put("deviceBrand", dictionary == null ? StringUtil.EMPTY_STRING : dictionary.getName());
+        jsonObject.put("deviceModel", iotDeviceInfo.getDeviceModel());
+        jsonObject.put("deviceCode", iotDeviceInfo.getDeviceCode());
+        jsonObject.put("deviceName", iotDeviceInfo.getDeviceName());
+        jsonObject.put("enable", iotDeviceInfo.getEnable());
+        jsonObject.put("extend", extend);
+        return jsonObject;
     }
 
     private JSONObject getAlarmHostJson(IotDeviceInfo deviceInfo) {
@@ -949,7 +1020,7 @@ public class IotDeviceInfoServiceImpl extends ServiceImpl<IotDeviceInfoMapper, I
         return obj;
     }
 
-    private JSONObject getNetDeviceJson(IotDeviceInfo deviceInfo,BaseDeviceTypeEnum deviceTypeEnum) {
+    private JSONObject getNetDeviceJson(IotDeviceInfo deviceInfo, BaseDeviceTypeEnum deviceTypeEnum) {
         final IotDeviceInfoExtend extend = iIotDeviceInfoExtendService.selectByDeviceId(deviceInfo.getId());
         final JSONObject obj = JSONObject.parseObject(JSON.toJSONString(deviceInfo));
         obj.put("deviceType", deviceTypeEnum.name());

+ 1 - 1
soc-modules/soc-modules-host/src/main/java/com/xunmei/host/north/controller/HostController.java

@@ -111,7 +111,7 @@ public class HostController {
         return AjaxResult.success();
     }
 
-    @PostMapping("/syncDevice/{id}")
+    @GetMapping("/syncDevice/{id}")
     AjaxResult syncDeviceToHost(@PathVariable("id") Long id) {
         deviceInfoService.syncDeviceToHost(id);
         return AjaxResult.success();

+ 8 - 0
soc-modules/soc-modules-host/src/main/java/com/xunmei/host/websocket/constant/WebSocketConstants.java

@@ -148,6 +148,14 @@ public interface WebSocketConstants {
      */
     String DEVICES_EVENT = "devices";
     /**
+     * 平台推送主机基础信息 服务名称
+     */
+    String PUSH_DEVICES_SERVICES = "pushDevice";
+    /**
+     * 增量设备数据 上送平台
+     */
+    String INCREMENT_DEVICES_EVENT = "incrementDevices";
+    /**
      * 主机主动上报 设备网络状态 事件名称
      */
     String DEVICES_STATUS_EVENT = "deviceStatus";

+ 4 - 7
soc-modules/soc-modules-host/src/main/java/com/xunmei/host/websocket/service/impl/WebsocketServiceImpl.java

@@ -1,5 +1,6 @@
 package com.xunmei.host.websocket.service.impl;
 
+import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.xunmei.common.core.domain.iot.domain.IotWebsocketMsg;
 import com.xunmei.common.redis.utils.RedisUtils;
@@ -11,22 +12,19 @@ import com.xunmei.host.websocket.holder.WebSocketSessionHolder;
 import com.xunmei.host.websocket.redis.WebsocketPublisher;
 import com.xunmei.host.websocket.service.WebsocketService;
 import com.xunmei.system.api.domain.websocket.RedisWebsocketMsg;
+import com.xunmei.system.api.util.LogUtils;
 import org.redisson.api.RKeys;
 import org.redisson.api.RedissonClient;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.annotation.Lazy;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
 import java.util.HashSet;
-import java.util.Iterator;
 import java.util.Set;
 
 @Service
 public class WebsocketServiceImpl implements WebsocketService {
-    private static final Logger log = LoggerFactory.getLogger(WebsocketServiceImpl.class);
     @Autowired
     private WebsocketPublisher websocketPublisher;
     @Resource
@@ -41,6 +39,7 @@ public class WebsocketServiceImpl implements WebsocketService {
         if (set.isEmpty()) {
             return;
         }
+        LogUtils.WEBSOCKET_MSG.info("获取设备基础信息,目标主机code:{}", JSON.toJSONString(set));
         for (String token : set) {
             final IotWebsocketMsg iotWebsocketMsg = websocketMsgService.proactiveSendAndSaveMsg(token, result);
             sendMsgByTokens(iotWebsocketMsg, token);
@@ -83,9 +82,7 @@ public class WebsocketServiceImpl implements WebsocketService {
         RKeys keys = client.getKeys();
         Iterable<String> keyTokens = keys.getKeysByPattern(WebSocketSessionHolder.REDIS_TOPIC_WEBSOCKET_TOKEN + "*");
         Set<String> tokens = new HashSet();
-        Iterator kts = keyTokens.iterator();
-        while (kts.hasNext()) {
-            String keyToken = (String) kts.next();
+        for (String keyToken : keyTokens) {
             String token = (String) RedisUtils.getCacheObject(keyToken);
             tokens.add(token);
         }

+ 3 - 0
soc-modules/soc-modules-host/src/main/resources/mapper/IotDeviceInfoExtendMapper.xml

@@ -20,4 +20,7 @@
                     iot_token = #{token} and device_type = #{deviceType}
             )
     </update>
+    <update id="deletedExtendByDeviceId">
+        UPDATE  iot_device_info_extend SET deleted = 1 where device_id = #{deviceId}
+    </update>
 </mapper>

+ 12 - 0
soc-modules/soc-modules-host/src/main/resources/mapper/IotDeviceInfoMapper.xml

@@ -51,4 +51,16 @@
           and d.deleted = 0
           and s.org_id=#{orgId}
     </select>
+
+    <select id="selectSysMultiLayerDictionaryById"
+            resultType="com.xunmei.common.core.domain.device.domain.SysMultiLayerDictionary">
+        select * from sys_multi_layer_dictionary where id=#{id}
+    </select>
+    <delete id="updateDvsAndChannelDeleted" >
+        update
+            iot_device_info
+        set deleted = 1
+        where iot_token = #{iotCode}
+          and (device_code = #{deviceCode} or host_code = #{deviceCode})
+    </delete>
 </mapper>

+ 7 - 0
soc-modules/soc-modules-iot/src/main/java/com/xunmei/iot/mapper/IotDeviceInfoMapper.java

@@ -2,6 +2,8 @@ package com.xunmei.iot.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.xunmei.common.core.domain.device.domain.SysMultiLayerDictionary;
+import com.xunmei.common.core.domain.iot.domain.IotServerProduct;
 import com.xunmei.iot.dto.deviceInfo.IotDeviceInfoPageDto;
 import com.xunmei.iot.vo.deviceInfo.DeviceDetailInfoVo;
 import com.xunmei.iot.vo.deviceInfo.IotDeviceInfoPageVo;
@@ -24,4 +26,9 @@ public interface IotDeviceInfoMapper extends BaseMapper<IotDeviceInfo> {
     List<DeviceDetailInfoVo> getByProductTypes(@Param("productTypes") List<String> productTypes,@Param("orgPath") String orgPath);
 
     List<DeviceDetailInfoVo> getByProductTypesAndOrgId(@Param("productTypes") List<String> productTypes,@Param("orgId") Long orgId);
+
+    IotServerProduct selectProduct(@Param("deviceProduct") String deviceProduct);
+
+    SysMultiLayerDictionary selectMultiLayerDictionaryByName(@Param("name") String name);
+
 }

+ 7 - 0
soc-modules/soc-modules-iot/src/main/java/com/xunmei/iot/service/impl/IotDeviceInfoServiceImpl.java

@@ -11,6 +11,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.xunmei.common.core.constant.Constants;
 import com.xunmei.common.core.constant.RedisConstant;
 import com.xunmei.common.core.constant.SecurityConstants;
+import com.xunmei.common.core.domain.device.domain.SysMultiLayerDictionary;
 import com.xunmei.common.core.domain.iot.domain.IotAlarmDefenceArea;
 import com.xunmei.common.core.domain.iot.domain.IotAlarmSubsystem;
 import com.xunmei.common.core.domain.iot.domain.IotServerProduct;
@@ -229,11 +230,17 @@ public class IotDeviceInfoServiceImpl extends ServiceImpl<IotDeviceInfoMapper, I
         if (ObjectUtil.isEmpty(deviceInfo.getDeviceCode())) {
             deviceInfo.setDeviceCode(generalDeviceCode(BaseDeviceTypeEnum.Dvs, null));
         }
+        IotServerProduct product = baseMapper.selectProduct(req.getDeviceProduct());
+        SysMultiLayerDictionary dictionary = baseMapper.selectMultiLayerDictionaryByName(product.getName());
+        if (dictionary!=null){
+            deviceInfo.setDeviceBrand(dictionary.getId());
+        }
         deviceInfo.setDeviceModel(req.getModels());
         deviceInfo.setIotToken(req.getIotCode());
         deviceInfo.setOrgId(req.getOrgId());
         deviceInfo.setEnable(req.getEnable());
         deviceInfo.setDeleted(0);
+        deviceInfo.setNetStatus("0");
         deviceInfo.setUpdateTime(new Date());
         deviceInfo.setUpdateBy(SecurityUtils.getLoginUser().getSysUser().getName());
         deviceInfo.setOrgName(sysOrg.getShortName());

+ 9 - 0
soc-modules/soc-modules-iot/src/main/resources/mapper/IotDeviceInfoMapper.xml

@@ -112,4 +112,13 @@
                 </foreach>
             </if>
     </select>
+
+    <select id="selectProduct" resultType="com.xunmei.common.core.domain.iot.domain.IotServerProduct">
+        select * from iot_server_product where name=#{deviceProduct} limit 1
+    </select>
+
+    <select id="selectMultiLayerDictionaryByName"
+            resultType="com.xunmei.common.core.domain.device.domain.SysMultiLayerDictionary">
+        select * from sys_multi_layer_dictionary where name=#{name} limit 1
+    </select>
 </mapper>