Commit da4a9577 authored by wang.wenrong's avatar wang.wenrong

Merge branch 'wwr' into 'develop'

扬尘返回空处理

See merge request !15
parents 6b106e16 dc74e9e6
...@@ -483,50 +483,17 @@ async def power_charge_p_point_aggs(date_start, date_end, pid_list, interval): ...@@ -483,50 +483,17 @@ async def power_charge_p_point_aggs(date_start, date_end, pid_list, interval):
async def point_aggs_kwh(point_list, start=None, end=None): async def point_aggs_kwh(point_list, start=None, end=None):
"""根据pid,求电量电费"""
query_body = {
"size": 0,
"query": {
"bool": {
"must": [
{
"terms": {
"pid": point_list
}
}
]
}
},
"aggs": {
"kwh": {
"sum": {
"field": "kwh"
}
},
"charge": {
"sum": {
"field": "charge"
}
}
}
}
if start and end: if start and end:
start_es = convert_es_str(start) sql = f"SELECT sum(kwh) kwh, sum(charge) charge FROM " \
end_es = convert_es_str(end) f"`point_15min_power` " \
query_body["query"]["bool"]["must"].append( f"where pid in %s and create_time BETWEEN {start} and {end}"
{ else:
"range": { sql = "SELECT sum(kwh) kwh,sum(charge) charge FROM point_15min_power" \
"datetime": { " where pid in %s"
"gte": start_es, async with MysqlUtil() as conn:
"lte": end_es data = await conn.fetchone(sql, args=(point_list,))
} return data
}
}
)
log.info(query_body)
async with EsUtil() as es:
es_re = await es.search_origin(body=query_body, index=index_point)
return es_re
async def point_aggs_kwh_new15(point_list, start=None, end=None): async def point_aggs_kwh_new15(point_list, start=None, end=None):
......
...@@ -209,15 +209,15 @@ async def post_risk_cost(req, body: RiskCostReq) -> RiskCostResp: ...@@ -209,15 +209,15 @@ async def post_risk_cost(req, body: RiskCostReq) -> RiskCostResp:
async def post_info_yang_chen(req, body: CountInfoReq) -> IycResp: async def post_info_yang_chen(req, body: CountInfoReq) -> IycResp:
# 1. 获取cid # 1. 获取cid
cid = body.cid cid = body.cid
return await info_yang_chen_service(cid) # return await info_yang_chen_service(cid)
return IycResp() # 扬尘不维护,返回空
@summary("工厂版首页地图信息-扬尘") @summary("工厂版首页地图信息-扬尘")
async def post_info_yang_chen_map(req, body: CountInfoReq) -> IycmResp: async def post_info_yang_chen_map(req, body: CountInfoReq) -> IycmResp:
# 1. 获取cid # 1. 获取cid
cid = body.cid cid = body.cid
return await info_yang_chen_map_service(cid) # return await info_yang_chen_map_service(cid)
return IycmResp()
@summary("获取首页用电经济指数") @summary("获取首页用电经济指数")
async def post_electric_economic_index_new(request, async def post_electric_economic_index_new(request,
......
...@@ -20,42 +20,42 @@ async def post_drop_dust_wave(req, body: DdwReq) -> DdwResp: ...@@ -20,42 +20,42 @@ async def post_drop_dust_wave(req, body: DdwReq) -> DdwResp:
point_id = body.point_id point_id = body.point_id
start = body.start start = body.start
end = body.end end = body.end
return await post_drop_dust_wave_service(point_id, start, end) # return await post_drop_dust_wave_service(point_id, start, end)
return DdwResp()
@summary("降尘措施-喷淋-运行曲线") @summary("降尘措施-喷淋-运行曲线")
async def post_drop_water_wave(req, body: DdwReq) -> DdwResp: async def post_drop_water_wave(req, body: DdwReq) -> DdwResp:
point_id = body.point_id # 对应的tsp_id point_id = body.point_id # 对应的tsp_id
start = body.start start = body.start
end = body.end end = body.end
return await drop_water_wave_service(point_id, start, end) # return await drop_water_wave_service(point_id, start, end)
return DdwResp()
@summary("首页-运行监测-统计") @summary("首页-运行监测-统计")
async def post_index_run_monit(req, body: DeReq) -> IrmResp: async def post_index_run_monit(req, body: DeReq) -> IrmResp:
cid = body.cid cid = body.cid
return await index_run_monit_service(cid) # return await index_run_monit_service(cid)
return IrmResp()
@summary("首页-运行统计-扬尘") @summary("首页-运行统计-扬尘")
async def post_index_op_stat(req, body: DeReq) -> IosResp: async def post_index_op_stat(req, body: DeReq) -> IosResp:
cid = body.cid cid = body.cid
return await index_op_stat_service(cid) # return await index_op_stat_service(cid)
return IosResp()
@summary("首页-今日数据-扬尘") @summary("首页-今日数据-扬尘")
async def post_index_today_info(req, body: DeReq) -> ItiResp: async def post_index_today_info(req, body: DeReq) -> ItiResp:
cid = body.cid cid = body.cid
return await index_today_info_service(cid) # return await index_today_info_service(cid)
return ItiResp()
@summary("首页-运行趋势-喷淋") @summary("首页-运行趋势-喷淋")
async def post_index_water_stati(req, body: WsStatiReq) -> WsStatiResp: async def post_index_water_stati(req, body: WsStatiReq) -> WsStatiResp:
start = body.start start = body.start
end = body.end end = body.end
date_type = body.date_type date_type = body.date_type
return await index_water_service(start, end, date_type) # return await index_water_service(start, end, date_type)
return WsStatiResp()
@summary("首页-运行趋势-雾炮") @summary("首页-运行趋势-雾炮")
async def post_index_wave_stati(req, body: WsStatiReq) -> WsStatiResp: async def post_index_wave_stati(req, body: WsStatiReq) -> WsStatiResp:
......
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