Commit 95140e9a authored by lcn's avatar lcn

bug修复

parent fd3450a0
......@@ -350,6 +350,9 @@ async def alarm_content_time_distribution_dao(cid, start, end, ):
"""
智电温度漏电流电参数分布
"""
if isinstance(cid, list):
mid_li = [f"cid in {str(tuple(cid)).replace(',)', ')')}"]
else:
mid_li = [f"cid={cid}"]
if start and end:
mid_li.append(f"event_datetime BETWEEN '{start}' and '{end}'")
......
......@@ -66,7 +66,10 @@ async def post_list_alarm(req, body: PageRequest) -> ListAlarmResponse:
# cids = await get_cids(user_id, product)
proxy_cids = await get_proxy_cids(user_id, product, proxy_id)
if req_cids and proxy_cids:
cids = list(set(req_cids) & set(proxy_cids))
else:
cids = proxy_cids
if req.json.get("product") in [Product.RecognitionElectric.value,
Product.IntelligentU.value]:
......
......@@ -14,7 +14,11 @@ async def post_elec_count_info(req, body: ProxyRankingReq) -> ProxyRankingResp:
product = body.product
# sql = "SELECT cid,safe_exp,health_exp,ele_quan,ele_charge " \
# "FROM safe_health_stats_cid where cid in %s and cal_month = %s"
sql = "SELECT safe_exp,health_exp,ele_quan,ele_charge,shsc.cid," \
sql = "SELECT ifnull(safe_exp,0) safe_exp," \
"ifnull(health_exp,0) health_exp," \
"ifnull(ele_quan,0) ele_quan," \
"ifnull(ele_charge,0) ele_charge," \
"shsc.cid," \
"company.shortname FROM safe_health_stats_cid shsc " \
"left join company on shsc.cid=company.cid where " \
"shsc.cid in %s and shsc.cal_month = %s"
......
......@@ -63,7 +63,7 @@ async def other_info(company_id):
# 获取到工厂安装时间create_time
async with MysqlUtil() as conn:
company_sql = "select create_time from company where cid = %s"
alarm_data = await conn.fetchone(alarm_sql, (company_id,))
alarm_data = await conn.fetchall(alarm_sql, (company_id,))
company = await conn.fetchone(company_sql, (company_id,))
create_time_timestamp = company["create_time"]
create_time = datetime.fromtimestamp(create_time_timestamp)
......
......@@ -79,7 +79,7 @@ async def post_count_info_proxy(req) -> CountInfoProxyResp:
safe_operation_days += safe_run_days
total_alarm += alarm_count
# 4. 累计监测用电
total_power = await proxy_power(cid_list)
total_power = await proxy_power15(cid_list)
return CountInfoProxyResp(
total_cid=total_cid,
total_monitor=total_monitor,
......
......@@ -120,7 +120,7 @@ async def post_alarm_content_distribution(
date_type = body.date_type
if product == Product.AndianUManage.value:
user_id = request.ctx.user_id
user_id = jwt_user(request)
# cids = await get_cids(user_id, product)
proxy_id = body.proxy_id
cids = await get_proxy_cids(user_id, product, proxy_id)
......@@ -129,7 +129,7 @@ async def post_alarm_content_distribution(
else:
raise BusinessException(message=f"暂时不支持其他产品")
alarm_info_map = await alarm_content_time_distribution_pds(req_cids, start, end, date_type)
alarm_info_map = await alarm_content_time_distribution_pds(req_cids, start, end)
temperature, residual_current, electric_param, electric_param_detail = (
alarm_info_map["temperature"],
alarm_info_map["residual_current"],
......
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