Commit 2bb7528c authored by ZZH's avatar ZZH

new_list_alarm_service add mtid 2023-7-31

parent 5a55d17c
...@@ -43,6 +43,7 @@ async def new_list_alarm_service(cid, storeys, offset, page_size, start, end, ...@@ -43,6 +43,7 @@ async def new_list_alarm_service(cid, storeys, offset, page_size, start, end,
# 3.增加sid返回字段, sdu龙岗客户需求 # 3.增加sid返回字段, sdu龙岗客户需求
monitor_point_list = await monitor_point_join_points(points) monitor_point_list = await monitor_point_join_points(points)
point_sid_map = {i["pid"]: i["sid"] for i in monitor_point_list} point_sid_map = {i["pid"]: i["sid"] for i in monitor_point_list}
point_mtid_map = {i["pid"]: i["mtid"] for i in monitor_point_list}
rows = [] rows = []
for res in results: for res in results:
es_id = res.get("id") es_id = res.get("id")
...@@ -50,7 +51,6 @@ async def new_list_alarm_service(cid, storeys, offset, page_size, start, end, ...@@ -50,7 +51,6 @@ async def new_list_alarm_service(cid, storeys, offset, page_size, start, end,
mode = res.get("event_mode") mode = res.get("event_mode")
type_str = constants.SDU_EVENT_TYPE_MAP.get(type, type) type_str = constants.SDU_EVENT_TYPE_MAP.get(type, type)
point_id = res.get("pid") point_id = res.get("pid")
sid = point_sid_map.get(point_id)
location_id = res.get("lid") location_id = res.get("lid")
date_time = res.get("event_datetime") date_time = res.get("event_datetime")
dt = time_format.convert_to_dt(date_time) dt = time_format.convert_to_dt(date_time)
...@@ -85,7 +85,8 @@ async def new_list_alarm_service(cid, storeys, offset, page_size, start, end, ...@@ -85,7 +85,8 @@ async def new_list_alarm_service(cid, storeys, offset, page_size, start, end,
storey_name=storey_name, storey_name=storey_name,
room_name=room_name, room_name=room_name,
storey_room_name=storey_name + room_name, storey_room_name=storey_name + room_name,
sid=sid sid=point_sid_map.get(point_id),
mtid=point_mtid_map.get(point_id)
) )
rows.append(alarm) rows.append(alarm)
return ListAlarmResponse(total=total, rows=rows, point_ids=point_ids) return ListAlarmResponse(total=total, rows=rows, point_ids=point_ids)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment