diff --git a/.idea/hik_push.iml b/.idea/hik_push.iml
index 7c232c8..630e264 100644
--- a/.idea/hik_push.iml
+++ b/.idea/hik_push.iml
@@ -2,7 +2,7 @@
-
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
index 5812083..f87a049 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -3,5 +3,5 @@
-
+
\ No newline at end of file
diff --git a/config.yaml b/config.yaml
index 8fe1a01..3b1c515 100644
--- a/config.yaml
+++ b/config.yaml
@@ -1,154 +1,270 @@
# 推送 api 地址
-push_url: http://192.168.1.233:8080/batch_msg
+push_url: http://192.168.20.115:8000/ipaasuat/engine_company/anycross/trigger/callback/MmRhZTE4OTRiYjVkZDQ5YWNmOGRmZDI0NjQ1MTBlODUw
# 推送用户表
user_ids:
all:
- - 1645
- - 2088
- - 2110
+ - id: "1645"
+ level: 3
+ - id: "2088"
+ level: 3
+ - id: "2110"
+ level: 1
T2变电所:
- - 1815
- - 1899
- - 1926
- - 2097
+ - id: "1815"
+ level: 1
+ - id: "1899"
+ level: 3
+ - id: "1926"
+ level: 2
+ - id: "2097"
+ level: 2
A区北油库:
- - 5791
- - 35393
- - 26292
+ - id: "5791"
+ level: 1
+ - id: "35393"
+ level: 2
+ - id: "26292"
+ level: 1
B区西~油库:
- - 1823
- - 2164
- - 2166
- - 30024
- - 2078
+ - id: "1823"
+ level: 1
+ - id: "2164"
+ level: 1
+ - id: "2166"
+ level: 2
+ - id: "30024"
+ level: 2
+ - id: "2078"
+ level: 1
二厂平台~东:
- - 1815
- - 1899
- - 1926
- - 2097
+ - id: "1815"
+ level: 1
+ - id: "1899"
+ level: 3
+ - id: "1926"
+ level: 2
+ - id: "2097"
+ level: 2
T1变电所:
- - 1815
- - 1899
- - 1926
- - 2097
+ - id: "1815"
+ level: 1
+ - id: "1899"
+ level: 3
+ - id: "1926"
+ level: 2
+ - id: "2097"
+ level: 2
A区南~油库:
- - 2043
- - 29246
- - 2090
+ - id: "2043"
+ level: 1
+ - id: "29246"
+ level: 2
+ - id: "2090"
+ level: 1
T3变电所:
- - 1815
- - 1899
- - 1926
- - 2097
+ - id: "1815"
+ level: 1
+ - id: "1899"
+ level: 3
+ - id: "1926"
+ level: 2
+ - id: "2097"
+ level: 2
T11变电所:
- - 1815
- - 1899
- - 1926
- - 2097
+ - id: "1815"
+ level: 1
+ - id: "1899"
+ level: 3
+ - id: "1926"
+ level: 2
+ - id: "2097"
+ level: 2
二厂平台~西:
- - 1815
- - 1899
- - 1926
- - 2097
+ - id: "1815"
+ level: 1
+ - id: "1899"
+ level: 3
+ - id: "1926"
+ level: 2
+ - id: "2097"
+ level: 2
二厂平台~中01:
- - 1815
- - 1899
- - 1926
- - 2097
+ - id: "1815"
+ level: 1
+ - id: "1899"
+ level: 3
+ - id: "1926"
+ level: 2
+ - id: "2097"
+ level: 2
二厂平台~中02:
- - 1815
- - 1899
- - 1926
- - 2097
+ - id: "1815"
+ level: 1
+ - id: "1899"
+ level: 3
+ - id: "1926"
+ level: 2
+ - id: "2097"
+ level: 2
T9变压器:
- - 1815
- - 1899
- - 1926
- - 2097
+ - id: "1815"
+ level: 1
+ - id: "1899"
+ level: 3
+ - id: "1926"
+ level: 2
+ - id: "2097"
+ level: 2
T6变压器:
- - 1815
- - 1899
- - 1926
- - 2097
+ - id: "1815"
+ level: 1
+ - id: "1899"
+ level: 3
+ - id: "1926"
+ level: 2
+ - id: "2097"
+ level: 2
B区西~油库(测温):
- - 1823
- - 2164
- - 2166
- - 30024
- - 2078
+ - id: "1823"
+ level: 1
+ - id: "2164"
+ level: 1
+ - id: "2166"
+ level: 2
+ - id: "30024"
+ level: 2
+ - id: "2078"
+ level: 1
T2变电所 (测温):
- - 1815
- - 1899
- - 1926
- - 2097
+ - id: "1815"
+ level: 1
+ - id: "1899"
+ level: 3
+ - id: "1926"
+ level: 2
+ - id: "2097"
+ level: 2
二厂平台~西(测温):
- - 1815
- - 1899
- - 1926
- - 2097
+ - id: "1815"
+ level: 1
+ - id: "1899"
+ level: 3
+ - id: "1926"
+ level: 2
+ - id: "2097"
+ level: 2
二厂平台~中01(测温):
- - 1815
- - 1899
- - 1926
- - 2097
+ - id: "1815"
+ level: 1
+ - id: "1899"
+ level: 3
+ - id: "1926"
+ level: 2
+ - id: "2097"
+ level: 2
T1变电所(测温):
- - 1815
- - 1899
- - 1926
- - 2097
+ - id: "1815"
+ level: 1
+ - id: "1899"
+ level: 3
+ - id: "1926"
+ level: 2
+ - id: "2097"
+ level: 2
二厂平台~东(测温):
- - 1815
- - 1899
- - 1926
- - 2097
+ - id: "1815"
+ level: 1
+ - id: "1899"
+ level: 3
+ - id: "1926"
+ level: 2
+ - id: "2097"
+ level: 2
二厂平台~中02(测温):
- - 1815
- - 1899
- - 1926
- - 2097
+ - id: "1815"
+ level: 1
+ - id: "1899"
+ level: 3
+ - id: "1926"
+ level: 2
+ - id: "2097"
+ level: 2
T3变电所(测温):
- - 1815
- - 1899
- - 1926
- - 2097
+ - id: "1815"
+ level: 1
+ - id: "1899"
+ level: 3
+ - id: "1926"
+ level: 2
+ - id: "2097"
+ level: 2
T11变电所(测温):
- - 1815
- - 1899
- - 1926
- - 2097
+ - id: "1815"
+ level: 1
+ - id: "1899"
+ level: 3
+ - id: "1926"
+ level: 2
+ - id: "2097"
+ level: 2
A区南~油库(测温):
- - 2043
- - 29246
- - 2090
+ - id: "2043"
+ level: 1
+ - id: "29246"
+ level: 2
+ - id: "2090"
+ level: 1
T9变压器(测温):
- - 1815
- - 1899
- - 1926
- - 2097
+ - id: "1815"
+ level: 1
+ - id: "1899"
+ level: 3
+ - id: "1926"
+ level: 2
+ - id: "2097"
+ level: 2
T6变压器(测温):
- - 1815
- - 1899
- - 1926
- - 2097
+ - id: "1815"
+ level: 1
+ - id: "1899"
+ level: 3
+ - id: "1926"
+ level: 2
+ - id: "2097"
+ level: 2
A区北油库(测温):
- - 5791
- - 35393
- - 26292
+ - id: "5791"
+ level: 1
+ - id: "35393"
+ level: 2
+ - id: "26292"
+ level: 1
A区_北油库_气体探测器:
- - 5791
- - 35393
- - 26292
+ - id: "5791"
+ level: 1
+ - id: "35393"
+ level: 2
+ - id: "26292"
+ level: 1
A区_南油库_气体探测器:
- - 2043
- - 29246
- - 2090
+ - id: "2043"
+ level: 1
+ - id: "29246"
+ level: 2
+ - id: "2090"
+ level: 1
B区油库_气体探测器:
- - 1823
- - 2164
- - 2166
- - 30024
- - 2078
+ - id: "1823"
+ level: 1
+ - id: "2164"
+ level: 1
+ - id: "2166"
+ level: 2
+ - id: "30024"
+ level: 2
+ - id: "2078"
+ level: 1
# srcIndex 与设备名称 map
devices:
@@ -246,107 +362,107 @@ event_type:
# 用户姓名部门科室
user_info:
- 1645:
+ "1645":
name: 项贤忠
work_no: GF20030242
depart: 安环机动部
section:
- 2088:
+ "2088":
name: 宫春月
work_no: GF20020113
depart: 安环机动部
section: 安全环保管理业务
- 2110:
+ "2110":
name: 程秋生
work_no: GF20061051
depart: 安环机动部
section: 安全环保管理业务
- 1815:
+ "1815":
name: 刘方
work_no: GF20060059
depart: 安环机动部
section: 设备能源管理业务
- 1899:
+ "1899":
name: 何国飞
work_no: GF20082111
depart: 安环机动部
section: 设备能源管理业务
- 1926:
+ "1926":
name: 朱江潮
work_no: GF19920032
depart: 安环机动部
section: 设备能源管理业务
- 2097:
+ "2097":
name: 董海波
work_no: GF20072117
depart: 安环机动部
section: 设备能源管理业务
- 1823:
+ "1823":
name: 朱政荣
work_no: GF20060063
depart: 动力二厂
section: 装调车间
- 2164:
+ "2164":
name: 罗运保
work_no: GF20082137
depart: 动力二厂
section: 装调车间
- 2166:
+ "2166":
name: 王军
work_no: GF20082149
depart: 动力二厂
section: 装调车间
- 30024:
+ "30024":
name: 王金宝
work_no: GF20160011
depart: 动力二厂
section: 装调车间
- 2078:
+ "2078":
name: 陈飞
work_no: GF20072258
depart: 动力二厂
section: 专业管理
- 2043:
+ "2043":
name: 赵东翔
work_no: GF20115183
depart: 动力一厂
section: 装调一车间
- 29246:
+ "29246":
name: 莫磊磊
work_no: GF20140817
depart: 动力一厂
section: 装调一车间
- 2090:
+ "2090":
name: 陶新
work_no: GF20082084
depart: 动力一厂
section: 装调一车间
- 5791:
+ "5791":
name: 陈健
work_no: GF20050025
depart: 动力一厂
section: 装调二车间
- 35393:
+ "35393":
name: 范永辉
work_no: GF20161338
depart: 动力一厂
section: 装调二车间
- 26292:
+ "26292":
name: 杨晨
work_no: GF20140093
depart: 动力一厂
section: 装调二车间
- 2152:
+ "2152":
name: 鲁新峰
work_no: GF20030639
depart: 动力一厂
section:
- 2050:
+ "2050":
name: 李建民
work_no: GF20030097
depart: 动力一厂
section:
- 24857:
+ "24857":
name: 李建民
work_no: GF20090716
depart: 动力一厂
diff --git a/event.json b/event.json
index a9fd3cb..8f425b7 100644
--- a/event.json
+++ b/event.json
@@ -1,55 +1,58 @@
{
- "eventId": "BE26E09F-0C6C-4EF9-BE2B-27007B261731",
- "eventType": "区域入侵",
- "deviceName": "A区北油料库",
- "eventLvl": 1,
- "userIds": [
- "gdsdfs"
- ],
- "happenTime": "2019-01-02T15:17:24.000+08:00",
- "srcIndex": "da107dd1989e44978a5efebe73d6e979",
- "srcName": "-",
- "srcType": "camera",
- "status": 0,
- "timeout": 0,
- "data": {
- "channelName": "A区北油料库",
- "dataType": "behavioralAnalysis",
- "recvTime": "2017-04-22T15:39:01+08:00",
- "sendTime": "2017-04-22T15:39:01+08:00",
- "dateTime": "2017-04-22T15:39:01+08:00",
- "ipAddress": "10.19.134.11",
- "portNo": 80,
- "channelID": 1,
- "eventType": "fielddetection",
- "eventDescription": "fielddetection",
- "_detectionResult": [
- {
- "imageUrl": "http://10.3.1.12:8080/xxx",
- "targetAttrs": {
- "imageServerCode": "3212234",
- "deviceIndexCode": "1568556",
- "cameraIndexCode": "1235415",
- "channelName": "tongdao1",
- "cameraAddress": "杭州市西兴",
- "longitude": 116.39737,
- "latitude": 116.39737
- },
- "duration": 120,
- "sensitivityLevel": 20,
- "rate": 30,
- "detectionTarget": 1,
- "regionCoordinatesList": [
- {
- "positionX": 0.901,
- "positionY": 0.536
- },
- {
- "positionX": 0.901,
- "positionY": 0.536
- }
- ]
- }
- ]
+ "eventId": "BE26E09F-0C6C-4EF9-BE2B-27007B261731",
+ "eventType": "区域入侵",
+ "deviceName": "A区北油料库",
+ "eventLvl": 1,
+ "userIds": [
+ {
+ "id": "4314",
+ "level": 1
}
+ ],
+ "happenTime": "2019-01-02T15:17:24.000+08:00",
+ "srcIndex": "da107dd1989e44978a5efebe73d6e979",
+ "srcName": "-",
+ "srcType": "camera",
+ "status": 0,
+ "timeout": 0,
+ "data": {
+ "channelName": "A区北油料库",
+ "dataType": "behavioralAnalysis",
+ "recvTime": "2017-04-22T15:39:01+08:00",
+ "sendTime": "2017-04-22T15:39:01+08:00",
+ "dateTime": "2017-04-22T15:39:01+08:00",
+ "ipAddress": "10.19.134.11",
+ "portNo": 80,
+ "channelID": 1,
+ "eventType": "fielddetection",
+ "eventDescription": "fielddetection",
+ "_detectionResult": [
+ {
+ "imageUrl": "http://192.168.11.180:8080/xxx",
+ "targetAttrs": {
+ "imageServerCode": "3212234",
+ "deviceIndexCode": "1568556",
+ "cameraIndexCode": "1235415",
+ "channelName": "tongdao1",
+ "cameraAddress": "杭州市西兴",
+ "longitude": 116.39737,
+ "latitude": 116.39737
+ },
+ "duration": 120,
+ "sensitivityLevel": 20,
+ "rate": 30,
+ "detectionTarget": 1,
+ "regionCoordinatesList": [
+ {
+ "positionX": 0.901,
+ "positionY": 0.536
+ },
+ {
+ "positionX": 0.901,
+ "positionY": 0.536
+ }
+ ]
+ }
+ ]
+ }
}
\ No newline at end of file
diff --git a/hik_push/read_event.py b/hik_push/read_event.py
index 68ff065..81c85c6 100644
--- a/hik_push/read_event.py
+++ b/hik_push/read_event.py
@@ -65,6 +65,7 @@ async def read_event():
if detection_field_name in event_detail['data']:
event_detail['data']["_detectionResult"] = event_detail['data'].pop(
detection_field_name)
+ replace_image_host(event_detail['data']["_detectionResult"])
logging.info(event_detail)
try:
push_resp = requests.post(push_url, json=event_detail).content.decode('utf-8')
@@ -93,6 +94,7 @@ async def read_event():
detection_field_name = event['data']['eventType']
if detection_field_name in event['data']:
event['data']["_detectionResult"] = event['data'].pop(detection_field_name)
+ replace_image_host(event['data']["_detectionResult"])
# 请求推送 api
logging.info(event)
try:
@@ -108,6 +110,13 @@ async def read_event():
await asyncio.sleep(0.5)
+def replace_image_host(detection_data):
+ if "imageUrl" in detection_data:
+ detection_data["imageUrl"] = detection_data["imageUrl"].replace("192.168.1.250", "192.168.11.180")
+ if "visiblePicUrl" in detection_data:
+ detection_data["visiblePicUrl"] = detection_data["visiblePicUrl"].replace("192.168.1.250", "192.168.11.180")
+
+
def run_app():
asyncio.run(read_event())
diff --git a/pyproject.toml b/pyproject.toml
index 286d1f7..019a489 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,6 +1,6 @@
[tool.poetry]
name = "hik-push"
-version = "0.3.1"
+version = "0.3.2"
description = ""
authors = ["quantulr <35954003+quantulr@users.noreply.github.com>"]
readme = "README.md"