diff --git a/.idea/httpRequests/http-requests-log.http b/.idea/httpRequests/http-requests-log.http deleted file mode 100644 index 79f18e1..0000000 --- a/.idea/httpRequests/http-requests-log.http +++ /dev/null @@ -1,1135 +0,0 @@ -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-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-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-14T085526.200.json - -### - -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 - -{ - "databaseName": "db_scene_1", - "superTableName": "st_ds34", - "field": { - "fieldName": "ttttt", - "dataTypeCode": 10, - "size":100 - } -} - -<> 2023-09-13T172758.200.json - -### - -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 - -{ - "databaseName": "db_scene_1", - "superTableName": "st_ds_34", - "field": { - "fieldName": "ttttt", - "dataTypeCode": 10, - "size":100 - } -} - -<> 2023-09-13T172744.200.json - -### - -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 - -{"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 - -### - -POST http://localhost/monitorUnit/getDeviceOperations - - } - -### - -POST http://localhost:9601/monitorUnit/export - -<> 2023-09-05T031749.200.json - -### - -GET http://localhost:9601/monitorUnit/ElectronicNumVo - -<> 2023-09-05T031734.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-05T151123.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-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/ruoyi-api/hw-api-tdengine/src/main/java/com/ruoyi/tdengine/api/RemoteTdEngineService.java b/ruoyi-api/hw-api-tdengine/src/main/java/com/ruoyi/tdengine/api/RemoteTdEngineService.java index 9b83e0e..8cfe757 100644 --- a/ruoyi-api/hw-api-tdengine/src/main/java/com/ruoyi/tdengine/api/RemoteTdEngineService.java +++ b/ruoyi-api/hw-api-tdengine/src/main/java/com/ruoyi/tdengine/api/RemoteTdEngineService.java @@ -13,6 +13,7 @@ import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestParam; +import java.util.List; import java.util.Map; @FeignClient(contextId = "remoteTdEngineService", value = ServiceNameConstants.TDENGINE_SERVICE, fallbackFactory = RemoteTdEngineFallbackFactory.class) @@ -43,10 +44,10 @@ public interface RemoteTdEngineService { R getLatestData(@Validated @RequestBody TdSelectDto tdSelectDto); @PostMapping("/tdengine/getLatestDataByTags") - R>> getLatestDataByTags(@RequestBody TdSelectDto tdSelectDto); + R>> getLatestDataByTags(@Validated @RequestBody TdSuperTableSelectVo tdSuperTableSelectVo); @PostMapping("/tdengine/getHistoryData") - R getHistoryData(@Validated @RequestBody TdHistorySelectDto tdHistorySelectDto); + R>> getHistoryData(@Validated @RequestBody TdHistorySelectDto tdHistorySelectDto); @PostMapping("/tdengine/getCountOfHistoryData") R getCountOfHistoryData(@Validated @RequestBody TdHistorySelectDto tdHistorySelectDto); diff --git a/ruoyi-api/hw-api-tdengine/src/main/java/com/ruoyi/tdengine/api/domain/TdSuperTableSelectVo.java b/ruoyi-api/hw-api-tdengine/src/main/java/com/ruoyi/tdengine/api/domain/TdSuperTableSelectVo.java new file mode 100644 index 0000000..16ad660 --- /dev/null +++ b/ruoyi-api/hw-api-tdengine/src/main/java/com/ruoyi/tdengine/api/domain/TdSuperTableSelectVo.java @@ -0,0 +1,49 @@ +package com.ruoyi.tdengine.api.domain; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; + +/** + * @Description: 用于查询超级表最新数据 + * @ClassName: TdSuperTableSelectVo + * @Author : xins + * @Date :2023-09-16 13:48 + * @Version :1.0 + */ +@Data +public class TdSuperTableSelectVo { + //数据库名称 + @NotBlank(message="databaseName cannot be empty") + private String databaseName; + + //超级表名称 + @NotBlank(message="superTableName cannot be empty") + private String superTableName; + + //group by tags名称 + @NotBlank(message="groupByTagsName cannot be empty") + private String groupByTagsName; + + //控制输出条数 + private int limit; + + //指定从第几条之后输出(例如:limit 2,5,输出第3行到第7行的数据) + private int offset; + + /** + * 第一个字段,数据类型必须是timestamp + */ + private String firstFieldName; + + //过滤条件:开始时间 + private long startTime; + + //过滤条件:结束时间 + private long endTime; + + private String deviceCode; + + private String deviceName; + +} diff --git a/ruoyi-api/hw-api-tdengine/src/main/java/com/ruoyi/tdengine/api/factory/RemoteTdEngineFallbackFactory.java b/ruoyi-api/hw-api-tdengine/src/main/java/com/ruoyi/tdengine/api/factory/RemoteTdEngineFallbackFactory.java index 64c1a65..d8a386c 100644 --- a/ruoyi-api/hw-api-tdengine/src/main/java/com/ruoyi/tdengine/api/factory/RemoteTdEngineFallbackFactory.java +++ b/ruoyi-api/hw-api-tdengine/src/main/java/com/ruoyi/tdengine/api/factory/RemoteTdEngineFallbackFactory.java @@ -8,23 +8,24 @@ import org.slf4j.LoggerFactory; import org.springframework.cloud.openfeign.FallbackFactory; import org.springframework.stereotype.Component; +import java.util.List; import java.util.Map; /** * @Description: TDengine服务降级处理 * @ClassName: RemoteTdEngineFallbackFactory - * @Author : xins - * @Date :2023-09-01 14:14 + * @Author : xins + * @Date :2023-09-01 14:14 * @Version :1.0 */ @Component public class RemoteTdEngineFallbackFactory implements FallbackFactory { private static final Logger log = LoggerFactory.getLogger(RemoteTdEngineFallbackFactory.class); + @Override public RemoteTdEngineService create(Throwable throwable) { - return new RemoteTdEngineService() - { + return new RemoteTdEngineService() { @Override public R createDataBase(String databaseName) { return R.fail("创建数据库失败:" + throwable.getMessage()); @@ -66,12 +67,12 @@ public class RemoteTdEngineFallbackFactory implements FallbackFactory>> getLatestDataByTags(TdSelectDto tdSelectDto) { + public R>> getLatestDataByTags(TdSuperTableSelectVo tdSuperTableSelectVo) { return R.fail("根据tags获取超级表最新数据失败:" + throwable.getMessage()); } @Override - public R getHistoryData(TdHistorySelectDto tdHistorySelectDto) { + public R>> getHistoryData(TdHistorySelectDto tdHistorySelectDto) { return R.fail("获取历史数据失败:" + throwable.getMessage()); } 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 77c88a5..8ad93df 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 @@ -32,4 +32,19 @@ public class HwDictConstants { public static final String DEVICE_STATUS_PUBLISH = "1";//设备状态:已发布 + public static final String FENCE_TYPE_DEVICE = "1";//电子围栏规则类型,设备 + public static final String FENCE_TYPE_MONITOR_UNIT = "2";//电子围栏规则类型,监控单元 + public static final String FENCE_TYPE_SCENE = "3";//电子围栏规则类型,场景 + + public static final String CONTROL_DEVICE = "1";//监控型设备 + + public static final String ACQUISITION_DEVICE = "2";//采集型设备 + + public static final String CONTROL_DEVICE_NAME = "control";//监控型设备 + + public static final String ACQUISITION_DEVICE_NAME = "acquisition";//采集型设备 + + public static final String DEVICE_DEFAULT_FLAG_YES="1";//默认是 + public static final String DEVICE_DEFAULT_FLAG_NO="0";//默认否 + } 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 6e7dbb1..312d2b2 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 @@ -60,6 +60,13 @@ public class TdEngineConstants { TDENGINE_KEY_TRANSFER_MAP.put("value", "value1"); } + public static final Map DEVICE_DATA_COLUMN_MAP = new HashMap(); + + static { + DEVICE_DATA_COLUMN_MAP.put(ST_TAG_DEVICECODE, "设备编号"); + DEVICE_DATA_COLUMN_MAP.put(ST_TAG_DEVICENAME, "设备名称"); + } + /** * @return String * @param: sceneId @@ -71,6 +78,17 @@ public class TdEngineConstants { return DEFAULT_DB_NAME_PREFIX + sceneId; } + /** + * @param: deviceModeId + * @description 获取超级表名称 + * @author xins + * @date 2023-09-16 14:42 + * @return String + */ + public static String getSupertTableName(Long deviceModeId) { + return DEFAULT_SUPER_TABLE_NAME_PREFIX + deviceModeId; + } + /** * @param: deviceId * @return String diff --git a/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/utils/NumberUtils.java b/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/utils/NumberUtils.java new file mode 100644 index 0000000..bfe6261 --- /dev/null +++ b/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/utils/NumberUtils.java @@ -0,0 +1,21 @@ +package com.ruoyi.common.core.utils; + +import java.text.DecimalFormat; + +/** + * @Description: 数字处理通用工具类 + * @ClassName: NumberUtils + * @Author : xins + * @Date :2023-09-15 9:28 + * @Version :1.0 + */ +public class NumberUtils { + + public static String getPercentage(int x, int y) { + double d1 = x * 1.0; + double d2 = y * 1.0; + // 设置保留几位小数, “.”后面几个零就保留几位小数,这里设置保留四位小数 + DecimalFormat decimalFormat = new DecimalFormat("##.00%"); + return decimalFormat.format(d1 / d2); + } +} diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwAlarmRuleController.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwAlarmRuleController.java new file mode 100644 index 0000000..08644c6 --- /dev/null +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwAlarmRuleController.java @@ -0,0 +1,105 @@ +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.common.log.annotation.Log; +import com.ruoyi.common.log.enums.BusinessType; +import com.ruoyi.common.security.annotation.RequiresPermissions; +import com.ruoyi.business.domain.HwAlarmRule; +import com.ruoyi.business.service.IHwAlarmRuleService; +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; + +/** + * 报警规则Controller + * + * @author xins + * @date 2023-09-16 + */ +@RestController +@RequestMapping("/alarmRule") +public class HwAlarmRuleController extends BaseController +{ + @Autowired + private IHwAlarmRuleService hwAlarmRuleService; + + /** + * 查询报警规则列表 + */ + @RequiresPermissions("business:alarmRule:list") + @GetMapping("/list") + public TableDataInfo list(HwAlarmRule hwAlarmRule) + { + startPage(); + List list = hwAlarmRuleService.selectHwAlarmRuleList(hwAlarmRule); + return getDataTable(list); + } + + /** + * 导出报警规则列表 + */ + @RequiresPermissions("business:alarmRule:export") + @Log(title = "报警规则", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, HwAlarmRule hwAlarmRule) + { + List list = hwAlarmRuleService.selectHwAlarmRuleList(hwAlarmRule); + ExcelUtil util = new ExcelUtil(HwAlarmRule.class); + util.exportExcel(response, list, "报警规则数据"); + } + + /** + * 获取报警规则详细信息 + */ + @RequiresPermissions("business:alarmRule:query") + @GetMapping(value = "/{alarmRuleId}") + public AjaxResult getInfo(@PathVariable("alarmRuleId") Long alarmRuleId) + { + return success(hwAlarmRuleService.selectHwAlarmRuleByAlarmRuleId(alarmRuleId)); + } + + /** + * 新增报警规则 + */ + @RequiresPermissions("business:alarmRule:add") + @Log(title = "报警规则", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody HwAlarmRule hwAlarmRule) + { + return toAjax(hwAlarmRuleService.insertHwAlarmRule(hwAlarmRule)); + } + + /** + * 修改报警规则 + */ + @RequiresPermissions("business:alarmRule:edit") + @Log(title = "报警规则", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody HwAlarmRule hwAlarmRule) + { + return toAjax(hwAlarmRuleService.updateHwAlarmRule(hwAlarmRule)); + } + + /** + * 删除报警规则 + */ + @RequiresPermissions("business:alarmRule:remove") + @Log(title = "报警规则", businessType = BusinessType.DELETE) + @DeleteMapping("/{alarmRuleIds}") + public AjaxResult remove(@PathVariable Long[] alarmRuleIds) + { + return toAjax(hwAlarmRuleService.deleteHwAlarmRuleByAlarmRuleIds(alarmRuleIds)); + } +} diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwDeviceController.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwDeviceController.java index 2c9a3a2..4c7b2a1 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwDeviceController.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwDeviceController.java @@ -4,8 +4,11 @@ import java.util.List; import java.util.Map; import javax.servlet.http.HttpServletResponse; +import com.ruoyi.business.domain.HwMonitorUnit; import com.ruoyi.business.domain.VO.DeviceModeVo; import com.ruoyi.business.domain.VO.HwMonitorUnitVo; +import com.ruoyi.business.service.IHwMonitorUnitService; +import com.ruoyi.system.api.domain.SysDept; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; @@ -38,6 +41,8 @@ public class HwDeviceController extends BaseController @Autowired private IHwDeviceService hwDeviceService; + @Autowired + private IHwMonitorUnitService hwMonitorUnitService; /** * 查询设备信息列表 */ @@ -108,4 +113,16 @@ public class HwDeviceController extends BaseController { return toAjax(hwDeviceService.deleteHwDeviceByDeviceIds(deviceIds)); } + + + /** + * 获取部门树列表 + */ + @RequiresPermissions("business:device:list") + @GetMapping("/monitorUnitTree") + public AjaxResult monitorUnitTree(HwMonitorUnit monitorUnit) + { + return success(hwMonitorUnitService.selectMonitorTreeList(monitorUnit)); + } + } diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwElectronicFenceController.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwElectronicFenceController.java index 0068f1a..8173367 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwElectronicFenceController.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwElectronicFenceController.java @@ -26,7 +26,7 @@ import com.ruoyi.common.core.web.page.TableDataInfo; * 电子围栏Controller * * @author xins - * @date 2023-09-04 + * @date 2023-09-15 */ @RestController @RequestMapping("/electronicFence") diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwMonitorPlatformController.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwMonitorPlatformController.java index e825b7f..4481fa6 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwMonitorPlatformController.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwMonitorPlatformController.java @@ -1,34 +1,20 @@ package com.ruoyi.business.controller; +import com.alibaba.fastjson.JSONObject; +import com.ruoyi.business.domain.*; +import com.ruoyi.business.domain.VO.*; +import com.ruoyi.business.service.*; +import com.ruoyi.common.core.constant.TdEngineConstants; +import com.ruoyi.common.core.web.controller.BaseController; +import com.ruoyi.common.core.web.domain.AjaxResult; +import com.ruoyi.common.core.web.page.TableDataInfo; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + import java.util.ArrayList; import java.util.List; import java.util.Map; -import javax.annotation.Resource; -import javax.servlet.http.HttpServletResponse; - -import com.ruoyi.business.domain.HwScene; -import com.ruoyi.business.domain.VO.*; -import com.ruoyi.business.mapper.HwSceneMapper; -import com.ruoyi.business.service.IHwDeviceService; -import com.ruoyi.business.service.IHwElectronicFenceService; -import com.ruoyi.business.service.IHwSceneService; -import com.ruoyi.common.core.domain.R; -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.*; -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.HwMonitorUnit; -import com.ruoyi.business.service.IHwMonitorUnitService; -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 static com.ruoyi.common.core.utils.PageUtils.startPage; @RestController @RequestMapping("/monitorPlatform") @@ -39,21 +25,164 @@ public class HwMonitorPlatformController extends BaseController { @Autowired private IHwDeviceService hwDeviceService; @Autowired + private IHwDeviceModeService hwDeviceModeService; + @Autowired private IHwSceneService hwSceneService; @Autowired private IHwElectronicFenceService hwElectronicFenceService; + @Autowired + private IHwAlarmInfoService hwAlarmInfoService; + @Autowired + private IHwMonitorPlatformService hwMonitorPlatformService; + + /** + * 查询3. 设备各类型占所有设备数量百分比饼状图(首页左下角) + */ + @GetMapping("/monitorUnitPercentage") + public TableDataInfo monitorUnitPercentage() { + List maps = hwDeviceService.selectDeviceModeNameVo(); + return getDataTable(maps); + } + + /** + * 各场景监控单元数量占监控单元总数量百分比图(首页左上) + */ + @GetMapping("/monitorPercentage") + public TableDataInfo monitorPercentage() { + List maps = hwMonitorUnitService.selectMonitorPercentage(); + return getDataTable(maps); + } + + /** + *  展示总的设备数量和总的监控单元数量(首页中间上方) + */ + @GetMapping("/allNums") + public AllNumsVo allNums() { + AllNumsVo allNumsVos = hwMonitorUnitService.selectAllNums(null); + + return allNumsVos; + } + + /** + * @return TableDataInfo + * @param: hwAlarmInfo + * @description 获取报警信息(首页右下角,定位场景首页,标准场景首页) + * @author xins + * @date 2023-09-15 11:03 + */ + @GetMapping("/getAlarmInfos") + public TableDataInfo getAlarmInfos(HwAlarmInfo hwAlarmInfo) { + startPage(); + List alarmInfos = hwAlarmInfoService.selectHwAlarmInfoList(hwAlarmInfo); + return getDataTable(alarmInfos); + } + + /** + * 2. 设备实时在运数量曲线图(首页右上角) + * + * @param sceneId 场景id + */ + @GetMapping("/getDeviceOperations/{sceneId}") + public AjaxResult selectDeviceStatus(@PathVariable("sceneId") Long sceneId) { + JSONObject data = new JSONObject(); + data.put("10-01", 10); + data.put("10-02", 20); + data.put("10-03", 30); + data.put("10-04", 40); + data.put("10-05", 16); + + return AjaxResult.success(data); + } /** - * 树状获取监控单元列表 - * @param hwMonitorUnits 监控单元对象 + *  按场景展示总的设备数量和总的监控单元数量 + */ + @GetMapping("/sceneAllNums/{sceneId}") + public AllNumsVo sceneAllNums(@PathVariable("sceneId") Long sceneId) { + AllNumsVo allNumsVos = hwMonitorUnitService.selectAllNums(sceneId); + return allNumsVos; + } + + /** + * 分页获取最子集监控单元列表(标准场景右侧) + */ + @GetMapping("/limitSubMonitorUnit/{sceneId}") + public TableDataInfo limitSubMonitorUnit(@PathVariable("sceneId") Long sceneId) { + //todo sceneid should be + startPage(); + List hwMonitorUnits = hwMonitorUnitService.selectLimitSubMonitorUnit(); + return getDataTable(hwMonitorUnits); + } + + @GetMapping("/getAlarmCountGroupAlarmType/{sceneId}") + public AjaxResult getAlarmCountGroupAlarmType(@PathVariable("sceneId") Long sceneId) { + return success(hwAlarmInfoService.selectAlarmsByAlarmType(sceneId)); + } + + /** + * 按电子围栏定位显示其下设备数量,以及报警的设备数量(定位场景地图气泡图) + * + * @param sceneId + */ + @GetMapping("/ElectronicNumVo/{sceneId}") + public AjaxResult ElectronicNumVo(@PathVariable("sceneId") Long sceneId) { + +// { +// type:'多边形', +// children:[{ +// latitude:'', +// longtitude:'' +// }] +// } + +// { +// type:'圆形', +// centerpoint:{ +// 'lantitude':, +// 'longtitude':, +// } +// } +// } + return success(hwElectronicFenceService.selectEleTypeNums(sceneId)); + } + + + /** + * 监控单元报警统计 + */ + @GetMapping("/alarmStats/{sceneId}") + public AjaxResult alarmStats(@PathVariable("sceneId") Long sceneId) { + List alarmStatsVos = hwMonitorUnitService.selectAlarmStats(sceneId); + return success(alarmStatsVos); + } + + /** + * 获取最子级监控单元数量、设备数量和在线设备数量 + * + * @param sceneId 场景id + */ + @GetMapping("/subDevice/{sceneId}") + public SubDeviceSumVo subDevice(@PathVariable("sceneId") Long sceneId) { + + SubDeviceSumVo subDeviceSumVos = hwMonitorUnitService.selectSubDeviceSum(sceneId); + + return subDeviceSumVos; + } + + + /** + * 树状获取监控单元列表(设备监测左侧树) + * + * @param sceneId 场景ID * @return list * @throws - * */ - @GetMapping("/treeList") - public TableDataInfo treeList(){ + */ + @GetMapping("/treeList{sceneId}") + public TableDataInfo treeList(@PathVariable("sceneId") Long sceneId) { HwMonitorUnit hwMonitorUnit = new HwMonitorUnit(); + hwMonitorUnit.setSceneId(sceneId); List hwMonitorUnits = hwMonitorUnitService.selectHwMonitorUnitList(hwMonitorUnit); List list = hwMonitorUnitService.selectTreeList(hwMonitorUnits); return getDataTable(list); @@ -71,165 +200,119 @@ public class HwMonitorPlatformController extends BaseController { // List hwScenes = hwSceneService.selectHwSceneBySceneModeId(sceneModeId); // return getDataTable(hwScenes); // } - /** - * 查询3. 设备各类型占所有设备数量百分比饼状图(左下角) - * */ - @GetMapping("/monitorUnitPercentage") - public TableDataInfo monitorUnitPercentage(){ - List maps = hwDeviceService.selectDeviceModeNameVo(); - return getDataTable(maps); - } + // - /** - * 获取有开关属性的设备 - * @param monitorUnitId 监控单元id - * */ - @PostMapping("/selectDeviceByDeviceModeByMonitorUnitId") - public Map> selectDeviceByDeviceModeByMonitorUnitId(Long monitorUnitId){ - startPage(); - Map> maps = hwDeviceService.selectDeviceByDeviceModeByMonitorUnitId(monitorUnitId); - return maps; - } - /** - * 获取直采变量的设备 - * @param monitorUnitId 监控单元id - */ - @PostMapping("/selectDeviceModeFunctionByFunctionType") - public Map> selectDeviceModeFunctionByFunctionType(Long monitorUnitId){ - startPage(); - - Map> maps = hwDeviceService.selectDeviceModeFunctionByFunctionType(monitorUnitId); - return maps; - } - // - /** - * 设备历史数据 - * @param deviceId 设备id - * */ - @PostMapping("/getHistoryData") - public TableDataInfo getHistoryData(Long deviceId){ - startPage(); - List> historyData = hwDeviceService.getHistoryData(deviceId); - return getDataTable(historyData); - } - /** - * 查询区域数量站场景区总数百分比 - * 1-左上 - * */ - @GetMapping("/monitorPercentage") - public TableDataInfo monitorPercentage(){ - List maps = hwMonitorUnitService.selectMonitorPercentage(); - return getDataTable(maps); - } - /** - *  展示总的设备数量和总的监控单元数量 - * */ - @GetMapping("/allNums") - public AllNumsVo allNums(){ - AllNumsVo allNumsVos = hwMonitorUnitService.selectAllNums(); - - return allNumsVos; - } - /** - *  按场景展示总的设备数量和总的监控单元数量 - * */ - @GetMapping("/sceneAllNums") - public TableDataInfo sceneAllNums(){ - List allNumsVos = hwMonitorUnitService.selectSenceAllNums(); - - return getDataTable(allNumsVos); - } - /** - * 分页获取最子集监控单元列表 - * */ - @PostMapping("/limitSubMonitorUnit") - public TableDataInfo limitSubMonitorUnit(){ - startPage(); - List hwMonitorUnits = hwMonitorUnitService.selectLimitSubMonitorUnit(); - return getDataTable(hwMonitorUnits); - } - /** - * 监控单元报警统计 - */ - @GetMapping("/alarmStats") - public TableDataInfo alarmStats(){ - List alarmStatsVos = hwMonitorUnitService.selectAlarmStats(); - return getDataTable(alarmStatsVos); - } - /** - * 获取最子级监控单元数量、设备数量和在线设备数量 - * @param sceneId 场景id - * */ - @PostMapping("/SubDevice") - public SubDeviceSumVo subDevice(Long sceneId){ - - SubDeviceSumVo subDeviceSumVos = hwMonitorUnitService.selectSubDeviceSum(sceneId); - - return subDeviceSumVos; - } - /** - * 按电子围栏定位显示其下设备数量,以及报警的设备数量。 - * @param sceneId - * */ - @PostMapping("/ElectronicNumVo") - public TableDataInfo ElectronicNumVo(Long sceneId){ - - List eleMonitorDeviceSumVos = hwElectronicFenceService.selectEleTypeNums(sceneId); - return getDataTable(eleMonitorDeviceSumVos); - } /** * 获取监控单元详细信息 - * @param monitorUnitId - * */ - @PostMapping("/selectMonitorUnitSub") - //ok - public AjaxResult selectMonitorUnitSub(Long monitorUnitId){ - - HwMonitorUnit hwMonitorUnits = hwMonitorUnitService.selectHwMonitorUnitByMonitorUnitId(monitorUnitId); - - return AjaxResult.success(monitorUnitId); + */ +// @RequiresPermissions("business:monitorUnit:query") + @GetMapping(value = "/getMonitorById/{monitorUnitId}") + public AjaxResult getMonitorById(@PathVariable("monitorUnitId") Long monitorUnitId) { + return success(hwMonitorUnitService.selectHwMonitorUnitByMonitorUnitId(monitorUnitId)); } + /** - * 2. 设备实时在运数量曲线图 - * @param beginTime 开始时间 - * @param endTime 结束时间 - * @param sceneId 场景id - * */ - @PostMapping("/getDeviceOperations") - public R> selectTdengine(String beginTime,String endTime,Long sceneId){ + * 根据监控单元ID获取设备信息,分可控制设备和上传数据设备 + * + * @param monitorUnitId 监控单元id + */ + @GetMapping("/selectDevicesByMonitorUnitId/{monitorUnitId}/{sceneId}") + public AjaxResult selectDeviceByDeviceModeByMonitorUnitId(@PathVariable("monitorUnitId") Long monitorUnitId, + @PathVariable("sceneId") Long sceneId) { + HwDevice queryHwDevice = new HwDevice(); + queryHwDevice.setMonitorUnitId(monitorUnitId); + queryHwDevice.setSceneId(sceneId); - Map objectIntegerMap = hwMonitorUnitService.selectTdengine(beginTime, endTime, sceneId); - return R.ok(objectIntegerMap); + return success(hwDeviceService.getDevicesByMonitor(queryHwDevice)); } + + /** - * 设备汇总 - * */ - @PostMapping("/selectLatestDataByTags") - public R>>selectLatestDataByTags(Long monitorUnitId){ - - R>> mapR = hwMonitorUnitService.selectLatestDataByTags(monitorUnitId); - return mapR; + * @description 根据场景ID获取设备模型列表 + * @author xins + * @date 2023-09-16 12:44 + */ + @PostMapping("/getDeviceModesBySceneId") + public AjaxResult getDeviceModesBySceneId(@RequestBody HwDeviceMode queryHwDeviceMode) { + return success(hwDeviceModeService.selectHwDeviceModeList(queryHwDeviceMode)); } + + /** + * @return AjaxResult + * @param: monitorUnitId + * @description 根据设备模型获取最新数据 + * @author xins + * @date 2023-09-16 12:45 + */ + @PostMapping("/selectLatestDataByDeviceMode") + public AjaxResult selectLatestDataByDeviceMode(@Validated @RequestBody DeviceLatestDataVo deviceLatestData) { + JSONObject returnObj = new JSONObject(); + List> latestDataMaps = hwMonitorPlatformService.selectLatestDataByTags(deviceLatestData); + List deviceDataColumnVos = this.getDeviceDataColumns(latestDataMaps); + TableDataInfo tableDataInfo = getDataTable(latestDataMaps); + returnObj.put("deviceDataColumns", deviceDataColumnVos); + returnObj.put("latestData", tableDataInfo); + return success(returnObj); + } + + + @GetMapping("/getDeviceInfo/{deviceId}") + public AjaxResult getDeviceInfo(@PathVariable("deviceId") Long deviceId){ + HwDevice device = hwDeviceService.selectHwDeviceJoinByDeviceId(deviceId); + return success(device); + } + + @GetMapping("/getLinkDevices/{deviceId}") + public AjaxResult getLinkDevices(@PathVariable("deviceId")Long deviceId){ + return success(hwDeviceService.selectLinkDeviceList(deviceId)); + } + + /** + * @return AjaxResult + * @param: deviceHistoryData + * @description 获取设备历史数据 + * @author xins + * @date 2023-09-16 15:15 + */ + @PostMapping("/getHistoryData") + public AjaxResult getHistoryData(@Validated @RequestBody DeviceHistoryDataVo deviceHistoryData) { +// startPage(); + JSONObject returnObj = new JSONObject(); + List> historyDataMaps = hwMonitorPlatformService.getHistoryData(deviceHistoryData); + List deviceDataColumnVos = this.getDeviceDataColumns(historyDataMaps); + TableDataInfo tableDataInfo = getDataTable(historyDataMaps); + returnObj.put("deviceDataColumns", deviceDataColumnVos); + returnObj.put("historyData", tableDataInfo); + return success(returnObj); + + } + + private List getDeviceDataColumns(List> latestDataMaps){ + List deviceDataColumnVos = new ArrayList(); + if (latestDataMaps != null && latestDataMaps.size() > 0) { + Map latestDataMap = latestDataMaps.get(0); + for (Map.Entry entry : latestDataMap.entrySet()) { + DeviceDataColumnVo deviceDataColumnVo = new DeviceDataColumnVo(); + String columnKey = entry.getKey(); + deviceDataColumnVo.setColumnKey(columnKey); + deviceDataColumnVo.setColumnName(TdEngineConstants.DEVICE_DATA_COLUMN_MAP.get(columnKey) == null + ? columnKey : TdEngineConstants.DEVICE_DATA_COLUMN_MAP.get(columnKey)); + deviceDataColumnVos.add(deviceDataColumnVo); + } + } + return deviceDataColumnVos; + } + /** * 场景选择 * ,id=0 可以返回所有,其他根据id过滤,默认标识 - * - * */ - @PostMapping("/SelectSecne") - public TableDataInfo SelectSecneByUser(){ - LoginUser loginUser = SecurityUtils.getLoginUser(); - SysUser sysUser = loginUser.getSysUser(); - Long tenantId = sysUser.getTenantId(); - List hwScenes = hwSceneService.selectHwSceneByTenantId(tenantId); - if (hwScenes.size()!=0){ - hwScenes.get(0).setDefaultFlag("1");} - return getDataTable(hwScenes); + */ + @GetMapping("/selectSecnes") + public AjaxResult selectSecnes(HwScene scene) { + List hwScenes = hwSceneService.selectHwSceneList(scene); + return success(hwScenes); } - /** - * 报警列表 - * 无alarminfo表 - * */ } diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwMonitorUnitController.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwMonitorUnitController.java index bcca3ba..fd44112 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwMonitorUnitController.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwMonitorUnitController.java @@ -1,21 +1,8 @@ package com.ruoyi.business.controller; -import java.util.ArrayList; import java.util.List; -import java.util.Map; -import javax.annotation.Resource; +import java.io.IOException; import javax.servlet.http.HttpServletResponse; - -import com.ruoyi.business.domain.HwScene; -import com.ruoyi.business.domain.VO.*; -import com.ruoyi.business.mapper.HwSceneMapper; -import com.ruoyi.business.service.IHwDeviceService; -import com.ruoyi.business.service.IHwElectronicFenceService; -import com.ruoyi.business.service.IHwSceneService; -import com.ruoyi.common.core.domain.R; -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; @@ -33,13 +20,12 @@ import com.ruoyi.business.service.IHwMonitorUnitService; 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; /** * 监控单元Controller - * - * @author YINQ - * @date 2023-08-31 + * + * @author xins + * @date 2023-09-14 */ @RestController @RequestMapping("/monitorUnit") @@ -47,28 +33,18 @@ public class HwMonitorUnitController extends BaseController { @Autowired private IHwMonitorUnitService hwMonitorUnitService; - @Autowired - private IHwDeviceService hwDeviceService; - @Autowired - private IHwSceneService hwSceneService; - @Autowired - private IHwElectronicFenceService hwElectronicFenceService; - - /** * 查询监控单元列表 */ @RequiresPermissions("business:monitorUnit:list") @GetMapping("/list") - public TableDataInfo list(HwMonitorUnit hwMonitorUnit) + public AjaxResult list(HwMonitorUnit hwMonitorUnit) { - startPage(); List list = hwMonitorUnitService.selectHwMonitorUnitList(hwMonitorUnit); - return getDataTable(list); + return success(list); } - /** * 导出监控单元列表 */ @@ -92,7 +68,6 @@ public class HwMonitorUnitController extends BaseController return success(hwMonitorUnitService.selectHwMonitorUnitByMonitorUnitId(monitorUnitId)); } - /** * 新增监控单元 */ @@ -125,9 +100,4 @@ public class HwMonitorUnitController extends BaseController { return toAjax(hwMonitorUnitService.deleteHwMonitorUnitByMonitorUnitIds(monitorUnitIds)); } - - - - - } diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwSceneController.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwSceneController.java index 80e8d0a..5536b50 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwSceneController.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwSceneController.java @@ -140,7 +140,13 @@ public class HwSceneController extends BaseController } } - + /** + * 查询场景信息列表供选择使用(例如下拉列表) + */ + @GetMapping("/getScenes") + public AjaxResult getScenes(HwScene hwScene) { + return success(hwSceneService.selectHwSceneList(hwScene)); + } } diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/HwAlarmInfo.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/HwAlarmInfo.java new file mode 100644 index 0000000..bf8da07 --- /dev/null +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/HwAlarmInfo.java @@ -0,0 +1,316 @@ +package com.ruoyi.business.domain; + +import java.util.Date; + +import com.fasterxml.jackson.annotation.JsonFormat; +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_alarm_info + * + * @author xins + * @date 2023-09-15 + */ +public class HwAlarmInfo extends BaseEntity { + private static final long serialVersionUID = 1L; + + /** + * 报警信息ID + */ + private Long alarmInfoId; + + /** + * 报警信息类型(1、设备报警,2、监控单元报警,3、离线报警,4、电子围栏) + */ + @Excel(name = "报警信息类型", readConverterExp = "1=、设备报警,2、监控单元报警,3、离线报警,4、电子围栏") + private String alarmInfoType; + + /** + * 报警信息类型是1关联表alarm_rule的字段alarm_rule_id; + * 报警信息类型是3关联表hw_offline_rule的字段offline_rule_id; + * 报警信息类型是4关联表hw_electronic_fence的字段electronic_fence_id。 + */ + @Excel(name = "报警信息类型") + private Long alarmReleatedId; + + /** + * 报警设备ID,关联hw_device表的device_id字段 + */ + @Excel(name = "报警设备ID,关联hw_device表的device_id字段") + private Long deviceId; + + /** + * 所属监控单元Id,关联表hw_monitor_unit字段monitor_unit_id + */ + @Excel(name = "所属监控单元Id,关联表hw_monitor_unit字段monitor_unit_id") + private Long monitorUnitId; + + /** + * 租户ID,关联hw_tenant的tenant_id + */ + @Excel(name = "租户ID,关联hw_tenant的tenant_id") + private Long tenantId; + + /** + * 所属场景ID,关联hw_scene的scene_id + */ + @Excel(name = "所属场景ID,关联hw_scene的scene_id") + private Long sceneId; + + /** + * 报警级别,关联hw_alarm_level的字段alarm_level_id,报警信息类型为1、2和3时保存 + */ + @Excel(name = "报警级别,关联hw_alarm_level的字段alarm_level_id,报警信息类型为1、2和3时保存") + private Long alarmLevelId; + + /** + * 报警类型,关联hw_alarm_type的字段alarm_type_id,报警信息类型为1和2时保存 + */ + @Excel(name = "报警类型,关联hw_alarm_type的字段alarm_type_id,报警信息类型为1和2时保存") + private Long alarmTypeId; + + /** + * 设备模型功能ID + */ + @Excel(name = "设备模型功能ID") + private Long modeFunctionId; + + /** + * 功能名称 + */ + @Excel(name = "功能名称") + private String functionName; + + /** + * 标识符 + */ + @Excel(name = "标识符") + private String functionIdentifier; + + /** + * 最新的值,如果是电子围栏则存经度,纬度 + */ + @Excel(name = "最新的值,如果是电子围栏则存经度,纬度") + private String functionValue; + + /** + * 触发状态(1、出界,2、入界,3、双向),报警信息类型为4时保存 + */ + @Excel(name = "触发状态", readConverterExp = "1=、出界,2、入界,3、双向") + private String triggerStatus; + + /** + * 处理状态(0、未处理 1、已处理) + */ + @Excel(name = "处理状态", readConverterExp = "0=、未处理,1=、已处理") + private String handleStatus; + + /** + * 实际报警时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "实际报警时间", width = 30, dateFormat = "yyyy-MM-dd") + private Date alarmTime; + + /** + * 预留字段 + */ + @Excel(name = "预留字段") + private String alarmInfoField; + + private String monitorUnitName; + private String alarmLevelName; + private String alarmTypeName; + + public void setAlarmInfoId(Long alarmInfoId) { + this.alarmInfoId = alarmInfoId; + } + + public Long getAlarmInfoId() { + return alarmInfoId; + } + + public void setAlarmInfoType(String alarmInfoType) { + this.alarmInfoType = alarmInfoType; + } + + public String getAlarmInfoType() { + return alarmInfoType; + } + + public void setAlarmReleatedId(Long alarmReleatedId) { + this.alarmReleatedId = alarmReleatedId; + } + + public Long getAlarmReleatedId() { + return alarmReleatedId; + } + + public void setDeviceId(Long deviceId) { + this.deviceId = deviceId; + } + + public Long getDeviceId() { + return deviceId; + } + + public void setMonitorUnitId(Long monitorUnitId) { + this.monitorUnitId = monitorUnitId; + } + + public Long getMonitorUnitId() { + return monitorUnitId; + } + + public void setTenantId(Long tenantId) { + this.tenantId = tenantId; + } + + public Long getTenantId() { + return tenantId; + } + + public void setSceneId(Long sceneId) { + this.sceneId = sceneId; + } + + public Long getSceneId() { + return sceneId; + } + + public void setAlarmLevelId(Long alarmLevelId) { + this.alarmLevelId = alarmLevelId; + } + + public Long getAlarmLevelId() { + return alarmLevelId; + } + + public void setAlarmTypeId(Long alarmTypeId) { + this.alarmTypeId = alarmTypeId; + } + + public Long getAlarmTypeId() { + return alarmTypeId; + } + + public void setModeFunctionId(Long modeFunctionId) { + this.modeFunctionId = modeFunctionId; + } + + public Long getModeFunctionId() { + return modeFunctionId; + } + + public void setFunctionName(String functionName) { + this.functionName = functionName; + } + + public String getFunctionName() { + return functionName; + } + + public void setFunctionIdentifier(String functionIdentifier) { + this.functionIdentifier = functionIdentifier; + } + + public String getFunctionIdentifier() { + return functionIdentifier; + } + + public void setFunctionValue(String functionValue) { + this.functionValue = functionValue; + } + + public String getFunctionValue() { + return functionValue; + } + + public void setTriggerStatus(String triggerStatus) { + this.triggerStatus = triggerStatus; + } + + public String getTriggerStatus() { + return triggerStatus; + } + + public void setHandleStatus(String handleStatus) { + this.handleStatus = handleStatus; + } + + public String getHandleStatus() { + return handleStatus; + } + + public void setAlarmTime(Date alarmTime) { + this.alarmTime = alarmTime; + } + + public Date getAlarmTime() { + return alarmTime; + } + + public void setAlarmInfoField(String alarmInfoField) { + this.alarmInfoField = alarmInfoField; + } + + public String getAlarmInfoField() { + return alarmInfoField; + } + + public String getMonitorUnitName() { + return monitorUnitName; + } + + public void setMonitorUnitName(String monitorUnitName) { + this.monitorUnitName = monitorUnitName; + } + + public String getAlarmLevelName() { + return alarmLevelName; + } + + public void setAlarmLevelName(String alarmLevelName) { + this.alarmLevelName = alarmLevelName; + } + + public String getAlarmTypeName() { + return alarmTypeName; + } + + public void setAlarmTypeName(String alarmTypeName) { + this.alarmTypeName = alarmTypeName; + } + + @Override + public String toString() { + return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) + .append("alarmInfoId", getAlarmInfoId()) + .append("alarmInfoType", getAlarmInfoType()) + .append("alarmReleatedId", getAlarmReleatedId()) + .append("deviceId", getDeviceId()) + .append("monitorUnitId", getMonitorUnitId()) + .append("tenantId", getTenantId()) + .append("sceneId", getSceneId()) + .append("alarmLevelId", getAlarmLevelId()) + .append("alarmTypeId", getAlarmTypeId()) + .append("modeFunctionId", getModeFunctionId()) + .append("functionName", getFunctionName()) + .append("functionIdentifier", getFunctionIdentifier()) + .append("functionValue", getFunctionValue()) + .append("triggerStatus", getTriggerStatus()) + .append("handleStatus", getHandleStatus()) + .append("alarmTime", getAlarmTime()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .append("alarmInfoField", getAlarmInfoField()) + .append("monitorUnitName", getMonitorUnitName()) + .append("alarmLevelName", getAlarmLevelName()) + .append("alarmTypeName", getAlarmTypeName()) + .toString(); + } +} diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/HwAlarmLevel.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/HwAlarmLevel.java new file mode 100644 index 0000000..a7d11b9 --- /dev/null +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/HwAlarmLevel.java @@ -0,0 +1,168 @@ +package com.ruoyi.business.domain; + +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_alarm_level + * + * @author xins + * @date 2023-09-15 + */ +public class HwAlarmLevel extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 报警级别ID */ + private Long alarmLevelId; + + /** 报警级别名称 */ + @Excel(name = "报警级别名称") + private String alarmLevelName; + + /** 租户ID,关联hw_tenant的tenant_id */ + @Excel(name = "租户ID,关联hw_tenant的tenant_id") + private Long tenantId; + + /** 所属场景,关联hw_scene表的scene_id字段 */ + @Excel(name = "所属场景,关联hw_scene表的scene_id字段") + private Long sceneId; + + /** 语言code,关联表hw_language的language_code字段 */ + @Excel(name = "语言code,关联表hw_language的language_code字段") + private String languageCode; + + /** 通用标识(1:是,0:否) */ + @Excel(name = "通用标识", readConverterExp = "1=:是,0:否") + private String commonFlag; + + /** 严重程度(数字越大,级别越高) */ + @Excel(name = "严重程度", readConverterExp = "数=字越大,级别越高") + private Long levelNumber; + + /** 状态(1、正常,9、删除) */ + @Excel(name = "状态", readConverterExp = "1=、正常,9、删除") + private String levelStatus; + + /** 默认通知方式(1、邮箱,2、短信,3、钉钉,4、微信公众号,5、企业微信),多个保存用,隔开。 */ + @Excel(name = "默认通知方式", readConverterExp = "1=、邮箱,2、短信,3、钉钉,4、微信公众号,5、企业微信") + private String defaultNotifyMode; + + /** 预留字段 */ + @Excel(name = "预留字段") + private String alarmLevelField; + + public void setAlarmLevelId(Long alarmLevelId) + { + this.alarmLevelId = alarmLevelId; + } + + public Long getAlarmLevelId() + { + return alarmLevelId; + } + public void setAlarmLevelName(String alarmLevelName) + { + this.alarmLevelName = alarmLevelName; + } + + public String getAlarmLevelName() + { + return alarmLevelName; + } + public void setTenantId(Long tenantId) + { + this.tenantId = tenantId; + } + + public Long getTenantId() + { + return tenantId; + } + public void setSceneId(Long sceneId) + { + this.sceneId = sceneId; + } + + public Long getSceneId() + { + return sceneId; + } + public void setLanguageCode(String languageCode) + { + this.languageCode = languageCode; + } + + public String getLanguageCode() + { + return languageCode; + } + public void setCommonFlag(String commonFlag) + { + this.commonFlag = commonFlag; + } + + public String getCommonFlag() + { + return commonFlag; + } + public void setLevelNumber(Long levelNumber) + { + this.levelNumber = levelNumber; + } + + public Long getLevelNumber() + { + return levelNumber; + } + public void setLevelStatus(String levelStatus) + { + this.levelStatus = levelStatus; + } + + public String getLevelStatus() + { + return levelStatus; + } + public void setDefaultNotifyMode(String defaultNotifyMode) + { + this.defaultNotifyMode = defaultNotifyMode; + } + + public String getDefaultNotifyMode() + { + return defaultNotifyMode; + } + public void setAlarmLevelField(String alarmLevelField) + { + this.alarmLevelField = alarmLevelField; + } + + public String getAlarmLevelField() + { + return alarmLevelField; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("alarmLevelId", getAlarmLevelId()) + .append("alarmLevelName", getAlarmLevelName()) + .append("tenantId", getTenantId()) + .append("sceneId", getSceneId()) + .append("languageCode", getLanguageCode()) + .append("commonFlag", getCommonFlag()) + .append("levelNumber", getLevelNumber()) + .append("levelStatus", getLevelStatus()) + .append("defaultNotifyMode", getDefaultNotifyMode()) + .append("remark", getRemark()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .append("alarmLevelField", getAlarmLevelField()) + .toString(); + } +} diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/HwAlarmRule.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/HwAlarmRule.java new file mode 100644 index 0000000..d9988d1 --- /dev/null +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/HwAlarmRule.java @@ -0,0 +1,392 @@ +package com.ruoyi.business.domain; + +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_alarm_rule + * + * @author xins + * @date 2023-09-16 + */ +public class HwAlarmRule extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 报警规则ID */ + private Long alarmRuleId; + + /** 规则名称 */ + @Excel(name = "规则名称") + private String alarmRuleName; + + /** 租户ID,关联hw_tenant的tenant_id */ + @Excel(name = "租户ID,关联hw_tenant的tenant_id") + private Long tenantId; + + /** 所属场景,关联hw_scene表的scene_id字段 */ + @Excel(name = "所属场景,关联hw_scene表的scene_id字段") + private Long sceneId; + + /** 报警级别,关联表hw_alarm_level字段alarm_level_id */ + @Excel(name = "报警级别,关联表hw_alarm_level字段alarm_level_id") + private Long alarmLevelId; + + /** 报警类型,关联表hw_alarm_type字段alarm_type_id */ + @Excel(name = "报警类型,关联表hw_alarm_type字段alarm_type_id") + private Long alarmTypeId; + + /** 规则类型(1、设备模型,2、设备) */ + @Excel(name = "规则类型", readConverterExp = "1=、设备模型,2、设备") + private String ruleType; + + /** 设备,关联表hw_device字段device_id */ + @Excel(name = "设备,关联表hw_device字段device_id") + private Long deviceId; + + /** 设备模型,关联表hw_device_mode字段device_mode_id */ + @Excel(name = "设备模型,关联表hw_device_mode字段device_mode_id") + private Long deviceModeId; + + /** 设备属性,关联表hw_device_mode_function字段mode_function_id */ + @Excel(name = "设备属性,关联表hw_device_mode_function字段mode_function_id") + private Long modeFunctionId; + + /** 触发条件(1、数值大于A,2、数值小于B,3、数值大于A且小于B,4、数值小于A或大于B,5、数值等于A) */ + @Excel(name = "触发条件", readConverterExp = "1=、数值大于A,2、数值小于B,3、数值大于A且小于B,4、数值小于A或大于B,5、数值等于A") + private String triggerCondition; + + /** 触发定义A值 */ + @Excel(name = "触发定义A值") + private String triggerDataA; + + /** 触发定义B值 */ + @Excel(name = "触发定义B值") + private String triggerDataB; + + /** 触发死区 */ + @Excel(name = "触发死区") + private String triggerDeadzone; + + /** 触发阈值次数 */ + @Excel(name = "触发阈值次数") + private Long triggerNumber; + + /** 时间范围(单位:分钟) */ + @Excel(name = "时间范围", readConverterExp = "单=位:分钟") + private Long triggerTimeFrame; + + /** 联动标识(1、是,0、否) */ + @Excel(name = "联动标识", readConverterExp = "1=、是,0、否") + private String linkFlag; + + /** 联动类型(1、控制,2、采集) */ + @Excel(name = "联动类型", readConverterExp = "1=、控制,2、采集") + private String linkType; + + /** 联动设备,关联表hw_device字段device_id */ + @Excel(name = "联动设备,关联表hw_device字段device_id") + private Long linkDeviceId; + + /** 联动设备功能,关联表hw_device_mode_function字段mode_function_id */ + @Excel(name = "联动设备功能,关联表hw_device_mode_function字段mode_function_id") + private Long linkDeviceFunctionId; + + /** 联动设备属性值 */ + @Excel(name = "联动设备属性值") + private String linkDeviceFunctionData; + + /** 报警启用状态(1、是,2、否) */ + @Excel(name = "报警启用状态(1、是,2、否)") + private String alarmRuleStatus; + + /** 报警推送标识(1、是,2、否) */ + @Excel(name = "报警推送标识(1、是,2、否)") + private String alarmPushFlag; + + /** 报警推送内容 */ + @Excel(name = "报警推送内容") + private String alarmPushContent; + + /** 恢复正常推送内容 */ + @Excel(name = "恢复正常推送内容") + private String alarmRecoverContent; + + /** 预留字段 */ + @Excel(name = "预留字段") + private String alarmRuleField; + + public void setAlarmRuleId(Long alarmRuleId) + { + this.alarmRuleId = alarmRuleId; + } + + public Long getAlarmRuleId() + { + return alarmRuleId; + } + public void setAlarmRuleName(String alarmRuleName) + { + this.alarmRuleName = alarmRuleName; + } + + public String getAlarmRuleName() + { + return alarmRuleName; + } + public void setTenantId(Long tenantId) + { + this.tenantId = tenantId; + } + + public Long getTenantId() + { + return tenantId; + } + public void setSceneId(Long sceneId) + { + this.sceneId = sceneId; + } + + public Long getSceneId() + { + return sceneId; + } + public void setAlarmLevelId(Long alarmLevelId) + { + this.alarmLevelId = alarmLevelId; + } + + public Long getAlarmLevelId() + { + return alarmLevelId; + } + public void setAlarmTypeId(Long alarmTypeId) + { + this.alarmTypeId = alarmTypeId; + } + + public Long getAlarmTypeId() + { + return alarmTypeId; + } + public void setRuleType(String ruleType) + { + this.ruleType = ruleType; + } + + public String getRuleType() + { + return ruleType; + } + public void setDeviceId(Long deviceId) + { + this.deviceId = deviceId; + } + + public Long getDeviceId() + { + return deviceId; + } + public void setDeviceModeId(Long deviceModeId) + { + this.deviceModeId = deviceModeId; + } + + public Long getDeviceModeId() + { + return deviceModeId; + } + public void setModeFunctionId(Long modeFunctionId) + { + this.modeFunctionId = modeFunctionId; + } + + public Long getModeFunctionId() + { + return modeFunctionId; + } + public void setTriggerCondition(String triggerCondition) + { + this.triggerCondition = triggerCondition; + } + + public String getTriggerCondition() + { + return triggerCondition; + } + public void setTriggerDataA(String triggerDataA) + { + this.triggerDataA = triggerDataA; + } + + public String getTriggerDataA() + { + return triggerDataA; + } + public void setTriggerDataB(String triggerDataB) + { + this.triggerDataB = triggerDataB; + } + + public String getTriggerDataB() + { + return triggerDataB; + } + public void setTriggerDeadzone(String triggerDeadzone) + { + this.triggerDeadzone = triggerDeadzone; + } + + public String getTriggerDeadzone() + { + return triggerDeadzone; + } + public void setTriggerNumber(Long triggerNumber) + { + this.triggerNumber = triggerNumber; + } + + public Long getTriggerNumber() + { + return triggerNumber; + } + public void setTriggerTimeFrame(Long triggerTimeFrame) + { + this.triggerTimeFrame = triggerTimeFrame; + } + + public Long getTriggerTimeFrame() + { + return triggerTimeFrame; + } + public void setLinkFlag(String linkFlag) + { + this.linkFlag = linkFlag; + } + + public String getLinkFlag() + { + return linkFlag; + } + public void setLinkType(String linkType) + { + this.linkType = linkType; + } + + public String getLinkType() + { + return linkType; + } + public void setLinkDeviceId(Long linkDeviceId) + { + this.linkDeviceId = linkDeviceId; + } + + public Long getLinkDeviceId() + { + return linkDeviceId; + } + public void setLinkDeviceFunctionId(Long linkDeviceFunctionId) + { + this.linkDeviceFunctionId = linkDeviceFunctionId; + } + + public Long getLinkDeviceFunctionId() + { + return linkDeviceFunctionId; + } + public void setLinkDeviceFunctionData(String linkDeviceFunctionData) + { + this.linkDeviceFunctionData = linkDeviceFunctionData; + } + + public String getLinkDeviceFunctionData() + { + return linkDeviceFunctionData; + } + public void setAlarmRuleStatus(String alarmRuleStatus) + { + this.alarmRuleStatus = alarmRuleStatus; + } + + public String getAlarmRuleStatus() + { + return alarmRuleStatus; + } + public void setAlarmPushFlag(String alarmPushFlag) + { + this.alarmPushFlag = alarmPushFlag; + } + + public String getAlarmPushFlag() + { + return alarmPushFlag; + } + public void setAlarmPushContent(String alarmPushContent) + { + this.alarmPushContent = alarmPushContent; + } + + public String getAlarmPushContent() + { + return alarmPushContent; + } + public void setAlarmRecoverContent(String alarmRecoverContent) + { + this.alarmRecoverContent = alarmRecoverContent; + } + + public String getAlarmRecoverContent() + { + return alarmRecoverContent; + } + public void setAlarmRuleField(String alarmRuleField) + { + this.alarmRuleField = alarmRuleField; + } + + public String getAlarmRuleField() + { + return alarmRuleField; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("alarmRuleId", getAlarmRuleId()) + .append("alarmRuleName", getAlarmRuleName()) + .append("tenantId", getTenantId()) + .append("sceneId", getSceneId()) + .append("alarmLevelId", getAlarmLevelId()) + .append("alarmTypeId", getAlarmTypeId()) + .append("ruleType", getRuleType()) + .append("deviceId", getDeviceId()) + .append("deviceModeId", getDeviceModeId()) + .append("modeFunctionId", getModeFunctionId()) + .append("triggerCondition", getTriggerCondition()) + .append("triggerDataA", getTriggerDataA()) + .append("triggerDataB", getTriggerDataB()) + .append("triggerDeadzone", getTriggerDeadzone()) + .append("triggerNumber", getTriggerNumber()) + .append("triggerTimeFrame", getTriggerTimeFrame()) + .append("linkFlag", getLinkFlag()) + .append("linkType", getLinkType()) + .append("linkDeviceId", getLinkDeviceId()) + .append("linkDeviceFunctionId", getLinkDeviceFunctionId()) + .append("linkDeviceFunctionData", getLinkDeviceFunctionData()) + .append("alarmRuleStatus", getAlarmRuleStatus()) + .append("alarmPushFlag", getAlarmPushFlag()) + .append("alarmPushContent", getAlarmPushContent()) + .append("alarmRecoverContent", getAlarmRecoverContent()) + .append("remark", getRemark()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .append("alarmRuleField", getAlarmRuleField()) + .toString(); + } +} diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/HwAlarmType.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/HwAlarmType.java new file mode 100644 index 0000000..61c07c4 --- /dev/null +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/HwAlarmType.java @@ -0,0 +1,154 @@ +package com.ruoyi.business.domain; + +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_alarm_type + * + * @author xins + * @date 2023-09-15 + */ +public class HwAlarmType extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 报警类型ID */ + private Long alarmTypeId; + + /** 报警类型名称 */ + @Excel(name = "报警类型名称") + private String alarmTypeName; + + /** 租户ID,关联hw_tenant的tenant_id */ + @Excel(name = "租户ID,关联hw_tenant的tenant_id") + private Long tenantId; + + /** 所属场景,关联hw_scene表的scene_id字段 */ + @Excel(name = "所属场景,关联hw_scene表的scene_id字段") + private Long sceneId; + + /** 语言code,关联表hw_language的language_code字段 */ + @Excel(name = "语言code,关联表hw_language的language_code字段") + private String languageCode; + + /** 通用标识(1:是,0:否) */ + @Excel(name = "通用标识", readConverterExp = "1=:是,0:否") + private String commonFlag; + + /** 处理方式(1、云端处理,2:终端上报) */ + @Excel(name = "处理方式", readConverterExp = "1=、云端处理,2:终端上报") + private String handleMode; + + /** 状态(1、正常,9、删除) */ + @Excel(name = "状态", readConverterExp = "1=、正常,9、删除") + private String typeStatus; + + /** 预留字段 */ + @Excel(name = "预留字段") + private String alarmTypeField; + + public void setAlarmTypeId(Long alarmTypeId) + { + this.alarmTypeId = alarmTypeId; + } + + public Long getAlarmTypeId() + { + return alarmTypeId; + } + public void setAlarmTypeName(String alarmTypeName) + { + this.alarmTypeName = alarmTypeName; + } + + public String getAlarmTypeName() + { + return alarmTypeName; + } + public void setTenantId(Long tenantId) + { + this.tenantId = tenantId; + } + + public Long getTenantId() + { + return tenantId; + } + public void setSceneId(Long sceneId) + { + this.sceneId = sceneId; + } + + public Long getSceneId() + { + return sceneId; + } + public void setLanguageCode(String languageCode) + { + this.languageCode = languageCode; + } + + public String getLanguageCode() + { + return languageCode; + } + public void setCommonFlag(String commonFlag) + { + this.commonFlag = commonFlag; + } + + public String getCommonFlag() + { + return commonFlag; + } + public void setHandleMode(String handleMode) + { + this.handleMode = handleMode; + } + + public String getHandleMode() + { + return handleMode; + } + public void setTypeStatus(String typeStatus) + { + this.typeStatus = typeStatus; + } + + public String getTypeStatus() + { + return typeStatus; + } + public void setAlarmTypeField(String alarmTypeField) + { + this.alarmTypeField = alarmTypeField; + } + + public String getAlarmTypeField() + { + return alarmTypeField; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("alarmTypeId", getAlarmTypeId()) + .append("alarmTypeName", getAlarmTypeName()) + .append("tenantId", getTenantId()) + .append("sceneId", getSceneId()) + .append("languageCode", getLanguageCode()) + .append("commonFlag", getCommonFlag()) + .append("handleMode", getHandleMode()) + .append("typeStatus", getTypeStatus()) + .append("remark", getRemark()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .append("alarmTypeField", getAlarmTypeField()) + .toString(); + } +} 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 d3f4e65..3c2890d 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 @@ -114,6 +114,8 @@ public class HwDevice extends BaseEntity @Excel(name = "在线状态", readConverterExp = "1=、在线,0、离线") private String onlineStatus; + private String monitorUnitName; + public void setDeviceId(Long deviceId) { this.deviceId = deviceId; @@ -331,6 +333,14 @@ public class HwDevice extends BaseEntity return onlineStatus; } + public String getMonitorUnitName() { + return monitorUnitName; + } + + public void setMonitorUnitName(String monitorUnitName) { + this.monitorUnitName = monitorUnitName; + } + @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/HwElectronicFence.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/HwElectronicFence.java index 9fe3f33..d26c35f 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/HwElectronicFence.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/HwElectronicFence.java @@ -1,5 +1,6 @@ package com.ruoyi.business.domain; +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; @@ -9,7 +10,7 @@ import com.ruoyi.common.core.web.domain.BaseEntity; * 电子围栏对象 hw_electronic_fence * * @author xins - * @date 2023-09-04 + * @date 2023-09-15 */ public class HwElectronicFence extends BaseEntity { @@ -70,6 +71,9 @@ public class HwElectronicFence extends BaseEntity @Excel(name = "预留字段") private String fenceField; + /** 电子围栏目标信息 */ + private List hwFenceTargetList; + public void setElectronicFenceId(Long electronicFenceId) { this.electronicFenceId = electronicFenceId; @@ -197,6 +201,16 @@ public class HwElectronicFence extends BaseEntity return fenceField; } + public List getHwFenceTargetList() + { + return hwFenceTargetList; + } + + public void setHwFenceTargetList(List hwFenceTargetList) + { + this.hwFenceTargetList = hwFenceTargetList; + } + @Override public String toString() { return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) @@ -219,6 +233,7 @@ public class HwElectronicFence extends BaseEntity .append("updateBy", getUpdateBy()) .append("updateTime", getUpdateTime()) .append("fenceField", getFenceField()) + .append("hwFenceTargetList", getHwFenceTargetList()) .toString(); } } diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/HwFenceTarget.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/HwFenceTarget.java index 0088e75..beeb66a 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/HwFenceTarget.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/HwFenceTarget.java @@ -9,7 +9,7 @@ import com.ruoyi.common.core.web.domain.BaseEntity; * 电子围栏目标对象 hw_fence_target * * @author xins - * @date 2023-09-04 + * @date 2023-09-15 */ public class HwFenceTarget extends BaseEntity { diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/HwMonitorUnit.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/HwMonitorUnit.java index 6772942..4552fa9 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/HwMonitorUnit.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/HwMonitorUnit.java @@ -4,6 +4,7 @@ import java.math.BigDecimal; import java.util.ArrayList; import java.util.List; +import com.ruoyi.system.api.domain.SysDept; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; import com.ruoyi.common.core.annotation.Excel; @@ -63,6 +64,9 @@ public class HwMonitorUnit extends BaseEntity private String monitorUnitField; private List child = new ArrayList(); + /** 子部门 */ + private List children = new ArrayList(); + public List getChild() { return child; } @@ -71,6 +75,14 @@ public class HwMonitorUnit extends BaseEntity this.child = child; } + public List getChildren() { + return children; + } + + public void setChildren(List children) { + this.children = children; + } + public void setMonitorUnitId(Long monitorUnitId) { this.monitorUnitId = monitorUnitId; @@ -174,22 +186,22 @@ public class HwMonitorUnit extends BaseEntity @Override public String toString() { return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("monitorUnitId", getMonitorUnitId()) - .append("monitorUnitName", getMonitorUnitName()) - .append("sceneId", getSceneId()) - .append("parentId", getParentId()) - .append("monitorUnitTypeId", getMonitorUnitTypeId()) - .append("areaId", getAreaId()) - .append("monitorAddress", getMonitorAddress()) - .append("monitorPic", getMonitorPic()) - .append("preserveTime", getPreserveTime()) - .append("remark", getRemark()) - .append("monitorUnitStatus", getMonitorUnitStatus()) - .append("createBy", getCreateBy()) - .append("createTime", getCreateTime()) - .append("updateBy", getUpdateBy()) - .append("updateTime", getUpdateTime()) - .append("monitorUnitField", getMonitorUnitField()) - .toString(); + .append("monitorUnitId", getMonitorUnitId()) + .append("monitorUnitName", getMonitorUnitName()) + .append("sceneId", getSceneId()) + .append("parentId", getParentId()) + .append("monitorUnitTypeId", getMonitorUnitTypeId()) + .append("areaId", getAreaId()) + .append("monitorAddress", getMonitorAddress()) + .append("monitorPic", getMonitorPic()) + .append("preserveTime", getPreserveTime()) + .append("remark", getRemark()) + .append("monitorUnitStatus", getMonitorUnitStatus()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .append("monitorUnitField", getMonitorUnitField()) + .toString(); } -} +} \ No newline at end of file diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/VO/AlarmTypeVo.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/VO/AlarmTypeVo.java new file mode 100644 index 0000000..86b8935 --- /dev/null +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/VO/AlarmTypeVo.java @@ -0,0 +1,39 @@ +package com.ruoyi.business.domain.VO; + +/** + * @Description: 报警信息VO + * @ClassName: AlarmTypeVo + * @Author : xins + * @Date :2023-09-15 13:10 + * @Version :1.0 + */ +public class AlarmTypeVo { + + private Long alarmTypeId; + private String alarmTypeName; + private Integer alarmCount; + + public Long getAlarmTypeId() { + return alarmTypeId; + } + + public void setAlarmTypeId(Long alarmTypeId) { + this.alarmTypeId = alarmTypeId; + } + + public String getAlarmTypeName() { + return alarmTypeName; + } + + public void setAlarmTypeName(String alarmTypeName) { + this.alarmTypeName = alarmTypeName; + } + + public Integer getAlarmCount() { + return alarmCount; + } + + public void setAlarmCount(Integer alarmCount) { + this.alarmCount = alarmCount; + } +} diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/VO/DeviceDataColumnVo.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/VO/DeviceDataColumnVo.java new file mode 100644 index 0000000..696de6b --- /dev/null +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/VO/DeviceDataColumnVo.java @@ -0,0 +1,18 @@ +package com.ruoyi.business.domain.VO; + +import lombok.Data; + +/** + * @Description: 设备数据动态字段实体对象 + * @ClassName: DeviceDataColumnVo + * @Author : xins + * @Date :2023-09-16 16:20 + * @Version :1.0 + */ +@Data +public class DeviceDataColumnVo { + + private String columnName; + + private String columnKey; +} diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/VO/DeviceHistoryDataVo.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/VO/DeviceHistoryDataVo.java new file mode 100644 index 0000000..2484b19 --- /dev/null +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/VO/DeviceHistoryDataVo.java @@ -0,0 +1,37 @@ +package com.ruoyi.business.domain.VO; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; + +/** + * @Description:历史数据实体对象 + * @ClassName: DeviceLatestDataVo + * @Author : xins + * @Date :2023-09-16 14:46 + * @Version :1.0 + */ +@Data +public class DeviceHistoryDataVo { + + @NotNull(message="sceneId cannot be null") + private Long sceneId; + + @NotNull(message="deviceId cannot be null") + private Long deviceId; + + private int limit; + + //指定从第几条之后输出(例如:limit 2,5,输出第3行到第7行的数据) + private int offset; + + + //过滤条件:开始时间 + private long startTime; + + //过滤条件:结束时间 + private long endTime; + + +} diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/VO/DeviceLatestDataVo.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/VO/DeviceLatestDataVo.java new file mode 100644 index 0000000..068fdb4 --- /dev/null +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/VO/DeviceLatestDataVo.java @@ -0,0 +1,43 @@ +package com.ruoyi.business.domain.VO; + +import lombok.Data; + +import javax.validation.constraints.NotNull; + +/** + * @Description:最新数据实体对象 + * @ClassName: DeviceLatestDataVo + * @Author : xins + * @Date :2023-09-16 14:46 + * @Version :1.0 + */ +@Data +public class DeviceLatestDataVo { + + @NotNull(message="sceneId cannot be null") + private Long sceneId; + + @NotNull(message="deviceModeId cannot be null") + private Long deviceModeId; + + private int limit; + + //指定从第几条之后输出(例如:limit 2,5,输出第3行到第7行的数据) + private int offset; + + /** + * 第一个字段,数据类型必须是timestamp + */ + private String firstFieldName; + + //过滤条件:开始时间 + private long startTime; + + //过滤条件:结束时间 + private long endTime; + + private String deviceCode; + + private String deviceName; + +} diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/VO/DeviceModeVo.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/VO/DeviceModeVo.java index 597d10b..c023b79 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/VO/DeviceModeVo.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/VO/DeviceModeVo.java @@ -15,9 +15,9 @@ public class DeviceModeVo { public Integer err; - public Double percentage; + public String percentage; - public Double getPercentage() { + public String getPercentage() { return percentage; } @@ -45,7 +45,7 @@ public class DeviceModeVo { this.err = err; } - public void setPercentage(Double percentage) { + public void setPercentage(String percentage) { this.percentage = percentage; } diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/VO/ElectronicFenceVo.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/VO/ElectronicFenceVo.java new file mode 100644 index 0000000..34cb17a --- /dev/null +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/VO/ElectronicFenceVo.java @@ -0,0 +1,89 @@ +package com.ruoyi.business.domain.VO; + +import java.util.List; + +public class ElectronicFenceVo { + + public Integer deviceCount; + + public Integer abnormalCount; + + public String areaShapeFlag;//1,多边形,2,圆形 + + public AreaPoint centerPoint;//圆形中心点 + + public List areaPoints;//多边型点 + public Double radius; + + public Integer getDeviceCount() { + return deviceCount; + } + + public void setDeviceCount(Integer deviceCount) { + this.deviceCount = deviceCount; + } + + public Integer getAbnormalCount() { + return abnormalCount; + } + + public void setAbnormalCount(Integer abnormalCount) { + this.abnormalCount = abnormalCount; + } + + public String getAreaShapeFlag() { + return areaShapeFlag; + } + + public void setAreaShapeFlag(String areaShapeFlag) { + this.areaShapeFlag = areaShapeFlag; + } + + public AreaPoint getCenterPoint() { + return centerPoint; + } + + public void setCenterPoint(AreaPoint centerPoint) { + this.centerPoint = centerPoint; + } + + public List getAreaPoints() { + return areaPoints; + } + + public void setAreaPoints(List areaPoints) { + this.areaPoints = areaPoints; + } + + public Double getRadius() { + return radius; + } + + public void setRadius(Double radius) { + this.radius = radius; + } + + public static class AreaPoint{ + private Double longitude; + private Double latitude; + + public Double getLongitude() { + return longitude; + } + + public void setLongitude(Double longitude) { + this.longitude = longitude; + } + + public Double getLatitude() { + return latitude; + } + + public void setLatitude(Double latitude) { + this.latitude = latitude; + } + + + } + +} diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/VO/HwDeviceVo.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/VO/HwDeviceVo.java new file mode 100644 index 0000000..644f9d3 --- /dev/null +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/VO/HwDeviceVo.java @@ -0,0 +1,37 @@ +package com.ruoyi.business.domain.VO; + +import java.util.List; +import java.util.Map; + +public class HwDeviceVo { + + private String deviceType;//1、开关属性(控制属性),2、只有采集属性 + private String deviceName; + + private List> deviceDataMaps; + + + public String getDeviceType() { + return deviceType; + } + + public void setDeviceType(String deviceType) { + this.deviceType = deviceType; + } + + public String getDeviceName() { + return deviceName; + } + + public void setDeviceName(String deviceName) { + this.deviceName = deviceName; + } + + public List> getDeviceDataMaps() { + return deviceDataMaps; + } + + public void setDeviceDataMaps(List> deviceDataMaps) { + this.deviceDataMaps = deviceDataMaps; + } +} diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/VO/HwMonitorUnitVo.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/VO/HwMonitorUnitVo.java index 43ba2f8..e5467bf 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/VO/HwMonitorUnitVo.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/VO/HwMonitorUnitVo.java @@ -9,26 +9,26 @@ package com.ruoyi.business.domain.VO; public class HwMonitorUnitVo { public String sceneName; - public String sceneId; + public Long sceneId; public Integer sum; public Integer err; - public Double percentage; + public String percentage; - public Double getPercentage() { + public String getPercentage() { return percentage; } - public void setPercentage(Double percentage) { + public void setPercentage(String percentage) { this.percentage = percentage; } - public String getSceneId() { + public Long getSceneId() { return sceneId; } - public void setSceneId(String sceneId) { + public void setSceneId(Long sceneId) { this.sceneId = sceneId; } diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/VO/SubDeviceSumVo.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/VO/SubDeviceSumVo.java index 6e601ec..dd26dc8 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/VO/SubDeviceSumVo.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/VO/SubDeviceSumVo.java @@ -7,42 +7,33 @@ package com.ruoyi.business.domain.VO; * @Date: 2023-09-04 13:42 */ public class SubDeviceSumVo { - private String SubSum; + private Integer SubSum; - private String DeviceNum; + private Integer DeviceNum; - private String OnlineDeviceNum; + private Integer OnlineDeviceNum; - public String getSubSum() { + public Integer getSubSum() { return SubSum; } - public void setSubSum(String subSum) { + public void setSubSum(Integer subSum) { SubSum = subSum; } - public String getDeviceNum() { + public Integer getDeviceNum() { return DeviceNum; } - public void setDeviceNum(String deviceNum) { + public void setDeviceNum(Integer deviceNum) { DeviceNum = deviceNum; } - public String getOnlineDeviceNum() { + public Integer getOnlineDeviceNum() { return OnlineDeviceNum; } - public void setOnlineDeviceNum(String onlineDeviceNum) { + public void setOnlineDeviceNum(Integer onlineDeviceNum) { OnlineDeviceNum = onlineDeviceNum; } - - @Override - public String toString() { - return "SubDeviceSumVo{" + - "SubSum='" + SubSum + '\'' + - ", DeviceNum='" + DeviceNum + '\'' + - ", OnlineDeviceNum='" + OnlineDeviceNum + '\'' + - '}'; - } } diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/VO/TreeSelectVo.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/VO/TreeSelectVo.java new file mode 100644 index 0000000..a31d339 --- /dev/null +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/VO/TreeSelectVo.java @@ -0,0 +1,70 @@ +package com.ruoyi.business.domain.VO; + +import java.io.Serializable; +import java.util.List; +import java.util.stream.Collectors; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.ruoyi.business.domain.HwMonitorUnit; + + +/** + * Treeselect树结构实体类 + * + * @author ruoyi + */ +public class TreeSelectVo implements Serializable { + private static final long serialVersionUID = 1L; + + /** + * 节点ID + */ + private Long id; + + /** + * 节点名称 + */ + private String label; + + /** + * 子节点 + */ + @JsonInclude(JsonInclude.Include.NON_EMPTY) + private List children; + + public TreeSelectVo() { + + } + + public TreeSelectVo(HwMonitorUnit monitorUnit) { + this.id = monitorUnit.getMonitorUnitId(); + this.label = monitorUnit.getMonitorUnitName(); +// this.children = monitorUnit.getChildren().stream().map(TreeSelectVo::new).collect(Collectors.toList()); + } + + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getLabel() { + return label; + } + + public void setLabel(String label) { + this.label = label; + } + + public List getChildren() { + return children; + } + + public void setChildren(List children) { + this.children = children; + } +} + diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/mapper/HwAlarmInfoMapper.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/mapper/HwAlarmInfoMapper.java new file mode 100644 index 0000000..bc7d488 --- /dev/null +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/mapper/HwAlarmInfoMapper.java @@ -0,0 +1,65 @@ +package com.ruoyi.business.mapper; + +import java.util.List; +import com.ruoyi.business.domain.HwAlarmInfo; +import com.ruoyi.business.domain.VO.AlarmTypeVo; + +/** + * 报警信息Mapper接口 + * + * @author xins + * @date 2023-09-15 + */ +public interface HwAlarmInfoMapper +{ + /** + * 查询报警信息 + * + * @param alarmInfoId 报警信息主键 + * @return 报警信息 + */ + public HwAlarmInfo selectHwAlarmInfoByAlarmInfoId(Long alarmInfoId); + + /** + * 查询报警信息列表 + * + * @param hwAlarmInfo 报警信息 + * @return 报警信息集合 + */ + public List selectHwAlarmInfoList(HwAlarmInfo hwAlarmInfo); + + /** + * 新增报警信息 + * + * @param hwAlarmInfo 报警信息 + * @return 结果 + */ + public int insertHwAlarmInfo(HwAlarmInfo hwAlarmInfo); + + /** + * 修改报警信息 + * + * @param hwAlarmInfo 报警信息 + * @return 结果 + */ + public int updateHwAlarmInfo(HwAlarmInfo hwAlarmInfo); + + /** + * 删除报警信息 + * + * @param alarmInfoId 报警信息主键 + * @return 结果 + */ + public int deleteHwAlarmInfoByAlarmInfoId(Long alarmInfoId); + + /** + * 批量删除报警信息 + * + * @param alarmInfoIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteHwAlarmInfoByAlarmInfoIds(Long[] alarmInfoIds); + + + public List selectAlarmsByAlarmType(Long sceneId); +} diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/mapper/HwAlarmLevelMapper.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/mapper/HwAlarmLevelMapper.java new file mode 100644 index 0000000..900e477 --- /dev/null +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/mapper/HwAlarmLevelMapper.java @@ -0,0 +1,61 @@ +package com.ruoyi.business.mapper; + +import java.util.List; +import com.ruoyi.business.domain.HwAlarmLevel; + +/** + * 报警级别Mapper接口 + * + * @author xins + * @date 2023-09-15 + */ +public interface HwAlarmLevelMapper +{ + /** + * 查询报警级别 + * + * @param alarmLevelId 报警级别主键 + * @return 报警级别 + */ + public HwAlarmLevel selectHwAlarmLevelByAlarmLevelId(Long alarmLevelId); + + /** + * 查询报警级别列表 + * + * @param hwAlarmLevel 报警级别 + * @return 报警级别集合 + */ + public List selectHwAlarmLevelList(HwAlarmLevel hwAlarmLevel); + + /** + * 新增报警级别 + * + * @param hwAlarmLevel 报警级别 + * @return 结果 + */ + public int insertHwAlarmLevel(HwAlarmLevel hwAlarmLevel); + + /** + * 修改报警级别 + * + * @param hwAlarmLevel 报警级别 + * @return 结果 + */ + public int updateHwAlarmLevel(HwAlarmLevel hwAlarmLevel); + + /** + * 删除报警级别 + * + * @param alarmLevelId 报警级别主键 + * @return 结果 + */ + public int deleteHwAlarmLevelByAlarmLevelId(Long alarmLevelId); + + /** + * 批量删除报警级别 + * + * @param alarmLevelIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteHwAlarmLevelByAlarmLevelIds(Long[] alarmLevelIds); +} diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/mapper/HwAlarmRuleMapper.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/mapper/HwAlarmRuleMapper.java new file mode 100644 index 0000000..d805c36 --- /dev/null +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/mapper/HwAlarmRuleMapper.java @@ -0,0 +1,61 @@ +package com.ruoyi.business.mapper; + +import java.util.List; +import com.ruoyi.business.domain.HwAlarmRule; + +/** + * 报警规则Mapper接口 + * + * @author xins + * @date 2023-09-16 + */ +public interface HwAlarmRuleMapper +{ + /** + * 查询报警规则 + * + * @param alarmRuleId 报警规则主键 + * @return 报警规则 + */ + public HwAlarmRule selectHwAlarmRuleByAlarmRuleId(Long alarmRuleId); + + /** + * 查询报警规则列表 + * + * @param hwAlarmRule 报警规则 + * @return 报警规则集合 + */ + public List selectHwAlarmRuleList(HwAlarmRule hwAlarmRule); + + /** + * 新增报警规则 + * + * @param hwAlarmRule 报警规则 + * @return 结果 + */ + public int insertHwAlarmRule(HwAlarmRule hwAlarmRule); + + /** + * 修改报警规则 + * + * @param hwAlarmRule 报警规则 + * @return 结果 + */ + public int updateHwAlarmRule(HwAlarmRule hwAlarmRule); + + /** + * 删除报警规则 + * + * @param alarmRuleId 报警规则主键 + * @return 结果 + */ + public int deleteHwAlarmRuleByAlarmRuleId(Long alarmRuleId); + + /** + * 批量删除报警规则 + * + * @param alarmRuleIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteHwAlarmRuleByAlarmRuleIds(Long[] alarmRuleIds); +} diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/mapper/HwAlarmTypeMapper.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/mapper/HwAlarmTypeMapper.java new file mode 100644 index 0000000..6e07a0d --- /dev/null +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/mapper/HwAlarmTypeMapper.java @@ -0,0 +1,61 @@ +package com.ruoyi.business.mapper; + +import java.util.List; +import com.ruoyi.business.domain.HwAlarmType; + +/** + * 报警类型Mapper接口 + * + * @author xins + * @date 2023-09-15 + */ +public interface HwAlarmTypeMapper +{ + /** + * 查询报警类型 + * + * @param alarmTypeId 报警类型主键 + * @return 报警类型 + */ + public HwAlarmType selectHwAlarmTypeByAlarmTypeId(Long alarmTypeId); + + /** + * 查询报警类型列表 + * + * @param hwAlarmType 报警类型 + * @return 报警类型集合 + */ + public List selectHwAlarmTypeList(HwAlarmType hwAlarmType); + + /** + * 新增报警类型 + * + * @param hwAlarmType 报警类型 + * @return 结果 + */ + public int insertHwAlarmType(HwAlarmType hwAlarmType); + + /** + * 修改报警类型 + * + * @param hwAlarmType 报警类型 + * @return 结果 + */ + public int updateHwAlarmType(HwAlarmType hwAlarmType); + + /** + * 删除报警类型 + * + * @param alarmTypeId 报警类型主键 + * @return 结果 + */ + public int deleteHwAlarmTypeByAlarmTypeId(Long alarmTypeId); + + /** + * 批量删除报警类型 + * + * @param alarmTypeIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteHwAlarmTypeByAlarmTypeIds(Long[] alarmTypeIds); +} diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/mapper/HwDeviceMapper.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/mapper/HwDeviceMapper.java index 40a40af..e9dbf24 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/mapper/HwDeviceMapper.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/mapper/HwDeviceMapper.java @@ -72,4 +72,12 @@ public interface HwDeviceMapper * @return 结果 */ public int deleteHwDeviceByDeviceIds(Long[] deviceIds); + + + public int getOnlineDeviceNum(Long sceneId); + + public HwDevice selectHwDeviceJoinByDeviceId(Long deviceId); + + public List selectLinkedDevices(Long deviceId); + } diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/mapper/HwElectronicFenceMapper.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/mapper/HwElectronicFenceMapper.java index 393e87d..9c3d1b4 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/mapper/HwElectronicFenceMapper.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/mapper/HwElectronicFenceMapper.java @@ -75,4 +75,10 @@ public interface HwElectronicFenceMapper * @return 结果 */ public int deleteHwElectronicFenceByElectronicFenceIds(Long[] electronicFenceIds); + + public int selectDeviceCount(Long electronicFenceId); + + public int selectDeviceCountByMonitorUnit(Long electronicFenceId); + + public int selectDeviceCountByScene(Long sceneId); } diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/mapper/HwMonitorUnitMapper.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/mapper/HwMonitorUnitMapper.java index 44186c2..5bb4228 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/mapper/HwMonitorUnitMapper.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/mapper/HwMonitorUnitMapper.java @@ -33,20 +33,20 @@ public interface HwMonitorUnitMapper public List selectsum(); //查询id与name的结果集 List selectSceneNameById(); - String selectSubSetNums(); + Integer selectSubSetNums(Long sceneId); /** * 分页获取最子集监控单元列表 * */ public List selectLimitSubMonitorUnit(); Integer selectReleatedDeviceIdNums(Long deviceCode); - String selectDeviceNums(); + Integer selectDeviceNums(Long sceneId); Integer selectSubDeviceSum(Long sceneId); /** * 监控单元报警统计 * */ - public List selectAlarmStats(); + public List selectAlarmStats(Long sceneId); /** * 获取最子级监控单元数量、设备数量和在线设备数量 * */ @@ -112,4 +112,13 @@ public interface HwMonitorUnitMapper * @return 结果 */ public int deleteHwMonitorUnitByMonitorUnitIds(Long[] monitorUnitIds); -} + + /** + * 查询监控单元列表join场景 + * + * @param hwMonitorUnit 监控单元 + * @return 监控单元集合 + */ + public List selectHwMonitorUnitListJoinScene(HwMonitorUnit hwMonitorUnit); + +} \ No newline at end of file diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/IHwAlarmInfoService.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/IHwAlarmInfoService.java new file mode 100644 index 0000000..d5f150b --- /dev/null +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/IHwAlarmInfoService.java @@ -0,0 +1,71 @@ +package com.ruoyi.business.service; + +import java.util.List; +import com.ruoyi.business.domain.HwAlarmInfo; +import com.ruoyi.business.domain.VO.AlarmTypeVo; + +/** + * 报警信息Service接口 + * + * @author xins + * @date 2023-09-15 + */ +public interface IHwAlarmInfoService +{ + /** + * 查询报警信息 + * + * @param alarmInfoId 报警信息主键 + * @return 报警信息 + */ + public HwAlarmInfo selectHwAlarmInfoByAlarmInfoId(Long alarmInfoId); + + /** + * 查询报警信息列表 + * + * @param hwAlarmInfo 报警信息 + * @return 报警信息集合 + */ + public List selectHwAlarmInfoList(HwAlarmInfo hwAlarmInfo); + + /** + * 新增报警信息 + * + * @param hwAlarmInfo 报警信息 + * @return 结果 + */ + public int insertHwAlarmInfo(HwAlarmInfo hwAlarmInfo); + + /** + * 修改报警信息 + * + * @param hwAlarmInfo 报警信息 + * @return 结果 + */ + public int updateHwAlarmInfo(HwAlarmInfo hwAlarmInfo); + + /** + * 批量删除报警信息 + * + * @param alarmInfoIds 需要删除的报警信息主键集合 + * @return 结果 + */ + public int deleteHwAlarmInfoByAlarmInfoIds(Long[] alarmInfoIds); + + /** + * 删除报警信息信息 + * + * @param alarmInfoId 报警信息主键 + * @return 结果 + */ + public int deleteHwAlarmInfoByAlarmInfoId(Long alarmInfoId); + + /** + * @param: sceneId + * @description 根据报警类型获取报警数量 + * @author xins + * @date 2023-09-15 13:20 + * @return List + */ + public List selectAlarmsByAlarmType(Long sceneId); +} diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/IHwAlarmRuleService.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/IHwAlarmRuleService.java new file mode 100644 index 0000000..73c42cc --- /dev/null +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/IHwAlarmRuleService.java @@ -0,0 +1,61 @@ +package com.ruoyi.business.service; + +import java.util.List; +import com.ruoyi.business.domain.HwAlarmRule; + +/** + * 报警规则Service接口 + * + * @author xins + * @date 2023-09-16 + */ +public interface IHwAlarmRuleService +{ + /** + * 查询报警规则 + * + * @param alarmRuleId 报警规则主键 + * @return 报警规则 + */ + public HwAlarmRule selectHwAlarmRuleByAlarmRuleId(Long alarmRuleId); + + /** + * 查询报警规则列表 + * + * @param hwAlarmRule 报警规则 + * @return 报警规则集合 + */ + public List selectHwAlarmRuleList(HwAlarmRule hwAlarmRule); + + /** + * 新增报警规则 + * + * @param hwAlarmRule 报警规则 + * @return 结果 + */ + public int insertHwAlarmRule(HwAlarmRule hwAlarmRule); + + /** + * 修改报警规则 + * + * @param hwAlarmRule 报警规则 + * @return 结果 + */ + public int updateHwAlarmRule(HwAlarmRule hwAlarmRule); + + /** + * 批量删除报警规则 + * + * @param alarmRuleIds 需要删除的报警规则主键集合 + * @return 结果 + */ + public int deleteHwAlarmRuleByAlarmRuleIds(Long[] alarmRuleIds); + + /** + * 删除报警规则信息 + * + * @param alarmRuleId 报警规则主键 + * @return 结果 + */ + public int deleteHwAlarmRuleByAlarmRuleId(Long alarmRuleId); +} diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/IHwDeviceService.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/IHwDeviceService.java index 488869e..4c1d0d8 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/IHwDeviceService.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/IHwDeviceService.java @@ -5,6 +5,7 @@ import java.util.Map; import com.ruoyi.business.domain.HwDevice; import com.ruoyi.business.domain.VO.DeviceModeVo; +import com.ruoyi.business.domain.VO.HwDeviceVo; import com.ruoyi.business.domain.VO.HwMonitorUnitVo; @@ -24,14 +25,19 @@ public interface IHwDeviceService */ public HwDevice selectHwDeviceByDeviceId(Long deviceId); + /** + * 查询设备信息,返回监控单元名称 + * + * @param deviceId 设备信息主键 + * @return 设备信息 + */ + public HwDevice selectHwDeviceJoinByDeviceId(Long deviceId); + /** * 查询3. 设备各类型占所有设备数量百分比饼状图(左下角) * */ public List selectDeviceModeNameVo(); - public Map> selectDeviceByDeviceModeByMonitorUnitId(Long monitorUnitId); - public Map> selectDeviceModeFunctionByFunctionType(Long monitorUnitId); - public List> getHistoryData(Long deviceId); /** * 查询设备信息列表 * @@ -40,6 +46,14 @@ public interface IHwDeviceService */ public List selectHwDeviceList(HwDevice hwDevice); + /** + * 查询关联设备信息列表 + * + * @param deviceId 设备信息主键 + * @return 设备信息 + */ + public List selectLinkDeviceList(Long deviceId); + /** * 新增设备信息 * @@ -71,4 +85,14 @@ public interface IHwDeviceService * @return 结果 */ public int deleteHwDeviceByDeviceId(Long deviceId); + + + /** + * @return Map> + * @description 设备监测页面,根据监控单元获取设备监控信息 + * @author xins + * @date 2023-09-15 16:59 + */ + public Map> getDevicesByMonitor(HwDevice queryHwDevice); + } diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/IHwElectronicFenceService.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/IHwElectronicFenceService.java index caf311a..99cb8ea 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/IHwElectronicFenceService.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/IHwElectronicFenceService.java @@ -3,6 +3,7 @@ package com.ruoyi.business.service; import java.util.List; import com.ruoyi.business.domain.HwElectronicFence; import com.ruoyi.business.domain.VO.EleMonitorDeviceSumVo; +import com.ruoyi.business.domain.VO.ElectronicFenceVo; import com.ruoyi.business.domain.VO.ElectronicNumVo; /** @@ -24,7 +25,7 @@ public interface IHwElectronicFenceService * 根据场景查询电子围栏信息 * */ public List selectElectronicByScene(Long sceneId); - List selectEleTypeNums(Long sceneId); + public List selectEleTypeNums(Long sceneId); /** * 查询电子围栏列表 * diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/IHwMonitorPlatformService.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/IHwMonitorPlatformService.java new file mode 100644 index 0000000..8f6dd6d --- /dev/null +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/IHwMonitorPlatformService.java @@ -0,0 +1,35 @@ +package com.ruoyi.business.service; + +import com.ruoyi.business.domain.VO.DeviceHistoryDataVo; +import com.ruoyi.business.domain.VO.DeviceLatestDataVo; + +import java.util.List; +import java.util.Map; + +/** + * @Description: 监控平台数据处理接口 + * @ClassName: IHwMonitorPlatformService + * @Author : xins + * @Date :2023-09-16 14:49 + * @Version :1.0 + */ +public interface IHwMonitorPlatformService { + + /** + * @param: deviceLatestDataVo + * @description 根据设备模型获取最新数据 + * @author xins + * @date 2023-09-16 14:49 + * @return List> + */ + public List> selectLatestDataByTags(DeviceLatestDataVo deviceLatestDataVo); + + /** + * @param: deviceHistoryDataVo + * @description 获取设备历史数据 + * @author xins + * @date 2023-09-16 15:14 + * @return List> + */ + public List> getHistoryData(DeviceHistoryDataVo deviceHistoryDataVo); +} diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/IHwMonitorUnitService.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/IHwMonitorUnitService.java index 5c6fdd4..f22467a 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/IHwMonitorUnitService.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/IHwMonitorUnitService.java @@ -2,6 +2,7 @@ package com.ruoyi.business.service; import java.util.List; import java.util.Map; +import java.util.stream.Collectors; import com.ruoyi.business.domain.HwMonitorUnit; import com.ruoyi.business.domain.VO.*; @@ -30,8 +31,8 @@ public interface IHwMonitorUnitService /** *  展示总的设备数量和总的监控单元数量(最低级的监控单元) * */ - public AllNumsVo selectAllNums(); - public List selectSenceAllNums(); + public AllNumsVo selectAllNums(Long sceneId); +// public List selectSenceAllNums(); /** * 分页获取最子集监控单元列表 @@ -48,7 +49,7 @@ public interface IHwMonitorUnitService /** * 监控单元报警统计 * */ - public List selectAlarmStats(); + public List selectAlarmStats(Long sceneId); /** * 查询监控单元列表 * @@ -61,10 +62,7 @@ public interface IHwMonitorUnitService * 获取最子级监控单元数量、设备数量和在线设备数量 * */ public SubDeviceSumVo selectSubDeviceSum(Long sceneId); - /** - * 按电子围栏定位显示其下设备数量,以及报警的设备数量。 - * */ - public Integer selectElectronicNum(Long sceneId); + /** * 树状获取监控单元列表 * */ @@ -73,19 +71,9 @@ public interface IHwMonitorUnitService * 获取监控单元详细信息 * */ public HwMonitorUnit selectHwmonitorUnitSub(Long monitorUnitId); + + /** - * 通过tdengine获取设备运行情况 - * - * @return*/ - public Map selectTdengine(String beginTime, String endTime, Long sceneId); - /** - * 设备汇总 - * - * @return*/ - public R>> selectLatestDataByTags(Long monitorUnitId); - - - /** * 新增监控单元 * * @param hwMonitorUnit 监控单元 @@ -116,4 +104,29 @@ public interface IHwMonitorUnitService * @return 结果 */ public int deleteHwMonitorUnitByMonitorUnitId(Long monitorUnitId); -} + + + /** + * 查询监控单元树结构信息 + * + * @param hwMonitorUnit 监控单元信息 + * @return 监控单元树信息集合 + */ + public List selectMonitorTreeList(HwMonitorUnit hwMonitorUnit); + + /** + * 构建前端所需要下拉树结构 + * + * @param hwMonitorUnits 监控单元列表 + * @return 下拉树结构列表 + */ + public List buildMonitorUnitTreeSelect(List hwMonitorUnits); + + /** + * 构建前端所需要树结构 + * + * @param hwMonitorUnits 监控单元列表 + * @return 树结构列表 + */ + public List buildMonitorUnitTree(List hwMonitorUnits); +} \ No newline at end of file diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/IHwSceneService.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/IHwSceneService.java index f65da07..093021d 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/IHwSceneService.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/IHwSceneService.java @@ -23,8 +23,6 @@ public interface IHwSceneService public List selectHwSceneBySceneModeId(Long sceneModeId); - //场景选择 - List selectHwSceneByTenantId(Long tenantId); /** * 查询场景信息列表 * diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwAlarmInfoServiceImpl.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwAlarmInfoServiceImpl.java new file mode 100644 index 0000000..97e611a --- /dev/null +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwAlarmInfoServiceImpl.java @@ -0,0 +1,136 @@ +package com.ruoyi.business.service.impl; + +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.stream.Collectors; + +import com.ruoyi.business.domain.HwAlarmType; +import com.ruoyi.business.domain.VO.AlarmTypeVo; +import com.ruoyi.business.mapper.HwAlarmTypeMapper; +import com.ruoyi.common.core.utils.DateUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ruoyi.business.mapper.HwAlarmInfoMapper; +import com.ruoyi.business.domain.HwAlarmInfo; +import com.ruoyi.business.service.IHwAlarmInfoService; + +/** + * 报警信息Service业务层处理 + * + * @author xins + * @date 2023-09-15 + */ +@Service +public class HwAlarmInfoServiceImpl implements IHwAlarmInfoService { + @Autowired + private HwAlarmInfoMapper hwAlarmInfoMapper; + + @Autowired + private HwAlarmTypeMapper hwAlarmTypeMapper; + + /** + * 查询报警信息 + * + * @param alarmInfoId 报警信息主键 + * @return 报警信息 + */ + @Override + public HwAlarmInfo selectHwAlarmInfoByAlarmInfoId(Long alarmInfoId) { + return hwAlarmInfoMapper.selectHwAlarmInfoByAlarmInfoId(alarmInfoId); + } + + /** + * 查询报警信息列表 + * + * @param hwAlarmInfo 报警信息 + * @return 报警信息 + */ + @Override + public List selectHwAlarmInfoList(HwAlarmInfo hwAlarmInfo) { + return hwAlarmInfoMapper.selectHwAlarmInfoList(hwAlarmInfo); + } + + /** + * 新增报警信息 + * + * @param hwAlarmInfo 报警信息 + * @return 结果 + */ + @Override + public int insertHwAlarmInfo(HwAlarmInfo hwAlarmInfo) { + hwAlarmInfo.setCreateTime(DateUtils.getNowDate()); + return hwAlarmInfoMapper.insertHwAlarmInfo(hwAlarmInfo); + } + + /** + * 修改报警信息 + * + * @param hwAlarmInfo 报警信息 + * @return 结果 + */ + @Override + public int updateHwAlarmInfo(HwAlarmInfo hwAlarmInfo) { + hwAlarmInfo.setUpdateTime(DateUtils.getNowDate()); + return hwAlarmInfoMapper.updateHwAlarmInfo(hwAlarmInfo); + } + + /** + * 批量删除报警信息 + * + * @param alarmInfoIds 需要删除的报警信息主键 + * @return 结果 + */ + @Override + public int deleteHwAlarmInfoByAlarmInfoIds(Long[] alarmInfoIds) { + return hwAlarmInfoMapper.deleteHwAlarmInfoByAlarmInfoIds(alarmInfoIds); + } + + /** + * 删除报警信息信息 + * + * @param alarmInfoId 报警信息主键 + * @return 结果 + */ + @Override + public int deleteHwAlarmInfoByAlarmInfoId(Long alarmInfoId) { + return hwAlarmInfoMapper.deleteHwAlarmInfoByAlarmInfoId(alarmInfoId); + } + + + /** + * @return List + * @param: sceneId + * @description 根据报警类型获取报警数量 + * @author xins + * @date 2023-09-15 13:20 + */ + @Override + public List selectAlarmsByAlarmType(Long sceneId) { + List list = hwAlarmInfoMapper.selectAlarmsByAlarmType(sceneId); + HwAlarmType queryAlarmType = new HwAlarmType(); + queryAlarmType.setSceneId(sceneId); + List alarmTypes = hwAlarmTypeMapper.selectHwAlarmTypeList(queryAlarmType); + Map alarmTypeMap = alarmTypes.stream() + .collect(Collectors.toMap(HwAlarmType::getAlarmTypeId, alarmType -> alarmType)); + list.stream().forEach(alarmType -> { + alarmType.setAlarmTypeName(alarmTypeMap.get(alarmType.getAlarmTypeId()) == null ? "" + : alarmTypeMap.get(alarmType.getAlarmTypeId()).getAlarmTypeName()); + alarmTypeMap.remove(alarmType.getAlarmTypeId()); + }); + + + Set alarmTypeIds = alarmTypeMap.keySet(); + for (Long alarmTypeId : alarmTypeIds) { + HwAlarmType alarmType = alarmTypeMap.get(alarmTypeId); + AlarmTypeVo alarmTypeVo = new AlarmTypeVo(); + alarmTypeVo.setAlarmTypeId(alarmType.getAlarmTypeId()); + alarmTypeVo.setAlarmTypeName(alarmType.getAlarmTypeName()); + alarmTypeVo.setAlarmCount(0); + list.add(alarmTypeVo); + } + + return list; + + } +} diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwAlarmRuleServiceImpl.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwAlarmRuleServiceImpl.java new file mode 100644 index 0000000..bdf057d --- /dev/null +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwAlarmRuleServiceImpl.java @@ -0,0 +1,96 @@ +package com.ruoyi.business.service.impl; + +import java.util.List; +import com.ruoyi.common.core.utils.DateUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ruoyi.business.mapper.HwAlarmRuleMapper; +import com.ruoyi.business.domain.HwAlarmRule; +import com.ruoyi.business.service.IHwAlarmRuleService; + +/** + * 报警规则Service业务层处理 + * + * @author xins + * @date 2023-09-16 + */ +@Service +public class HwAlarmRuleServiceImpl implements IHwAlarmRuleService +{ + @Autowired + private HwAlarmRuleMapper hwAlarmRuleMapper; + + /** + * 查询报警规则 + * + * @param alarmRuleId 报警规则主键 + * @return 报警规则 + */ + @Override + public HwAlarmRule selectHwAlarmRuleByAlarmRuleId(Long alarmRuleId) + { + return hwAlarmRuleMapper.selectHwAlarmRuleByAlarmRuleId(alarmRuleId); + } + + /** + * 查询报警规则列表 + * + * @param hwAlarmRule 报警规则 + * @return 报警规则 + */ + @Override + public List selectHwAlarmRuleList(HwAlarmRule hwAlarmRule) + { + return hwAlarmRuleMapper.selectHwAlarmRuleList(hwAlarmRule); + } + + /** + * 新增报警规则 + * + * @param hwAlarmRule 报警规则 + * @return 结果 + */ + @Override + public int insertHwAlarmRule(HwAlarmRule hwAlarmRule) + { + hwAlarmRule.setCreateTime(DateUtils.getNowDate()); + return hwAlarmRuleMapper.insertHwAlarmRule(hwAlarmRule); + } + + /** + * 修改报警规则 + * + * @param hwAlarmRule 报警规则 + * @return 结果 + */ + @Override + public int updateHwAlarmRule(HwAlarmRule hwAlarmRule) + { + hwAlarmRule.setUpdateTime(DateUtils.getNowDate()); + return hwAlarmRuleMapper.updateHwAlarmRule(hwAlarmRule); + } + + /** + * 批量删除报警规则 + * + * @param alarmRuleIds 需要删除的报警规则主键 + * @return 结果 + */ + @Override + public int deleteHwAlarmRuleByAlarmRuleIds(Long[] alarmRuleIds) + { + return hwAlarmRuleMapper.deleteHwAlarmRuleByAlarmRuleIds(alarmRuleIds); + } + + /** + * 删除报警规则信息 + * + * @param alarmRuleId 报警规则主键 + * @return 结果 + */ + @Override + public int deleteHwAlarmRuleByAlarmRuleId(Long alarmRuleId) + { + return hwAlarmRuleMapper.deleteHwAlarmRuleByAlarmRuleId(alarmRuleId); + } +} 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 c77642c..ebd0089 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 @@ -8,6 +8,7 @@ import com.ruoyi.business.mapper.HwDeviceMapper; import com.ruoyi.business.mapper.HwDeviceModeFunctionMapper; import com.ruoyi.business.mapper.HwDeviceModeMapper; import com.ruoyi.business.service.IHwDeviceModeService; +import com.ruoyi.common.core.constant.Constants; import com.ruoyi.common.core.constant.HwDictConstants; import com.ruoyi.common.core.constant.TdEngineConstants; import com.ruoyi.common.core.domain.R; @@ -146,6 +147,14 @@ public class HwDeviceModeServiceImpl implements IHwDeviceModeService { @Transactional @Override public int deleteHwDeviceModeByDeviceModeIds(Long[] deviceModeIds) { + for (Long deviceModeId : deviceModeIds) { + HwDevice queryDevice = new HwDevice(); + queryDevice.setDeviceModeId(deviceModeId); + List deviceList = hwDeviceMapper.selectHwDeviceList(queryDevice); + if (deviceList != null && !deviceList.isEmpty()) { + throw new ServiceException("该设备模型下存在设备,不能删除"); + } + } hwDeviceModeMapper.deleteHwDeviceModeFunctionByDeviceModeIds(deviceModeIds); return hwDeviceModeMapper.deleteHwDeviceModeByDeviceModeIds(deviceModeIds); } @@ -408,7 +417,11 @@ public class HwDeviceModeServiceImpl implements IHwDeviceModeService { tdSuperTableVo.setFirstFieldName(TdEngineConstants.DEFAULT_FIRST_FIELD_NAME); tdSuperTableVo.setSchemaFields(schemaFields); tdSuperTableVo.setTagsFields(tagFields); - this.remoteTdEngineService.createSuperTable(tdSuperTableVo); + + R tdReturnMsg = this.remoteTdEngineService.createSuperTable(tdSuperTableVo); + if(tdReturnMsg.getCode() != Constants.SUCCESS){//抛出异常,回滚事务 + throw new RuntimeException(tdReturnMsg.getMsg()); + } } private void addTdSuperTableColumn(HwDeviceModeFunction hwDeviceModeFunction) { @@ -430,7 +443,10 @@ public class HwDeviceModeServiceImpl implements IHwDeviceModeService { tdSuperTableVo.setDatabaseName(dbName); tdSuperTableVo.setSuperTableName(superTableName); tdSuperTableVo.setField(schemaField); - this.remoteTdEngineService.addSuperTableColumn(tdSuperTableVo); + R tdReturnMsg = this.remoteTdEngineService.addSuperTableColumn(tdSuperTableVo); + if(tdReturnMsg.getCode() != Constants.SUCCESS){//抛出异常,回滚事务 + throw new RuntimeException(tdReturnMsg.getMsg()); + } } } @@ -448,7 +464,10 @@ public class HwDeviceModeServiceImpl implements IHwDeviceModeService { tdSuperTableVo.setSuperTableName(superTableName); tdSuperTableVo.setField(schemaField); - this.remoteTdEngineService.dropColumnForSuperTable(tdSuperTableVo); + R tdReturnMsg =this.remoteTdEngineService.dropColumnForSuperTable(tdSuperTableVo); + if(tdReturnMsg.getCode() != Constants.SUCCESS){//抛出异常,回滚事务 + throw new RuntimeException(tdReturnMsg.getMsg()); + } } } diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwDeviceServiceImpl.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwDeviceServiceImpl.java index deed73f..baf9f35 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwDeviceServiceImpl.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwDeviceServiceImpl.java @@ -4,11 +4,18 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.concurrent.atomic.AtomicReference; +import java.util.stream.Collectors; +import com.ruoyi.business.domain.HwDeviceModeFunction; import com.ruoyi.business.domain.VO.DeviceModeVo; +import com.ruoyi.business.domain.VO.HwDeviceVo; +import com.ruoyi.business.mapper.HwDeviceModeFunctionMapper; +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.utils.DateUtils; +import com.ruoyi.common.core.utils.NumberUtils; import com.ruoyi.tdengine.api.RemoteTdEngineService; import com.ruoyi.tdengine.api.domain.TdHistorySelectDto; import com.ruoyi.tdengine.api.domain.TdSelectDto; @@ -25,11 +32,12 @@ import com.ruoyi.business.service.IHwDeviceService; * @date 2023-08-24 */ @Service -public class HwDeviceServiceImpl implements IHwDeviceService -{ +public class HwDeviceServiceImpl implements IHwDeviceService { @Autowired private HwDeviceMapper hwDeviceMapper; @Autowired + private HwDeviceModeFunctionMapper hwDevieModeFunctionMapper; + @Autowired private RemoteTdEngineService remoteTdEgineService; /** @@ -39,11 +47,21 @@ public class HwDeviceServiceImpl implements IHwDeviceService * @return 设备信息 */ @Override - public HwDevice selectHwDeviceByDeviceId(Long deviceId) - { + public HwDevice selectHwDeviceByDeviceId(Long deviceId) { return hwDeviceMapper.selectHwDeviceByDeviceId(deviceId); } + /** + * 查询设备信息,返回监控单元名称 + * + * @param deviceId 设备信息主键 + * @return 设备信息 + */ + + @Override + public HwDevice selectHwDeviceJoinByDeviceId(Long deviceId) { + return hwDeviceMapper.selectHwDeviceJoinByDeviceId(deviceId); + } /** * 查询设备信息列表 * @@ -51,11 +69,21 @@ public class HwDeviceServiceImpl implements IHwDeviceService * @return 设备信息 */ @Override - public List selectHwDeviceList(HwDevice hwDevice) - { + public List selectHwDeviceList(HwDevice hwDevice) { return hwDeviceMapper.selectHwDeviceList(hwDevice); } + /** + * 查询关联设备信息列表 + * + * @param deviceId 设备信息主键 + * @return 设备信息 + */ + @Override + public List selectLinkDeviceList(Long deviceId) { + return hwDeviceMapper.selectLinkedDevices(deviceId); + } + /** * 新增设备信息 * @@ -63,93 +91,51 @@ public class HwDeviceServiceImpl implements IHwDeviceService * @return 结果 */ @Override - public int insertHwDevice(HwDevice hwDevice) - { + public int insertHwDevice(HwDevice hwDevice) { hwDevice.setCreateTime(DateUtils.getNowDate()); return hwDeviceMapper.insertHwDevice(hwDevice); } + /** * 查询3. 设备各类型占所有设备数量百分比饼状图(左下角) - * */ + */ @Override public List selectDeviceModeNameVo() { List list = hwDeviceMapper.selectDeviceModeNameVo(); Integer value = 0; if (list.size() > 10) { for (int i = 9; i < list.size(); i++) { - if (list.get(i).sum==null){ + if (list.get(i).sum == null) { list.get(i).sum = 0; } value = value + list.get(i).sum; } } - DeviceModeVo hwMonitorUnitTypeVo = new DeviceModeVo(); - hwMonitorUnitTypeVo.setDeviceModeName("其他"); - hwMonitorUnitTypeVo.setSum(value); +// DeviceModeVo hwMonitorUnitTypeVo = new DeviceModeVo(); +// hwMonitorUnitTypeVo.setDeviceModeName("其他"); +// hwMonitorUnitTypeVo.setSum(value); Integer sums = 0; - for (int i = 0; i < list.size();i++){ - if (list.get(i).sum==null){ + for (int i = 0; i < list.size(); i++) { + if (list.get(i).sum == null) { list.get(i).sum = 0; } - sums = sums+list.get(i).sum; + sums = sums + list.get(i).sum; } - for (int i=0;i 10) { - list.add(10, hwMonitorUnitTypeVo); - return list.subList(0, 10); - } else { - return list; - } - } - //获取有开关属性的设备 - @Override - public Map> selectDeviceByDeviceModeByMonitorUnitId(Long monitorUnitId){ - List hwDevices = hwDeviceMapper.selectDeviceByDeviceModeByMonitorUnitId(monitorUnitId);//todo 根据监控单元(已解决) - TdSelectDto tdSelectDto = new TdSelectDto(); - Map> latestDataByTags = new HashMap>(); - for (int i = 0; i < hwDevices.size(); i++){ - String s = hwDeviceMapper.selectDeviceByDeviceModeByDeviceModeFunction(hwDevices.get(i).getDeviceId()); - if (s!=null&&s!=""){ - tdSelectDto.setDatabaseName(TdEngineConstants.PLATFORM_DB_NAME); - tdSelectDto.setSuperTableName(TdEngineConstants.DEFAULT_DEVICE_STATUS_SUPER_TABLE_NAME); - tdSelectDto.setTagsName(hwDevices.get(i).getDeviceCode()); - latestDataByTags = (Map>) remoteTdEgineService.getLatestDataByTags(tdSelectDto); - } - //todo 根据获取的device,通过devicemodeid获取devicemode,再根据devicemodeid获取devicemodefunction,(已解决) - // todo 然后根据devicemodefunction中的datatype为8的(是bool的)(以解决) - } - return latestDataByTags; - } - //查询直采变量属性的设备 - @Override - public Map> selectDeviceModeFunctionByFunctionType(Long monitorUnitId) { - List hwDevices = hwDeviceMapper.selectDeviceByDeviceModeByMonitorUnitId(monitorUnitId);//todo 根据监控单元(已解决) - TdSelectDto tdSelectDto = new TdSelectDto(); - Map> latestDataByTags = new HashMap>(); - for (int i = 0; i < hwDevices.size(); i++){ - String s = hwDeviceMapper.selectDeviceModeFunctionByFunctionType(hwDevices.get(i).getDeviceId()); - if (s!=null&&s!=""){ - tdSelectDto.setDatabaseName(TdEngineConstants.PLATFORM_DB_NAME); - tdSelectDto.setSuperTableName(TdEngineConstants.DEFAULT_DEVICE_STATUS_SUPER_TABLE_NAME); - tdSelectDto.setTagsName(hwDevices.get(i).getDeviceCode()); - latestDataByTags = (Map>) remoteTdEgineService.getLatestDataByTags(tdSelectDto); - }} - return latestDataByTags; + + return list; +// if (list.size() > 10) { +// list.add(10, hwMonitorUnitTypeVo); +// return list.subList(0, 10); +// } else { +// return list; +// } } - @Override - public List> getHistoryData(Long deviceId) { - TdHistorySelectDto tdHistorySelectDto = new TdHistorySelectDto(); - tdHistorySelectDto.setDatabaseName(TdEngineConstants.PLATFORM_DB_NAME); - tdHistorySelectDto.setTableName(TdEngineConstants.getDeviceDataTableName(deviceId)); - tdHistorySelectDto.setOrderByFieldName(tdHistorySelectDto.getFirstFieldName()); - tdHistorySelectDto.setSort(TdEngineConstants.DEFAULT_ORDER_BY_MODE); - List> historyData = (List>) remoteTdEgineService.getHistoryData(tdHistorySelectDto); - return historyData; - } /** * 修改设备信息 @@ -158,8 +144,7 @@ public class HwDeviceServiceImpl implements IHwDeviceService * @return 结果 */ @Override - public int updateHwDevice(HwDevice hwDevice) - { + public int updateHwDevice(HwDevice hwDevice) { hwDevice.setUpdateTime(DateUtils.getNowDate()); return hwDeviceMapper.updateHwDevice(hwDevice); } @@ -171,8 +156,7 @@ public class HwDeviceServiceImpl implements IHwDeviceService * @return 结果 */ @Override - public int deleteHwDeviceByDeviceIds(Long[] deviceIds) - { + public int deleteHwDeviceByDeviceIds(Long[] deviceIds) { return hwDeviceMapper.deleteHwDeviceByDeviceIds(deviceIds); } @@ -183,8 +167,70 @@ public class HwDeviceServiceImpl implements IHwDeviceService * @return 结果 */ @Override - public int deleteHwDeviceByDeviceId(Long deviceId) - { + public int deleteHwDeviceByDeviceId(Long deviceId) { return hwDeviceMapper.deleteHwDeviceByDeviceId(deviceId); } + + + /** + * @return Map> + * @description 设备监测页面,根据监控单元获取设备监控信息 + * @author xins + * @date 2023-09-15 16:59 + */ + @Override + public Map> getDevicesByMonitor(HwDevice queryHwDevice) { + Map> devicesMap = new HashMap>(); + List controlDeviceVos = new ArrayList(); + List acquisitionDeviceVos = new ArrayList(); + Long sceneId = queryHwDevice.getSceneId(); + String databaseName = TdEngineConstants.getDatabaseName(sceneId); + + List hwDevices = hwDeviceMapper.selectHwDeviceList(queryHwDevice); + hwDevices.forEach(hwDevice -> { + + Long deviceId = hwDevice.getDeviceId(); + String tableName = TdEngineConstants.getDeviceDataTableName(deviceId); + TdSelectDto tdSelectDto = new TdSelectDto(); + tdSelectDto.setDatabaseName(databaseName); + tdSelectDto.setTableName(tableName); + List> deviceLatestDataMapList = (List>) this.remoteTdEgineService.getLatestData(tdSelectDto).getData(); + + HwDeviceModeFunction queryDeviceModeFunction = new HwDeviceModeFunction(); + queryDeviceModeFunction.setDeviceModeId(hwDevice.getDeviceModeId()); + List deviceModeFunctions = hwDevieModeFunctionMapper.selectHwDeviceModeFunctionList(queryDeviceModeFunction); + List dds = deviceModeFunctions.stream() + .filter(dmf -> dmf.getFunctionMode().equals(HwDictConstants.FUNCTION_MODE_ATTRIBUTE) + && dmf.getDataType() != null && String.valueOf(dmf.getDataType()).equals(String.valueOf(DataTypeEnums.TINYINT.getDataCode()))).collect(Collectors.toList()); + + HwDeviceVo hwDeviceVo = new HwDeviceVo(); + hwDeviceVo.setDeviceName(hwDevice.getDeviceName()); + if (dds != null && dds.size() > 0) { + hwDeviceVo.setDeviceType(HwDictConstants.CONTROL_DEVICE); + HwDeviceModeFunction dd = dds.get(0); + List> ddValueMapList = new ArrayList>(); + Map ddValueMap = new HashMap(); + + deviceLatestDataMapList.forEach(deviceLatestDataMap -> { + ddValueMap.put(dd.getFunctionIdentifier(), deviceLatestDataMap.get(dd.getFunctionIdentifier()) == null + ? 0 : deviceLatestDataMap.get(dd.getFunctionIdentifier())); + }); + ddValueMapList.add(ddValueMap); + + hwDeviceVo.setDeviceDataMaps(ddValueMapList); + controlDeviceVos.add(hwDeviceVo); + } else { + hwDeviceVo.setDeviceType(HwDictConstants.ACQUISITION_DEVICE); + hwDeviceVo.setDeviceDataMaps(deviceLatestDataMapList); + acquisitionDeviceVos.add(hwDeviceVo); + } + + }); + + devicesMap.put(HwDictConstants.CONTROL_DEVICE_NAME, controlDeviceVos); + devicesMap.put(HwDictConstants.ACQUISITION_DEVICE_NAME, acquisitionDeviceVos); + + return devicesMap; + } + } diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwElectronicFenceServiceImpl.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwElectronicFenceServiceImpl.java index c8133e1..0af93d0 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwElectronicFenceServiceImpl.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwElectronicFenceServiceImpl.java @@ -3,7 +3,13 @@ package com.ruoyi.business.service.impl; import java.util.ArrayList; import java.util.List; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.ruoyi.business.domain.HwFenceTarget; import com.ruoyi.business.domain.VO.EleMonitorDeviceSumVo; +import com.ruoyi.business.domain.VO.ElectronicFenceVo; +import com.ruoyi.business.mapper.HwFenceTargetMapper; +import com.ruoyi.common.core.constant.HwDictConstants; import com.ruoyi.common.core.utils.DateUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -18,11 +24,13 @@ import com.ruoyi.business.service.IHwElectronicFenceService; * @date 2023-09-04 */ @Service -public class HwElectronicFenceServiceImpl implements IHwElectronicFenceService -{ +public class HwElectronicFenceServiceImpl implements IHwElectronicFenceService { @Autowired private HwElectronicFenceMapper hwElectronicFenceMapper; + @Autowired + private HwFenceTargetMapper hwFenceTargetMapper; + /** * 查询电子围栏 * @@ -30,8 +38,7 @@ public class HwElectronicFenceServiceImpl implements IHwElectronicFenceService * @return 电子围栏 */ @Override - public HwElectronicFence selectHwElectronicFenceByElectronicFenceId(Long electronicFenceId) - { + public HwElectronicFence selectHwElectronicFenceByElectronicFenceId(Long electronicFenceId) { return hwElectronicFenceMapper.selectHwElectronicFenceByElectronicFenceId(electronicFenceId); } @@ -41,114 +48,58 @@ public class HwElectronicFenceServiceImpl implements IHwElectronicFenceService } @Override - public List selectEleTypeNums(Long sceneId) { - List list = hwElectronicFenceMapper.selectEleTypeBySceneId(sceneId); - list.stream().forEach(v->{}); - List voList = new ArrayList(); - if (list.size()==1){ - if (list.get(0)==1){ - //电子围栏下只有设备 - voList = hwElectronicFenceMapper.selectSumsFromMonitorByElectronicFence(sceneId); + public List selectEleTypeNums(Long sceneId) { + List electronicFenceVos = new ArrayList(); + HwElectronicFence queryElectronicFence = new HwElectronicFence(); + queryElectronicFence.setSceneId(sceneId); + List electronicFenceList = hwElectronicFenceMapper.selectHwElectronicFenceList(queryElectronicFence); + electronicFenceList.forEach(electronicFence -> { + ElectronicFenceVo e = new ElectronicFenceVo(); + String fenceType = electronicFence.getFenceType(); + String areaShapeFlag = electronicFence.getAreaShapeFlag(); + String areaRange = electronicFence.getAreaRange(); + Integer deviceCount = 0; + if (fenceType.equals(HwDictConstants.FENCE_TYPE_DEVICE) + || fenceType.equals(HwDictConstants.FENCE_TYPE_MONITOR_UNIT)) { + deviceCount = hwElectronicFenceMapper.selectDeviceCount(electronicFence.getElectronicFenceId()); + } - return voList; - } - else if (list.get(0)==2){ - //电子围栏下只有监控单元 - voList = hwElectronicFenceMapper.selectEleOnlyMonitorBySceneId(sceneId); - return voList; - } - else if (list.get(0)==3){ - //电子围栏下只有场景 - Integer integer = hwElectronicFenceMapper.selectEleOnlyScene(sceneId); - EleMonitorDeviceSumVo eleMonitorDeviceSumVo = new EleMonitorDeviceSumVo(); - eleMonitorDeviceSumVo.setSceneId(sceneId); - eleMonitorDeviceSumVo.setSum(integer); - voList.add(eleMonitorDeviceSumVo); - return voList; - } - } - else if (list.size()==2){ - if (list.get(0)+list.get(1)==3){ - //设备与监控单元 - List devices = new ArrayList<>(); - List monitor = new ArrayList<>(); - //查询场景下的所有设备根据电子围栏分组,在查询场景下的所有监控单元以及下面的设备按电子围栏分组 - //shebei - devices = hwElectronicFenceMapper.selectSumsFromMonitorByElectronicFence(sceneId); - //jiankongdanyuan - monitor = hwElectronicFenceMapper.selectEleOnlyMonitorBySceneId(sceneId); - for (int i=0; i devices = new ArrayList<>(); + if (fenceType.equals(HwDictConstants.FENCE_TYPE_MONITOR_UNIT)) { + deviceCount = hwElectronicFenceMapper.selectDeviceCountByMonitorUnit(electronicFence.getElectronicFenceId()); - devices = hwElectronicFenceMapper.selectSumsFromMonitorByElectronicFence(sceneId); - Integer aLong = hwElectronicFenceMapper.selectEleOnlyScene(sceneId); - for (int i = 0; i < devices.size();i++){ - aLong = aLong-devices.get(i).getSum(); - } - EleMonitorDeviceSumVo eleMonitorDeviceSumVo = new EleMonitorDeviceSumVo(); - eleMonitorDeviceSumVo.setSceneId(sceneId); - eleMonitorDeviceSumVo.setSum(aLong); - voList.add(eleMonitorDeviceSumVo); - voList.addAll(devices); - return voList; - } - else if (list.get(0)+list.get(1)==5){ - //场景与监控单元 - List monitor = new ArrayList<>(); - monitor=hwElectronicFenceMapper.selectEleOnlyMonitorBySceneId(sceneId); - Integer aLong = hwElectronicFenceMapper.selectEleOnlyScene(sceneId); - for (int i = 0;i points = new ArrayList(); + for (String areaR : areaRangeArr) { + String[] areaRArr = areaR.split(","); + ElectronicFenceVo.AreaPoint p = new ElectronicFenceVo.AreaPoint(); + p.setLongitude(Double.valueOf(areaRArr[0])); + p.setLatitude(Double.valueOf(areaRArr[1])); + points.add(p); } - EleMonitorDeviceSumVo eleMonitorDeviceSumVo = new EleMonitorDeviceSumVo(); - eleMonitorDeviceSumVo.setSceneId(sceneId); - eleMonitorDeviceSumVo.setSum(aLong); - voList.add(eleMonitorDeviceSumVo); - voList.addAll(monitor); - return voList; - } + e.setAreaPoints(points); - }else if (list.size()==3){ - List devices = new ArrayList<>(); - List monitor = new ArrayList<>(); - //shebei - devices = hwElectronicFenceMapper.selectSumsFromMonitorByElectronicFence(sceneId); - //jiankongdanyuan - monitor = hwElectronicFenceMapper.selectEleOnlyMonitorBySceneId(sceneId); - Integer aLong = hwElectronicFenceMapper.selectEleOnlyScene(sceneId); - for (int i=0; i selectHwElectronicFenceList(HwElectronicFence hwElectronicFence) - { + public List selectHwElectronicFenceList(HwElectronicFence hwElectronicFence) { return hwElectronicFenceMapper.selectHwElectronicFenceList(hwElectronicFence); } @@ -170,8 +120,7 @@ public class HwElectronicFenceServiceImpl implements IHwElectronicFenceService * @return 结果 */ @Override - public int insertHwElectronicFence(HwElectronicFence hwElectronicFence) - { + public int insertHwElectronicFence(HwElectronicFence hwElectronicFence) { hwElectronicFence.setCreateTime(DateUtils.getNowDate()); return hwElectronicFenceMapper.insertHwElectronicFence(hwElectronicFence); } @@ -183,8 +132,7 @@ public class HwElectronicFenceServiceImpl implements IHwElectronicFenceService * @return 结果 */ @Override - public int updateHwElectronicFence(HwElectronicFence hwElectronicFence) - { + public int updateHwElectronicFence(HwElectronicFence hwElectronicFence) { hwElectronicFence.setUpdateTime(DateUtils.getNowDate()); return hwElectronicFenceMapper.updateHwElectronicFence(hwElectronicFence); } @@ -196,8 +144,7 @@ public class HwElectronicFenceServiceImpl implements IHwElectronicFenceService * @return 结果 */ @Override - public int deleteHwElectronicFenceByElectronicFenceIds(Long[] electronicFenceIds) - { + public int deleteHwElectronicFenceByElectronicFenceIds(Long[] electronicFenceIds) { return hwElectronicFenceMapper.deleteHwElectronicFenceByElectronicFenceIds(electronicFenceIds); } @@ -208,8 +155,7 @@ public class HwElectronicFenceServiceImpl implements IHwElectronicFenceService * @return 结果 */ @Override - public int deleteHwElectronicFenceByElectronicFenceId(Long electronicFenceId) - { + public int deleteHwElectronicFenceByElectronicFenceId(Long electronicFenceId) { return hwElectronicFenceMapper.deleteHwElectronicFenceByElectronicFenceId(electronicFenceId); } } diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwMonitorPlatformServiceImpl.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwMonitorPlatformServiceImpl.java new file mode 100644 index 0000000..135aaff --- /dev/null +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwMonitorPlatformServiceImpl.java @@ -0,0 +1,86 @@ +package com.ruoyi.business.service.impl; + +import com.ruoyi.business.domain.VO.DeviceDataColumnVo; +import com.ruoyi.business.domain.VO.DeviceHistoryDataVo; +import com.ruoyi.business.domain.VO.DeviceLatestDataVo; +import com.ruoyi.business.service.IHwMonitorPlatformService; +import com.ruoyi.common.core.constant.HwDictConstants; +import com.ruoyi.common.core.constant.TdEngineConstants; +import com.ruoyi.tdengine.api.RemoteTdEngineService; +import com.ruoyi.tdengine.api.domain.TdHistorySelectDto; +import com.ruoyi.tdengine.api.domain.TdSuperTableSelectVo; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +/** + * @Description: 监控平台数据处理接口 + * @ClassName: HwMonitorPlatformServiceImpl + * @Author : xins + * @Date :2023-09-16 14:50 + * @Version :1.0 + */ +@Service +public class HwMonitorPlatformServiceImpl implements IHwMonitorPlatformService { + @Resource + private RemoteTdEngineService remoteTdEngineService; + + /** + * @return List> + * @param: deviceLatestDataVo + * @description 根据设备模型获取最新数据 + * @author xins + * @date 2023-09-16 14:49 + */ + @Override + public List> selectLatestDataByTags(DeviceLatestDataVo deviceLatestDataVo) { + TdSuperTableSelectVo tdSuperTableSelectVo = new TdSuperTableSelectVo(); + String databaseName = TdEngineConstants.getDatabaseName(deviceLatestDataVo.getSceneId()); + String superTableName = TdEngineConstants.getSupertTableName(deviceLatestDataVo.getDeviceModeId()); + tdSuperTableSelectVo.setDatabaseName(databaseName); + tdSuperTableSelectVo.setSuperTableName(superTableName); + tdSuperTableSelectVo.setGroupByTagsName(TdEngineConstants.ST_TAG_DEVICEID); + if (deviceLatestDataVo.getStartTime() != 0 || deviceLatestDataVo.getEndTime() != 0) { + tdSuperTableSelectVo.setFirstFieldName(TdEngineConstants.DEFAULT_FIRST_FIELD_NAME); + } + tdSuperTableSelectVo.setDeviceCode(deviceLatestDataVo.getDeviceCode()); + tdSuperTableSelectVo.setDeviceName(deviceLatestDataVo.getDeviceName()); + tdSuperTableSelectVo.setStartTime(deviceLatestDataVo.getStartTime()); + tdSuperTableSelectVo.setEndTime(deviceLatestDataVo.getEndTime()); + tdSuperTableSelectVo.setOffset(deviceLatestDataVo.getOffset()); + tdSuperTableSelectVo.setLimit(deviceLatestDataVo.getLimit()); + return this.remoteTdEngineService.getLatestDataByTags(tdSuperTableSelectVo).getData(); + + } + + + /** + * @param: deviceHistoryDataVo + * @description 获取设备历史数据 + * @author xins + * @date 2023-09-16 15:14 + * @return List> + */ + @Override + public List> getHistoryData(DeviceHistoryDataVo deviceHistoryDataVo) { + TdHistorySelectDto tdHistorySelectDto = new TdHistorySelectDto(); + tdHistorySelectDto.setDatabaseName(TdEngineConstants.getDatabaseName(deviceHistoryDataVo.getSceneId())); + tdHistorySelectDto.setTableName(TdEngineConstants.getDeviceDataTableName(deviceHistoryDataVo.getDeviceId())); + tdHistorySelectDto.setOrderByFieldName(TdEngineConstants.DEFAULT_FIRST_FIELD_NAME); + tdHistorySelectDto.setSort(TdEngineConstants.DEFAULT_ORDER_BY_MODE); + if (deviceHistoryDataVo.getStartTime() != 0 || deviceHistoryDataVo.getEndTime() != 0) { + tdHistorySelectDto.setFirstFieldName(TdEngineConstants.DEFAULT_FIRST_FIELD_NAME); + } + tdHistorySelectDto.setStartTime(deviceHistoryDataVo.getStartTime()); + tdHistorySelectDto.setEndTime(deviceHistoryDataVo.getEndTime()); + tdHistorySelectDto.setOffset(deviceHistoryDataVo.getOffset()); + tdHistorySelectDto.setLimit(deviceHistoryDataVo.getLimit()); + + return this.remoteTdEngineService.getHistoryData(tdHistorySelectDto).getData(); + + } + +} diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwMonitorUnitServiceImpl.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwMonitorUnitServiceImpl.java index be57e45..289e03d 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwMonitorUnitServiceImpl.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwMonitorUnitServiceImpl.java @@ -1,5 +1,26 @@ package com.ruoyi.business.service.impl; +import com.ruoyi.business.domain.HwAlarmInfo; +import com.ruoyi.business.domain.HwDevice; +import com.ruoyi.business.domain.HwMonitorUnit; +import com.ruoyi.business.domain.VO.*; +import com.ruoyi.business.mapper.HwAlarmInfoMapper; +import com.ruoyi.business.mapper.HwDeviceMapper; +import com.ruoyi.business.mapper.HwElectronicFenceMapper; +import com.ruoyi.business.mapper.HwMonitorUnitMapper; +import com.ruoyi.business.service.IHwMonitorUnitService; +import com.ruoyi.common.core.constant.TdEngineConstants; +import com.ruoyi.common.core.domain.R; +import com.ruoyi.common.core.utils.DateUtils; +import com.ruoyi.common.core.utils.NumberUtils; +import com.ruoyi.common.core.utils.StringUtils; +import com.ruoyi.tdengine.api.RemoteTdEngineService; +import com.ruoyi.tdengine.api.domain.DeviceStatus; +import com.ruoyi.tdengine.api.domain.TdSelectDto; +import com.ruoyi.tdengine.api.domain.TdSuperTableSelectVo; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + import java.time.LocalDate; import java.time.LocalDateTime; import java.time.LocalTime; @@ -8,23 +29,6 @@ import java.time.format.DateTimeFormatter; import java.util.*; import java.util.stream.Collectors; -import com.ruoyi.business.domain.HwDevice; -import com.ruoyi.business.domain.VO.*; -import com.ruoyi.business.mapper.HwDeviceMapper; -import com.ruoyi.business.mapper.HwElectronicFenceMapper; -import com.ruoyi.common.core.constant.TdEngineConstants; -import com.ruoyi.common.core.domain.R; -import com.ruoyi.common.core.utils.DateUtils; -import com.ruoyi.common.core.utils.StringUtils; -import com.ruoyi.tdengine.api.RemoteTdEngineService; -import com.ruoyi.tdengine.api.domain.DeviceStatus; -import com.ruoyi.tdengine.api.domain.TdSelectDto; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import com.ruoyi.business.mapper.HwMonitorUnitMapper; -import com.ruoyi.business.domain.HwMonitorUnit; -import com.ruoyi.business.service.IHwMonitorUnitService; - /** * 监控单元Service业务层处理 * @@ -32,8 +36,7 @@ import com.ruoyi.business.service.IHwMonitorUnitService; * @date 2023-08-31 */ @Service -public class HwMonitorUnitServiceImpl implements IHwMonitorUnitService -{ +public class HwMonitorUnitServiceImpl implements IHwMonitorUnitService { @Autowired private HwMonitorUnitMapper hwMonitorUnitMapper; @Autowired @@ -42,8 +45,8 @@ public class HwMonitorUnitServiceImpl implements IHwMonitorUnitService private RemoteTdEngineService remoteTdEgineService; @Autowired private HwDeviceMapper hwDeviceMapper; - - + @Autowired + private HwAlarmInfoMapper hwAlarmInfoMapper; /** * 查询监控单元 @@ -52,106 +55,106 @@ public class HwMonitorUnitServiceImpl implements IHwMonitorUnitService * @return 监控单元 */ @Override - public HwMonitorUnit selectHwMonitorUnitByMonitorUnitId(Long monitorUnitId) - { + public HwMonitorUnit selectHwMonitorUnitByMonitorUnitId(Long monitorUnitId) { return hwMonitorUnitMapper.selectHwMonitorUnitByMonitorUnitId(monitorUnitId); } + /** * 查询区域数量站场景区总数百分比 - * */ + */ @Override public List selectMonitorPercentage() { +// HwMonitorUnit queryMonitorUnit = new HwMonitorUnit(); +// List list = hwMonitorUnitMapper.selectHwMonitorUnitListJoinScene(queryMonitorUnit); +// Map> monitorUnitMap = list.stream() +// .collect(Collectors.groupingBy(HwMonitorUnit::getSceneId)); +// List monitorUnitVoList = new ArrayList<>(); +// +// +// Set keys = monitorUnitMap.keySet(); +// for(Long key:keys){ +// Integer value = monitorUnitMap.get(key); +// System.out.println(key+"\t"+value); +// } List list = hwMonitorUnitMapper.selectMonitorPercentage(); List hwScenes = hwMonitorUnitMapper.selectSceneNameById(); - int count = hwScenes.size(); - if (list.size()<=hwScenes.size()) { - count = list.size(); - } - for (int i = 0; i < count; i++) { - for (int j = 0;j { + for (int i = 0; i < hwScenes.size(); i++) { + if (l.getSceneId().equals(hwScenes.get(i).getSceneId())) { + l.setSceneName(hwScenes.get(i).getSceneName()); } } - } + }); + Integer value = 0; // Integer sums = 0; - if (list.size()>5){ - for (int i = 4; i < list.size(); i++){ - if (list.get(i).sum==null){ - list.get(i).sum = 0; - } - value = value+list.get(i).sum; - } - } - for (int i = 0; i < list.size();i++){ - if (list.get(i).sum==null){ +// if (list.size() > 5) { +// for (int i = 4; i < list.size(); i++) {//这是剩下的总数 +// if (list.get(i).sum == null) { +// list.get(i).sum = 0; +// } +// value = value + list.get(i).sum; +// } +// } + for (int i = 0; i < list.size(); i++) { + if (list.get(i).sum == null) { list.get(i).sum = 0; } - sums = sums+list.get(i).sum; + sums = sums + list.get(i).sum; } - for (int i=0;i alarmInfos = hwAlarmInfoMapper.selectHwAlarmInfoList(queryAlarmInfo); + Integer alarmInfoSize = alarmInfos == null ? 0 : alarmInfos.size(); + hwMonitorUnitVo.setErr(alarmInfoSize); } - HwMonitorUnitVo hwMonitorUnitVo = new HwMonitorUnitVo(); - hwMonitorUnitVo.setSceneName("其他"); - hwMonitorUnitVo.setSum(value); - if (list.size()>5){ - list.add(5,hwMonitorUnitVo); - return list.subList(0,5); - } - else { - return list; - } +// HwMonitorUnitVo hwMonitorUnitVo = new HwMonitorUnitVo(); +// hwMonitorUnitVo.setSceneName("其他"); +// hwMonitorUnitVo.setSum(value); + +// if (list.size() > 5) { +// list.add(5, hwMonitorUnitVo); +// return list.subList(0, 5); +// } else { +// return list; +// } + return list; } //获取总的设备数量与监控单元数量 @Override - public AllNumsVo selectAllNums() { + public AllNumsVo selectAllNums(Long sceneId) { //监控单元 - String monitor = hwMonitorUnitMapper.selectSubSetNums(); - String integer = hwMonitorUnitMapper.selectDeviceNums(); - System.out.println(monitor+" dsaas "+integer); - Integer monitor1 = 0; - Integer monitor2 = 0; - + Integer monitor = hwMonitorUnitMapper.selectSubSetNums(sceneId) == null ? 0 + : hwMonitorUnitMapper.selectSubSetNums(sceneId); + Integer integer = hwMonitorUnitMapper.selectDeviceNums(sceneId) == null ? 0 + : hwMonitorUnitMapper.selectDeviceNums(sceneId); AllNumsVo vo = new AllNumsVo(); - if (monitor == null){ - monitor1 = 0; - } - else { - monitor1 = Integer.valueOf(monitor); - } - if (integer == null){ - monitor2 = 0; - } - else { - monitor2 = Integer.valueOf(integer); - } - vo.setSubSum(monitor1); - vo.setSum(monitor2); - - + vo.setSubSum(monitor); + vo.setSum(integer); return vo; } - - @Override - public List selectSenceAllNums() { - List allNumsVos = hwMonitorUnitMapper.selectAllNums(); - List allNums = hwMonitorUnitMapper.selectsum(); - for (int i=0;i< allNums.size();i++){ - for (int j=0;j< allNums.size();j++){ - if (allNums.get(i).getSceneId().equals(allNumsVos.get(i).getSceneId())){ - allNums.get(i).setSubSum(allNumsVos.get(i).getSubSum()); - } - } - } - return allNums; - } +// @Override +// public List selectSenceAllNums() { +// List allNumsVos = hwMonitorUnitMapper.selectAllNums(); +// List allNums = hwMonitorUnitMapper.selectsum(); +// for (int i = 0; i < allNums.size(); i++) { +// for (int j = 0; j < allNums.size(); j++) { +// if (allNums.get(i).getSceneId().equals(allNumsVos.get(i).getSceneId())) { +// allNums.get(i).setSubSum(allNumsVos.get(i).getSubSum()); +// } +// } +// } +// return allNums; +// } @Override public List selectLimitSubMonitorUnit() { @@ -161,8 +164,8 @@ public class HwMonitorUnitServiceImpl implements IHwMonitorUnitService } @Override - public List selectAlarmStats() { - return hwMonitorUnitMapper.selectAlarmStats(); + public List selectAlarmStats(Long sceneId) { + return hwMonitorUnitMapper.selectAlarmStats(sceneId); } @@ -173,155 +176,72 @@ public class HwMonitorUnitServiceImpl implements IHwMonitorUnitService * @return 监控单元 */ @Override - public List selectHwMonitorUnitList(HwMonitorUnit hwMonitorUnit) - { + public List selectHwMonitorUnitList(HwMonitorUnit hwMonitorUnit) { return hwMonitorUnitMapper.selectHwMonitorUnitList(hwMonitorUnit); } @Override public SubDeviceSumVo selectSubDeviceSum(Long sceneId) { - int SubSum = hwMonitorUnitMapper.selectSubDeviceSum(sceneId); - List hwDevices = hwDeviceMapper.selectDeviceNum(sceneId); - int onlineDevice = 0; - for (int i = 0;i longs = hwMonitorUnitMapper.selectEleInScene(sceneId); - return null; - } - @Override public HwMonitorUnit selectHwmonitorUnitSub(Long monitorUnitId) { - return hwMonitorUnitMapper.selectHwMonitorUnitByMonitorUnitId(monitorUnitId); + return hwMonitorUnitMapper.selectHwMonitorUnitByMonitorUnitId(monitorUnitId); } + //todo SysDeptServiceImpl类中的递归方法recursionFn(以实现) @Override - // 加一个begintime参数,endtime参数 stream时间戳 从开始时间0点开始,结束时间23.59.59结束 - public Map selectTdengine(String beginTime, String endTime, Long sceneId) { - DeviceStatus queryDeviceStatus = new DeviceStatus(); - - Map params = queryDeviceStatus.getParams(); - DateTimeFormatter ofPattern = DateTimeFormatter.ofPattern("yyyy-MM-dd", Locale.CHINA); - System.out.println(ofPattern); - LocalDate parse = LocalDate.parse(beginTime, ofPattern); - long begintime = parse.atStartOfDay().toInstant(ZoneOffset.of("+8")).toEpochMilli(); - - DateTimeFormatter ofPattern1 = DateTimeFormatter.ofPattern("yyyy-MM-dd", Locale.CHINA); - LocalDate parse1 = LocalDate.parse(endTime, ofPattern); - long endtime = LocalDateTime.of(parse1, LocalTime.MAX).toInstant(ZoneOffset.of("+8")).toEpochMilli(); - - params.put("beginTime",begintime); - params.put("endTime", endtime); - queryDeviceStatus.setParams(params); - if (sceneId != null) { - queryDeviceStatus.setSceneId(sceneId); + public List selectTreeList(List hwMonitorUnits) { + List returnList = new ArrayList<>(); + List tempList = hwMonitorUnits.stream().map(HwMonitorUnit::getMonitorUnitId).collect(Collectors.toList()); + List treeList = new ArrayList<>(); + for (HwMonitorUnit hwMonitorUnit : hwMonitorUnits) { + if (!tempList.contains(hwMonitorUnit.getParentId())) + recursionFn(hwMonitorUnits, hwMonitorUnit); + returnList.add(hwMonitorUnit); } - - int sum = 0; - int values[] = new int[10]; - Map valuesMap = new HashMap<>(); - //todo 使用id(以解决) - //map key时间戳,value List 对象 - R r = remoteTdEgineService.getOnlineDevicesGroupByDay(queryDeviceStatus); - Map> deviceStatusMap = (Map>) r.getData(); - List list = (List) remoteTdEgineService.getOnlineDevicesGroupByDay(queryDeviceStatus); - Set longs = deviceStatusMap.keySet(); - for (Object key:longs){ - List deviceStatuses = deviceStatusMap.get(key); - for (int i=0;i>> selectLatestDataByTags(Long monitorUnitId) { -// - R>> latestDataByTags = new R>>(); - List hwDevices = hwDeviceMapper.selectDeviceByMonitorId(monitorUnitId); - TdSelectDto tdSelectDto = new TdSelectDto(); - for (int i = 0; i < hwDevices.size(); i++){ - tdSelectDto.setDatabaseName(TdEngineConstants.PLATFORM_DB_NAME); - tdSelectDto.setTableName(TdEngineConstants.getDeviceDataTableName(hwDevices.get(i).getDeviceId())); - tdSelectDto.setTagsName(hwDevices.get(i).getDeviceCode()); - - latestDataByTags = remoteTdEgineService.getLatestDataByTags(tdSelectDto); - } - return latestDataByTags; - } - -//todo SysDeptServiceImpl类中的递归方法recursionFn(以实现) -@Override -public List selectTreeList(List hwMonitorUnits) { - List returnList = new ArrayList<>(); - List tempList = hwMonitorUnits.stream().map(HwMonitorUnit::getMonitorUnitId).collect(Collectors.toList()); - List treeList = new ArrayList<>(); - for (HwMonitorUnit hwMonitorUnit:hwMonitorUnits){ - if (!tempList.contains(hwMonitorUnit.getParentId())) - recursionFn(hwMonitorUnits,hwMonitorUnit); - returnList.add(hwMonitorUnit); - } - for (int i = 0; i < returnList.size(); i++){ - if (returnList.get(i).getParentId()==null){ - treeList.add(returnList.get(i)); - } - } - return treeList; -} - private void recursionFn(List list, HwMonitorUnit t) - { + private void recursionFn(List list, HwMonitorUnit t) { // 得到子节点列表 List childList = getChildList(list, t); t.setChild(childList); - for (HwMonitorUnit tChild : childList) - { - if (hasChild(list, tChild)) - { + for (HwMonitorUnit tChild : childList) { + if (hasChild(list, tChild)) { recursionFn(list, tChild); } } } - private List getChildList(List list, HwMonitorUnit t) - { + + private List getChildList(List list, HwMonitorUnit t) { List tlist = new ArrayList(); Iterator it = list.iterator(); - while (it.hasNext()) - { + while (it.hasNext()) { HwMonitorUnit n = (HwMonitorUnit) it.next(); - if (StringUtils.isNotNull(n.getParentId()) && n.getParentId().longValue() == t.getMonitorUnitId().longValue()) - { + if (StringUtils.isNotNull(n.getParentId()) && n.getParentId().longValue() == t.getMonitorUnitId().longValue()) { tlist.add(n); } } return tlist; } - private boolean hasChild(List list, HwMonitorUnit t) - { + + private boolean hasChild(List list, HwMonitorUnit t) { return getChildList(list, t).size() > 0 ? true : false; } @@ -332,8 +252,7 @@ public List selectTreeList(List hwMonitorUnits) { * @return 结果 */ @Override - public int insertHwMonitorUnit(HwMonitorUnit hwMonitorUnit) - { + public int insertHwMonitorUnit(HwMonitorUnit hwMonitorUnit) { hwMonitorUnit.setCreateTime(DateUtils.getNowDate()); return hwMonitorUnitMapper.insertHwMonitorUnit(hwMonitorUnit); } @@ -345,8 +264,7 @@ public List selectTreeList(List hwMonitorUnits) { * @return 结果 */ @Override - public int updateHwMonitorUnit(HwMonitorUnit hwMonitorUnit) - { + public int updateHwMonitorUnit(HwMonitorUnit hwMonitorUnit) { hwMonitorUnit.setUpdateTime(DateUtils.getNowDate()); return hwMonitorUnitMapper.updateHwMonitorUnit(hwMonitorUnit); } @@ -358,8 +276,7 @@ public List selectTreeList(List hwMonitorUnits) { * @return 结果 */ @Override - public int deleteHwMonitorUnitByMonitorUnitIds(Long[] monitorUnitIds) - { + public int deleteHwMonitorUnitByMonitorUnitIds(Long[] monitorUnitIds) { return hwMonitorUnitMapper.deleteHwMonitorUnitByMonitorUnitIds(monitorUnitIds); } @@ -370,28 +287,91 @@ public List selectTreeList(List hwMonitorUnits) { * @return 结果 */ @Override - public int deleteHwMonitorUnitByMonitorUnitId(Long monitorUnitId) - { + public int deleteHwMonitorUnitByMonitorUnitId(Long monitorUnitId) { return hwMonitorUnitMapper.deleteHwMonitorUnitByMonitorUnitId(monitorUnitId); } -} -//remoteTdEngineSevice.getOnlineDevicesGroupByDay方法获取 -// 参数实例: -// // params.put("beginTime", beginTime); -//// params.put("endTime", endTime); -//// queryDeviceStatus.setParams(params); -//// if (sceneId != null) { -//// queryDeviceStatus.setSceneId(sceneId); -//// } -// -// 这是IDEA参数传的参数Content-Type: application/json -// { -// "params": { "beginTime":1666666666666,"endTime":1766666666666 } -// -// } -// -// 如果在IDEA测试可以{ -// "params": {"databaseName":"db_scene_1","superTableName":"st_ds_1", -// "beginTime":1666666666666,"endTime":1766666666666 } -// } + + /** + * 查询监控单元树结构信息 + * + * @param hwMonitorUnit 监控单元信息 + * @return 监控单元树信息集合 + */ + @Override + public List selectMonitorTreeList(HwMonitorUnit hwMonitorUnit) { + List hwMonitorUnits = this.selectHwMonitorUnitList(hwMonitorUnit); + return buildMonitorUnitTreeSelect(hwMonitorUnits); + } + + /** + * 构建前端所需要下拉树结构 + * + * @param hwMonitorUnits 监控单元列表 + * @return 下拉树结构列表 + */ + @Override + public List buildMonitorUnitTreeSelect(List hwMonitorUnits) { + List monitorUnitTrees = buildMonitorUnitTree(hwMonitorUnits); + return monitorUnitTrees.stream().map(TreeSelectVo::new).collect(Collectors.toList()); + } + + /** + * 构建前端所需要树结构 + * + * @param hwMonitorUnits 监控单元列表 + * @return 树结构列表 + */ + @Override + public List buildMonitorUnitTree(List hwMonitorUnits) { + List returnList = new ArrayList(); + List tempList = hwMonitorUnits.stream().map(HwMonitorUnit::getMonitorUnitId).collect(Collectors.toList()); + for (HwMonitorUnit monitorUnit : hwMonitorUnits) { + // 如果是顶级节点, 遍历该父节点的所有子节点 + if (!tempList.contains(monitorUnit.getParentId())) { + recursionFn1(hwMonitorUnits, monitorUnit); + returnList.add(monitorUnit); + } + } + if (returnList.isEmpty()) { + returnList = hwMonitorUnits; + } + return returnList; + } + + /** + * 递归列表 + */ + private void recursionFn1(List list, HwMonitorUnit t) { + // 得到子节点列表 + List childList = getChildList1(list, t); + t.setChildren(childList); + for (HwMonitorUnit tChild : childList) { + if (hasChild1(list, tChild)) { + recursionFn1(list, tChild); + } + } + } + + /** + * 得到子节点列表 + */ + private List getChildList1(List list, HwMonitorUnit t) { + List tlist = new ArrayList(); + Iterator it = list.iterator(); + while (it.hasNext()) { + HwMonitorUnit n = (HwMonitorUnit) it.next(); + if (StringUtils.isNotNull(n.getParentId()) && n.getParentId().longValue() == t.getMonitorUnitId().longValue()) { + tlist.add(n); + } + } + return tlist; + } + + /** + * 判断是否有子节点 + */ + private boolean hasChild1(List list, HwMonitorUnit t) { + return getChildList1(list, t).size() > 0 ? true : false; + } +} diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwSceneServiceImpl.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwSceneServiceImpl.java index 28881c2..491dcbb 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwSceneServiceImpl.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwSceneServiceImpl.java @@ -7,6 +7,7 @@ import java.util.List; import com.ruoyi.business.domain.HwSceneMode; import com.ruoyi.business.domain.VO.HwSceneVo; +import com.ruoyi.common.core.constant.HwDictConstants; import com.ruoyi.common.core.utils.DateUtils; import com.ruoyi.common.redis.service.RedisService; import com.ruoyi.common.security.utils.SecurityUtils; @@ -26,8 +27,7 @@ import com.ruoyi.business.service.IHwSceneService; * @date 2023-08-23 */ @Service -public class HwSceneServiceImpl implements IHwSceneService -{ +public class HwSceneServiceImpl implements IHwSceneService { @Autowired private HwSceneMapper hwSceneMapper; @Autowired @@ -41,8 +41,7 @@ public class HwSceneServiceImpl implements IHwSceneService * @return 场景信息 */ @Override - public HwScene selectHwSceneBySceneId(Long sceneId) - { + public HwScene selectHwSceneBySceneId(Long sceneId) { return hwSceneMapper.selectHwSceneBySceneId(sceneId); } @@ -53,17 +52,6 @@ public class HwSceneServiceImpl implements IHwSceneService return hwScenes; } - @Override - public List selectHwSceneByTenantId(Long tenantId) { - if (tenantId == 0){ - return hwSceneMapper.selectHwSceneByTenantId0(tenantId); - } - else - return hwSceneMapper.selectHwSceneByTenantIdNot0(tenantId); - - } - - /** * 查询场景信息列表 * @@ -71,9 +59,26 @@ public class HwSceneServiceImpl implements IHwSceneService * @return 场景信息 */ @Override - public List selectHwSceneList(HwScene hwScene) - { - return hwSceneMapper.selectHwSceneList(hwScene); + public List selectHwSceneList(HwScene hwScene) { +// LoginUser loginUser = SecurityUtils.getLoginUser(); +// SysUser sysUser = loginUser.getSysUser(); +// Long tenantId = sysUser.getTenantId(); + Long tenantId = 1L; + if (tenantId != 0L) {//如果不是金瑞铭,则只能返回租户自己的场景 + hwScene.setTenantId(tenantId); + } + List scenes = hwSceneMapper.selectHwSceneList(hwScene); + boolean defaultFlag = false; + for (HwScene scene : scenes) { + if (defaultFlag) { + scene.setDefaultFlag(HwDictConstants.DEVICE_DEFAULT_FLAG_NO); + } else { + if (scene.getDefaultFlag().equalsIgnoreCase(HwDictConstants.DEVICE_DEFAULT_FLAG_YES)) { + defaultFlag = true; + } + } + } + return scenes; } @Override @@ -89,10 +94,9 @@ public class HwSceneServiceImpl implements IHwSceneService * @return 结果 */ @Override - public int insertHwScene(HwScene hwScene) - { - if(hwScene.getDefaultFlag() == "1"){ - hwSceneMapper.updateDefaultFlag(hwScene.getTenantId()); + public int insertHwScene(HwScene hwScene) { + if (hwScene.getDefaultFlag() == "1") { + hwSceneMapper.updateDefaultFlag(hwScene.getTenantId()); } hwScene.setDefaultFlag("1"); LoginUser loginUser = SecurityUtils.getLoginUser(); @@ -102,20 +106,20 @@ public class HwSceneServiceImpl implements IHwSceneService hwScene.setSceneId(lon); hwScene.setCreateBy(sysUser.getNickName()); - if (hwScene.getPreserveTime()==null){ + if (hwScene.getPreserveTime() == null) { hwScene.setPreserveTime(new BigDecimal(90)); } - if (hwScene.getTestPreserveTime()==null){ + if (hwScene.getTestPreserveTime() == null) { hwScene.setTestPreserveTime(new BigDecimal(30)); } String randomKey = RandomStringUtils.random(12, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ123456789"); - String randomSecret = RandomStringUtils.random(16,"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ123456789"); + String randomSecret = RandomStringUtils.random(16, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ123456789"); hwScene.setModeKey(randomKey); hwScene.setModeSecret(randomSecret); hwScene.setCreateTime(DateUtils.getNowDate()); List list = new ArrayList(); list.add(hwScene); - redisService.setCacheList(hwScene.getSceneId()+"",list); + redisService.setCacheList(hwScene.getSceneId() + "", list); return hwSceneMapper.insertHwScene(hwScene); } @@ -127,16 +131,15 @@ public class HwSceneServiceImpl implements IHwSceneService * @return 结果 */ @Override - public int updateHwScene(HwScene hwScene) - { - if(hwScene.getDefaultFlag() == "1"){ + public int updateHwScene(HwScene hwScene) { + if (hwScene.getDefaultFlag() == "1") { hwSceneMapper.updateDefaultFlag(hwScene.getTenantId()); } hwScene.setDefaultFlag("1"); hwScene.setUpdateTime(DateUtils.getNowDate()); List list = new ArrayList(); list.add(hwScene); - redisService.setCacheList(hwScene.getSceneId()+"",list); + redisService.setCacheList(hwScene.getSceneId() + "", list); return hwSceneMapper.updateHwScene(hwScene); } @@ -147,13 +150,12 @@ public class HwSceneServiceImpl implements IHwSceneService * @return 结果 */ @Override - public int deleteHwSceneBySceneIds(Long[] sceneIds) - { + public int deleteHwSceneBySceneIds(Long[] sceneIds) { List list = new ArrayList<>(); - for (int i = 0; i < sceneIds.length;i++){ + for (int i = 0; i < sceneIds.length; i++) { list.add(sceneIds[i]); } - redisService.deleteObject(sceneIds+""); + redisService.deleteObject(sceneIds + ""); return hwSceneMapper.deleteHwSceneBySceneIds(sceneIds); } @@ -164,9 +166,8 @@ public class HwSceneServiceImpl implements IHwSceneService * @return 结果 */ @Override - public int deleteHwSceneBySceneId(Long sceneId) - { - redisService.deleteObject(sceneId+""); + public int deleteHwSceneBySceneId(Long sceneId) { + redisService.deleteObject(sceneId + ""); return hwSceneMapper.deleteHwSceneBySceneId(sceneId); } } diff --git a/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwAlarmInfoMapper.xml b/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwAlarmInfoMapper.xml new file mode 100644 index 0000000..43a69d5 --- /dev/null +++ b/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwAlarmInfoMapper.xml @@ -0,0 +1,168 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select hai.alarm_info_id, hai.alarm_info_type, hai.alarm_releated_id, hai.device_id, + hai.monitor_unit_id, hai.tenant_id, hai.scene_id, hai.alarm_level_id, + hai.alarm_type_id, hai.mode_function_id, hai.function_name, hai.function_identifier, + hai.function_value, hai.trigger_status, hai.handle_status, hai.alarm_time, + hai.create_time, hai.update_by, hai.update_time, hai.alarm_info_field, + hmu.monitor_unit_name,hal.alarm_level_name,hat.alarm_type_name + from hw_alarm_info hai left join hw_monitor_unit hmu on hai.monitor_unit_id = hmu.monitor_unit_id + left join hw_alarm_level hal on hai.alarm_level_id=hal.alarm_level_id + left join hw_alarm_type hat on hai.alarm_type_id=hat.alarm_type_id + + + + + + + + insert into hw_alarm_info + + alarm_info_type, + alarm_releated_id, + device_id, + monitor_unit_id, + tenant_id, + scene_id, + alarm_level_id, + alarm_type_id, + mode_function_id, + function_name, + function_identifier, + function_value, + trigger_status, + handle_status, + alarm_time, + create_time, + update_by, + update_time, + alarm_info_field, + + + #{alarmInfoType}, + #{alarmReleatedId}, + #{deviceId}, + #{monitorUnitId}, + #{tenantId}, + #{sceneId}, + #{alarmLevelId}, + #{alarmTypeId}, + #{modeFunctionId}, + #{functionName}, + #{functionIdentifier}, + #{functionValue}, + #{triggerStatus}, + #{handleStatus}, + #{alarmTime}, + #{createTime}, + #{updateBy}, + #{updateTime}, + #{alarmInfoField}, + + + + + update hw_alarm_info + + alarm_info_type = #{alarmInfoType}, + alarm_releated_id = #{alarmReleatedId}, + device_id = #{deviceId}, + monitor_unit_id = #{monitorUnitId}, + tenant_id = #{tenantId}, + scene_id = #{sceneId}, + alarm_level_id = #{alarmLevelId}, + alarm_type_id = #{alarmTypeId}, + mode_function_id = #{modeFunctionId}, + function_name = #{functionName}, + function_identifier = #{functionIdentifier}, + function_value = #{functionValue}, + trigger_status = #{triggerStatus}, + handle_status = #{handleStatus}, + alarm_time = #{alarmTime}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + alarm_info_field = #{alarmInfoField}, + + where alarm_info_id = #{alarmInfoId} + + + + delete from hw_alarm_info where alarm_info_id = #{alarmInfoId} + + + + delete from hw_alarm_info where alarm_info_id in + + #{alarmInfoId} + + + + + + + \ No newline at end of file diff --git a/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwAlarmLevelMapper.xml b/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwAlarmLevelMapper.xml new file mode 100644 index 0000000..8f7ccd7 --- /dev/null +++ b/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwAlarmLevelMapper.xml @@ -0,0 +1,116 @@ + + + + + + + + + + + + + + + + + + + + + + + + select alarm_level_id, alarm_level_name, tenant_id, scene_id, language_code, common_flag, level_number, level_status, default_notify_mode, remark, create_by, create_time, update_by, update_time, alarm_level_field from hw_alarm_level + + + + + + + + insert into hw_alarm_level + + alarm_level_name, + tenant_id, + scene_id, + language_code, + common_flag, + level_number, + level_status, + default_notify_mode, + remark, + create_by, + create_time, + update_by, + update_time, + alarm_level_field, + + + #{alarmLevelName}, + #{tenantId}, + #{sceneId}, + #{languageCode}, + #{commonFlag}, + #{levelNumber}, + #{levelStatus}, + #{defaultNotifyMode}, + #{remark}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + #{alarmLevelField}, + + + + + update hw_alarm_level + + alarm_level_name = #{alarmLevelName}, + tenant_id = #{tenantId}, + scene_id = #{sceneId}, + language_code = #{languageCode}, + common_flag = #{commonFlag}, + level_number = #{levelNumber}, + level_status = #{levelStatus}, + default_notify_mode = #{defaultNotifyMode}, + remark = #{remark}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + alarm_level_field = #{alarmLevelField}, + + where alarm_level_id = #{alarmLevelId} + + + + delete from hw_alarm_level where alarm_level_id = #{alarmLevelId} + + + + delete from hw_alarm_level where alarm_level_id in + + #{alarmLevelId} + + + \ No newline at end of file diff --git a/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwAlarmRuleMapper.xml b/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwAlarmRuleMapper.xml new file mode 100644 index 0000000..5982648 --- /dev/null +++ b/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwAlarmRuleMapper.xml @@ -0,0 +1,196 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select alarm_rule_id, alarm_rule_name, tenant_id, scene_id, alarm_level_id, alarm_type_id, rule_type, device_id, device_mode_id, mode_function_id, trigger_condition, trigger_data_a, trigger_data_b, trigger_deadzone, trigger_number, trigger_time_frame, link_flag, link_type, link_device_id, link_device_function_id, link_device_function_data, alarm_rule_status, alarm_push_flag, alarm_push_content, alarm_recover_content, remark, create_by, create_time, update_by, update_time, alarm_rule_field from hw_alarm_rule + + + + + + + + insert into hw_alarm_rule + + alarm_rule_name, + tenant_id, + scene_id, + alarm_level_id, + alarm_type_id, + rule_type, + device_id, + device_mode_id, + mode_function_id, + trigger_condition, + trigger_data_a, + trigger_data_b, + trigger_deadzone, + trigger_number, + trigger_time_frame, + link_flag, + link_type, + link_device_id, + link_device_function_id, + link_device_function_data, + alarm_rule_status, + alarm_push_flag, + alarm_push_content, + alarm_recover_content, + remark, + create_by, + create_time, + update_by, + update_time, + alarm_rule_field, + + + #{alarmRuleName}, + #{tenantId}, + #{sceneId}, + #{alarmLevelId}, + #{alarmTypeId}, + #{ruleType}, + #{deviceId}, + #{deviceModeId}, + #{modeFunctionId}, + #{triggerCondition}, + #{triggerDataA}, + #{triggerDataB}, + #{triggerDeadzone}, + #{triggerNumber}, + #{triggerTimeFrame}, + #{linkFlag}, + #{linkType}, + #{linkDeviceId}, + #{linkDeviceFunctionId}, + #{linkDeviceFunctionData}, + #{alarmRuleStatus}, + #{alarmPushFlag}, + #{alarmPushContent}, + #{alarmRecoverContent}, + #{remark}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + #{alarmRuleField}, + + + + + update hw_alarm_rule + + alarm_rule_name = #{alarmRuleName}, + tenant_id = #{tenantId}, + scene_id = #{sceneId}, + alarm_level_id = #{alarmLevelId}, + alarm_type_id = #{alarmTypeId}, + rule_type = #{ruleType}, + device_id = #{deviceId}, + device_mode_id = #{deviceModeId}, + mode_function_id = #{modeFunctionId}, + trigger_condition = #{triggerCondition}, + trigger_data_a = #{triggerDataA}, + trigger_data_b = #{triggerDataB}, + trigger_deadzone = #{triggerDeadzone}, + trigger_number = #{triggerNumber}, + trigger_time_frame = #{triggerTimeFrame}, + link_flag = #{linkFlag}, + link_type = #{linkType}, + link_device_id = #{linkDeviceId}, + link_device_function_id = #{linkDeviceFunctionId}, + link_device_function_data = #{linkDeviceFunctionData}, + alarm_rule_status = #{alarmRuleStatus}, + alarm_push_flag = #{alarmPushFlag}, + alarm_push_content = #{alarmPushContent}, + alarm_recover_content = #{alarmRecoverContent}, + remark = #{remark}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + alarm_rule_field = #{alarmRuleField}, + + where alarm_rule_id = #{alarmRuleId} + + + + delete from hw_alarm_rule where alarm_rule_id = #{alarmRuleId} + + + + delete from hw_alarm_rule where alarm_rule_id in + + #{alarmRuleId} + + + \ No newline at end of file diff --git a/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwAlarmTypeMapper.xml b/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwAlarmTypeMapper.xml new file mode 100644 index 0000000..9028571 --- /dev/null +++ b/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwAlarmTypeMapper.xml @@ -0,0 +1,111 @@ + + + + + + + + + + + + + + + + + + + + + + + select alarm_type_id, alarm_type_name, tenant_id, scene_id, language_code, common_flag, handle_mode, type_status, remark, create_by, create_time, update_by, update_time, alarm_type_field from hw_alarm_type + + + + + + + + insert into hw_alarm_type + + alarm_type_name, + tenant_id, + scene_id, + language_code, + common_flag, + handle_mode, + type_status, + remark, + create_by, + create_time, + update_by, + update_time, + alarm_type_field, + + + #{alarmTypeName}, + #{tenantId}, + #{sceneId}, + #{languageCode}, + #{commonFlag}, + #{handleMode}, + #{typeStatus}, + #{remark}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + #{alarmTypeField}, + + + + + update hw_alarm_type + + alarm_type_name = #{alarmTypeName}, + tenant_id = #{tenantId}, + scene_id = #{sceneId}, + language_code = #{languageCode}, + common_flag = #{commonFlag}, + handle_mode = #{handleMode}, + type_status = #{typeStatus}, + remark = #{remark}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + alarm_type_field = #{alarmTypeField}, + + where alarm_type_id = #{alarmTypeId} + + + + delete from hw_alarm_type where alarm_type_id = #{alarmTypeId} + + + + delete from hw_alarm_type where alarm_type_id in + + #{alarmTypeId} + + + \ No newline at end of file diff --git a/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwDeviceMapper.xml b/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwDeviceMapper.xml index 0dee03a..3072448 100644 --- a/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwDeviceMapper.xml +++ b/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwDeviceMapper.xml @@ -34,6 +34,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + @@ -219,4 +220,26 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{deviceId} + + + + + select hd.device_code,hd.device_name, hd.device_status,hd.online_status, hd.device_pic,hd.active_time, + hmu.monitor_unit_name + from hw_device hd left join hw_monitor_unit hmu on hd.monitor_unit_id = hmu.monitor_unit_id + + + + + \ No newline at end of file diff --git a/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwElectronicFenceMapper.xml b/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwElectronicFenceMapper.xml index 723e9cb..d5abd95 100644 --- a/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwElectronicFenceMapper.xml +++ b/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwElectronicFenceMapper.xml @@ -32,6 +32,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + + + + + + + + + select electronic_fence_id, electronic_fence_name, scene_id, fence_type, effective_time_flag, time_zone, effective_time, trigger_status, area_shape_flag, area_range, fence_push_flag, fence_push_content, fence_recover_content, remark, create_by, create_time, update_by, update_time, fence_field from hw_electronic_fence @@ -130,9 +140,12 @@ GROUP BY - + select a.electronic_fence_id, a.electronic_fence_name, a.scene_id, a.fence_type, a.effective_time_flag, a.time_zone, a.effective_time, a.trigger_status, a.area_shape_flag, a.area_range, a.fence_push_flag, a.fence_push_content, a.fence_recover_content, a.remark, a.create_by, a.create_time, a.update_by, a.update_time, a.fence_field, + b.electronic_fence_id as sub_electronic_fence_id, b.target_type as sub_target_type, b.target_id as sub_target_id + from hw_electronic_fence a + left join hw_fence_target b on b.electronic_fence_id = a.electronic_fence_id + where a.electronic_fence_id = #{electronicFenceId} @@ -214,4 +227,25 @@ GROUP BY #{electronicFenceId} + + + + + + + + + + diff --git a/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwMonitorUnitMapper.xml b/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwMonitorUnitMapper.xml index 33d5e7e..67aa83a 100644 --- a/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwMonitorUnitMapper.xml +++ b/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwMonitorUnitMapper.xml @@ -1,7 +1,7 @@ + PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> @@ -20,6 +20,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + @@ -59,18 +60,27 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" select monitor_unit_id, monitor_unit_name, scene_id, parent_id, monitor_unit_type_id, area_id, monitor_address, monitor_pic, preserve_time, remark, monitor_unit_status, create_by, create_time, update_by, update_time, monitor_unit_field from hw_monitor_unit + + + select hmu.monitor_unit_id, hmu.monitor_unit_name, hmu.scene_id, hmu.parent_id, + hmu.monitor_unit_type_id, hmu.area_id, hmu.monitor_address, hmu.monitor_pic, + hmu.preserve_time, hmu.monitor_unit_status, hc.scene_name + from hw_monitor_unit hmu left join hw_scene hc on hmu.scene_id = hc.scene_id + + + select scene_id,count(*) as sub_sum from - (select monitor_unit_id,scene_id from hw_monitor_unit - where monitor_unit_id not in (select parent_id from hw_monitor_unit where parent_id is not null))as temp + (select monitor_unit_id,scene_id from hw_monitor_unit + where monitor_unit_id not in (select parent_id from hw_monitor_unit where parent_id is not null))as temp GROUP BY scene_id - - select count(*)from hw_monitor_unit - where monitor_unit_id not in (select parent_id from hw_monitor_unit where parent_id is not null) + select count(*)from hw_monitor_unit + where monitor_unit_id not in (select parent_id from hw_monitor_unit where parent_id is not null) + and scene_id = #{sceneId} - select count(*) as sum from hw_device -where device_status = '1' + where device_status = '1' + and scene_id = #{sceneId} - + - + - + - + select scene_id,scene_name from hw_scene - + - + - + - + - + + select count(*) from hw_device where monitor_unit_id = (select target_id from hw_fence_target where target_type='2' and electronic_fence_id = #{electronicFenceId}) + insert into hw_monitor_unit @@ -199,7 +211,7 @@ select count(*) from hw_device where monitor_unit_id = (select target_id from hw update_by, update_time, monitor_unit_field, - + #{monitorUnitName}, #{sceneId}, @@ -216,7 +228,7 @@ select count(*) from hw_device where monitor_unit_id = (select target_id from hw #{updateBy}, #{updateTime}, #{monitorUnitField}, - + @@ -251,4 +263,23 @@ select count(*) from hw_device where monitor_unit_id = (select target_id from hw #{monitorUnitId} - + + + + + \ No newline at end of file diff --git a/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwSceneMapper.xml b/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwSceneMapper.xml index 42593fa..4e42444 100644 --- a/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwSceneMapper.xml +++ b/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwSceneMapper.xml @@ -88,6 +88,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and scene_environment = #{sceneEnvironment} and scene_field = #{sceneField} + order by scene_id desc select last(*) from #{databaseName}.#{tableName} @@ -217,10 +217,30 @@ + 也可以用select last_row()--> @@ -228,21 +248,21 @@ SELECT * FROM #{databaseName}.#{tableName} - ${firstFieldName} BETWEEN #{startTime} AND #{endTime} + startTime!= 0 "> + and ${firstFieldName} >= #{startTime} + + + and ${firstFieldName} <= #{endTime} - order by ${orderByFieldName} ${sort} - - - - + LIMIT #{offset},#{limit} diff --git a/ruoyi-modules/hw-websocket-server/src/main/java/com/hw/websocket/controller/WebSocketApi.java b/ruoyi-modules/hw-websocket-server/src/main/java/com/hw/websocket/controller/WebSocketApi.java index 780a025..45818b7 100644 --- a/ruoyi-modules/hw-websocket-server/src/main/java/com/hw/websocket/controller/WebSocketApi.java +++ b/ruoyi-modules/hw-websocket-server/src/main/java/com/hw/websocket/controller/WebSocketApi.java @@ -2,7 +2,9 @@ package com.hw.websocket.controller; import com.alibaba.fastjson2.JSONObject; import com.hw.websocket.operate.WebSocket; +import com.ruoyi.common.core.utils.StringUtils; import com.ruoyi.common.core.utils.uuid.UUID; +import com.ruoyi.common.core.web.domain.AjaxResult; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -23,17 +25,24 @@ import javax.annotation.Resource; @RequestMapping("/webSocketApi") public class WebSocketApi { - private Logger logger = LoggerFactory.getLogger(WebSocketApi.class); + private final Logger logger = LoggerFactory.getLogger(WebSocketApi.class); @Resource private WebSocket webSocket; @PostMapping() @ResponseBody - public void push(String message){ + public AjaxResult push(String message){ try{ + if(StringUtils.isEmpty(message)){ + logger.info("WebSocket Api接收数据为空"); + return AjaxResult.error("参数不允许为空"); + } + logger.info("WebSocket Api接收数据:"+message); webSocket.sendAllMessage(message); + return AjaxResult.success(); }catch (Exception ex){ logger.error("WebSocket Api接口异常:"+ex.getMessage()); + return AjaxResult.error(ex.getMessage()); } } } diff --git a/ruoyi-modules/hw-websocket-server/src/main/java/com/hw/websocket/operate/WebSocket.java b/ruoyi-modules/hw-websocket-server/src/main/java/com/hw/websocket/operate/WebSocket.java index eb8e8ac..6ce6b83 100644 --- a/ruoyi-modules/hw-websocket-server/src/main/java/com/hw/websocket/operate/WebSocket.java +++ b/ruoyi-modules/hw-websocket-server/src/main/java/com/hw/websocket/operate/WebSocket.java @@ -20,7 +20,7 @@ import java.util.concurrent.CopyOnWriteArraySet; @ServerEndpoint("/websocket/{userId}") // 接口路径 ws://localhost:8087/webSocket/userId; public class WebSocket { - private Logger logger = LoggerFactory.getLogger(WebSocket.class); + private final Logger logger = LoggerFactory.getLogger(WebSocket.class); //与某个客户端的连接会话,需要通过它来给客户端发送数据 private Session session; diff --git a/ruoyi-modules/hw-websocket-server/src/main/resources/application.yml b/ruoyi-modules/hw-websocket-server/src/main/resources/application.yml index 7e8b233..e7adb8c 100644 --- a/ruoyi-modules/hw-websocket-server/src/main/resources/application.yml +++ b/ruoyi-modules/hw-websocket-server/src/main/resources/application.yml @@ -5,21 +5,21 @@ server: # Spring spring: application: - # ???? + # 应用名称 name: hw-websocket profiles: - # ???? + # 环境配置 active: dev cloud: nacos: discovery: - # ?????? + # 服务注册地址 server-addr: localhost:8848 config: - # ?????? + # 配置中心地址 server-addr: localhost:8848 - # ?????? + # 配置文件格式 file-extension: yml - # ???? + # 共享配置 shared-configs: - application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}