diff --git a/app/routers/wechat_callback.py b/app/routers/wechat_callback.py index 4c65bb1..9838cec 100644 --- a/app/routers/wechat_callback.py +++ b/app/routers/wechat_callback.py @@ -94,7 +94,7 @@ async def alarm_action_callback( }, "ignore": { "alarm_status": "FALSE", - "handle_status": "DONE", + "handle_status": "IGNORED", "remark": "标记误报", }, } diff --git a/app/routers/yudao_aiot_alarm.py b/app/routers/yudao_aiot_alarm.py index fc51462..bea78da 100644 --- a/app/routers/yudao_aiot_alarm.py +++ b/app/routers/yudao_aiot_alarm.py @@ -228,7 +228,7 @@ async def handle_alert( alarmId: Optional[str] = Query(None, description="告警ID"), id: Optional[str] = Query(None, description="告警ID(兼容)"), alarmStatus: Optional[str] = Query(None, description="告警状态: CONFIRMED/FALSE/CLOSED"), - handleStatus: Optional[str] = Query(None, description="处理状态: HANDLING/DONE"), + handleStatus: Optional[str] = Query(None, description="处理状态: HANDLING/DONE/IGNORED"), status: Optional[str] = Query(None, description="处理状态(兼容旧接口)"), remark: Optional[str] = Query(None, description="处理备注"), service: AlarmEventService = Depends(get_alarm_event_service), @@ -244,6 +244,9 @@ async def handle_alert( if not alarmStatus and status: status_convert = {"handled": "CONFIRMED", "ignored": "FALSE", "resolved": "CLOSED"} alarmStatus = status_convert.get(status, status.upper()) + # 忽略操作设置 handle_status=IGNORED,区别于自动结单的 DONE + if status == "ignored" and not handleStatus: + handleStatus = "IGNORED" alarm = service.handle_alarm( alarm_id=alarm_id, diff --git a/app/services/alarm_event_service.py b/app/services/alarm_event_service.py index 0674ac1..ea34fe3 100644 --- a/app/services/alarm_event_service.py +++ b/app/services/alarm_event_service.py @@ -574,8 +574,10 @@ class AlarmEventService: except Exception: alarm.last_frame_time = beijing_now().replace(microsecond=0) - # 如果是人员回岗,标记为自动关闭 - if resolve_type == "person_returned": + # 如果已被 VLM 标记为误报(IGNORED),只更新时长,不覆盖状态 + if alarm.handle_status == "IGNORED": + logger.info(f"告警已为误报状态,仅更新时长: {alarm_id}") + elif resolve_type == "person_returned": alarm.alarm_status = "CLOSED" alarm.handle_status = "DONE" alarm.handle_remark = "人员回岗自动关闭" diff --git a/app/services/notify_dispatch.py b/app/services/notify_dispatch.py index 5c7c36f..3a080b1 100644 --- a/app/services/notify_dispatch.py +++ b/app/services/notify_dispatch.py @@ -154,7 +154,7 @@ def _mark_false_alarm(alarm_id: str): if alarm: now = beijing_now() alarm.alarm_status = "FALSE" - alarm.handle_status = "DONE" + alarm.handle_status = "IGNORED" alarm.handle_remark = "VLM复核判定误报" alarm.handled_at = now # 计算告警时长(VLM复核时间 - 事件时间)