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
4100febc
Commit
4100febc
authored
Jul 07, 2023
by
ZZH
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix query_points_by_storey 2023-7-7
parent
042ec0e5
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
17 additions
and
17 deletions
+17
-17
alarm_static_service.py
...api/modules/alarm_manager/service/alarm_static_service.py
+1
-1
list_alarm_service.py
...y_api/modules/alarm_manager/service/list_alarm_service.py
+1
-1
common_dao.py
unify_api/modules/common/dao/common_dao.py
+3
-3
points.py
unify_api/modules/common/procedures/points.py
+2
-2
elec_charge_service.py
unify_api/modules/elec_charge/service/elec_charge_service.py
+1
-1
elec_charge.py
unify_api/modules/elec_charge/views/elec_charge.py
+1
-1
electric_service.py
unify_api/modules/electric/service/electric_service.py
+4
-4
electric.py
unify_api/modules/electric/views/electric.py
+4
-4
No files found.
unify_api/modules/alarm_manager/service/alarm_static_service.py
View file @
4100febc
...
@@ -140,7 +140,7 @@ async def sdu_app_statistics_sort_service(cid, start, end):
...
@@ -140,7 +140,7 @@ async def sdu_app_statistics_sort_service(cid, start, end):
async
def
sdu_electric_behave_service
(
cid
,
start
,
end
,
storeys
,
product
):
async
def
sdu_electric_behave_service
(
cid
,
start
,
end
,
storeys
,
product
):
"""近30天用电行为"""
"""近30天用电行为"""
# 1.根据storeys获取points信息
# 1.根据storeys获取points信息
point_list
=
await
points_by_storeys
(
storeys
)
point_list
=
await
points_by_storeys
(
cid
,
storeys
)
# 获取point_id列表
# 获取point_id列表
points
=
[
i
.
get
(
"point_id"
)
for
i
in
point_list
]
points
=
[
i
.
get
(
"point_id"
)
for
i
in
point_list
]
# 2. es查询违规/大功率/正常次数
# 2. es查询违规/大功率/正常次数
...
...
unify_api/modules/alarm_manager/service/list_alarm_service.py
View file @
4100febc
...
@@ -18,7 +18,7 @@ async def new_list_alarm_service(cid, storeys, offset, page_size, start, end,
...
@@ -18,7 +18,7 @@ async def new_list_alarm_service(cid, storeys, offset, page_size, start, end,
importance
,
points
,
product
):
importance
,
points
,
product
):
"""报警信息分页列表"""
"""报警信息分页列表"""
# 1.根据storeys获取points信息
# 1.根据storeys获取points信息
point_list
=
await
points_by_storeys
(
storeys
)
point_list
=
await
points_by_storeys
(
cid
,
storeys
)
if
not
point_list
:
if
not
point_list
:
return
ListAlarmResponse
(
total
=
0
,
rows
=
[])
return
ListAlarmResponse
(
total
=
0
,
rows
=
[])
# point_id和storey对应关系
# point_id和storey对应关系
...
...
unify_api/modules/common/dao/common_dao.py
View file @
4100febc
...
@@ -33,15 +33,15 @@ async def storey_by_cid(cid):
...
@@ -33,15 +33,15 @@ async def storey_by_cid(cid):
return
storey_list
return
storey_list
async
def
query_points_by_storey
(
storeys
):
async
def
query_points_by_storey
(
cid
,
storeys
):
"""根据storey_id查询point_id和room_name"""
"""根据storey_id查询point_id和room_name"""
sql
=
"SELECT s.storey_id,s.storey_name,s.point_id,s.room_name,m.mtid,"
\
sql
=
"SELECT s.storey_id,s.storey_name,s.point_id,s.room_name,m.mtid,"
\
"p.ctnum,p.cid from storey_room_map s LEFT JOIN point p "
\
"p.ctnum,p.cid from storey_room_map s LEFT JOIN point p "
\
"on p.pid=s.point_id LEFT JOIN monitor m on m.mtid=p.mtid "
\
"on p.pid=s.point_id LEFT JOIN monitor m on m.mtid=p.mtid "
\
"where s.storey_id in
%
s and m.demolished=0 "
\
"where s.storey_id in
%
s and
s.cid=
%
s and
m.demolished=0 "
\
"order by s.storey_id, s.room_name"
"order by s.storey_id, s.room_name"
async
with
MysqlUtil
()
as
conn
:
async
with
MysqlUtil
()
as
conn
:
points
=
await
conn
.
fetchall
(
sql
,
args
=
(
tuple
(
storeys
),))
points
=
await
conn
.
fetchall
(
sql
,
args
=
(
tuple
(
storeys
),
cid
))
return
points
return
points
...
...
unify_api/modules/common/procedures/points.py
View file @
4100febc
...
@@ -102,7 +102,7 @@ async def point_to_mid(points):
...
@@ -102,7 +102,7 @@ async def point_to_mid(points):
return
point_mid
,
len
(
point_mid
)
return
point_mid
,
len
(
point_mid
)
async
def
points_by_storeys
(
storeys
):
async
def
points_by_storeys
(
cid
,
storeys
):
"""根据storey_id查询point_id和room_name"""
"""根据storey_id查询point_id和room_name"""
point_list
=
await
query_points_by_storey
(
storeys
)
point_list
=
await
query_points_by_storey
(
cid
,
storeys
)
return
point_list
return
point_list
unify_api/modules/elec_charge/service/elec_charge_service.py
View file @
4100febc
...
@@ -15,7 +15,7 @@ from unify_api.utils.common_utils import round_2, division_two
...
@@ -15,7 +15,7 @@ from unify_api.utils.common_utils import round_2, division_two
async
def
kwh_points_service
(
cid
,
start
,
end
,
storeys
):
async
def
kwh_points_service
(
cid
,
start
,
end
,
storeys
):
"""获取points电量"""
"""获取points电量"""
# 1.根据storeys获取points信息
# 1.根据storeys获取points信息
point_list
=
await
points_by_storeys
(
storeys
)
point_list
=
await
points_by_storeys
(
cid
,
storeys
)
# 获取point_id列表
# 获取point_id列表
points
=
[
i
.
get
(
"point_id"
)
for
i
in
point_list
]
points
=
[
i
.
get
(
"point_id"
)
for
i
in
point_list
]
# 2. es查询数据
# 2. es查询数据
...
...
unify_api/modules/elec_charge/views/elec_charge.py
View file @
4100febc
...
@@ -410,7 +410,7 @@ async def get_kwh_points_download(req):
...
@@ -410,7 +410,7 @@ async def get_kwh_points_download(req):
start
=
args
.
get
(
"start"
)
start
=
args
.
get
(
"start"
)
end
=
args
.
get
(
"end"
)
end
=
args
.
get
(
"end"
)
# 2.根据storeys获取points信息
# 2.根据storeys获取points信息
point_list
=
await
points_by_storeys
(
storeys
)
point_list
=
await
points_by_storeys
(
cid
,
storeys
)
# 获取point_id列表
# 获取point_id列表
points
=
[
i
.
get
(
"point_id"
)
for
i
in
point_list
]
points
=
[
i
.
get
(
"point_id"
)
for
i
in
point_list
]
# 3. es查询数据
# 3. es查询数据
...
...
unify_api/modules/electric/service/electric_service.py
View file @
4100febc
...
@@ -28,10 +28,10 @@ from unify_api.modules.electric.components.electric import (
...
@@ -28,10 +28,10 @@ from unify_api.modules.electric.components.electric import (
)
)
async
def
elec_current_storeys_service
(
storeys
):
async
def
elec_current_storeys_service
(
cid
,
storeys
):
"""用电监测-实时监测-楼层"""
"""用电监测-实时监测-楼层"""
# 1.根据storeys获取points信息
# 1.根据storeys获取points信息
point_list
=
await
points_by_storeys
(
storeys
)
point_list
=
await
points_by_storeys
(
cid
,
storeys
)
mtids
=
[
i
.
get
(
"mtid"
)
for
i
in
point_list
]
mtids
=
[
i
.
get
(
"mtid"
)
for
i
in
point_list
]
d_rt_ele
=
await
batch_load_rt_ele
(
mtids
)
d_rt_ele
=
await
batch_load_rt_ele
(
mtids
)
elec_data
=
{}
elec_data
=
{}
...
@@ -95,10 +95,10 @@ async def elec_current_storeys_service(storeys):
...
@@ -95,10 +95,10 @@ async def elec_current_storeys_service(storeys):
return
EscResp
(
elec_data
=
elec_list
)
return
EscResp
(
elec_data
=
elec_list
)
async
def
qual_current_storeys_service
(
storeys
):
async
def
qual_current_storeys_service
(
cid
,
storeys
):
"""电能质量-实时参数-楼层"""
"""电能质量-实时参数-楼层"""
# 1.根据storeys获取points信息
# 1.根据storeys获取points信息
point_list
=
await
points_by_storeys
(
storeys
)
point_list
=
await
points_by_storeys
(
cid
,
storeys
)
mtids
=
[
point
[
"mtid"
]
for
point
in
point_list
if
point
[
"mtid"
]]
mtids
=
[
point
[
"mtid"
]
for
point
in
point_list
if
point
[
"mtid"
]]
d_rt_ele
=
await
batch_load_rt_ele_with_hr
(
mtids
)
d_rt_ele
=
await
batch_load_rt_ele_with_hr
(
mtids
)
# 4. 返回数据
# 4. 返回数据
...
...
unify_api/modules/electric/views/electric.py
View file @
4100febc
...
@@ -411,14 +411,14 @@ async def post_qual_current(req, body: PageRequest) -> QualCurrentResponse:
...
@@ -411,14 +411,14 @@ async def post_qual_current(req, body: PageRequest) -> QualCurrentResponse:
@
summary
(
"用电监测-实时监测-楼层"
)
@
summary
(
"用电监测-实时监测-楼层"
)
async
def
post_elec_current_storeys
(
req
,
body
:
EcsReq
)
->
EscResp
:
async
def
post_elec_current_storeys
(
req
,
body
:
EcsReq
)
->
EscResp
:
storeys
=
body
.
storeys
cid
,
storeys
=
body
.
cid
,
body
.
storeys
return
await
elec_current_storeys_service
(
storeys
)
return
await
elec_current_storeys_service
(
cid
,
storeys
)
@
summary
(
"电能质量-实时参数-楼层"
)
@
summary
(
"电能质量-实时参数-楼层"
)
async
def
post_qual_current_storeys
(
req
,
body
:
EcsReq
)
->
QcsResp
:
async
def
post_qual_current_storeys
(
req
,
body
:
EcsReq
)
->
QcsResp
:
storeys
=
body
.
storeys
cid
,
storeys
=
body
.
cid
,
body
.
storeys
return
await
qual_current_storeys_service
(
storeys
)
return
await
qual_current_storeys_service
(
cid
,
storeys
)
@
summary
(
"用电监测-卡片信息-level"
)
@
summary
(
"用电监测-卡片信息-level"
)
...
...
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