Commit 6412c059 authored by ZZH's avatar ZZH

fix shidianu ele behavior curve 2023-5-15

parent 1b340470
...@@ -14,7 +14,7 @@ from unify_api.modules.shidianu.components.algorithm_cps import WcResp, AbcResp ...@@ -14,7 +14,7 @@ from unify_api.modules.shidianu.components.algorithm_cps import WcResp, AbcResp
from unify_api.modules.shidianu.dao.analysis_result_dao import \ from unify_api.modules.shidianu.dao.analysis_result_dao import \
query_sdu_power_wave, query_sdu_recog_record query_sdu_power_wave, query_sdu_recog_record
from unify_api.modules.shidianu.procedures.output_result import get_p_list, \ from unify_api.modules.shidianu.procedures.output_result import get_p_list, \
get_p_list_new15 get_curve_p
from unify_api.utils.time_format import last30_day_range, \ from unify_api.utils.time_format import last30_day_range, \
get_start_end_by_tz_time, day_slots, get_start_end_by_tz_time_new get_start_end_by_tz_time, day_slots, get_start_end_by_tz_time_new
...@@ -85,7 +85,7 @@ async def wave_curve_service_new15(point_id, req_date, product): ...@@ -85,7 +85,7 @@ async def wave_curve_service_new15(point_id, req_date, product):
mtid, meter_no = meter_info["mtid"], meter_info["meter_no"] mtid, meter_no = meter_info["mtid"], meter_info["meter_no"]
start, end = get_start_end_by_tz_time_new(req_date) start, end = get_start_end_by_tz_time_new(req_date)
# 获取设备数据 # 获取设备数据
p_list = await get_p_list_new15(mtid, meter_no, start, end, time_slot) p_list = await get_curve_p(mtid, meter_no, start, end, time_slot)
# 3. 获取用电设备识别结果 # 3. 获取用电设备识别结果
device_data = await query_sdu_recog_record(point_id, start, end) device_data = await query_sdu_recog_record(point_id, start, end)
electric_actions = {} electric_actions = {}
......
...@@ -196,14 +196,14 @@ async def get_p_list(sid, meter_sn, req_date, time_slots): ...@@ -196,14 +196,14 @@ async def get_p_list(sid, meter_sn, req_date, time_slots):
return p_list return p_list
async def get_p_list_new15(mtid, meter_sn, start, end, time_slots): async def get_curve_p(mtid, meter_sn, start, end, time_slots):
''' '''
从tdenine中获取相关数据 从tdenine中获取相关数据
''' '''
sn = meter_sn.lower() sn = meter_sn.lower()
p_field = f"p{sn}" p_field = f"p{sn}"
url = f"{SETTING.stb_url}db_electric?tz=Asia/Shanghai" url = f"{SETTING.stb_url}db_electric?tz=Asia/Shanghai"
sql = f"select max({p_field}) {p_field} from mt{mtid}_ele " \ sql = f"select ts, max({p_field}) {p_field} from mt{mtid}_ele " \
f"where meter_sn='{str.upper(sn)}' " \ f"where meter_sn='{str.upper(sn)}' " \
f"and ts >= '{start}' and ts <= '{end}' INTERVAL(1m)" f"and ts >= '{start}' and ts <= '{end}' INTERVAL(1m)"
status, results = await get_td_engine_data(url, sql) status, results = await get_td_engine_data(url, sql)
......
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