update
This commit is contained in:
2
.idea/hik_push.iml
generated
2
.idea/hik_push.iml
generated
@ -2,7 +2,7 @@
|
|||||||
<module type="PYTHON_MODULE" version="4">
|
<module type="PYTHON_MODULE" version="4">
|
||||||
<component name="NewModuleRootManager">
|
<component name="NewModuleRootManager">
|
||||||
<content url="file://$MODULE_DIR$" />
|
<content url="file://$MODULE_DIR$" />
|
||||||
<orderEntry type="inheritedJdk" />
|
<orderEntry type="jdk" jdkName="Poetry (hik_push) (2)" jdkType="Python SDK" />
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
</component>
|
</component>
|
||||||
</module>
|
</module>
|
2
.idea/misc.xml
generated
2
.idea/misc.xml
generated
@ -3,5 +3,5 @@
|
|||||||
<component name="Black">
|
<component name="Black">
|
||||||
<option name="sdkName" value="Poetry (hik_push)" />
|
<option name="sdkName" value="Poetry (hik_push)" />
|
||||||
</component>
|
</component>
|
||||||
<component name="ProjectRootManager" version="2" project-jdk-name="Poetry (hik_push)" project-jdk-type="Python SDK" />
|
<component name="ProjectRootManager" version="2" project-jdk-name="Poetry (hik_push) (2)" project-jdk-type="Python SDK" />
|
||||||
</project>
|
</project>
|
364
config.yaml
364
config.yaml
@ -1,39 +1,196 @@
|
|||||||
|
# 推送 api 地址
|
||||||
|
push_url: http://192.168.1.233:8080/batch_msg
|
||||||
|
|
||||||
|
# 推送用户表
|
||||||
user_ids:
|
user_ids:
|
||||||
|
all:
|
||||||
|
- 1645
|
||||||
|
- 2088
|
||||||
|
- 2110
|
||||||
T2变电所:
|
T2变电所:
|
||||||
- g78976das
|
- 1815
|
||||||
A区北油库: []
|
- 1899
|
||||||
|
- 1926
|
||||||
|
- 2097
|
||||||
|
A区北油库:
|
||||||
|
- 5791
|
||||||
|
- 35393
|
||||||
|
- 26292
|
||||||
B区西~油库:
|
B区西~油库:
|
||||||
- fsdf34324
|
- 1823
|
||||||
- dsffee879
|
- 2164
|
||||||
二厂平台~东: []
|
- 2166
|
||||||
T1变电所: []
|
- 30024
|
||||||
|
- 2078
|
||||||
|
二厂平台~东:
|
||||||
|
- 1815
|
||||||
|
- 1899
|
||||||
|
- 1926
|
||||||
|
- 2097
|
||||||
|
T1变电所:
|
||||||
|
- 1815
|
||||||
|
- 1899
|
||||||
|
- 1926
|
||||||
|
- 2097
|
||||||
A区南~油库:
|
A区南~油库:
|
||||||
- ffe348244
|
- 2043
|
||||||
T3变电所: []
|
- 29246
|
||||||
T11变电所: []
|
- 2090
|
||||||
二厂平台~西: []
|
T3变电所:
|
||||||
二厂平台~中01: []
|
- 1815
|
||||||
二厂平台~中02: []
|
- 1899
|
||||||
T9变压器: []
|
- 1926
|
||||||
T6变压器: []
|
- 2097
|
||||||
B区西~油库(测温): []
|
T11变电所:
|
||||||
T2变电所 (测温): []
|
- 1815
|
||||||
二厂平台~西(测温): []
|
- 1899
|
||||||
二厂平台~中01(测温): []
|
- 1926
|
||||||
T1变电所(测温): []
|
- 2097
|
||||||
二厂平台~东(测温): []
|
二厂平台~西:
|
||||||
二厂平台~中02(测温): []
|
- 1815
|
||||||
T3变电所(测温): []
|
- 1899
|
||||||
T11变电所(测温): []
|
- 1926
|
||||||
A区南~油库(测温): []
|
- 2097
|
||||||
T9变压器(测温): []
|
二厂平台~中01:
|
||||||
T6变压器(测温): []
|
- 1815
|
||||||
A区北油库(测温): []
|
- 1899
|
||||||
A区_北油库_气体探测器: []
|
- 1926
|
||||||
A区_南油库_气体探测器: []
|
- 2097
|
||||||
B区油库_气体探测器: []
|
二厂平台~中02:
|
||||||
|
- 1815
|
||||||
|
- 1899
|
||||||
|
- 1926
|
||||||
|
- 2097
|
||||||
|
T9变压器:
|
||||||
|
- 1815
|
||||||
|
- 1899
|
||||||
|
- 1926
|
||||||
|
- 2097
|
||||||
|
T6变压器:
|
||||||
|
- 1815
|
||||||
|
- 1899
|
||||||
|
- 1926
|
||||||
|
- 2097
|
||||||
|
B区西~油库(测温):
|
||||||
|
- 1823
|
||||||
|
- 2164
|
||||||
|
- 2166
|
||||||
|
- 30024
|
||||||
|
- 2078
|
||||||
|
T2变电所 (测温):
|
||||||
|
- 1815
|
||||||
|
- 1899
|
||||||
|
- 1926
|
||||||
|
- 2097
|
||||||
|
二厂平台~西(测温):
|
||||||
|
- 1815
|
||||||
|
- 1899
|
||||||
|
- 1926
|
||||||
|
- 2097
|
||||||
|
二厂平台~中01(测温):
|
||||||
|
- 1815
|
||||||
|
- 1899
|
||||||
|
- 1926
|
||||||
|
- 2097
|
||||||
|
T1变电所(测温):
|
||||||
|
- 1815
|
||||||
|
- 1899
|
||||||
|
- 1926
|
||||||
|
- 2097
|
||||||
|
二厂平台~东(测温):
|
||||||
|
- 1815
|
||||||
|
- 1899
|
||||||
|
- 1926
|
||||||
|
- 2097
|
||||||
|
二厂平台~中02(测温):
|
||||||
|
- 1815
|
||||||
|
- 1899
|
||||||
|
- 1926
|
||||||
|
- 2097
|
||||||
|
T3变电所(测温):
|
||||||
|
- 1815
|
||||||
|
- 1899
|
||||||
|
- 1926
|
||||||
|
- 2097
|
||||||
|
T11变电所(测温):
|
||||||
|
- 1815
|
||||||
|
- 1899
|
||||||
|
- 1926
|
||||||
|
- 2097
|
||||||
|
A区南~油库(测温):
|
||||||
|
- 2043
|
||||||
|
- 29246
|
||||||
|
- 2090
|
||||||
|
T9变压器(测温):
|
||||||
|
- 1815
|
||||||
|
- 1899
|
||||||
|
- 1926
|
||||||
|
- 2097
|
||||||
|
T6变压器(测温):
|
||||||
|
- 1815
|
||||||
|
- 1899
|
||||||
|
- 1926
|
||||||
|
- 2097
|
||||||
|
A区北油库(测温):
|
||||||
|
- 5791
|
||||||
|
- 35393
|
||||||
|
- 26292
|
||||||
|
A区_北油库_气体探测器:
|
||||||
|
- 5791
|
||||||
|
- 35393
|
||||||
|
- 26292
|
||||||
|
A区_南油库_气体探测器:
|
||||||
|
- 2043
|
||||||
|
- 29246
|
||||||
|
- 2090
|
||||||
|
B区油库_气体探测器:
|
||||||
|
- 1823
|
||||||
|
- 2164
|
||||||
|
- 2166
|
||||||
|
- 30024
|
||||||
|
- 2078
|
||||||
|
|
||||||
|
# srcIndex 与设备名称 map
|
||||||
|
devices:
|
||||||
|
f3e4a7ff9123414e8654735a6346c709: T2变电所
|
||||||
|
fbd248070e194ee7a5d19bbebd04b416: A区北油库
|
||||||
|
7b2e3262db0944f6aafb46e92662b5d0: B区西~油库
|
||||||
|
2fea57a3fb0e4b1690a4c3f0ea104e5a: 二厂平台~东
|
||||||
|
3a749d1152ed46c8ae5fb6498c93fd5c: T1变电所
|
||||||
|
326798a515e34beebb192e310a083b6f: A区南~油库
|
||||||
|
60755219aaac48d4b28330557f3195ab: T3变电所
|
||||||
|
f35c4c52e3a14d79bb7550add62e53c1: T11变电所
|
||||||
|
c08f3b8317a743069ac18fc1f9d3dfc3: B区西~油库
|
||||||
|
f56fe78367e5428ea86a0df60c65ce97: T2变电所
|
||||||
|
0f13fc0d975744cc87020ec684ac567f: 二厂平台~西
|
||||||
|
c25ef7b22a014427b81450e9947a4900: 二厂平台~中01
|
||||||
|
5241132804bc4190a9602de3eef52e67: T1变电所
|
||||||
|
6408079965494092aa9098d4c40e5de1: 二厂平台~东
|
||||||
|
98836b3470724ac286bcf13409680cd3: 二厂平台~中02
|
||||||
|
17d6d40adab940d09c31fdc61eddbf0f: T3变电所
|
||||||
|
870bd26f6c8e4d37aa66f055cf948ad2: T11变电所
|
||||||
|
daa37a58d3364f6ab195a7b7f37864f4: A区南~油库
|
||||||
|
ca89140d5deb448888aee8505f36e380: T9变压器
|
||||||
|
b61cc3688e41446f882e4ac17ff9de94: T6变压器
|
||||||
|
96d676184b2c46ddaa58cc1959844649: A区北油库
|
||||||
|
38a57cbc742a4ff7bedf84582ae12ceb: B区西~油库(测温)
|
||||||
|
c9558cebdc7b4bc3afff8e574c9980e5: T2变电所 (测温)
|
||||||
|
6db35c44bd2749d99513e42bf0e807a3: 二厂平台~西(测温)
|
||||||
|
600984a71b104b7f87f04166e6116120: 二厂平台~中01(测温)
|
||||||
|
0167f324d14246dda04dc0d5cadd03d7: T1变电所(测温)
|
||||||
|
6128d2a2ab5746279135c96c79f2561f: 二厂平台~东(测温)
|
||||||
|
cb82b9641aa54011abe92408cae86a3f: 二厂平台~中02(测温)
|
||||||
|
c914de0202544211822fee8ca293b5be: T3变电所(测温)
|
||||||
|
2ecfd396c4d0454f99101d3b3de6e60f: T11变电所(测温)
|
||||||
|
f1e5e56900f847df8b982a6f5046f6ef: A区南~油库(测温
|
||||||
|
4c3504b4122a4edf98befbcc5f8de8f4: T9变压器(测温)
|
||||||
|
210062d2e12d4b56b31a8324b42e8af8: T6变压器(测温)
|
||||||
|
d16a70c6461c407a8f507013c29fce97: A区北油库(测温)
|
||||||
|
4a1057f79b12483288e22d81a2f587f9: A区_北油库_气体探测器
|
||||||
|
c0f9b4d866af46d79d7ddb19c4f4a874: A区_南油库_气体探测器
|
||||||
|
2b6d0f3694854ad393537ececed20704: B区油库_气体探测器
|
||||||
|
|
||||||
|
# 事件类型 map
|
||||||
event_type:
|
event_type:
|
||||||
131329: 视频丢失
|
131329: 视频丢失
|
||||||
131330: 视频遮挡
|
131330: 视频遮挡
|
||||||
@ -87,43 +244,110 @@ event_type:
|
|||||||
422400000: 有人抽烟
|
422400000: 有人抽烟
|
||||||
422400002: 有人抽烟或打电话
|
422400002: 有人抽烟或打电话
|
||||||
|
|
||||||
devices:
|
# 用户姓名部门科室
|
||||||
f3e4a7ff9123414e8654735a6346c709: T2变电所
|
user_info:
|
||||||
fbd248070e194ee7a5d19bbebd04b416: A区北油库
|
1645:
|
||||||
7b2e3262db0944f6aafb46e92662b5d0: B区西~油库
|
name: 项贤忠
|
||||||
2fea57a3fb0e4b1690a4c3f0ea104e5a: 二厂平台~东
|
work_no: GF20030242
|
||||||
3a749d1152ed46c8ae5fb6498c93fd5c: T1变电所
|
depart: 安环机动部
|
||||||
326798a515e34beebb192e310a083b6f: A区南~油库
|
section:
|
||||||
60755219aaac48d4b28330557f3195ab: T3变电所
|
2088:
|
||||||
f35c4c52e3a14d79bb7550add62e53c1: T11变电所
|
name: 宫春月
|
||||||
c08f3b8317a743069ac18fc1f9d3dfc3: B区西~油库
|
work_no: GF20020113
|
||||||
f56fe78367e5428ea86a0df60c65ce97: T2变电所
|
depart: 安环机动部
|
||||||
0f13fc0d975744cc87020ec684ac567f: 二厂平台~西
|
section: 安全环保管理业务
|
||||||
c25ef7b22a014427b81450e9947a4900: 二厂平台~中01
|
2110:
|
||||||
5241132804bc4190a9602de3eef52e67: T1变电所
|
name: 程秋生
|
||||||
6408079965494092aa9098d4c40e5de1: 二厂平台~东
|
work_no: GF20061051
|
||||||
98836b3470724ac286bcf13409680cd3: 二厂平台~中02
|
depart: 安环机动部
|
||||||
17d6d40adab940d09c31fdc61eddbf0f: T3变电所
|
section: 安全环保管理业务
|
||||||
870bd26f6c8e4d37aa66f055cf948ad2: T11变电所
|
1815:
|
||||||
daa37a58d3364f6ab195a7b7f37864f4: A区南~油库
|
name: 刘方
|
||||||
ca89140d5deb448888aee8505f36e380: T9变压器
|
work_no: GF20060059
|
||||||
b61cc3688e41446f882e4ac17ff9de94: T6变压器
|
depart: 安环机动部
|
||||||
96d676184b2c46ddaa58cc1959844649: A区北油库
|
section: 设备能源管理业务
|
||||||
38a57cbc742a4ff7bedf84582ae12ceb: B区西~油库(测温)
|
1899:
|
||||||
c9558cebdc7b4bc3afff8e574c9980e5: T2变电所 (测温)
|
name: 何国飞
|
||||||
6db35c44bd2749d99513e42bf0e807a3: 二厂平台~西(测温)
|
work_no: GF20082111
|
||||||
600984a71b104b7f87f04166e6116120: 二厂平台~中01(测温)
|
depart: 安环机动部
|
||||||
0167f324d14246dda04dc0d5cadd03d7: T1变电所(测温)
|
section: 设备能源管理业务
|
||||||
6128d2a2ab5746279135c96c79f2561f: 二厂平台~东(测温)
|
1926:
|
||||||
cb82b9641aa54011abe92408cae86a3f: 二厂平台~中02(测温)
|
name: 朱江潮
|
||||||
c914de0202544211822fee8ca293b5be: T3变电所(测温)
|
work_no: GF19920032
|
||||||
2ecfd396c4d0454f99101d3b3de6e60f: T11变电所(测温)
|
depart: 安环机动部
|
||||||
f1e5e56900f847df8b982a6f5046f6ef: A区南~油库(测温
|
section: 设备能源管理业务
|
||||||
4c3504b4122a4edf98befbcc5f8de8f4: T9变压器(测温)
|
2097:
|
||||||
210062d2e12d4b56b31a8324b42e8af8: T6变压器(测温)
|
name: 董海波
|
||||||
d16a70c6461c407a8f507013c29fce97: A区北油库(测温
|
work_no: GF20072117
|
||||||
4a1057f79b12483288e22d81a2f587f9: A区_北油库_气体探测器
|
depart: 安环机动部
|
||||||
c0f9b4d866af46d79d7ddb19c4f4a874: A区_南油库_气体探测器
|
section: 设备能源管理业务
|
||||||
2b6d0f3694854ad393537ececed20704: B区油库_气体探测器
|
1823:
|
||||||
|
name: 朱政荣
|
||||||
push_url: http://192.168.1.233:8080/batch_msg
|
work_no: GF20060063
|
||||||
|
depart: 动力二厂
|
||||||
|
section: 装调车间
|
||||||
|
2164:
|
||||||
|
name: 罗运保
|
||||||
|
work_no: GF20082137
|
||||||
|
depart: 动力二厂
|
||||||
|
section: 装调车间
|
||||||
|
2166:
|
||||||
|
name: 王军
|
||||||
|
work_no: GF20082149
|
||||||
|
depart: 动力二厂
|
||||||
|
section: 装调车间
|
||||||
|
30024:
|
||||||
|
name: 王金宝
|
||||||
|
work_no: GF20160011
|
||||||
|
depart: 动力二厂
|
||||||
|
section: 装调车间
|
||||||
|
2078:
|
||||||
|
name: 陈飞
|
||||||
|
work_no: GF20072258
|
||||||
|
depart: 动力二厂
|
||||||
|
section: 专业管理
|
||||||
|
2043:
|
||||||
|
name: 赵东翔
|
||||||
|
work_no: GF20115183
|
||||||
|
depart: 动力一厂
|
||||||
|
section: 装调一车间
|
||||||
|
29246:
|
||||||
|
name: 莫磊磊
|
||||||
|
work_no: GF20140817
|
||||||
|
depart: 动力一厂
|
||||||
|
section: 装调一车间
|
||||||
|
2090:
|
||||||
|
name: 陶新
|
||||||
|
work_no: GF20082084
|
||||||
|
depart: 动力一厂
|
||||||
|
section: 装调一车间
|
||||||
|
5791:
|
||||||
|
name: 陈健
|
||||||
|
work_no: GF20050025
|
||||||
|
depart: 动力一厂
|
||||||
|
section: 装调二车间
|
||||||
|
35393:
|
||||||
|
name: 范永辉
|
||||||
|
work_no: GF20161338
|
||||||
|
depart: 动力一厂
|
||||||
|
section: 装调二车间
|
||||||
|
26292:
|
||||||
|
name: 杨晨
|
||||||
|
work_no: GF20140093
|
||||||
|
depart: 动力一厂
|
||||||
|
section: 装调二车间
|
||||||
|
2152:
|
||||||
|
name: 鲁新峰
|
||||||
|
work_no: GF20030639
|
||||||
|
depart: 动力一厂
|
||||||
|
section:
|
||||||
|
2050:
|
||||||
|
name: 李建民
|
||||||
|
work_no: GF20030097
|
||||||
|
depart: 动力一厂
|
||||||
|
section:
|
||||||
|
24857:
|
||||||
|
name: 李建民
|
||||||
|
work_no: GF20090716
|
||||||
|
depart: 动力一厂
|
||||||
|
section:
|
14
event.json
14
event.json
@ -1,19 +1,19 @@
|
|||||||
{
|
{
|
||||||
"eventId": "BE26E09F-0C6C-4EF9-BE2B-27007B261731",
|
"eventId": "BE26E09F-0C6C-4EF9-BE2B-27007B261731",
|
||||||
"eventType": "区域入侵",
|
"eventType": "区域入侵",
|
||||||
|
"deviceName": "A区北油料库",
|
||||||
"eventLvl": 1,
|
"eventLvl": 1,
|
||||||
"happenTime": "2019-01-02T15:17:24.000+08:00",
|
|
||||||
"srcIndex": "da107dd1989e44978a5efebe73d6e979",
|
|
||||||
"srcName": "浙江杭州",
|
|
||||||
"srcType": "camera",
|
|
||||||
"status": 0,
|
|
||||||
"timeout": 0,
|
|
||||||
"userIds": [
|
"userIds": [
|
||||||
"gdsdfs"
|
"gdsdfs"
|
||||||
],
|
],
|
||||||
|
"happenTime": "2019-01-02T15:17:24.000+08:00",
|
||||||
|
"srcIndex": "da107dd1989e44978a5efebe73d6e979",
|
||||||
|
"srcName": "-",
|
||||||
|
"srcType": "camera",
|
||||||
|
"status": 0,
|
||||||
|
"timeout": 0,
|
||||||
"data": {
|
"data": {
|
||||||
"channelName": "A区北油料库",
|
"channelName": "A区北油料库",
|
||||||
|
|
||||||
"dataType": "behavioralAnalysis",
|
"dataType": "behavioralAnalysis",
|
||||||
"recvTime": "2017-04-22T15:39:01+08:00",
|
"recvTime": "2017-04-22T15:39:01+08:00",
|
||||||
"sendTime": "2017-04-22T15:39:01+08:00",
|
"sendTime": "2017-04-22T15:39:01+08:00",
|
||||||
|
@ -50,7 +50,9 @@ async def read_event():
|
|||||||
device_name = device_map.get(src_index, "未知设备")
|
device_name = device_map.get(src_index, "未知设备")
|
||||||
event_detail['deviceName'] = device_name
|
event_detail['deviceName'] = device_name
|
||||||
# 根据设备名称获取 user_ids
|
# 根据设备名称获取 user_ids
|
||||||
|
user_all = user_map.get("all", []) # 接受全部通知的用户
|
||||||
user_ids = user_map.get(device_name, [])
|
user_ids = user_map.get(device_name, [])
|
||||||
|
user_ids = user_ids + user_all
|
||||||
event_detail['userIds'] = user_ids
|
event_detail['userIds'] = user_ids
|
||||||
# 添加其他字段
|
# 添加其他字段
|
||||||
event_detail["eventLvl"] = event['eventLvl']
|
event_detail["eventLvl"] = event['eventLvl']
|
||||||
@ -61,7 +63,8 @@ async def read_event():
|
|||||||
if "eventType" in event_detail['data']:
|
if "eventType" in event_detail['data']:
|
||||||
detection_field_name = event_detail['data']['eventType']
|
detection_field_name = event_detail['data']['eventType']
|
||||||
if detection_field_name in event_detail['data']:
|
if detection_field_name in event_detail['data']:
|
||||||
event_detail['data']["_detectionResult"] = event_detail['data'].pop(detection_field_name)
|
event_detail['data']["_detectionResult"] = event_detail['data'].pop(
|
||||||
|
detection_field_name)
|
||||||
logging.info(event_detail)
|
logging.info(event_detail)
|
||||||
try:
|
try:
|
||||||
push_resp = requests.post(push_url, json=event_detail).content.decode('utf-8')
|
push_resp = requests.post(push_url, json=event_detail).content.decode('utf-8')
|
||||||
@ -78,7 +81,9 @@ async def read_event():
|
|||||||
src_index = event["srcIndex"]
|
src_index = event["srcIndex"]
|
||||||
device_name = device_map.get(src_index, "未知设备")
|
device_name = device_map.get(src_index, "未知设备")
|
||||||
# 根据设备名称获取 user_ids
|
# 根据设备名称获取 user_ids
|
||||||
|
user_all = user_map.get("all", []) # 接受全部通知的用户
|
||||||
user_ids = user_map.get(device_name, [])
|
user_ids = user_map.get(device_name, [])
|
||||||
|
user_ids = user_ids + user_all
|
||||||
event['deviceName'] = device_name
|
event['deviceName'] = device_name
|
||||||
event['userIds'] = user_ids
|
event['userIds'] = user_ids
|
||||||
if "data" in event:
|
if "data" in event:
|
||||||
|
@ -1,14 +0,0 @@
|
|||||||
import io
|
|
||||||
import json
|
|
||||||
|
|
||||||
import requests
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
image_content = requests.get(
|
|
||||||
"http://47.102.206.10:8086/api/uploads/image/20231101/5bedf085-841a-48cc-bca2-9c9b2c751b48.jpeg").content
|
|
||||||
image_bytes = io.BytesIO(image_content)
|
|
||||||
# files = {"file": image_bytes}
|
|
||||||
data = {"file": "67tgby6y67tg", "file_bytes": "fsfadfsdffadf"}
|
|
||||||
resp = requests.post("http://localhost:8000/upload",
|
|
||||||
files={"file": image_bytes}).content.decode('utf-8')
|
|
||||||
print(resp)
|
|
Reference in New Issue
Block a user