同步视频通道时移除多余通道
This commit is contained in:
parent
32e472b790
commit
d48795f237
|
@ -184,8 +184,8 @@ class TestViewSet(CustomGenericViewSet):
|
|||
测试算法2
|
||||
"""
|
||||
from apps.ecm.service import dispatch_dahua_event
|
||||
data = {'id': 1661934212905, 'category': 'alarm', 'method': 'alarm.msg', 'info': {'orgName': '曲阳县金隅水泥厂', 'nodeCode': '1000038$1$0$24', 'deviceCode': '1000038', 'alarmCode': '4ad645c7-384e-40d6-8d29-ff81e4813d31', 'alarmPicture': '6ad010cf-ce45-11ec-9715-e4246c7d1635/20220831/1/dsf_648dfccd-2903-11ed-884a-e4246c7d1635_25747813_25755688.jpg', 'nodeType': 2, 'alarmDate': '1661934211', 'alarmGrade': 2, 'isSave': True, 'extend': {'faceImageUrl': ['6ad010cf-ce45-11ec-9715-e4246c7d1635/20220831/1/dsf_648dfccd-2903-11ed-884a-e4246c7d1635_25747813_25755688.jpg'], 'glass': 0, 'beard': 0, 'candidateInfo': [{'birthday': '2022-8-24', 'faceImageUrl': [
|
||||
'6ad010cf-ce45-11ec-9715-e4246c7d1635/20220831/1/dsf_648dfccd-2903-11ed-884a-e4246c7d1635_25755688_25829090.jpg'], 'groupName': '全体人员', 'similarity': 99, 'sex': 1, 'cardType': 1, 'name': '曹前明', 'devPersonId': '48', 'id': '342422199004040175', 'type': 0}], 'sex': 0, 'occurrenceCount': 0, 'deviceCode': '1000038', 'globalScenePicUrl': '6ad010cf-ce45-11ec-9715-e4246c7d1635/20220831/1/dsf_648dfccd-2903-11ed-884a-e4246c7d1635_25409330_25747813.jpg', 'eye': 0, 'alarmType': 1001003, 'perFlag': -1, 'mouth': 0, 'feature': [], 'isHit': True, 'channelSeq': 24, 'szSerialUUID': '', 'channelName': '窑头平台值班室', 'beginTime': 1661934211, 'endTime': 1661934211, 'age': -1, 'mask': 0}, 'unitType': 1, 'alarmType': 1001003, 'channelSeq': 24, 'orgCode': '001001001', 'channelName': '窑头平台值班室', 'alarmStat': 1, 'isEvent': True}, 'subsystem': 'evo-face', 'userIds': None, 'sid': None, 'domainId': None, 'infoArray': None, 'protocol': None}
|
||||
data = {'id': None, 'category': 'alarm', 'method': 'alarm.msg', 'info': {'orgName': '河北省', 'alarmPictureSize': '885977', 'nodeCode': '1002182$1$0$0', 'deviceCode': '1002182', 'alarmCode': '{B55A1489-0064-8D42-B6F4-EFF2DE1DA9B1}', 'alarmPicture': '6ad010cf-ce45-11ec-9715-e4246c7d1635/20220831/1/dsf_3c4ef3fe-290f-11ed-884a-e4246c7d1635_55425449_56311426.jpg', 'nodeType': 2, 'deviceName': '192.168.10.155',
|
||||
'alarmDate': '1661942981', 'alarmGrade': 2, 'isSave': True, 'unitType': 1, 'unitSeq': 0, 'extend': {'params': {'ObjectType': 'Human', 'GroupId': 30.0, 'ObjectSubType': ''}, 'objectSubType': ''}, 'alarmType': 964, 'channelSeq': 0, 'orgCode': '001', 'channelName': '192.168.10.155_视频通道_1', 'alarmStat': 1, 'isEvent': True}, 'subsystem': 'admin', 'userIds': None, 'sid': None, 'domainId': None, 'infoArray': None, 'protocol': None}
|
||||
dispatch_dahua_event(data=data)
|
||||
return Response()
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
|
||||
from apps.vm.models import Visit
|
||||
from apps.ai.main import ai_analyse
|
||||
from apps.opm.models import Operation, Opl, OplWorker
|
||||
from apps.utils.sms import send_sms
|
||||
|
@ -24,7 +25,6 @@ from apps.third.clients import xxClient
|
|||
from apps.third.tapis import xxapis
|
||||
import logging
|
||||
myLogger = logging.getLogger('log')
|
||||
from apps.vm.models import Visit
|
||||
requests.packages.urllib3.disable_warnings()
|
||||
|
||||
|
||||
|
@ -120,6 +120,7 @@ def save_voice_and_speak(event: Event):
|
|||
_, event.voice, _ = generate_voice(event.voice_msg, v_p)
|
||||
event.save()
|
||||
if main_cate.speaker_on:
|
||||
sps = []
|
||||
if event.area: # 如果事件存在发生区域
|
||||
sps = list(TDevice.objects.filter(area=event.area, type=TDevice.DEVICE_SPEAKER).values_list('code', flat=True))
|
||||
if len(sps) == 0: # 如果当前区域没有喇叭就找覆盖区的喇叭
|
||||
|
@ -218,9 +219,9 @@ def check_miss_lcard(ep: Employee, area: Area):
|
|||
try:
|
||||
railId = area.third_info['xx_rail']['id']
|
||||
json = {
|
||||
"railId": railId,
|
||||
"type": ""
|
||||
}
|
||||
"railId": railId,
|
||||
"type": ""
|
||||
}
|
||||
is_ok, res = xxClient.request(**xxapis['rail_ibeacon_list'], json=json, raise_exception=False)
|
||||
if is_ok:
|
||||
blt_list = res['recordList']
|
||||
|
@ -282,7 +283,7 @@ def dispatch_dahua_event(data: dict):
|
|||
'cate': i,
|
||||
'event': event
|
||||
})
|
||||
elif alarm_type in [302, 303] and vchannel: # 拌线入侵/区域入侵
|
||||
elif 300 < alarm_type < 1000 and vchannel: # 其他智能通道报警
|
||||
ec = EventCate.objects.filter(code=str(alarm_type)).first()
|
||||
event = None
|
||||
global_img_o = dhClient.get_full_pic(data['info']['alarmPicture'])
|
||||
|
@ -639,4 +640,4 @@ def snap_and_analyse(vchannel: TDevice, algo_codes: list, opl: Opl):
|
|||
'event': event
|
||||
})
|
||||
if event:
|
||||
notify_event(event)
|
||||
notify_event(event)
|
||||
|
|
|
@ -208,8 +208,11 @@ class TDeviceViewSet(ListModelMixin, UpdateModelMixin, DestroyModelMixin, Custom
|
|||
'includeSubOwnerCodeFlag': True
|
||||
}
|
||||
_, res = dhClient.request(**dhapis['channel_list'], json=json)
|
||||
|
||||
if res.get('pageData', None):
|
||||
t_l = []
|
||||
for i in res['pageData']:
|
||||
t_l.append(i['channelCode'])
|
||||
td = TDevice.objects.filter(code=i['channelCode']).first()
|
||||
if td:
|
||||
pass
|
||||
|
@ -217,6 +220,7 @@ class TDeviceViewSet(ListModelMixin, UpdateModelMixin, DestroyModelMixin, Custom
|
|||
td = TDevice(code=i['channelCode'], type=TDevice.DEVICE_VCHANNEL)
|
||||
td.name = i['channelName']
|
||||
td.save()
|
||||
TDevice.objects.filter(type=TDevice.DEVICE_VCHANNEL).exclude(code__in=i['channelCode']).delete()
|
||||
return Response()
|
||||
|
||||
@action(methods=['post'], detail=False, perms_map={'post': '*'},
|
||||
|
|
Loading…
Reference in New Issue