Commit 3eee08fd authored by lcn's avatar lcn

BUG修复

parent 121f1444
......@@ -20,7 +20,7 @@ from unify_api.modules.common.procedures.points import points_by_storeys
from unify_api.modules.home_page.components.security_info_cps import \
SecurityCountResp, LevelCount, ContentCount, AlarmContentDistributionResp
from unify_api.modules.home_page.procedures.security_info_pds import \
alarm_count_info, alarm_content_time_distribution
alarm_content_time_distribution, alarm_count_info_new15
from unify_api.utils.common_utils import round_1, division_two
......@@ -418,7 +418,7 @@ async def sdu_index_alarm_ranking_service_new15(cid, start, end, product):
async def zdu_level_distribution_service(cid, start, end, product):
"""报警统计-报警等级-智电u"""
alarm_info_map = await alarm_count_info([cid], start, end, "month")
alarm_info_map = await alarm_count_info_new15([cid], start, end, "month")
first_alarm, second_alarm, third_alarm = (
alarm_info_map["first_alarm"],
alarm_info_map["second_alarm"],
......
......@@ -132,7 +132,7 @@ async def pttl_max_new15(cid, start, end, point_id=None, inline_id=None):
# 根据时间范围, 返回不同时间格式
if max_val_time:
if date_type == "day":
max_val_time = str(max_val_time)[:10]
max_val_time = str(max_val_time)[11:16]
elif date_type == "month":
max_val_time = str(max_val_time)[5:10]
else:
......
......@@ -43,7 +43,7 @@ from unify_api.modules.home_page.procedures.count_info_proxy_pds import (
total_run_day_proxy,
)
from unify_api.modules.home_page.procedures.security_info_pds import \
alarm_count_info
alarm_count_info_new15
from unify_api.modules.home_page.service.count_info_service import \
safe_run_sdu, safe_run_sdu_new15
from unify_api.modules.elec_charge.components.elec_charge_cps import \
......@@ -225,7 +225,7 @@ async def post_reg_alarm_distribution(request,
if product == Product.RecognitionElectric.value:
user_id = request.ctx.user_id
cids = await get_cids(user_id, product)
alarm_info_map = await alarm_count_info(cids, start, end, date_type)
alarm_info_map = await alarm_count_info_new15(cids, start, end, date_type)
type_alarm_cnt_map = alarm_info_map["type_alarm_cnt_map"]
return AlarmDistributionResp(
alarm_categories=RegAlarmCnt(
......@@ -250,7 +250,7 @@ async def post_reg_alarm_rank(request,
if product == Product.RecognitionElectric.value:
user_id = request.ctx.user_id
cids = await get_cids(user_id, product)
alarm_info_map = await alarm_count_info(cids, start, end, date_type)
alarm_info_map = await alarm_count_info_new15(cids, start, end, date_type)
cid_alarm_cnt_map = alarm_info_map["cid_alarm_cnt_map"]
cid_info_map = await get_cid_info(all=True)
......
......@@ -19,9 +19,8 @@ from unify_api.modules.home_page.components.security_info_cps import (
AlarmSummaryResp,
)
from unify_api.modules.home_page.procedures.security_info_pds import (
alarm_count_info,
alarm_content_time_distribution,
alarm_summary,
alarm_summary, alarm_count_info_new15,
)
......@@ -43,7 +42,7 @@ async def post_security_index(request, body: SecurityCountReq) -> SecurityCountR
elif product == Product.RecognitionElectric.value:
user_id = request.ctx.user_id
cids = await get_cids(user_id, product)
alarm_info_map = await alarm_count_info(cids, start, end, date_type)
alarm_info_map = await alarm_count_info_new15(cids, start, end, date_type)
first_alarm, second_alarm, third_alarm = (
alarm_info_map["first_alarm"],
alarm_info_map["second_alarm"],
......@@ -84,7 +83,7 @@ async def post_alarm_level_distribution(request, body: SecurityCommonReq) -> Sec
else:
raise BusinessException(message=f"暂时不支持其他产品")
alarm_info_map = await alarm_count_info(req_cids, start, end, date_type)
alarm_info_map = await alarm_count_info_new15(req_cids, start, end, date_type)
first_alarm, second_alarm, third_alarm = (
alarm_info_map["first_alarm"],
alarm_info_map["second_alarm"],
......
......@@ -134,14 +134,19 @@ def year_slots(start, end):
return slots
def day_slots():
def day_slots(type='minutes'):
"""
获取一天时间点
"""
dt = my_pendulum.now().start_of('day')
slots = [
dt.add(minutes=i).format("HH:mm") for i in range(1440)
]
if type == 'minutes':
slots = [
dt.add(minutes=i).format("HH:mm") for i in range(1440)
]
else:
slots = [
dt.add(hours=i).format("HH") for i in range(24)
]
return slots
......
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