Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
U
unify_api2
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
chaonan
unify_api2
Commits
dc74e9e6
Commit
dc74e9e6
authored
Apr 13, 2023
by
wang.wenrong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
扬尘返回空处理
parent
a7eb03e0
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
59 deletions
+26
-59
elec_charge_dao.py
unify_api/modules/elec_charge/dao/elec_charge_dao.py
+10
-43
count_info.py
unify_api/modules/home_page/views/count_info.py
+4
-4
drop_dust.py
unify_api/modules/tsp_water/views/drop_dust.py
+12
-12
No files found.
unify_api/modules/elec_charge/dao/elec_charge_dao.py
View file @
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
):
...
...
unify_api/modules/home_page/views/count_info.py
View file @
dc74e9e6
...
@@ -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
,
...
...
unify_api/modules/tsp_water/views/drop_dust.py
View file @
dc74e9e6
...
@@ -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
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment