diff --git a/.idea/httpRequests/http-requests-log.http b/.idea/httpRequests/http-requests-log.http index d0be8a9..79f18e1 100644 --- a/.idea/httpRequests/http-requests-log.http +++ b/.idea/httpRequests/http-requests-log.http @@ -1,284 +1,156 @@ -POST http://localhost:9601/monitorPlatform/selectLatestDataByTags - -<> 2023-09-13T061701.200.json - -### - -POST http://localhost:9601/monitorPlatform/selectLatestDataByTags - -<> 2023-09-13T061655.200.json - -### - -POST http://localhost:9601/monitorPlatform/selectLatestDataByTags - -<> 2023-09-13T061503.200.json - -### - -POST http://localhost:9601/monitorPlatform/selectLatestDataByTags - -<> 2023-09-13T061452.200.json - -### - -POST http://localhost:9601/monitorPlatform/SelectSecne - -<> 2023-09-13T061340.200.json - -### - -POST http://localhost:9601/monitorPlatform/SelectSecne - -<> 2023-09-13T061335.200.json - -### - -POST http://localhost:9601/monitorPlatform/getDeviceOperations - -<> 2023-09-13T061308.200.json - -### - -POST http://localhost:9601/monitorPlatform/getDeviceOperations - -<> 2023-09-13T061257.200.json - -### - -POST http://localhost:9601/monitorPlatform/SelectSecne - -<> 2023-09-13T061249.200.json - -### - -POST http://localhost:9601/monitorPlatform/selectLatestDataByTags - -<> 2023-09-13T061231.200.json - -### - -POST http://localhost:9601/monitorPlatform/selectMonitorUnitSub - -### - -POST http://localhost:9601/monitorPlatform/ElectronicNumVo - -<> 2023-09-13T061202.200.json - -### - -POST http://localhost:9601/monitorPlatform/SubDevice -{: -{"sceneId": "123"} -}: - -<> 2023-09-13T061009.400.html - -### - -POST http://localhost:9601/monitorPlatform/SubDevice -{"sceneId": "123"} -<> 2023-09-13T060718.200.json: -<> 2023-09-13T060624.200.json: - -<> 2023-09-13T060937.400.html - -### - -POST http://localhost:9601/monitorPlatform/SubDevice -{sceneId: 123} -<> 2023-09-13T060718.200.json: -<> 2023-09-13T060624.200.json: - -<> 2023-09-13T060905.400.html - -### - -POST http://localhost:9601/monitorPlatform/SubDevice - -<> 2023-09-13T060718.200.json - -### - -POST http://localhost:9601/monitorPlatform/SubDevice - -<> 2023-09-13T060624.200.json - -### - -GET http://localhost:9601/monitorPlatform/alarmStats - -<> 2023-09-13T060618.200.json - -### - -POST http://localhost:9601/monitorPlatform/limitSubMonitorUnit - -<> 2023-09-13T060616.200.json - -### - -GET http://localhost:9601/monitorPlatform/alarmStats - -<> 2023-09-13T060506.200.json - -### - -POST http://localhost:9601/monitorPlatform/limitSubMonitorUnit - -<> 2023-09-13T060502.200.json - -### - -GET http://localhost:9601/monitorPlatform/sceneAllNums - -<> 2023-09-13T060450.200.json - -### - -GET http://localhost:9601/monitorPlatform/sceneAllNums - -<> 2023-09-13T060330.200.json - -### - -GET http://localhost:9601/monitorPlatform/allNums - -<> 2023-09-13T060322.200.json - -### - -GET http://localhost:9601/monitorPlatform/allNums - -<> 2023-09-13T060138.200.json - -### - -GET http://localhost:9601/monitorPlatform/allNums - -<> 2023-09-13T055901.200.json - -### - -GET http://localhost:9601/monitorPlatform/allNums - -<> 2023-09-13T055320.200.json - -### - -GET http://localhost:9601/monitorPlatform/allNums - -<> 2023-09-13T055144.200.json - -### - -GET http://localhost:9601/monitorPlatform/monitorUnitPercentage - -<> 2023-09-13T051210.200.json - -### - -GET http://localhost:9601/monitorPlatform/alarmStats - -<> 2023-09-13T051159.200.json - -### - -GET http://localhost:9601/monitorPlatform/alarmStats - -<> 2023-09-13T050258.200.json - -### - GET http://localhost:9601/monitorPlatform/monitorPercentage +Connection: Keep-Alive +User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.8) +Accept-Encoding: br,deflate,gzip,x-gzip -<> 2023-09-13T044426.200.json - -### - -GET http://localhost:9601/monitorPlatform/monitorPercentage - -<> 2023-09-13T044310.200.json +<> 2023-09-14T085602.200.json ### GET http://localhost:9601/monitorPlatform/monitorUnitPercentage +Connection: Keep-Alive +User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.8) +Accept-Encoding: br,deflate,gzip,x-gzip -<> 2023-09-13T044215.200.json - -### - -GET http://localhost:9601/monitorPlatform/monitorPercentage - -<> 2023-09-13T044040.200.json - -### - -GET http://localhost:9601/monitorPlatform/monitorPercentage - -<> 2023-09-13T042534.200.json - -### - -GET http://localhost:9601/monitorPlatform/monitorPercentage - -<> 2023-09-13T041522.200.json - -### - -GET http://localhost:9601/monitorPlatform/monitorUnitPercentage - -<> 2023-09-13T041504.200.json - -### - -GET http://localhost:9601/monitorPlatform/monitorUnitPercentage - -<> 2023-09-13T035712.200.json - -### - -POST http://localhost:9601/monitorPlatform/selectDeviceByDeviceModeByMonitorUnitId -{21321321}: - -<> 2023-09-13T035612.400.html - -### - -GET http://localhost:9601/monitorPlatform/monitorUnitPercentage - -<> 2023-09-13T035551.200.json - -### - -GET http://localhost:9601/monitorPlatform/monitorUnitPercentage - -<> 2023-09-13T035541.200.json +<> 2023-09-14T085533.200.json ### POST http://localhost:9601/monitorPlatform/treeList +Content-Length: 0 +Connection: Keep-Alive +User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.8) +Accept-Encoding: br,deflate,gzip,x-gzip -<> 2023-09-13T035533.200.json +<> 2023-09-14T085526.200.json ### -GET http://localhost:9601/tenant/list +POST http://localhost:9602/tdengine/addSuperTableColumn +Content-Type: application/json +Content-Length: 148 +Connection: Keep-Alive +User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.8) +Accept-Encoding: br,deflate,gzip,x-gzip -<> 2023-09-11T045735.200.json +{ + "databaseName": "db_scene_1", + "superTableName": "st_ds34", + "field": { + "fieldName": "ttttt", + "dataTypeCode": 10, + "size":100 + } +} + +<> 2023-09-13T172758.200.json ### -GET http://localhost:9601/monitorUnit/alarmStats +POST http://localhost:9602/tdengine/addSuperTableColumn +Content-Type: application/json +Content-Length: 149 +Connection: Keep-Alive +User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.8) +Accept-Encoding: br,deflate,gzip,x-gzip -<> 2023-09-11T045659.200.json +{ + "databaseName": "db_scene_1", + "superTableName": "st_ds_34", + "field": { + "fieldName": "ttttt", + "dataTypeCode": 10, + "size":100 + } +} + +<> 2023-09-13T172744.200.json ### -POST http://localhost:9601/monitorUnit/SelectSecne +POST http://localhost:9602/tdengine/dropSuperTableColumn +Content-Type: application/json +Content-Length: 110 +Connection: Keep-Alive +User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.8) +Accept-Encoding: br,deflate,gzip,x-gzip -<> 2023-09-11T045623.200.json +{"databaseName":"db_scene_1", + "superTableName":"st_devicemode_37", + "field": { + "fieldName": "ddd" + } +} + +<> 2023-09-13T165010.200.json + +### + +POST http://localhost:9602/tdengine/dropSuperTableColumn +Content-Type: application/json +Content-Length: 124 +Connection: Keep-Alive +User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.8) +Accept-Encoding: br,deflate,gzip,x-gzip + +{"databaseName":"test", + "superTableName":"supertable1", + "field": { + "fieldName": "ttttt", + "dataTypeCode": 3 + } +} + +<> 2023-09-13T160812.200.json + +### + +GET http://localhost:9601/monitorUnit/monitorUnitPercentage +Connection: Keep-Alive +User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.8) +Accept-Encoding: br,deflate,gzip,x-gzip + +<> 2023-09-13T160602.200.json + +### + +GET http://localhost:9601/monitorUnit/monitorUnitPercentage +Connection: Keep-Alive +User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.8) +Accept-Encoding: br,deflate,gzip,x-gzip + +<> 2023-09-13T160600.200.json + +### + +GET http://localhost:9601/monitorUnit/monitorUnitPercentage +Connection: Keep-Alive +User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.8) +Accept-Encoding: br,deflate,gzip,x-gzip + +<> 2023-09-13T155532.200.json + +### + +GET http://localhost:9201/config/configKeyStr/hw.gps.longitude +Content-Length: 18 +Content-Type: */*; charset=UTF-8 +Connection: Keep-Alive +User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.8) +Accept-Encoding: br,deflate,gzip,x-gzip + +"hw.gps.longitude" + +<> f.txt + +### + +GET http://localhost:9601/deviceModeFunction/getDeviceModeParameters/1 +Connection: Keep-Alive +User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.8) +Accept-Encoding: br,deflate,gzip,x-gzip + +<> 2023-09-12T110359.200.json ### @@ -316,3 +188,948 @@ Accept-Encoding: br,deflate,gzip,x-gzip ### +POST http://localhost:9602/tdengine/getOnlineDevicesGroupByDay +Content-Type: application/json +Content-Length: 71 +Connection: Keep-Alive +User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.8) +Accept-Encoding: br,deflate,gzip,x-gzip + +{ + "params": { "beginTime":1666666666666,"endTime":1766666666666 } + +} + +<> 2023-09-05T151121.200.json + +### + +POST http://localhost:9602/tdengine/getOnlineDevicesGroupByDay +Content-Type: application/json +Content-Length: 71 +Connection: Keep-Alive +User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.8) +Accept-Encoding: br,deflate,gzip,x-gzip + +{ + "params": { "beginTime":1666666666666,"endTime":1766666666666 } + +} + +<> 2023-09-05T151106.200.json + +### + +POST http://localhost:9602/tdengine/getOnlineDevicesGroupByDay +Content-Type: application/json +Content-Length: 102 +Connection: Keep-Alive +User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.8) +Accept-Encoding: br,deflate,gzip,x-gzip + +{ + "params": {"superTableName":"st_ds_1", + "beginTime":1666666666666,"endTime":1766666666666 } + +} + +<> 2023-09-05T150635.200.json + +### + +POST http://localhost:9602/tdengine/getOnlineDevicesGroupByDay +Content-Type: application/json +Content-Length: 102 +Connection: Keep-Alive +User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.8) +Accept-Encoding: br,deflate,gzip,x-gzip + +{ + "params": {"superTableName":"st_ds_1", + "beginTime":1666666666666,"endTime":1766666666666 } + +} + +<> 2023-09-05T150420.200.json + +### + +POST http://localhost:9602/tdengine/insertTable +Content-Type: application/json +Content-Length: 292 +Connection: Keep-Alive +User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.8) +Accept-Encoding: br,deflate,gzip,x-gzip + +{ + "databaseName": "db_hwsaas", + "tableName": "t_ds_4", + "schemaFields": [ + { + "fieldName": "onlineStatus", + "fieldValue": 0 + }, + { + "fieldName": "deviceType", + "fieldValue": 1 + }, + { + "fieldName": "ts", + "fieldValue": 1693683999996 + } + ] +} + +<> 2023-09-05T150015.200.json + +### + +POST http://localhost:9602/tdengine/insertTable +Content-Type: application/json +Content-Length: 292 +Connection: Keep-Alive +User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.8) +Accept-Encoding: br,deflate,gzip,x-gzip + +{ + "databaseName": "db_hwsaas", + "tableName": "t_ds_4", + "schemaFields": [ + { + "fieldName": "onlineStatus", + "fieldValue": 0 + }, + { + "fieldName": "deviceType", + "fieldValue": 1 + }, + { + "fieldName": "ts", + "fieldValue": 1693583999996 + } + ] +} + +<> 2023-09-05T150007.200.json + +### + +POST http://localhost:9602/tdengine/insertTable +Content-Type: application/json +Content-Length: 292 +Connection: Keep-Alive +User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.8) +Accept-Encoding: br,deflate,gzip,x-gzip + +{ + "databaseName": "db_hwsaas", + "tableName": "t_ds_4", + "schemaFields": [ + { + "fieldName": "onlineStatus", + "fieldValue": 0 + }, + { + "fieldName": "deviceType", + "fieldValue": 1 + }, + { + "fieldName": "ts", + "fieldValue": 1693582999996 + } + ] +} + +<> 2023-09-05T150004.200.json + +### + +POST http://localhost:9602/tdengine/insertTable +Content-Type: application/json +Content-Length: 292 +Connection: Keep-Alive +User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.8) +Accept-Encoding: br,deflate,gzip,x-gzip + +{ + "databaseName": "db_hwsaas", + "tableName": "t_ds_4", + "schemaFields": [ + { + "fieldName": "onlineStatus", + "fieldValue": 0 + }, + { + "fieldName": "deviceType", + "fieldValue": 1 + }, + { + "fieldName": "ts", + "fieldValue": 1693581999996 + } + ] +} + +<> 2023-09-05T145959.200.json + +### + +POST http://localhost:9602/tdengine/insertTable +Content-Type: application/json +Content-Length: 292 +Connection: Keep-Alive +User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.8) +Accept-Encoding: br,deflate,gzip,x-gzip + +{ + "databaseName": "db_hwsaas", + "tableName": "t_ds_3", + "schemaFields": [ + { + "fieldName": "onlineStatus", + "fieldValue": 0 + }, + { + "fieldName": "deviceType", + "fieldValue": 1 + }, + { + "fieldName": "ts", + "fieldValue": 1693772969706 + } + ] +} + +<> 2023-09-05T145949.200.json + +### + +POST http://localhost:9602/tdengine/insertTable +Content-Type: application/json +Content-Length: 292 +Connection: Keep-Alive +User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.8) +Accept-Encoding: br,deflate,gzip,x-gzip + +{ + "databaseName": "db_hwsaas", + "tableName": "t_ds_3", + "schemaFields": [ + { + "fieldName": "onlineStatus", + "fieldValue": 1 + }, + { + "fieldName": "deviceType", + "fieldValue": 1 + }, + { + "fieldName": "ts", + "fieldValue": 1693772969106 + } + ] +} + +<> 2023-09-05T145933.200.json + +### + +POST http://localhost:9602/tdengine/insertTable +Content-Type: application/json +Content-Length: 292 +Connection: Keep-Alive +User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.8) +Accept-Encoding: br,deflate,gzip,x-gzip + +{ + "databaseName": "db_hwsaas", + "tableName": "t_ds_3", + "schemaFields": [ + { + "fieldName": "onlineStatus", + "fieldValue": 1 + }, + { + "fieldName": "deviceType", + "fieldValue": 1 + }, + { + "fieldName": "ts", + "fieldValue": 1693672969106 + } + ] +} + +<> 2023-09-05T145928.200.json + +### + +POST http://localhost:9602/tdengine/insertTable +Content-Type: application/json +Content-Length: 292 +Connection: Keep-Alive +User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.8) +Accept-Encoding: br,deflate,gzip,x-gzip + +{ + "databaseName": "db_hwsaas", + "tableName": "t_ds_3", + "schemaFields": [ + { + "fieldName": "onlineStatus", + "fieldValue": 0 + }, + { + "fieldName": "deviceType", + "fieldValue": 1 + }, + { + "fieldName": "ts", + "fieldValue": 1693572969106 + } + ] +} + +<> 2023-09-05T145916.200.json + +### + +POST http://localhost:9602/tdengine/insertTable +Content-Type: application/json +Content-Length: 292 +Connection: Keep-Alive +User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.8) +Accept-Encoding: br,deflate,gzip,x-gzip + +{ + "databaseName": "db_hwsaas", + "tableName": "t_ds_3", + "schemaFields": [ + { + "fieldName": "onlineStatus", + "fieldValue": 1 + }, + { + "fieldName": "deviceType", + "fieldValue": 1 + }, + { + "fieldName": "ts", + "fieldValue": 1693572949106 + } + ] +} + +<> 2023-09-05T145911.200.json + +### + +POST http://localhost:9602/tdengine/insertTable +Content-Type: application/json +Content-Length: 292 +Connection: Keep-Alive +User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.8) +Accept-Encoding: br,deflate,gzip,x-gzip + +{ + "databaseName": "db_hwsaas", + "tableName": "t_ds_3", + "schemaFields": [ + { + "fieldName": "onlineStatus", + "fieldValue": 1 + }, + { + "fieldName": "deviceType", + "fieldValue": 1 + }, + { + "fieldName": "ts", + "fieldValue": 1693571949106 + } + ] +} + +<> 2023-09-05T145907.200.json + +### + +POST http://localhost:9602/tdengine/insertTable +Content-Type: application/json +Content-Length: 292 +Connection: Keep-Alive +User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.8) +Accept-Encoding: br,deflate,gzip,x-gzip + +{ + "databaseName": "db_hwsaas", + "tableName": "t_ds_2", + "schemaFields": [ + { + "fieldName": "onlineStatus", + "fieldValue": 1 + }, + { + "fieldName": "deviceType", + "fieldValue": 1 + }, + { + "fieldName": "ts", + "fieldValue": 1693326578166 + } + ] +} + +<> 2023-09-05T145851.200.json + +### + +POST http://localhost:9602/tdengine/insertTable +Content-Type: application/json +Content-Length: 292 +Connection: Keep-Alive +User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.8) +Accept-Encoding: br,deflate,gzip,x-gzip + +{ + "databaseName": "db_hwsaas", + "tableName": "t_ds_2", + "schemaFields": [ + { + "fieldName": "onlineStatus", + "fieldValue": 1 + }, + { + "fieldName": "deviceType", + "fieldValue": 1 + }, + { + "fieldName": "ts", + "fieldValue": 1693326378166 + } + ] +} + +<> 2023-09-05T145821.200.json + +### + +POST http://localhost:9602/tdengine/insertTable +Content-Type: application/json +Content-Length: 292 +Connection: Keep-Alive +User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.8) +Accept-Encoding: br,deflate,gzip,x-gzip + +{ + "databaseName": "db_hwsaas", + "tableName": "t_ds_2", + "schemaFields": [ + { + "fieldName": "onlineStatus", + "fieldValue": 0 + }, + { + "fieldName": "deviceType", + "fieldValue": 1 + }, + { + "fieldName": "ts", + "fieldValue": 1693326368166 + } + ] +} + +<> 2023-09-05T145814.200.json + +### + +POST http://localhost:9602/tdengine/insertTable +Content-Type: application/json +Content-Length: 292 +Connection: Keep-Alive +User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.8) +Accept-Encoding: br,deflate,gzip,x-gzip + +{ + "databaseName": "db_hwsaas", + "tableName": "t_ds_2", + "schemaFields": [ + { + "fieldName": "onlineStatus", + "fieldValue": 0 + }, + { + "fieldName": "deviceType", + "fieldValue": 1 + }, + { + "fieldName": "ts", + "fieldValue": 1693316368166 + } + ] +} + +<> 2023-09-05T145810.200.json + +### + +POST http://localhost:9602/tdengine/insertTable +Content-Type: application/json +Content-Length: 292 +Connection: Keep-Alive +User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.8) +Accept-Encoding: br,deflate,gzip,x-gzip + +{ + "databaseName": "db_hwsaas", + "tableName": "t_ds_1", + "schemaFields": [ + { + "fieldName": "onlineStatus", + "fieldValue": 0 + }, + { + "fieldName": "deviceType", + "fieldValue": 1 + }, + { + "fieldName": "ts", + "fieldValue": 1693766689106 + } + ] +} + +<> 2023-09-05T145759.200.json + +### + +POST http://localhost:9602/tdengine/insertTable +Content-Type: application/json +Content-Length: 292 +Connection: Keep-Alive +User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.8) +Accept-Encoding: br,deflate,gzip,x-gzip + +{ + "databaseName": "db_hwsaas", + "tableName": "t_ds_1", + "schemaFields": [ + { + "fieldName": "onlineStatus", + "fieldValue": 1 + }, + { + "fieldName": "deviceType", + "fieldValue": 1 + }, + { + "fieldName": "ts", + "fieldValue": 1693666689106 + } + ] +} + +<> 2023-09-05T145750.200.json + +### + +POST http://localhost:9602/tdengine/insertTable +Content-Type: application/json +Content-Length: 292 +Connection: Keep-Alive +User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.8) +Accept-Encoding: br,deflate,gzip,x-gzip + +{ + "databaseName": "db_hwsaas", + "tableName": "t_ds_1", + "schemaFields": [ + { + "fieldName": "onlineStatus", + "fieldValue": 1 + }, + { + "fieldName": "deviceType", + "fieldValue": 1 + }, + { + "fieldName": "ts", + "fieldValue": 1693616689106 + } + ] +} + +<> 2023-09-05T145745.200.json + +### + +POST http://localhost:9602/tdengine/insertTable +Content-Type: application/json +Content-Length: 292 +Connection: Keep-Alive +User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.8) +Accept-Encoding: br,deflate,gzip,x-gzip + +{ + "databaseName": "db_hwsaas", + "tableName": "t_ds_1", + "schemaFields": [ + { + "fieldName": "onlineStatus", + "fieldValue": 1 + }, + { + "fieldName": "deviceType", + "fieldValue": 1 + }, + { + "fieldName": "ts", + "fieldValue": 1693616589106 + } + ] +} + +<> 2023-09-05T145741.200.json + +### + +POST http://localhost:9602/tdengine/insertTable +Content-Type: application/json +Content-Length: 292 +Connection: Keep-Alive +User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.8) +Accept-Encoding: br,deflate,gzip,x-gzip + +{ + "databaseName": "db_hwsaas", + "tableName": "t_ds_1", + "schemaFields": [ + { + "fieldName": "onlineStatus", + "fieldValue": 0 + }, + { + "fieldName": "deviceType", + "fieldValue": 1 + }, + { + "fieldName": "ts", + "fieldValue": 1693616189106 + } + ] +} + +<> 2023-09-05T145734.200.json + +### + +POST http://localhost:9602/tdengine/createTable +Content-Type: application/json +Content-Length: 494 +Connection: Keep-Alive +User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.8) +Accept-Encoding: br,deflate,gzip,x-gzip + +{ + "databaseName": "db_hwsaas", + "superTableName": "st_ds", + "tableName": "t_ds_4", + "tagsFieldValues": [ + { + "fieldName": "deviceCode", + "fieldValue": "'0009340109040_33a'" + }, + { + "fieldName": "deviceName", + "fieldValue": "'定位传感器'" + }, + { + "fieldName": "deviceModeId", + "fieldValue": 1 + }, + { + "fieldName": "monitorUnitId", + "fieldValue": 1 + }, + { + "fieldName": "sceneId", + "fieldValue": 1 + } + ] +} + +<> 2023-09-05T145715.200.json + +### + +POST http://localhost:9602/tdengine/createTable +Content-Type: application/json +Content-Length: 492 +Connection: Keep-Alive +User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.8) +Accept-Encoding: br,deflate,gzip,x-gzip + +{ + "databaseName": "db_hwsaas", + "superTableName": "st_ds", + "tableName": "t_ds_3", + "tagsFieldValues": [ + { + "fieldName": "deviceCode", + "fieldValue": "0009340109040924" + }, + { + "fieldName": "deviceName", + "fieldValue": "'温度传感器2'" + }, + { + "fieldName": "deviceModeId", + "fieldValue": 1 + }, + { + "fieldName": "monitorUnitId", + "fieldValue": 1 + }, + { + "fieldName": "sceneId", + "fieldValue": 1 + } + ] +} + +<> 2023-09-05T145711.200.json + +### + +POST http://localhost:9602/tdengine/createTable +Content-Type: application/json +Content-Length: 492 +Connection: Keep-Alive +User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.8) +Accept-Encoding: br,deflate,gzip,x-gzip + +{ + "databaseName": "db_hwsaas", + "superTableName": "st_ds", + "tableName": "t_ds_2", + "tagsFieldValues": [ + { + "fieldName": "deviceCode", + "fieldValue": "0009340109040126" + }, + { + "fieldName": "deviceName", + "fieldValue": "'温度传感器1'" + }, + { + "fieldName": "deviceModeId", + "fieldValue": 1 + }, + { + "fieldName": "monitorUnitId", + "fieldValue": 1 + }, + { + "fieldName": "sceneId", + "fieldValue": 1 + } + ] +} + +<> 2023-09-05T145708.200.json + +### + +POST http://localhost:9602/tdengine/createTable +Content-Type: application/json +Content-Length: 467 +Connection: Keep-Alive +User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.8) +Accept-Encoding: br,deflate,gzip,x-gzip + +{ + "databaseName": "db_hwsaas", + "superTableName": "st_ds", + "tableName": "t_ds_1", + "tagsFieldValues": [ + { + "fieldName": "deviceCode", + "fieldValue": "1" + }, + { + "fieldName": "deviceName", + "fieldValue": "'基站'" + }, + { + "fieldName": "deviceModeId", + "fieldValue": 1 + }, + { + "fieldName": "monitorUnitId", + "fieldValue": 1 + }, + { + "fieldName": "sceneId", + "fieldValue": 1 + } + ] +} + +<> 2023-09-05T145704.200.json + +### + +POST http://localhost:9602/tdengine/createSuperTable +Content-Type: application/json +Content-Length: 667 +Connection: Keep-Alive +User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.8) +Accept-Encoding: br,deflate,gzip,x-gzip + +{ + "databaseName": "db_hwsaas", + "superTableName": "st_ds", + "firstFieldName": "ts", + "schemaFields": [ + { + "fieldName": "onlineStatus", + "dataTypeCode": 8 + }, + { + "fieldName": "deviceType", + "dataTypeCode": 8 + } + ], + "tagsFields": [ + { + "fieldName": "deviceCode", + "dataTypeCode": 10, + "size": 50 + }, + { + "fieldName": "deviceName", + "dataTypeCode": 10, + "size": 200 + }, + { + "fieldName": "deviceModeId", + "dataTypeCode": 2 + }, + { + "fieldName": "monitorUnitId", + "dataTypeCode": 2 + }, + { + "fieldName": "sceneId", + "dataTypeCode": 2 + } + ] +} + +<> 2023-09-05T145614.200.json + +### + +POST http://localhost:9602/tdengine/getOnlineDevicesGroupByDay +Content-Type: application/json +Content-Length: 130 +Connection: Keep-Alive +User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.8) +Accept-Encoding: br,deflate,gzip,x-gzip + +{ + "params": {"databaseName":"db_scene_1","superTableName":"st_ds_1", + "beginTime":1666666666666,"endTime":1766666666666 } + +} + +<> 2023-09-05T144005.200.json + +### + +POST http://localhost:9602/tdengine/getOnlineDevicesGroupByDay +Content-Type: application/json +Content-Length: 130 +Connection: Keep-Alive +User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.8) +Accept-Encoding: br,deflate,gzip,x-gzip + +{ + "params": {"databaseName":"db_scene_1","superTableName":"st_ds_1", + "beginTime":1666666666666,"endTime":1766666666666 } + +} + +<> 2023-09-05T144003.200.json + +### + +POST http://localhost:9602/tdengine/getOnlineDevicesGroupByDay +Content-Type: application/json +Content-Length: 130 +Connection: Keep-Alive +User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.8) +Accept-Encoding: br,deflate,gzip,x-gzip + +{ + "params": {"databaseName":"db_scene_1","superTableName":"st_ds_1", + "beginTime":1666666666666,"endTime":1766666666666 } + +} + +<> 2023-09-05T143711.200.json + +### + +POST http://localhost:9602/tdengine/getOnlineDevicesGroupByDay +Content-Type: application/json +Content-Length: 130 +Connection: Keep-Alive +User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.8) +Accept-Encoding: br,deflate,gzip,x-gzip + +{ + "params": {"databaseName":"db_scene_1","superTableName":"st_ds_1", + "beginTime":1666666666666,"endTime":1766666666666 } + +} + +<> 2023-09-05T143237.200.json + +### + +POST http://localhost:9602/tdengine/getOnlineDevicesGroupByDay +Content-Type: application/json +Content-Length: 130 +Connection: Keep-Alive +User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.8) +Accept-Encoding: br,deflate,gzip,x-gzip + +{ + "params": {"databaseName":"db_scene_1","superTableName":"st_ds_1", + "beginTime":1666666666666,"endTime":1766666666666 } + +} + +<> 2023-09-05T142515.200.json + +### + +POST http://localhost:9602/tdengine/getOnlineDevicesGroupByDay +Content-Type: application/json +Content-Length: 130 +Connection: Keep-Alive +User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.8) +Accept-Encoding: br,deflate,gzip,x-gzip + +{ + "params": {"databaseName":"db_scene_1","superTableName":"st_ds_1", + "beginTime":1666666666666,"endTime":1766666666666 } + +} + +<> 2023-09-05T142512.200.json + +### + diff --git a/logs/hw-mqtt-broker/all.log.2023-08-30.0.gz b/logs/hw-mqtt-broker/all.log.2023-08-30.0.gz deleted file mode 100644 index 2bc4cde..0000000 Binary files a/logs/hw-mqtt-broker/all.log.2023-08-30.0.gz and /dev/null differ diff --git a/logs/hw-mqtt-broker/all.log.2023-08-31.0.gz b/logs/hw-mqtt-broker/all.log.2023-08-31.0.gz deleted file mode 100644 index f880f85..0000000 Binary files a/logs/hw-mqtt-broker/all.log.2023-08-31.0.gz and /dev/null differ diff --git a/logs/hw-mqtt-broker/all.log.2023-09-01.0.gz b/logs/hw-mqtt-broker/all.log.2023-09-01.0.gz deleted file mode 100644 index eda10eb..0000000 Binary files a/logs/hw-mqtt-broker/all.log.2023-09-01.0.gz and /dev/null differ diff --git a/logs/hw-mqtt-broker/all.log.2023-09-02.0.gz b/logs/hw-mqtt-broker/all.log.2023-09-02.0.gz deleted file mode 100644 index 1e590e0..0000000 Binary files a/logs/hw-mqtt-broker/all.log.2023-09-02.0.gz and /dev/null differ diff --git a/logs/hw-mqtt-broker/all.log.2023-09-03.0.gz b/logs/hw-mqtt-broker/all.log.2023-09-03.0.gz deleted file mode 100644 index 79ae8f9..0000000 Binary files a/logs/hw-mqtt-broker/all.log.2023-09-03.0.gz and /dev/null differ diff --git a/logs/hw-mqtt-broker/all.log.2023-09-04.0.gz b/logs/hw-mqtt-broker/all.log.2023-09-04.0.gz deleted file mode 100644 index 0d14e07..0000000 Binary files a/logs/hw-mqtt-broker/all.log.2023-09-04.0.gz and /dev/null differ diff --git a/logs/hw-mqtt-broker/all.log.2023-09-05.0.gz b/logs/hw-mqtt-broker/all.log.2023-09-05.0.gz new file mode 100644 index 0000000..a0cb698 Binary files /dev/null and b/logs/hw-mqtt-broker/all.log.2023-09-05.0.gz differ diff --git a/logs/hw-mqtt-broker/all.log.2023-09-06.0.gz b/logs/hw-mqtt-broker/all.log.2023-09-06.0.gz new file mode 100644 index 0000000..7b46268 Binary files /dev/null and b/logs/hw-mqtt-broker/all.log.2023-09-06.0.gz differ diff --git a/logs/hw-mqtt-broker/error.log.2023-08-30.0.gz b/logs/hw-mqtt-broker/error.log.2023-08-30.0.gz deleted file mode 100644 index a9448ce..0000000 Binary files a/logs/hw-mqtt-broker/error.log.2023-08-30.0.gz and /dev/null differ diff --git a/logs/hw-mqtt-broker/error.log.2023-08-31.0.gz b/logs/hw-mqtt-broker/error.log.2023-08-31.0.gz deleted file mode 100644 index 9dd9e98..0000000 Binary files a/logs/hw-mqtt-broker/error.log.2023-08-31.0.gz and /dev/null differ diff --git a/logs/hw-mqtt-broker/error.log.2023-09-01.0.gz b/logs/hw-mqtt-broker/error.log.2023-09-01.0.gz deleted file mode 100644 index f31e23e..0000000 Binary files a/logs/hw-mqtt-broker/error.log.2023-09-01.0.gz and /dev/null differ diff --git a/logs/hw-mqtt-broker/error.log.2023-09-02.0.gz b/logs/hw-mqtt-broker/error.log.2023-09-02.0.gz deleted file mode 100644 index 94f7c9f..0000000 Binary files a/logs/hw-mqtt-broker/error.log.2023-09-02.0.gz and /dev/null differ diff --git a/logs/hw-mqtt-broker/error.log.2023-09-03.0.gz b/logs/hw-mqtt-broker/error.log.2023-09-03.0.gz deleted file mode 100644 index 4ffa6bd..0000000 Binary files a/logs/hw-mqtt-broker/error.log.2023-09-03.0.gz and /dev/null differ diff --git a/logs/hw-mqtt-broker/error.log.2023-09-06.0.gz b/logs/hw-mqtt-broker/error.log.2023-09-06.0.gz new file mode 100644 index 0000000..1c4d7b9 Binary files /dev/null and b/logs/hw-mqtt-broker/error.log.2023-09-06.0.gz differ diff --git a/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/RemoteConfigService.java b/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/RemoteConfigService.java new file mode 100644 index 0000000..0ede009 --- /dev/null +++ b/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/RemoteConfigService.java @@ -0,0 +1,26 @@ +package com.ruoyi.system.api; + +import com.ruoyi.common.core.constant.ServiceNameConstants; +import com.ruoyi.common.core.domain.R; +import com.ruoyi.common.core.web.domain.AjaxResult; +import com.ruoyi.system.api.factory.RemoteConfigFallbackFactory; +import com.ruoyi.system.api.factory.RemoteUserFallbackFactory; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestParam; + +/** + * @Description: 参数配置服务 + * @ClassName: RemoteConfigService + * @Author : xins + * @Date :2023-09-13 11:05 + * @Version :1.0 + */ +@FeignClient(contextId = "remoteConfigService", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = RemoteConfigFallbackFactory.class) +public interface RemoteConfigService { + + @GetMapping(value = "/config/configKeyStr/{configKey}") + R getConfigKeyStr(@PathVariable("configKey") String configKey); +} diff --git a/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/factory/RemoteConfigFallbackFactory.java b/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/factory/RemoteConfigFallbackFactory.java new file mode 100644 index 0000000..8daee4c --- /dev/null +++ b/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/factory/RemoteConfigFallbackFactory.java @@ -0,0 +1,27 @@ +package com.ruoyi.system.api.factory; + +import com.ruoyi.common.core.domain.R; +import com.ruoyi.system.api.RemoteConfigService; +import org.springframework.cloud.openfeign.FallbackFactory; +import org.springframework.stereotype.Component; + +/** + * @Description: 参数配置服务降级处理 + * @ClassName: RemoteConfigFallbackFactory + * @Author : xins + * @Date :2023-09-13 11:10 + * @Version :1.0 + */ +@Component +public class RemoteConfigFallbackFactory implements FallbackFactory { + @Override + public RemoteConfigService create(Throwable throwable) { + return new RemoteConfigService() + { + @Override + public R getConfigKeyStr(String configKey) { + return R.fail("获取参数失败:" + throwable.getMessage()); + } + }; + } +} diff --git a/ruoyi-api/ruoyi-api-system/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/ruoyi-api/ruoyi-api-system/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports index 0a60da5..48b6511 100644 --- a/ruoyi-api/ruoyi-api-system/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports +++ b/ruoyi-api/ruoyi-api-system/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -1,3 +1,4 @@ com.ruoyi.system.api.factory.RemoteUserFallbackFactory com.ruoyi.system.api.factory.RemoteLogFallbackFactory com.ruoyi.system.api.factory.RemoteFileFallbackFactory +com.ruoyi.system.api.factory.RemoteConfigFallbackFactory diff --git a/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/constant/HwDictConstants.java b/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/constant/HwDictConstants.java index cc2f169..77c88a5 100644 --- a/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/constant/HwDictConstants.java +++ b/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/constant/HwDictConstants.java @@ -26,4 +26,10 @@ public class HwDictConstants { public static final String ALARM_INFO_TYPE_OFFLINE = "3";//离线报警 public static final String ALARM_INFO_TYPE_ELECTRONIC_FENCE = "4";//电子围栏 + public static final String FUNCTION_MODE_ATTRIBUTE = "1";//设备模型功能模式属性 + public static final String FUNCTION_MODE_SERVICE = "2";//设备模型功能模式服务 + public static final String FUNCTION_MODE_EVENT = "3";//设备模型功能模式事件 + + public static final String DEVICE_STATUS_PUBLISH = "1";//设备状态:已发布 + } diff --git a/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/constant/TdEngineConstants.java b/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/constant/TdEngineConstants.java index d2f7ba0..6e7dbb1 100644 --- a/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/constant/TdEngineConstants.java +++ b/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/constant/TdEngineConstants.java @@ -26,12 +26,31 @@ public class TdEngineConstants { public static final String DEFAULT_DB_NAME_PREFIX = "db_scene_";//数据库名称前缀 + public static final String DEFAULT_SUPER_TABLE_NAME_PREFIX = "st_devicemode_";//超级表名称前缀 public static final String DEFAULT_TABLE_NAME_PREFIX = "t_device_";//数据表名称前缀 public static final String DEFAULT_DEVICE_STATUS_SUPER_TABLE_NAME= "st_ds";//设备状态超级表名称 public static final String DEFAULT_DEVICE_STATUS_TABLE_NAME_PREFIX = "t_ds_";//设备状态数据表名称前缀 public static final String PLATFORM_DB_NAME = "db_hwsaas";//全局数据库名称 + + public static final String ST_TAG_DEVICECODE = "devicecode"; + public static final int ST_TAG_DEVICECODE_TYPE = 10; + public static final int ST_TAG_DEVICECODE_SIZE=50; + + public static final String ST_TAG_DEVICENAME = "devicename"; + public static final int ST_TAG_DEVICENAME_TYPE = 10; + public static final int ST_TAG_DEVICENAME_SIZE=200; + + public static final String ST_TAG_DEVICEID = "deviceid"; + public static final int ST_TAG_DEVICEID_TYPE = 2; + + public static final String ST_TAG_DEVICEMODEID = "devicemodeid"; + public static final int ST_TAG_DEVICEMODEID_TYPE = 2; + + public static final String ST_TAG_MONITORUNITID = "monitorunitid"; + public static final int ST_TAG_MONITORUNITID_TYPE = 2; + /** * 需要转换的key */ diff --git a/ruoyi-modules/hw-basic/src/main/java/com/ruoyi/basic/controller/HwLanguageController.java b/ruoyi-modules/hw-basic/src/main/java/com/ruoyi/basic/controller/HwLanguageController.java index a985dbb..26e0911 100644 --- a/ruoyi-modules/hw-basic/src/main/java/com/ruoyi/basic/controller/HwLanguageController.java +++ b/ruoyi-modules/hw-basic/src/main/java/com/ruoyi/basic/controller/HwLanguageController.java @@ -35,6 +35,21 @@ public class HwLanguageController extends BaseController @Autowired private IHwLanguageService hwLanguageService; + /** + * @param: hwLanguage + * @description 获取语言信息列表供选择使用(下拉列表等) + * @author xins + * @date 2023-09-07 9:57 + * @return AjaxResult + */ + @GetMapping("/getLanguages") + public AjaxResult getLanguages(HwLanguage hwLanguage) + { + return success(hwLanguageService.selectHwLanguageList(hwLanguage)); + } + + + /** * 查询语言信息列表 */ diff --git a/ruoyi-modules/hw-business/pom.xml b/ruoyi-modules/hw-business/pom.xml index f2407d2..a473a61 100644 --- a/ruoyi-modules/hw-business/pom.xml +++ b/ruoyi-modules/hw-business/pom.xml @@ -83,6 +83,11 @@ ruoyi-api-system + + com.ruoyi + hw-api-tdengine + + com.ruoyi @@ -94,16 +99,12 @@ + junit junit - - com.ruoyi - hw-api-tdengine - 3.6.3 - compile - + diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwDeviceModeController.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwDeviceModeController.java index 5ab930a..82875b6 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwDeviceModeController.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwDeviceModeController.java @@ -1,8 +1,18 @@ package com.ruoyi.business.controller; +import java.util.HashMap; import java.util.List; import java.io.IOException; +import java.util.Map; +import java.util.stream.Collectors; import javax.servlet.http.HttpServletResponse; + +import com.ruoyi.business.domain.HwDeviceModeFunction; +import com.ruoyi.common.core.constant.SecurityConstants; +import com.ruoyi.common.core.context.SecurityContextHolder; +import com.ruoyi.common.security.utils.SecurityUtils; +import com.ruoyi.system.api.domain.SysUser; +import com.ruoyi.system.api.model.LoginUser; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; @@ -24,14 +34,13 @@ import com.ruoyi.common.core.web.page.TableDataInfo; /** * 设备模型Controller - * + * * @author xins * @date 2023-09-04 */ @RestController @RequestMapping("/deviceMode") -public class HwDeviceModeController extends BaseController -{ +public class HwDeviceModeController extends BaseController { @Autowired private IHwDeviceModeService hwDeviceModeService; @@ -40,8 +49,7 @@ public class HwDeviceModeController extends BaseController */ @RequiresPermissions("business:deviceMode:list") @GetMapping("/list") - public TableDataInfo list(HwDeviceMode hwDeviceMode) - { + public TableDataInfo list(HwDeviceMode hwDeviceMode) { startPage(); List list = hwDeviceModeService.selectHwDeviceModeList(hwDeviceMode); return getDataTable(list); @@ -53,8 +61,7 @@ public class HwDeviceModeController extends BaseController @RequiresPermissions("business:deviceMode:export") @Log(title = "设备模型", businessType = BusinessType.EXPORT) @PostMapping("/export") - public void export(HttpServletResponse response, HwDeviceMode hwDeviceMode) - { + public void export(HttpServletResponse response, HwDeviceMode hwDeviceMode) { List list = hwDeviceModeService.selectHwDeviceModeList(hwDeviceMode); ExcelUtil util = new ExcelUtil(HwDeviceMode.class); util.exportExcel(response, list, "设备模型数据"); @@ -65,9 +72,16 @@ public class HwDeviceModeController extends BaseController */ @RequiresPermissions("business:deviceMode:query") @GetMapping(value = "/{deviceModeId}") - public AjaxResult getInfo(@PathVariable("deviceModeId") Long deviceModeId) - { - return success(hwDeviceModeService.selectHwDeviceModeByDeviceModeId(deviceModeId)); + public AjaxResult getInfo(@PathVariable("deviceModeId") Long deviceModeId) { + HwDeviceMode hwDeviceMode = hwDeviceModeService.selectHwDeviceModeByDeviceModeId(deviceModeId); + List hwDeviceModeFunctions = hwDeviceMode.getHwDeviceModeFunctionList(); + hwDeviceMode.setHwDeviceModeFunctionList(null); + Map> hwDeviceModeFunctionMap = hwDeviceModeFunctions.stream() + .collect(Collectors.groupingBy(HwDeviceModeFunction::getFunctionMode)); + Map map = new HashMap<>(); + map.put("deviceMode", hwDeviceMode); + map.put("deviceModeFunctionMap", hwDeviceModeFunctionMap); + return success(map); } /** @@ -76,8 +90,7 @@ public class HwDeviceModeController extends BaseController @RequiresPermissions("business:deviceMode:add") @Log(title = "设备模型", businessType = BusinessType.INSERT) @PostMapping - public AjaxResult add(@RequestBody HwDeviceMode hwDeviceMode) - { + public AjaxResult add(@RequestBody HwDeviceMode hwDeviceMode) { return toAjax(hwDeviceModeService.insertHwDeviceMode(hwDeviceMode)); } @@ -87,8 +100,7 @@ public class HwDeviceModeController extends BaseController @RequiresPermissions("business:deviceMode:edit") @Log(title = "设备模型", businessType = BusinessType.UPDATE) @PutMapping - public AjaxResult edit(@RequestBody HwDeviceMode hwDeviceMode) - { + public AjaxResult edit(@RequestBody HwDeviceMode hwDeviceMode) { return toAjax(hwDeviceModeService.updateHwDeviceMode(hwDeviceMode)); } @@ -97,9 +109,9 @@ public class HwDeviceModeController extends BaseController */ @RequiresPermissions("business:deviceMode:remove") @Log(title = "设备模型", businessType = BusinessType.DELETE) - @DeleteMapping("/{deviceModeIds}") - public AjaxResult remove(@PathVariable Long[] deviceModeIds) - { + @DeleteMapping("/{deviceModeIds}") + public AjaxResult remove(@PathVariable Long[] deviceModeIds) { return toAjax(hwDeviceModeService.deleteHwDeviceModeByDeviceModeIds(deviceModeIds)); } + } diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwDeviceModeFunctionController.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwDeviceModeFunctionController.java index ea2d94b..efe4adc 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwDeviceModeFunctionController.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwDeviceModeFunctionController.java @@ -1,74 +1,26 @@ package com.ruoyi.business.controller; -import java.util.List; -import java.io.IOException; -import javax.servlet.http.HttpServletResponse; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.PutMapping; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import com.ruoyi.business.domain.HwDeviceModeFunction; +import com.ruoyi.business.service.IHwDeviceModeService; +import com.ruoyi.common.core.web.controller.BaseController; +import com.ruoyi.common.core.web.domain.AjaxResult; import com.ruoyi.common.log.annotation.Log; import com.ruoyi.common.log.enums.BusinessType; import com.ruoyi.common.security.annotation.RequiresPermissions; -import com.ruoyi.business.domain.HwDeviceModeFunction; -import com.ruoyi.business.service.IHwDeviceModeFunctionService; -import com.ruoyi.common.core.web.controller.BaseController; -import com.ruoyi.common.core.web.domain.AjaxResult; -import com.ruoyi.common.core.utils.poi.ExcelUtil; -import com.ruoyi.common.core.web.page.TableDataInfo; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; /** * 设备模型功能Controller - * + * * @author xins * @date 2023-09-05 */ @RestController @RequestMapping("/deviceModeFunction") -public class HwDeviceModeFunctionController extends BaseController -{ +public class HwDeviceModeFunctionController extends BaseController { @Autowired - private IHwDeviceModeFunctionService hwDeviceModeFunctionService; - - /** - * 查询设备模型功能列表 - */ - @RequiresPermissions("business:deviceModeFunction:list") - @GetMapping("/list") - public TableDataInfo list(HwDeviceModeFunction hwDeviceModeFunction) - { - startPage(); - List list = hwDeviceModeFunctionService.selectHwDeviceModeFunctionList(hwDeviceModeFunction); - return getDataTable(list); - } - - /** - * 导出设备模型功能列表 - */ - @RequiresPermissions("business:deviceModeFunction:export") - @Log(title = "设备模型功能", businessType = BusinessType.EXPORT) - @PostMapping("/export") - public void export(HttpServletResponse response, HwDeviceModeFunction hwDeviceModeFunction) - { - List list = hwDeviceModeFunctionService.selectHwDeviceModeFunctionList(hwDeviceModeFunction); - ExcelUtil util = new ExcelUtil(HwDeviceModeFunction.class); - util.exportExcel(response, list, "设备模型功能数据"); - } - - /** - * 获取设备模型功能详细信息 - */ - @RequiresPermissions("business:deviceModeFunction:query") - @GetMapping(value = "/{modeFunctionId}") - public AjaxResult getInfo(@PathVariable("modeFunctionId") Long modeFunctionId) - { - return success(hwDeviceModeFunctionService.selectHwDeviceModeFunctionByModeFunctionId(modeFunctionId)); - } + private IHwDeviceModeService hwDeviceModeService; /** * 新增设备模型功能 @@ -76,9 +28,8 @@ public class HwDeviceModeFunctionController extends BaseController @RequiresPermissions("business:deviceModeFunction:add") @Log(title = "设备模型功能", businessType = BusinessType.INSERT) @PostMapping - public AjaxResult add(@RequestBody HwDeviceModeFunction hwDeviceModeFunction) - { - return toAjax(hwDeviceModeFunctionService.insertHwDeviceModeFunction(hwDeviceModeFunction)); + public AjaxResult add(@RequestBody HwDeviceModeFunction hwDeviceModeFunction) { + return success(hwDeviceModeService.insertHwDeviceModeFunction(hwDeviceModeFunction)); } /** @@ -87,9 +38,8 @@ public class HwDeviceModeFunctionController extends BaseController @RequiresPermissions("business:deviceModeFunction:edit") @Log(title = "设备模型功能", businessType = BusinessType.UPDATE) @PutMapping - public AjaxResult edit(@RequestBody HwDeviceModeFunction hwDeviceModeFunction) - { - return toAjax(hwDeviceModeFunctionService.updateHwDeviceModeFunction(hwDeviceModeFunction)); + public AjaxResult edit(@RequestBody HwDeviceModeFunction hwDeviceModeFunction) { + return toAjax(hwDeviceModeService.updateHwDeviceModeFunction(hwDeviceModeFunction)); } /** @@ -97,9 +47,13 @@ public class HwDeviceModeFunctionController extends BaseController */ @RequiresPermissions("business:deviceModeFunction:remove") @Log(title = "设备模型功能", businessType = BusinessType.DELETE) - @DeleteMapping("/{modeFunctionIds}") - public AjaxResult remove(@PathVariable Long[] modeFunctionIds) - { - return toAjax(hwDeviceModeFunctionService.deleteHwDeviceModeFunctionByModeFunctionIds(modeFunctionIds)); + @DeleteMapping("/{modeFunctionId}") + public AjaxResult remove(@PathVariable Long modeFunctionId) { + return toAjax(hwDeviceModeService.deleteHwDeviceModeFunctionByModeFunctionId(modeFunctionId)); + } + + @GetMapping("/getDeviceModeParameters/{modeFunctionId}") + public AjaxResult getDeviceModeParameters(@PathVariable("modeFunctionId") Long modeFunctionId) { + return success(hwDeviceModeService.selectDeviceModeParametersByModeFunctionId(modeFunctionId)); } } diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/HwDevice.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/HwDevice.java index 8f1c3fd..d3f4e65 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/HwDevice.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/HwDevice.java @@ -11,7 +11,7 @@ import com.ruoyi.common.core.web.domain.BaseEntity; * 设备信息对象 hw_device * * @author xins - * @date 2023-08-24 + * @date 2023-09-13 */ public class HwDevice extends BaseEntity { @@ -106,6 +106,14 @@ public class HwDevice extends BaseEntity @Excel(name = "预留字段") private String deviceField; + /** 租户ID,关联hw_tenant的tenant_id */ + @Excel(name = "租户ID,关联hw_tenant的tenant_id") + private Long tenantId; + + /** 在线状态(1、在线,0、离线) */ + @Excel(name = "在线状态", readConverterExp = "1=、在线,0、离线") + private String onlineStatus; + public void setDeviceId(Long deviceId) { this.deviceId = deviceId; @@ -304,6 +312,24 @@ public class HwDevice extends BaseEntity { return deviceField; } + public void setTenantId(Long tenantId) + { + this.tenantId = tenantId; + } + + public Long getTenantId() + { + return tenantId; + } + public void setOnlineStatus(String onlineStatus) + { + this.onlineStatus = onlineStatus; + } + + public String getOnlineStatus() + { + return onlineStatus; + } @Override public String toString() { @@ -335,6 +361,8 @@ public class HwDevice extends BaseEntity .append("updateBy", getUpdateBy()) .append("updateTime", getUpdateTime()) .append("deviceField", getDeviceField()) + .append("tenantId", getTenantId()) + .append("onlineStatus", getOnlineStatus()) .toString(); } } diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/HwDeviceModeFunction.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/HwDeviceModeFunction.java index ac81b36..27209da 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/HwDeviceModeFunction.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/HwDeviceModeFunction.java @@ -1,6 +1,8 @@ package com.ruoyi.business.domain; import java.math.BigDecimal; +import java.util.List; + import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; import com.ruoyi.common.core.annotation.Excel; @@ -110,6 +112,12 @@ public class HwDeviceModeFunction extends BaseEntity @Excel(name = "预留字段") private String propertyField; + private List inputParameters; + + private List outputParameters; + +// private List + public void setModeFunctionId(Long modeFunctionId) { this.modeFunctionId = modeFunctionId; @@ -291,6 +299,22 @@ public class HwDeviceModeFunction extends BaseEntity return propertyField; } + public List getInputParameters() { + return inputParameters; + } + + public void setInputParameters(List inputParameters) { + this.inputParameters = inputParameters; + } + + public List getOutputParameters() { + return outputParameters; + } + + public void setOutputParameters(List outputParameters) { + this.outputParameters = outputParameters; + } + @Override public String toString() { return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/HwDeviceModeParameter.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/HwDeviceModeParameter.java new file mode 100644 index 0000000..4a0f3c6 --- /dev/null +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/HwDeviceModeParameter.java @@ -0,0 +1,173 @@ +package com.ruoyi.business.domain; + +import java.math.BigDecimal; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ruoyi.common.core.annotation.Excel; +import com.ruoyi.common.core.web.domain.BaseEntity; + +/** + * 设备参数对象 hw_device_mode_parameter + * + * @author xins + * @date 2023-09-11 + */ +public class HwDeviceModeParameter extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 设备属性参数ID */ + private Long modeParameterId; + + /** 设备模型功能ID,关联表hw_device_mode_function的字段mode_function_id */ + @Excel(name = "设备模型功能ID,关联表hw_device_mode_function的字段mode_function_id") + private Long modeFunctionId; + + /** 设备属性参数ID,关联本表的字段mode_parameter_id。如果数据类型为struct类型,定义json参数时需要用此字段 */ + @Excel(name = "设备属性参数ID,关联本表的字段mode_parameter_id。如果数据类型为struct类型,定义json参数时需要用此字段") + private Long releatedParameterId; + + /** 参数类型(1、输入参数,2、输出参数) */ + @Excel(name = "参数类型", readConverterExp = "1=、输入参数,2、输出参数") + private String parameterType; + + /** 参数名称 */ + @Excel(name = "参数名称") + private String parameterName; + + /** 标识符(支持大小写字母、数字和下划线,对外暂时不超过50个字符) */ + @Excel(name = "标识符", readConverterExp = "支=持大小写字母、数字和下划线,对外暂时不超过50个字符") + private String parameterIdentifier; + + /** 数据类型(在平台字典表中定义) */ + @Excel(name = "数据类型", readConverterExp = "在=平台字典表中定义") + private String dataType; + + /** 数据定义,按json保存,示例如下: + 1、取值范围:{'minValue':1,'maxValue':100}, + 2、枚举型: + {'1':'成功','2','失败','3','提示} + 3、bool型: + {'0':'关','1','开'} + 4、Text型: + {'dataLength':1024} + 5、Date类型(此类型需要定义在数据字典中,支持多语言): + {'dateFormat':'String类型的UTC时间戳(毫秒)'} */ + @Excel(name = "数据定义,按json保存") + private String dataDefinition; + + /** 单位 */ + @Excel(name = "单位") + private String propertyUnit; + + /** 预留字段,步长 */ + @Excel(name = "预留字段,步长") + private BigDecimal propertyStep; + + public void setModeParameterId(Long modeParameterId) + { + this.modeParameterId = modeParameterId; + } + + public Long getModeParameterId() + { + return modeParameterId; + } + public void setModeFunctionId(Long modeFunctionId) + { + this.modeFunctionId = modeFunctionId; + } + + public Long getModeFunctionId() + { + return modeFunctionId; + } + public void setReleatedParameterId(Long releatedParameterId) + { + this.releatedParameterId = releatedParameterId; + } + + public Long getReleatedParameterId() + { + return releatedParameterId; + } + public void setParameterType(String parameterType) + { + this.parameterType = parameterType; + } + + public String getParameterType() + { + return parameterType; + } + public void setParameterName(String parameterName) + { + this.parameterName = parameterName; + } + + public String getParameterName() + { + return parameterName; + } + public void setParameterIdentifier(String parameterIdentifier) + { + this.parameterIdentifier = parameterIdentifier; + } + + public String getParameterIdentifier() + { + return parameterIdentifier; + } + public void setDataType(String dataType) + { + this.dataType = dataType; + } + + public String getDataType() + { + return dataType; + } + public void setDataDefinition(String dataDefinition) + { + this.dataDefinition = dataDefinition; + } + + public String getDataDefinition() + { + return dataDefinition; + } + public void setPropertyUnit(String propertyUnit) + { + this.propertyUnit = propertyUnit; + } + + public String getPropertyUnit() + { + return propertyUnit; + } + public void setPropertyStep(BigDecimal propertyStep) + { + this.propertyStep = propertyStep; + } + + public BigDecimal getPropertyStep() + { + return propertyStep; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("modeParameterId", getModeParameterId()) + .append("modeFunctionId", getModeFunctionId()) + .append("releatedParameterId", getReleatedParameterId()) + .append("parameterType", getParameterType()) + .append("parameterName", getParameterName()) + .append("parameterIdentifier", getParameterIdentifier()) + .append("dataType", getDataType()) + .append("dataDefinition", getDataDefinition()) + .append("propertyUnit", getPropertyUnit()) + .append("propertyStep", getPropertyStep()) + .toString(); + } +} diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/mapper/HwDeviceModeMapper.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/mapper/HwDeviceModeMapper.java index 52b6ce8..e1db335 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/mapper/HwDeviceModeMapper.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/mapper/HwDeviceModeMapper.java @@ -3,6 +3,7 @@ package com.ruoyi.business.mapper; import java.util.List; import com.ruoyi.business.domain.HwDeviceMode; import com.ruoyi.business.domain.HwDeviceModeFunction; +import com.ruoyi.business.domain.HwDeviceModeParameter; /** * 设备模型Mapper接口 @@ -84,4 +85,54 @@ public interface HwDeviceModeMapper * @return 结果 */ public int deleteHwDeviceModeFunctionByDeviceModeId(Long deviceModeId); + + /** + * 新增设备模型功能 + * + * @param hwDeviceModeFunction 设备模型功能 + * @return 结果 + */ + public int insertHwDeviceModeFunction(HwDeviceModeFunction hwDeviceModeFunction); + + /** + * 修改设备模型功能 + * + * @param hwDeviceModeFunction 设备模型功能 + * @return 结果 + */ + public int updateHwDeviceModeFunction(HwDeviceModeFunction hwDeviceModeFunction); + + /** + * 删除设备模型功能 + * + * @param modeFunctionId 设备模型功能主键 + * @return 结果 + */ + public int deleteHwDeviceModeFunctionByModeFunctionId(Long modeFunctionId); + + /** + * 批量新增设备模型功能参数 + * + * @param hwDeviceModeParameterList 设备模型功能参数列表 + * @return 结果 + */ + public int batchHwDeviceModeParameters(List hwDeviceModeParameterList); + + /** + * 通过设备模型功能主键删除设备模型功能参数信息 + * + * @param deviceModeId 设备模型功能ID + * @return 结果 + */ + public int deleteHwDeviceModeParameterByModeFunctionId(Long modeFunctionId); + + /** + * @param: modeFunctionId + * @description 根据设备功能主键获取参数信息 + * @author xins + * @date 2023-09-12 10:44 + * @return List + */ + public List selectDeviceModeParametersByModeFunctionId(Long modeFunctionId); + } diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/IHwDeviceModeFunctionService.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/IHwDeviceModeFunctionService.java deleted file mode 100644 index b524c96..0000000 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/IHwDeviceModeFunctionService.java +++ /dev/null @@ -1,61 +0,0 @@ -package com.ruoyi.business.service; - -import java.util.List; -import com.ruoyi.business.domain.HwDeviceModeFunction; - -/** - * 设备模型功能Service接口 - * - * @author xins - * @date 2023-09-05 - */ -public interface IHwDeviceModeFunctionService -{ - /** - * 查询设备模型功能 - * - * @param modeFunctionId 设备模型功能主键 - * @return 设备模型功能 - */ - public HwDeviceModeFunction selectHwDeviceModeFunctionByModeFunctionId(Long modeFunctionId); - - /** - * 查询设备模型功能列表 - * - * @param hwDeviceModeFunction 设备模型功能 - * @return 设备模型功能集合 - */ - public List selectHwDeviceModeFunctionList(HwDeviceModeFunction hwDeviceModeFunction); - - /** - * 新增设备模型功能 - * - * @param hwDeviceModeFunction 设备模型功能 - * @return 结果 - */ - public int insertHwDeviceModeFunction(HwDeviceModeFunction hwDeviceModeFunction); - - /** - * 修改设备模型功能 - * - * @param hwDeviceModeFunction 设备模型功能 - * @return 结果 - */ - public int updateHwDeviceModeFunction(HwDeviceModeFunction hwDeviceModeFunction); - - /** - * 批量删除设备模型功能 - * - * @param modeFunctionIds 需要删除的设备模型功能主键集合 - * @return 结果 - */ - public int deleteHwDeviceModeFunctionByModeFunctionIds(Long[] modeFunctionIds); - - /** - * 删除设备模型功能信息 - * - * @param modeFunctionId 设备模型功能主键 - * @return 结果 - */ - public int deleteHwDeviceModeFunctionByModeFunctionId(Long modeFunctionId); -} diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/IHwDeviceModeService.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/IHwDeviceModeService.java index c83ce6a..7642fcd 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/IHwDeviceModeService.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/IHwDeviceModeService.java @@ -1,7 +1,11 @@ package com.ruoyi.business.service; import java.util.List; +import java.util.Map; + import com.ruoyi.business.domain.HwDeviceMode; +import com.ruoyi.business.domain.HwDeviceModeFunction; +import com.ruoyi.business.domain.HwDeviceModeParameter; /** * 设备模型Service接口 @@ -58,4 +62,41 @@ public interface IHwDeviceModeService * @return 结果 */ public int deleteHwDeviceModeByDeviceModeId(Long deviceModeId); + + + /** + * 新增设备模型功能 + * + * @param hwDeviceModeFunction 设备模型功能 + * @return 结果 + */ + public Long insertHwDeviceModeFunction(HwDeviceModeFunction hwDeviceModeFunction); + + /** + * 修改设备模型功能 + * + * @param hwDeviceModeFunction 设备模型功能 + * @return 结果 + */ + public int updateHwDeviceModeFunction(HwDeviceModeFunction hwDeviceModeFunction); + + + /** + * 删除设备模型功能信息 + * + * @param modeFunctionId 设备模型功能主键 + * @return 结果 + */ + public int deleteHwDeviceModeFunctionByModeFunctionId(Long modeFunctionId); + + + /** + * @param: modeFunctionId + * @description 根据设备功能主键获取参数信息列表 + * @author xins + * @date 2023-09-12 10:45 + * @return Map> + */ + public Map> selectDeviceModeParametersByModeFunctionId(Long modeFunctionId); + } diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwDeviceModeFunctionServiceImpl.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwDeviceModeFunctionServiceImpl.java deleted file mode 100644 index 2e3a868..0000000 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwDeviceModeFunctionServiceImpl.java +++ /dev/null @@ -1,93 +0,0 @@ -package com.ruoyi.business.service.impl; - -import java.util.List; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import com.ruoyi.business.mapper.HwDeviceModeFunctionMapper; -import com.ruoyi.business.domain.HwDeviceModeFunction; -import com.ruoyi.business.service.IHwDeviceModeFunctionService; - -/** - * 设备模型功能Service业务层处理 - * - * @author xins - * @date 2023-09-05 - */ -@Service -public class HwDeviceModeFunctionServiceImpl implements IHwDeviceModeFunctionService -{ - @Autowired - private HwDeviceModeFunctionMapper hwDeviceModeFunctionMapper; - - /** - * 查询设备模型功能 - * - * @param modeFunctionId 设备模型功能主键 - * @return 设备模型功能 - */ - @Override - public HwDeviceModeFunction selectHwDeviceModeFunctionByModeFunctionId(Long modeFunctionId) - { - return hwDeviceModeFunctionMapper.selectHwDeviceModeFunctionByModeFunctionId(modeFunctionId); - } - - /** - * 查询设备模型功能列表 - * - * @param hwDeviceModeFunction 设备模型功能 - * @return 设备模型功能 - */ - @Override - public List selectHwDeviceModeFunctionList(HwDeviceModeFunction hwDeviceModeFunction) - { - return hwDeviceModeFunctionMapper.selectHwDeviceModeFunctionList(hwDeviceModeFunction); - } - - /** - * 新增设备模型功能 - * - * @param hwDeviceModeFunction 设备模型功能 - * @return 结果 - */ - @Override - public int insertHwDeviceModeFunction(HwDeviceModeFunction hwDeviceModeFunction) - { - return hwDeviceModeFunctionMapper.insertHwDeviceModeFunction(hwDeviceModeFunction); - } - - /** - * 修改设备模型功能 - * - * @param hwDeviceModeFunction 设备模型功能 - * @return 结果 - */ - @Override - public int updateHwDeviceModeFunction(HwDeviceModeFunction hwDeviceModeFunction) - { - return hwDeviceModeFunctionMapper.updateHwDeviceModeFunction(hwDeviceModeFunction); - } - - /** - * 批量删除设备模型功能 - * - * @param modeFunctionIds 需要删除的设备模型功能主键 - * @return 结果 - */ - @Override - public int deleteHwDeviceModeFunctionByModeFunctionIds(Long[] modeFunctionIds) - { - return hwDeviceModeFunctionMapper.deleteHwDeviceModeFunctionByModeFunctionIds(modeFunctionIds); - } - - /** - * 删除设备模型功能信息 - * - * @param modeFunctionId 设备模型功能主键 - * @return 结果 - */ - @Override - public int deleteHwDeviceModeFunctionByModeFunctionId(Long modeFunctionId) - { - return hwDeviceModeFunctionMapper.deleteHwDeviceModeFunctionByModeFunctionId(modeFunctionId); - } -} diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwDeviceModeServiceImpl.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwDeviceModeServiceImpl.java index 578fac5..284462b 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwDeviceModeServiceImpl.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwDeviceModeServiceImpl.java @@ -1,134 +1,454 @@ package com.ruoyi.business.service.impl; -import java.util.List; +import com.ruoyi.business.domain.HwDevice; +import com.ruoyi.business.domain.HwDeviceMode; +import com.ruoyi.business.domain.HwDeviceModeFunction; +import com.ruoyi.business.domain.HwDeviceModeParameter; +import com.ruoyi.business.mapper.HwDeviceMapper; +import com.ruoyi.business.mapper.HwDeviceModeMapper; +import com.ruoyi.business.service.IHwDeviceModeService; +import com.ruoyi.common.core.constant.HwDictConstants; +import com.ruoyi.common.core.constant.TdEngineConstants; +import com.ruoyi.common.core.domain.R; +import com.ruoyi.common.core.enums.DataTypeEnums; +import com.ruoyi.common.core.exception.ServiceException; import com.ruoyi.common.core.utils.DateUtils; +import com.ruoyi.common.core.utils.StringUtils; +import com.ruoyi.common.security.utils.SecurityUtils; +import com.ruoyi.system.api.RemoteConfigService; +import com.ruoyi.tdengine.api.RemoteTdEngineService; +import com.ruoyi.tdengine.api.domain.TdField; +import com.ruoyi.tdengine.api.domain.TdSuperTableVo; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import java.util.ArrayList; -import com.ruoyi.common.core.utils.StringUtils; import org.springframework.transaction.annotation.Transactional; -import com.ruoyi.business.domain.HwDeviceModeFunction; -import com.ruoyi.business.mapper.HwDeviceModeMapper; -import com.ruoyi.business.domain.HwDeviceMode; -import com.ruoyi.business.service.IHwDeviceModeService; + +import javax.annotation.Resource; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; /** * 设备模型Service业务层处理 - * + * * @author xins * @date 2023-09-04 */ @Service -public class HwDeviceModeServiceImpl implements IHwDeviceModeService -{ +public class HwDeviceModeServiceImpl implements IHwDeviceModeService { @Autowired private HwDeviceModeMapper hwDeviceModeMapper; + @Autowired + private HwDeviceModeFunctionMapper hwDeviceModeFunctionMapper; + + @Autowired + private HwDeviceMapper hwDeviceMapper; + + @Resource + private RemoteConfigService remoteConfigService; + + @Resource + private RemoteTdEngineService remoteTdEngineService; + /** * 查询设备模型 - * + * * @param deviceModeId 设备模型主键 * @return 设备模型 */ @Override - public HwDeviceMode selectHwDeviceModeByDeviceModeId(Long deviceModeId) - { + public HwDeviceMode selectHwDeviceModeByDeviceModeId(Long deviceModeId) { return hwDeviceModeMapper.selectHwDeviceModeByDeviceModeId(deviceModeId); } /** * 查询设备模型列表 - * + * * @param hwDeviceMode 设备模型 * @return 设备模型 */ @Override - public List selectHwDeviceModeList(HwDeviceMode hwDeviceMode) - { + public List selectHwDeviceModeList(HwDeviceMode hwDeviceMode) { return hwDeviceModeMapper.selectHwDeviceModeList(hwDeviceMode); } /** * 新增设备模型 - * + * * @param hwDeviceMode 设备模型 * @return 结果 */ @Transactional @Override - public int insertHwDeviceMode(HwDeviceMode hwDeviceMode) - { + public int insertHwDeviceMode(HwDeviceMode hwDeviceMode) { + //先判断是否有重复的标识符 + List hwDeviceModeFunctionList = hwDeviceMode.getHwDeviceModeFunctionList(); + + List duplicateFunctionIdentifiers = hwDeviceModeFunctionList.stream() + .collect(Collectors.groupingBy(p -> p.getFunctionIdentifier(), Collectors.counting())).entrySet().stream() + .filter(entry -> entry.getValue() > 1) // >1 查找重复的集合;== 查找不重复的集合 + .map(entry -> entry.getKey()) + .collect(Collectors.toList()); + if (duplicateFunctionIdentifiers != null && !duplicateFunctionIdentifiers.isEmpty()) { + throw new ServiceException("存在重复的标识符:" + duplicateFunctionIdentifiers.toString()); + } + //再判断是否不是定位的标识符与定位标识符相同 + R keyLongitudeR = remoteConfigService.getConfigKeyStr("hw.gps.longitude"); + R keyLatitudeR = remoteConfigService.getConfigKeyStr("hw.gps.latitude"); + String keyLongitude = keyLongitudeR.getData(); + String keyLatitude = keyLatitudeR.getData(); + + hwDeviceModeFunctionList.forEach(d -> { + if (d.getFunctionIdentifier().equalsIgnoreCase(TdEngineConstants.DEFAULT_FIRST_FIELD_NAME)) { + throw new ServiceException("标识符不能等于:" + TdEngineConstants.DEFAULT_FIRST_FIELD_NAME); + } + if (StringUtils.isEmpty(d.getCoordinate()) && + (d.getFunctionIdentifier().equalsIgnoreCase(keyLongitude) + || d.getFunctionIdentifier().equalsIgnoreCase(keyLatitude))) { + throw new ServiceException("非定位设备模型标识符不能等于:" + keyLongitude + "或" + keyLatitude); + } + }); + hwDeviceMode.setCreateTime(DateUtils.getNowDate()); + hwDeviceMode.setCreateBy(SecurityUtils.getUsername()); int rows = hwDeviceModeMapper.insertHwDeviceMode(hwDeviceMode); - insertHwDeviceModeFunction(hwDeviceMode); + batchInsertHwDeviceModeFunction(hwDeviceMode); + + this.createTdSuperTable(hwDeviceMode); return rows; } /** * 修改设备模型 - * + * * @param hwDeviceMode 设备模型 * @return 结果 */ @Transactional @Override - public int updateHwDeviceMode(HwDeviceMode hwDeviceMode) - { + public int updateHwDeviceMode(HwDeviceMode hwDeviceMode) { + hwDeviceMode.setUpdateBy(SecurityUtils.getUsername()); hwDeviceMode.setUpdateTime(DateUtils.getNowDate()); - hwDeviceModeMapper.deleteHwDeviceModeFunctionByDeviceModeId(hwDeviceMode.getDeviceModeId()); - insertHwDeviceModeFunction(hwDeviceMode); +// hwDeviceModeMapper.deleteHwDeviceModeFunctionByDeviceModeId(hwDeviceMode.getDeviceModeId()); +// insertHwDeviceModeFunction(hwDeviceMode); return hwDeviceModeMapper.updateHwDeviceMode(hwDeviceMode); } /** * 批量删除设备模型 - * + * * @param deviceModeIds 需要删除的设备模型主键 * @return 结果 */ @Transactional @Override - public int deleteHwDeviceModeByDeviceModeIds(Long[] deviceModeIds) - { + public int deleteHwDeviceModeByDeviceModeIds(Long[] deviceModeIds) { hwDeviceModeMapper.deleteHwDeviceModeFunctionByDeviceModeIds(deviceModeIds); return hwDeviceModeMapper.deleteHwDeviceModeByDeviceModeIds(deviceModeIds); } /** * 删除设备模型信息 - * + * * @param deviceModeId 设备模型主键 * @return 结果 */ @Transactional @Override - public int deleteHwDeviceModeByDeviceModeId(Long deviceModeId) - { + public int deleteHwDeviceModeByDeviceModeId(Long deviceModeId) { hwDeviceModeMapper.deleteHwDeviceModeFunctionByDeviceModeId(deviceModeId); return hwDeviceModeMapper.deleteHwDeviceModeByDeviceModeId(deviceModeId); } /** * 新增设备模型功能信息 - * + * * @param hwDeviceMode 设备模型对象 */ - public void insertHwDeviceModeFunction(HwDeviceMode hwDeviceMode) - { + private void batchInsertHwDeviceModeFunction(HwDeviceMode hwDeviceMode) { List hwDeviceModeFunctionList = hwDeviceMode.getHwDeviceModeFunctionList(); Long deviceModeId = hwDeviceMode.getDeviceModeId(); - if (StringUtils.isNotNull(hwDeviceModeFunctionList)) - { - List list = new ArrayList(); - for (HwDeviceModeFunction hwDeviceModeFunction : hwDeviceModeFunctionList) - { + if (StringUtils.isNotNull(hwDeviceModeFunctionList)) { + List list = new ArrayList<>(); + for (HwDeviceModeFunction hwDeviceModeFunction : hwDeviceModeFunctionList) { hwDeviceModeFunction.setDeviceModeId(deviceModeId); list.add(hwDeviceModeFunction); } - if (list.size() > 0) - { + if (list.size() > 0) { hwDeviceModeMapper.batchHwDeviceModeFunction(list); + batchInsertHwDeviceModeParameters(list); } } } + + /** + * @param: list + * @description 根据设备功能列表插入参数列表(包括入参和出参) + * @author xins + * @date 2023-09-12 9:54 + */ + private void batchInsertHwDeviceModeParameters(List list) { + List toInsertedParameters = new ArrayList<>(); + for (HwDeviceModeFunction insertedDeviceModeFunction : list) { + List inputParameters = insertedDeviceModeFunction.getInputParameters(); + List outputParameters = insertedDeviceModeFunction.getOutputParameters(); + + if (inputParameters != null && !inputParameters.isEmpty()) { + for (HwDeviceModeParameter inputParameter : inputParameters) { + inputParameter.setModeFunctionId(insertedDeviceModeFunction.getModeFunctionId()); + toInsertedParameters.add(inputParameter); + } + } + + if (outputParameters != null && !outputParameters.isEmpty()) { + for (HwDeviceModeParameter outputParameter : outputParameters) { + outputParameter.setModeFunctionId(insertedDeviceModeFunction.getModeFunctionId()); + toInsertedParameters.add(outputParameter); + } + } + } + + if (!toInsertedParameters.isEmpty()) { + hwDeviceModeMapper.batchHwDeviceModeParameters(toInsertedParameters); + } + } + + /** + * 新增设备模型功能 + * + * @param hwDeviceModeFunction 设备模型功能 + * @return 结果 + */ + @Override + @Transactional + public Long insertHwDeviceModeFunction(HwDeviceModeFunction hwDeviceModeFunction) { + checkDuplicateIdentifiers(hwDeviceModeFunction); + int rows = hwDeviceModeMapper.insertHwDeviceModeFunction(hwDeviceModeFunction); + List hwDeviceModeFunctions = new ArrayList<>(); + hwDeviceModeFunctions.add(hwDeviceModeFunction); + batchInsertHwDeviceModeParameters(hwDeviceModeFunctions); + + this.addTdSuperTableColumn(hwDeviceModeFunction); + + return hwDeviceModeFunction.getModeFunctionId(); + } + + /** + * 修改设备模型功能 + * + * @param hwDeviceModeFunction 设备模型功能 + * @return 结果 + */ + @Override + @Transactional + public int updateHwDeviceModeFunction(HwDeviceModeFunction hwDeviceModeFunction) { + //查询是否有已发布的设备关联此设备模型 + HwDevice queryHwDevice = new HwDevice(); + queryHwDevice.setDeviceModeId(hwDeviceModeFunction.getDeviceModeId()); + queryHwDevice.setDeviceStatus(HwDictConstants.DEVICE_STATUS_PUBLISH); + List hwDevices = hwDeviceMapper.selectHwDeviceList(queryHwDevice); + if (hwDevices.size() > 0) { + throw new ServiceException("已有已发布状态设备关联,不能修改"); + } + + checkDuplicateIdentifiers(hwDeviceModeFunction); + hwDeviceModeMapper.deleteHwDeviceModeParameterByModeFunctionId(hwDeviceModeFunction.getModeFunctionId()); + List hwDeviceModeFunctions = new ArrayList<>(); + hwDeviceModeFunctions.add(hwDeviceModeFunction); + batchInsertHwDeviceModeParameters(hwDeviceModeFunctions); + + //与数据库中的数据判断标识符有没有修改,如果修改则在tdengine超级表删除老的字段,增加修改的字段 + String functionMode = hwDeviceModeFunction.getFunctionMode(); + if (functionMode.equals(HwDictConstants.FUNCTION_MODE_ATTRIBUTE)) { + HwDeviceModeFunction dbHwDeviceModeFunction = hwDeviceModeFunctionMapper + .selectHwDeviceModeFunctionByModeFunctionId(hwDeviceModeFunction.getModeFunctionId()); + + String dbFunctionIdentifier = dbHwDeviceModeFunction.getFunctionIdentifier(); + String functionIdentifier = hwDeviceModeFunction.getFunctionIdentifier(); + Long dbDataType = dbHwDeviceModeFunction.getDataType(); + Long dataType = hwDeviceModeFunction.getDataType(); + //标识符或数据类型变化时需要先删除超级表column,再增加新的column + if (!dbFunctionIdentifier.equalsIgnoreCase(functionIdentifier) + || !dbDataType.equals(dataType)) { + this.dropTdSuperTableColumn(dbHwDeviceModeFunction); + this.addTdSuperTableColumn(hwDeviceModeFunction); + } + } + + return hwDeviceModeMapper.updateHwDeviceModeFunction(hwDeviceModeFunction); + } + + /** + * 删除设备模型功能信息 + * + * @param modeFunctionId 设备模型功能主键 + * @return 结果 + */ + @Override + @Transactional + public int deleteHwDeviceModeFunctionByModeFunctionId(Long modeFunctionId) { + HwDeviceModeFunction hwDeviceModeFunction = hwDeviceModeFunctionMapper.selectHwDeviceModeFunctionByModeFunctionId(modeFunctionId); + hwDeviceModeMapper.deleteHwDeviceModeParameterByModeFunctionId(modeFunctionId); + int rows = hwDeviceModeMapper.deleteHwDeviceModeFunctionByModeFunctionId(modeFunctionId); + this.dropTdSuperTableColumn(hwDeviceModeFunction); + return rows; + } + + + /** + * @return Map> + * @param: modeFunctionId + * @description 根据设备功能主键获取参数信息列表(入参和出参按map返回) + * @author xins + * @date 2023-09-12 10:45 + */ + @Override + public Map> selectDeviceModeParametersByModeFunctionId(Long modeFunctionId) { + List hwDeviceModeParameters = hwDeviceModeMapper.selectDeviceModeParametersByModeFunctionId(modeFunctionId); + Map> hwDeviceModeParametersMap = hwDeviceModeParameters.stream() + .collect(Collectors.groupingBy(HwDeviceModeParameter::getParameterType)); + return hwDeviceModeParametersMap; + } + + /** + * @param: hwDeviceModeFunction + * @description 在编辑设备模型添加功能或者编辑功能时判断属性值 + * @author xins + * @date 2023-09-13 13:38 + */ + private void checkDuplicateIdentifiers(HwDeviceModeFunction hwDeviceModeFunction) { + if (hwDeviceModeFunction.getFunctionIdentifier().equalsIgnoreCase(TdEngineConstants.DEFAULT_FIRST_FIELD_NAME)) { + throw new ServiceException("标识符不能等于:" + TdEngineConstants.DEFAULT_FIRST_FIELD_NAME); + } + + R keyLongitudeR = remoteConfigService.getConfigKeyStr("hw.gps.longitude"); + R keyLatitudeR = remoteConfigService.getConfigKeyStr("hw.gps.latitude"); + String keyLongitude = keyLongitudeR.getData(); + String keyLatitude = keyLatitudeR.getData(); + + if (StringUtils.isEmpty(hwDeviceModeFunction.getCoordinate()) && + (hwDeviceModeFunction.getFunctionIdentifier().equalsIgnoreCase(keyLongitude) + || hwDeviceModeFunction.getFunctionIdentifier().equalsIgnoreCase(keyLatitude))) { + throw new ServiceException("非定位设备模型标识符不能等于:" + keyLongitude + "或" + keyLatitude); + } + + Long deviceModeId = hwDeviceModeFunction.getDeviceModeId(); + HwDeviceModeFunction queryDeviceModeFunction = new HwDeviceModeFunction(); + queryDeviceModeFunction.setDeviceModeId(deviceModeId); + List hwDeviceModeFunctions = hwDeviceModeFunctionMapper.selectHwDeviceModeFunctionList(queryDeviceModeFunction); + + /** + * 判断时如果是修改的标识符则不能跟自己比较 + */ + long duplicateCount = hwDeviceModeFunctions.stream().filter(dmf -> + ((hwDeviceModeFunction.getModeFunctionId() == null) || + (hwDeviceModeFunction.getModeFunctionId() != null && !hwDeviceModeFunction.getModeFunctionId().equals(dmf.getModeFunctionId()))) + && dmf.getFunctionIdentifier().equalsIgnoreCase(hwDeviceModeFunction.getFunctionIdentifier())).count(); + if (duplicateCount > 0) { + throw new ServiceException("标识符重复"); + } + } + + private void createTdSuperTable(HwDeviceMode hwDeviceMode) { + TdSuperTableVo tdSuperTableVo = new TdSuperTableVo(); + Long sceneId = hwDeviceMode.getSceneId(); + String dbName = TdEngineConstants.DEFAULT_DB_NAME_PREFIX + sceneId; + String superTableName = TdEngineConstants.DEFAULT_SUPER_TABLE_NAME_PREFIX + hwDeviceMode.getDeviceModeId(); + + List tagFields = new ArrayList(); + TdField tagField = new TdField(); + tagField.setFieldName(TdEngineConstants.ST_TAG_DEVICECODE); + tagField.setDataTypeCode(TdEngineConstants.ST_TAG_DEVICECODE_TYPE); + tagField.setSize(TdEngineConstants.ST_TAG_DEVICECODE_SIZE); + tagFields.add(tagField); + + tagField = new TdField(); + tagField.setFieldName(TdEngineConstants.ST_TAG_DEVICENAME); + tagField.setDataTypeCode(TdEngineConstants.ST_TAG_DEVICENAME_TYPE); + tagField.setSize(TdEngineConstants.ST_TAG_DEVICENAME_SIZE); + tagFields.add(tagField); + + tagField = new TdField(); + tagField.setFieldName(TdEngineConstants.ST_TAG_DEVICEID); + tagField.setDataTypeCode(TdEngineConstants.ST_TAG_DEVICEID_TYPE); + tagFields.add(tagField); + + tagField = new TdField(); + tagField.setFieldName(TdEngineConstants.ST_TAG_DEVICEMODEID); + tagField.setDataTypeCode(TdEngineConstants.ST_TAG_DEVICEMODEID_TYPE); + tagFields.add(tagField); + + tagField = new TdField(); + tagField.setFieldName(TdEngineConstants.ST_TAG_MONITORUNITID); + tagField.setDataTypeCode(TdEngineConstants.ST_TAG_MONITORUNITID_TYPE); + tagFields.add(tagField); + + List schemaFields = new ArrayList(); + List hwDeviceModeFunctions = hwDeviceMode.getHwDeviceModeFunctionList(); + TdField schemaField; + for (HwDeviceModeFunction hwDeviceModeFunction : hwDeviceModeFunctions) { + String functionMode = hwDeviceModeFunction.getFunctionMode(); + if (functionMode.equalsIgnoreCase(HwDictConstants.FUNCTION_MODE_ATTRIBUTE)) { + schemaField = new TdField(); + schemaField.setFieldName(hwDeviceModeFunction.getFunctionIdentifier()); + Long dataType = hwDeviceModeFunction.getDataType(); + schemaField.setDataTypeCode(dataType.intValue()); + if (String.valueOf(dataType).equals(String.valueOf(DataTypeEnums.NCHAR.getDataCode()))) { + schemaField.setSize(Integer.valueOf(hwDeviceModeFunction.getDataDefinition())); + } + schemaFields.add(schemaField); + } + } + + tdSuperTableVo.setDatabaseName(dbName); + tdSuperTableVo.setSuperTableName(superTableName); + tdSuperTableVo.setFirstFieldName(TdEngineConstants.DEFAULT_FIRST_FIELD_NAME); + tdSuperTableVo.setSchemaFields(schemaFields); + tdSuperTableVo.setTagsFields(tagFields); + this.remoteTdEngineService.createSuperTable(tdSuperTableVo); + } + + private void addTdSuperTableColumn(HwDeviceModeFunction hwDeviceModeFunction) { + String functionMode = hwDeviceModeFunction.getFunctionMode(); + if (functionMode.equals(HwDictConstants.FUNCTION_MODE_ATTRIBUTE)) { + Long deviceModeId = hwDeviceModeFunction.getDeviceModeId(); + HwDeviceMode hwDeviceMode = hwDeviceModeMapper.selectHwDeviceModeByDeviceModeId(deviceModeId); + String dbName = TdEngineConstants.DEFAULT_DB_NAME_PREFIX + hwDeviceMode.getSceneId(); + String superTableName = TdEngineConstants.DEFAULT_SUPER_TABLE_NAME_PREFIX + deviceModeId; + TdSuperTableVo tdSuperTableVo = new TdSuperTableVo(); + TdField schemaField = new TdField(); + schemaField.setFieldName(hwDeviceModeFunction.getFunctionIdentifier()); + Long dataType = hwDeviceModeFunction.getDataType(); + schemaField.setDataTypeCode(dataType.intValue()); + //一个integer类型,一个long类型,需要转换为string类型比较 + if (String.valueOf(dataType).equals(String.valueOf(DataTypeEnums.NCHAR.getDataCode()))) { + schemaField.setSize(Integer.valueOf(hwDeviceModeFunction.getDataDefinition())); + } + tdSuperTableVo.setDatabaseName(dbName); + tdSuperTableVo.setSuperTableName(superTableName); + tdSuperTableVo.setField(schemaField); + this.remoteTdEngineService.addSuperTableColumn(tdSuperTableVo); + } + } + + private void dropTdSuperTableColumn(HwDeviceModeFunction hwDeviceModeFunction) { + String functionMode = hwDeviceModeFunction.getFunctionMode(); + if (functionMode.equals(HwDictConstants.FUNCTION_MODE_ATTRIBUTE)) { + Long deviceModeId = hwDeviceModeFunction.getDeviceModeId(); + HwDeviceMode hwDeviceMode = hwDeviceModeMapper.selectHwDeviceModeByDeviceModeId(deviceModeId); + String dbName = TdEngineConstants.DEFAULT_DB_NAME_PREFIX + hwDeviceMode.getSceneId(); + String superTableName = TdEngineConstants.DEFAULT_SUPER_TABLE_NAME_PREFIX + deviceModeId; + TdSuperTableVo tdSuperTableVo = new TdSuperTableVo(); + TdField schemaField = new TdField(); + schemaField.setFieldName(hwDeviceModeFunction.getFunctionIdentifier()); + tdSuperTableVo.setDatabaseName(dbName); + tdSuperTableVo.setSuperTableName(superTableName); + tdSuperTableVo.setField(schemaField); + + this.remoteTdEngineService.dropColumnForSuperTable(tdSuperTableVo); + } + } + } diff --git a/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwDeviceModeMapper.xml b/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwDeviceModeMapper.xml index a1e5cdb..6d1e984 100644 --- a/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwDeviceModeMapper.xml +++ b/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwDeviceModeMapper.xml @@ -52,10 +52,28 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + + + + + + + + + + + + + select device_mode_id, device_mode_name, tenant_id, scene_id, language_code, gps_flag, device_mode_status, common_flag, mode_classfication, device_mode_pic, data_verify_level, remark, create_by, create_time, update_by, update_time, device_mode_field from hw_device_mode + + select mode_parameter_id, mode_function_id, releated_parameter_id, parameter_type, parameter_name, parameter_identifier, data_type, data_definition, property_unit, property_step from hw_device_mode_parameter + + + + where mode_function_id = #{modeFunctionId} + + \ No newline at end of file diff --git a/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwDeviceModeParameterMapper.xml b/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwDeviceModeParameterMapper.xml new file mode 100644 index 0000000..f963f9c --- /dev/null +++ b/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwDeviceModeParameterMapper.xml @@ -0,0 +1,105 @@ + + + + + + + + + + + + + + + + + + + select mode_parameter_id, mode_function_id, releated_parameter_id, parameter_type, parameter_name, parameter_identifier, data_type, data_definition, property_unit, property_step from hw_device_mode_parameter + + + + + + + + insert into hw_device_mode_parameter + + mode_function_id, + releated_parameter_id, + parameter_type, + parameter_name, + parameter_identifier, + data_type, + data_definition, + property_unit, + property_step, + + + #{modeFunctionId}, + #{releatedParameterId}, + #{parameterType}, + #{parameterName}, + #{parameterIdentifier}, + #{dataType}, + #{dataDefinition}, + #{propertyUnit}, + #{propertyStep}, + + + + + update hw_device_mode_parameter + + mode_function_id = #{modeFunctionId}, + releated_parameter_id = #{releatedParameterId}, + parameter_type = #{parameterType}, + parameter_name = #{parameterName}, + parameter_identifier = #{parameterIdentifier}, + data_type = #{dataType}, + data_definition = #{dataDefinition}, + property_unit = #{propertyUnit}, + property_step = #{propertyStep}, + + where mode_parameter_id = #{modeParameterId} + + + + delete from hw_device_mode_parameter where mode_parameter_id = #{modeParameterId} + + + + delete from hw_device_mode_parameter where mode_parameter_id in + + #{modeParameterId} + + + + + + insert into hw_device_mode_parameter( mode_function_id, parameter_type, parameter_name, parameter_identifier, data_type, data_definition, property_unit, property_step) values + + ( #{item.modeFunctionId}, #{item.parameterType}, #{item.parameterName}, #{item.parameterIdentifier}, #{item.dataType}, #{item.dataDefinition}, #{item.propertyUnit}, #{item.propertyStep}) + + + + \ No newline at end of file diff --git a/ruoyi-modules/hw-data-process/src/main/java/com/ruoyi/dataprocess/domain/HwDevice.java b/ruoyi-modules/hw-data-process/src/main/java/com/ruoyi/dataprocess/domain/HwDevice.java index 46d25c5..29ed081 100644 --- a/ruoyi-modules/hw-data-process/src/main/java/com/ruoyi/dataprocess/domain/HwDevice.java +++ b/ruoyi-modules/hw-data-process/src/main/java/com/ruoyi/dataprocess/domain/HwDevice.java @@ -1,18 +1,17 @@ package com.ruoyi.dataprocess.domain; +import java.util.Date; import com.fasterxml.jackson.annotation.JsonFormat; -import com.ruoyi.common.core.annotation.Excel; -import com.ruoyi.common.core.web.domain.BaseEntity; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; - -import java.util.Date; +import com.ruoyi.common.core.annotation.Excel; +import com.ruoyi.common.core.web.domain.BaseEntity; /** * 设备信息对象 hw_device * * @author xins - * @date 2023-08-24 + * @date 2023-09-13 */ public class HwDevice extends BaseEntity { @@ -107,6 +106,14 @@ public class HwDevice extends BaseEntity @Excel(name = "预留字段") private String deviceField; + /** 租户ID,关联hw_tenant的tenant_id */ + @Excel(name = "租户ID,关联hw_tenant的tenant_id") + private Long tenantId; + + /** 在线状态(1、在线,0、离线) */ + @Excel(name = "在线状态", readConverterExp = "1=、在线,0、离线") + private String onlineStatus; + public void setDeviceId(Long deviceId) { this.deviceId = deviceId; @@ -305,6 +312,24 @@ public class HwDevice extends BaseEntity { return deviceField; } + public void setTenantId(Long tenantId) + { + this.tenantId = tenantId; + } + + public Long getTenantId() + { + return tenantId; + } + public void setOnlineStatus(String onlineStatus) + { + this.onlineStatus = onlineStatus; + } + + public String getOnlineStatus() + { + return onlineStatus; + } @Override public String toString() { @@ -336,6 +361,8 @@ public class HwDevice extends BaseEntity .append("updateBy", getUpdateBy()) .append("updateTime", getUpdateTime()) .append("deviceField", getDeviceField()) + .append("tenantId", getTenantId()) + .append("onlineStatus", getOnlineStatus()) .toString(); } } diff --git a/ruoyi-modules/hw-data-process/src/main/java/com/ruoyi/dataprocess/mapper/HwDeviceMapper.java b/ruoyi-modules/hw-data-process/src/main/java/com/ruoyi/dataprocess/mapper/HwDeviceMapper.java index 6f60e55..91a6754 100644 --- a/ruoyi-modules/hw-data-process/src/main/java/com/ruoyi/dataprocess/mapper/HwDeviceMapper.java +++ b/ruoyi-modules/hw-data-process/src/main/java/com/ruoyi/dataprocess/mapper/HwDeviceMapper.java @@ -21,5 +21,11 @@ public interface HwDeviceMapper */ public HwDevice selectHwDeviceByDeviceCode(String deviceCode); - + /** + * 修改设备信息 + * + * @param hwDevice 设备信息 + * @return 结果 + */ + public int updateHwDevice(HwDevice hwDevice); } diff --git a/ruoyi-modules/hw-data-process/src/main/java/com/ruoyi/dataprocess/service/impl/DeviceStatusServiceImpl.java b/ruoyi-modules/hw-data-process/src/main/java/com/ruoyi/dataprocess/service/impl/DeviceStatusServiceImpl.java index bdf19dc..2a1fe09 100644 --- a/ruoyi-modules/hw-data-process/src/main/java/com/ruoyi/dataprocess/service/impl/DeviceStatusServiceImpl.java +++ b/ruoyi-modules/hw-data-process/src/main/java/com/ruoyi/dataprocess/service/impl/DeviceStatusServiceImpl.java @@ -20,7 +20,7 @@ import java.util.List; * @Description: 设备状态处理服务 * @ClassName: DeviceStatusServiceImpl * @Author : xins - * @Date :2023-09-04 15:31 + * @Date :2023-09-12 15:31 * @Version :1.0 */ @Service @@ -34,7 +34,6 @@ public class DeviceStatusServiceImpl implements IDeviceStatusService { @Override public void handleDeviceStatus(String payloadString, String clientId) { - System.out.println("ddd:" + payloadString); // ddd:{"msg":"设备设备连接状态信息","deviceType":"edge","connectStatus":1, // "statusTime":1694506127199,"deviceCode":"hw-data-process-1"} JSONObject json = JSON.parseObject(payloadString); @@ -68,6 +67,10 @@ public class DeviceStatusServiceImpl implements IDeviceStatusService { tdTableVo.setSchemaFields(schemaFields); this.remoteTdEngineService.insertTable(tdTableVo); + + //更新设备当前状态信息 + hwDevice.setOnlineStatus(String.valueOf(json.getInteger("connectStatus"))); + hwDeviceMapper.updateHwDevice(hwDevice); } } } diff --git a/ruoyi-modules/hw-data-process/src/main/resources/mapper/dataprocess/HwDeviceMapper.xml b/ruoyi-modules/hw-data-process/src/main/resources/mapper/dataprocess/HwDeviceMapper.xml index d192fcf..80c1fcf 100644 --- a/ruoyi-modules/hw-data-process/src/main/resources/mapper/dataprocess/HwDeviceMapper.xml +++ b/ruoyi-modules/hw-data-process/src/main/resources/mapper/dataprocess/HwDeviceMapper.xml @@ -4,7 +4,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> - + @@ -32,16 +32,52 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + - select device_id, device_code, scene_id, monitor_unit_id, device_type, device_mode_id, device_status from hw_device + select device_id, device_code, device_name, scene_id, monitor_unit_id, device_type, networking_mode, access_protocol, data_format, releated_device_id, device_mode_id, access_gw_protocol, active_status, device_status, active_time, device_pic, ip_address, area_id, device_location, current_module_version, current_singlechip_version, remark, create_by, create_time, update_by, update_time, device_field, tenant_id, online_status from hw_device - + + + update hw_device + + device_code = #{deviceCode}, + device_name = #{deviceName}, + scene_id = #{sceneId}, + monitor_unit_id = #{monitorUnitId}, + device_type = #{deviceType}, + networking_mode = #{networkingMode}, + access_protocol = #{accessProtocol}, + data_format = #{dataFormat}, + releated_device_id = #{releatedDeviceId}, + device_mode_id = #{deviceModeId}, + access_gw_protocol = #{accessGwProtocol}, + active_status = #{activeStatus}, + device_status = #{deviceStatus}, + active_time = #{activeTime}, + device_pic = #{devicePic}, + ip_address = #{ipAddress}, + area_id = #{areaId}, + device_location = #{deviceLocation}, + current_module_version = #{currentModuleVersion}, + current_singlechip_version = #{currentSinglechipVersion}, + remark = #{remark}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + device_field = #{deviceField}, + tenant_id = #{tenantId}, + online_status = #{onlineStatus}, + + where device_id = #{deviceId} + \ No newline at end of file diff --git a/ruoyi-modules/hw-tdengine/src/main/java/com/ruoyi/tdengine/controller/TdEngineController.java b/ruoyi-modules/hw-tdengine/src/main/java/com/ruoyi/tdengine/controller/TdEngineController.java index c50e794..6a33bea 100644 --- a/ruoyi-modules/hw-tdengine/src/main/java/com/ruoyi/tdengine/controller/TdEngineController.java +++ b/ruoyi-modules/hw-tdengine/src/main/java/com/ruoyi/tdengine/controller/TdEngineController.java @@ -181,8 +181,8 @@ public class TdEngineController { TdField dropField = tdSuperTableVo.getField(); try { - TdFieldVo dropFieldVo = TdFieldVo.convertField(dropField); - this.tdEngineService.dropSuperTableColumn(databaseName, superTableName, dropFieldVo); +// TdFieldVo dropFieldVo = TdFieldVo.convertField(dropField); + this.tdEngineService.dropSuperTableColumn(databaseName, superTableName, dropField); log.info("successfully droped column of superTable " + superTableName); return R.ok("successfully droped column of superTable " + superTableName); } catch (UncategorizedSQLException e) { diff --git a/ruoyi-modules/hw-tdengine/src/main/java/com/ruoyi/tdengine/mapper/TdEngineMapper.java b/ruoyi-modules/hw-tdengine/src/main/java/com/ruoyi/tdengine/mapper/TdEngineMapper.java index 98e0e4d..1ba469c 100644 --- a/ruoyi-modules/hw-tdengine/src/main/java/com/ruoyi/tdengine/mapper/TdEngineMapper.java +++ b/ruoyi-modules/hw-tdengine/src/main/java/com/ruoyi/tdengine/mapper/TdEngineMapper.java @@ -77,7 +77,7 @@ public interface TdEngineMapper { */ void dropSuperTableColumn(@Param("databaseName") String databaseName, @Param("superTableName") String superTableName, - @Param("dropFieldsVo") TdFieldVo dropFieldsVo); + @Param("dropField") TdField dropField); /** diff --git a/ruoyi-modules/hw-tdengine/src/main/java/com/ruoyi/tdengine/service/ITdEngineService.java b/ruoyi-modules/hw-tdengine/src/main/java/com/ruoyi/tdengine/service/ITdEngineService.java index 867b6e8..81644f9 100644 --- a/ruoyi-modules/hw-tdengine/src/main/java/com/ruoyi/tdengine/service/ITdEngineService.java +++ b/ruoyi-modules/hw-tdengine/src/main/java/com/ruoyi/tdengine/service/ITdEngineService.java @@ -67,7 +67,7 @@ public interface ITdEngineService { * @author xins * @date 2023-08-28 17:13 */ - public void dropSuperTableColumn(String databaseName,String superTableName, TdFieldVo dropFieldsVo) throws Exception; + public void dropSuperTableColumn(String databaseName,String superTableName, TdField dropField) throws Exception; /** * @param: databaseName diff --git a/ruoyi-modules/hw-tdengine/src/main/java/com/ruoyi/tdengine/service/impl/TdEngineServiceImpl.java b/ruoyi-modules/hw-tdengine/src/main/java/com/ruoyi/tdengine/service/impl/TdEngineServiceImpl.java index 8571556..8340b54 100644 --- a/ruoyi-modules/hw-tdengine/src/main/java/com/ruoyi/tdengine/service/impl/TdEngineServiceImpl.java +++ b/ruoyi-modules/hw-tdengine/src/main/java/com/ruoyi/tdengine/service/impl/TdEngineServiceImpl.java @@ -99,8 +99,8 @@ public class TdEngineServiceImpl implements ITdEngineService { * @author xins * @date 2023-08-28 17:13 */ - public void dropSuperTableColumn(String databaseName, String superTableName, TdFieldVo dropFieldsVo) throws Exception { - this.tdEngineMapper.dropSuperTableColumn(databaseName, superTableName, dropFieldsVo); + public void dropSuperTableColumn(String databaseName, String superTableName, TdField dropField) throws Exception { + this.tdEngineMapper.dropSuperTableColumn(databaseName, superTableName, dropField); } /** diff --git a/ruoyi-modules/hw-tdengine/src/main/resources/mapper/tdengine/TdEngineMapper.xml b/ruoyi-modules/hw-tdengine/src/main/resources/mapper/tdengine/TdEngineMapper.xml index c4132ab..685f21d 100644 --- a/ruoyi-modules/hw-tdengine/src/main/resources/mapper/tdengine/TdEngineMapper.xml +++ b/ruoyi-modules/hw-tdengine/src/main/resources/mapper/tdengine/TdEngineMapper.xml @@ -168,8 +168,8 @@ ALTER STABLE #{databaseName}.#{superTableName} DROP COLUMN - - ${dropFieldsVo.fieldName} + + ${dropField.fieldName} diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysConfigController.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysConfigController.java index bfa9001..8588b11 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysConfigController.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysConfigController.java @@ -2,6 +2,8 @@ package com.ruoyi.system.controller; import java.util.List; import javax.servlet.http.HttpServletResponse; + +import com.ruoyi.common.core.domain.R; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.DeleteMapping; @@ -130,4 +132,13 @@ public class SysConfigController extends BaseController configService.resetConfigCache(); return success(); } + + /** + * 根据参数键名查询参数值 + */ + @GetMapping(value = "/configKeyStr/{configKey}") + public R getConfigKeyStr(@PathVariable String configKey) + { + return R.ok(configService.selectConfigByKey(configKey)); + } } diff --git a/ruoyi-ui/src/api/basic/language.js b/ruoyi-ui/src/api/basic/language.js index 7d79cf7..1df4d70 100644 --- a/ruoyi-ui/src/api/basic/language.js +++ b/ruoyi-ui/src/api/basic/language.js @@ -42,3 +42,13 @@ export function delLanguage(languageId) { method: 'delete' }) } + + +// 查询语言信息列表供选择使用 +export function getLanguages(query) { + return request({ + url: '/basic/language/getLanguages', + method: 'get', + params: query + }) +} diff --git a/ruoyi-ui/src/api/business/deviceMode.js b/ruoyi-ui/src/api/business/deviceMode.js index 3a6ff6a..6038db6 100644 --- a/ruoyi-ui/src/api/business/deviceMode.js +++ b/ruoyi-ui/src/api/business/deviceMode.js @@ -42,3 +42,4 @@ export function delDeviceMode(deviceModeId) { method: 'delete' }) } + diff --git a/ruoyi-ui/src/api/business/deviceModeFunction.js b/ruoyi-ui/src/api/business/deviceModeFunction.js index 1b708cb..abedd07 100644 --- a/ruoyi-ui/src/api/business/deviceModeFunction.js +++ b/ruoyi-ui/src/api/business/deviceModeFunction.js @@ -42,3 +42,12 @@ export function delDeviceModeFunction(modeFunctionId) { method: 'delete' }) } + + +// 查询设备模型功能参数列表 +export function getDeviceModeParameters(modeFunctionId) { + return request({ + url: '/business/deviceModeFunction/getDeviceModeParameters/'+modeFunctionId, + method: 'get' + }) +} diff --git a/ruoyi-ui/src/api/business/scene.js b/ruoyi-ui/src/api/business/scene.js index d10d4fc..0f41a70 100644 --- a/ruoyi-ui/src/api/business/scene.js +++ b/ruoyi-ui/src/api/business/scene.js @@ -42,3 +42,13 @@ export function delScene(sceneId) { method: 'delete' }) } + + +// 查询场景信息列表供选择使用(例如下拉列表) +export function getScenes(query) { + return request({ + url: '/business/scene/getScenes', + method: 'get', + params: query + }) +} diff --git a/ruoyi-ui/src/views/business/deviceMode/deviceModeAttribute.vue b/ruoyi-ui/src/views/business/deviceMode/deviceModeAttribute.vue deleted file mode 100644 index d09bd45..0000000 --- a/ruoyi-ui/src/views/business/deviceMode/deviceModeAttribute.vue +++ /dev/null @@ -1,551 +0,0 @@ - - - diff --git a/ruoyi-ui/src/views/business/deviceMode/deviceModeEvent.vue b/ruoyi-ui/src/views/business/deviceMode/deviceModeEvent.vue index d09bd45..0552eb1 100644 --- a/ruoyi-ui/src/views/business/deviceMode/deviceModeEvent.vue +++ b/ruoyi-ui/src/views/business/deviceMode/deviceModeEvent.vue @@ -1,550 +1,464 @@ diff --git a/ruoyi-ui/src/views/business/deviceMode/index.vue b/ruoyi-ui/src/views/business/deviceMode/index.vue index a982530..6520d2a 100644 --- a/ruoyi-ui/src/views/business/deviceMode/index.vue +++ b/ruoyi-ui/src/views/business/deviceMode/index.vue @@ -9,26 +9,26 @@ @keyup.enter.native="handleQuery" /> - + - + - + @@ -57,30 +57,7 @@ @keyup.enter.native="handleQuery" /> - - - - - - - - - + 搜索 重置 @@ -137,17 +114,15 @@ - - - + + + - -