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
da4a9577
Commit
da4a9577
authored
Apr 13, 2023
by
wang.wenrong
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'wwr' into 'develop'
扬尘返回空处理 See merge request
!15
parents
6b106e16
dc74e9e6
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 @
da4a9577
...
...
@@ -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
):
"""根据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
:
start_es
=
convert_es_str
(
start
)
end_es
=
convert_es_str
(
end
)
query_body
[
"query"
][
"bool"
][
"must"
]
.
append
(
{
"range"
:
{
"datetime"
:
{
"gte"
:
start_es
,
"lte"
:
end_es
}
}
}
)
log
.
info
(
query_body
)
async
with
EsUtil
()
as
es
:
es_re
=
await
es
.
search_origin
(
body
=
query_body
,
index
=
index_point
)
return
es_re
sql
=
f
"SELECT sum(kwh) kwh, sum(charge) charge FROM "
\
f
"`point_15min_power` "
\
f
"where pid in
%
s and create_time BETWEEN {start} and {end}"
else
:
sql
=
"SELECT sum(kwh) kwh,sum(charge) charge FROM point_15min_power"
\
" where pid in
%
s"
async
with
MysqlUtil
()
as
conn
:
data
=
await
conn
.
fetchone
(
sql
,
args
=
(
point_list
,))
return
data
async
def
point_aggs_kwh_new15
(
point_list
,
start
=
None
,
end
=
None
):
...
...
unify_api/modules/home_page/views/count_info.py
View file @
da4a9577
...
...
@@ -209,15 +209,15 @@ async def post_risk_cost(req, body: RiskCostReq) -> RiskCostResp:
async
def
post_info_yang_chen
(
req
,
body
:
CountInfoReq
)
->
IycResp
:
# 1. 获取cid
cid
=
body
.
cid
return
await
info_yang_chen_service
(
cid
)
#
return await info_yang_chen_service(cid)
return
IycResp
()
# 扬尘不维护,返回空
@
summary
(
"工厂版首页地图信息-扬尘"
)
async
def
post_info_yang_chen_map
(
req
,
body
:
CountInfoReq
)
->
IycmResp
:
# 1. 获取cid
cid
=
body
.
cid
return
await
info_yang_chen_map_service
(
cid
)
#
return await info_yang_chen_map_service(cid)
return
IycmResp
()
@
summary
(
"获取首页用电经济指数"
)
async
def
post_electric_economic_index_new
(
request
,
...
...
unify_api/modules/tsp_water/views/drop_dust.py
View file @
da4a9577
...
...
@@ -20,42 +20,42 @@ async def post_drop_dust_wave(req, body: DdwReq) -> DdwResp:
point_id
=
body
.
point_id
start
=
body
.
start
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
(
"降尘措施-喷淋-运行曲线"
)
async
def
post_drop_water_wave
(
req
,
body
:
DdwReq
)
->
DdwResp
:
point_id
=
body
.
point_id
# 对应的tsp_id
start
=
body
.
start
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
(
"首页-运行监测-统计"
)
async
def
post_index_run_monit
(
req
,
body
:
DeReq
)
->
IrmResp
:
cid
=
body
.
cid
return
await
index_run_monit_service
(
cid
)
#
return await index_run_monit_service(cid)
return
IrmResp
()
@
summary
(
"首页-运行统计-扬尘"
)
async
def
post_index_op_stat
(
req
,
body
:
DeReq
)
->
IosResp
:
cid
=
body
.
cid
return
await
index_op_stat_service
(
cid
)
#
return await index_op_stat_service(cid)
return
IosResp
()
@
summary
(
"首页-今日数据-扬尘"
)
async
def
post_index_today_info
(
req
,
body
:
DeReq
)
->
ItiResp
:
cid
=
body
.
cid
return
await
index_today_info_service
(
cid
)
#
return await index_today_info_service(cid)
return
ItiResp
()
@
summary
(
"首页-运行趋势-喷淋"
)
async
def
post_index_water_stati
(
req
,
body
:
WsStatiReq
)
->
WsStatiResp
:
start
=
body
.
start
end
=
body
.
end
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
(
"首页-运行趋势-雾炮"
)
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