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
cbee7a55
Commit
cbee7a55
authored
Aug 22, 2022
by
lcn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
BUG修复
parent
e0e81eef
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
10 deletions
+17
-10
electric_service.py
unify_api/modules/electric/service/electric_service.py
+16
-4
electric.py
unify_api/modules/electric/views/electric.py
+1
-6
No files found.
unify_api/modules/electric/service/electric_service.py
View file @
cbee7a55
...
...
@@ -773,7 +773,10 @@ async def elec_index_service_new15(cid, point_id, start, end):
"freq_dev_mean"
,
"freq_dev_min"
,
"freq_dev_max"
]
datas
=
await
get_electric_datas_dao
(
table_name
,
point_id
,
start
,
end
)
if
not
datas
:
return
ctnum
,
[],
[]
return
ElecIndexResponse
(
ctnum
=
ctnum
,
common_indexes
=
[],
elec_qual_indexes
=
[]
)
df
=
pd
.
DataFrame
(
list
(
datas
))
# 常规参数统计
common_indexes
=
[]
...
...
@@ -798,7 +801,10 @@ async def elec_index_service_new15(cid, point_id, start, end):
min_value
,
min_time
=
""
,
""
mean_item_name
=
f
"{item}_mean"
avg_value
=
df
[
mean_item_name
]
.
mean
()
avg_value
=
round
(
avg_value
,
2
)
if
avg_value
else
""
if
not
pd
.
isna
(
avg_value
):
avg_value
=
round
(
avg_value
,
2
)
if
avg_value
else
""
else
:
avg_value
=
""
elec_index
=
ElecIndex
(
stats_index
=
item_name
,
max
=
max_value
,
...
...
@@ -831,7 +837,10 @@ async def elec_index_service_new15(cid, point_id, start, end):
min_value
,
min_time
=
""
,
""
mean_item_name
=
f
"{item}_mean"
avg_value
=
df
[
mean_item_name
]
.
mean
()
avg_value
=
round
(
avg_value
,
2
)
if
avg_value
else
""
if
not
pd
.
isna
(
avg_value
):
avg_value
=
round
(
avg_value
,
2
)
if
avg_value
else
""
else
:
avg_value
=
""
elec_index
=
ElecIndex
(
stats_index
=
item_name
,
max
=
max_value
,
...
...
@@ -862,7 +871,10 @@ async def elec_index_service_new15(cid, point_id, start, end):
avg
=
value
.
get
(
"mean_value"
)
or
''
,
)
)
return
ctnum
,
common_indexes
,
elec_qual_indexes
return
ElecIndexResponse
(
ctnum
=
ctnum
,
common_indexes
=
common_indexes
,
elec_qual_indexes
=
elec_qual_indexes
)
async
def
elec_current_service_new15
(
point_id
):
# 获取mtid
...
...
unify_api/modules/electric/views/electric.py
View file @
cbee7a55
...
...
@@ -475,12 +475,7 @@ async def post_elec_index(req, body: PageRequest) -> ElecIndexResponse:
log
.
error
(
"param error, ranges is NULL"
)
raise
ParamException
(
message
=
"param error, ranges is NULL"
)
# return await elec_index_service(cid, point_id, date_start, date_end)
ctnum
,
common_indexes
,
elec_qual_indexes
=
\
await
elec_index_service_new15
(
cid
,
point_id
,
date_start
,
date_end
)
return
ElecIndexResponse
(
ctnum
=
ctnum
,
common_indexes
=
common_indexes
,
elec_qual_indexes
=
elec_qual_indexes
)
return
await
elec_index_service_new15
(
cid
,
point_id
,
date_start
,
date_end
)
@
summary
(
"电能质量-历史曲线"
)
...
...
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