Commit 68fa4a8c authored by ZZH's avatar ZZH

fix longgang data 2023-7-19

parent 2bd87ca5
......@@ -168,12 +168,11 @@ async def supplement_data_service(user_id, cid, start, end, d_type):
db_name = topic2db[d_type]
stb_url = f"{SETTING.stb_url}{db_name}?tz=Asia/Shanghai"
table_name = f"{d_type}_stb"
if d_type == "electric":
sql = f"select * from {table_name} where cpyid={cid} and " \
sql = f"select * from {d_type}_stb where cpyid={cid} and " \
f"ts >= '{start}' and ts <= '{end}'"
else:
sql = f"select * from {table_name} where cpyid={cid} and " \
sql = f"select * from {d_type}_stb where cpyid={cid} and " \
f"ts_origin >= '{start}' and ts_origin <= '{end}'"
resp_str, status = await AioHttpUtils().post_data(
stb_url, data=sql, timeout=50,
......
......@@ -15,7 +15,7 @@ from unify_api.utils.time_format import last30_day_range
from unify_api.modules.common.dao.common_dao import monitor_by_cid
from unify_api.modules.home_page.service.count_info_service import safe_run_sdu
from unify_api.modules.common.procedures.power_cps import power_use_count
from unify_api.modules.common.procedures.alarm_cps import alarm_count_sdu_new
from unify_api.modules.common.procedures.alarm_cps import load_alarm_cnt_sdu
from unify_api.modules.shidianu.service.open_data_service import get_power
from unify_api.modules.common.components.select_company_cps import CmReq
from pot_libs.common.components.responses import success_res
......@@ -115,7 +115,7 @@ async def post_home_page_data(req, body: CmReq) -> HomeDataResp:
total_power = await power_use_count(cids)
# 5. 累计报警
total_alarm = await alarm_count_sdu_new(cids)
total_alarm = await load_alarm_cnt_sdu(cids)
return HomeDataResp(
risk_distribution=res.risk_distribution,
content_distribution=res.content_distribution,
......
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