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
d2c161bf
Commit
d2c161bf
authored
Jun 30, 2023
by
lcn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug修复
parent
4c7a3d80
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
44 deletions
+41
-44
electric_service.py
unify_api/modules/electric/service/electric_service.py
+41
-44
No files found.
unify_api/modules/electric/service/electric_service.py
View file @
d2c161bf
...
@@ -20,8 +20,7 @@ from unify_api.modules.electric.procedures.electric_util import \
...
@@ -20,8 +20,7 @@ from unify_api.modules.electric.procedures.electric_util import \
load_point_ctnum
load_point_ctnum
from
datetime
import
datetime
from
datetime
import
datetime
from
unify_api.constants
import
REAL_EXP_TIME
from
unify_api.constants
import
REAL_EXP_TIME
from
unify_api.utils.time_format
import
CST
,
YMD_Hms
,
timestamp2dts
,
\
from
unify_api.utils.time_format
import
CST
,
YMD_Hms
,
timestamp2dts
time_pick_transf
from
unify_api.modules.common.procedures.location_temp_rcurrent
import
\
from
unify_api.modules.common.procedures.location_temp_rcurrent
import
\
location_stats_statics
location_stats_statics
from
unify_api.modules.electric.components.electric
import
(
from
unify_api.modules.electric.components.electric
import
(
...
@@ -347,14 +346,12 @@ async def elec_index_service(cid, point_id, start, end):
...
@@ -347,14 +346,12 @@ async def elec_index_service(cid, point_id, start, end):
ctnum
=
await
load_point_ctnum
(
point_id
)
ctnum
=
await
load_point_ctnum
(
point_id
)
ctnum
=
ctnum
if
ctnum
==
2
else
3
ctnum
=
ctnum
if
ctnum
==
2
else
3
now
=
str
(
datetime
.
now
())
now
=
str
(
datetime
.
now
())
intervel
,
_
=
time_pick_transf
(
start
,
end
)
if
start
[:
10
]
==
now
[:
10
]
and
end
[:
10
]
==
now
[:
10
]:
if
intervel
==
86400
:
table_name
=
"point_1day_electric"
redi_table_name
=
"location_1day_aiao"
else
:
table_name
=
"point_15min_electric"
table_name
=
"point_15min_electric"
redi_table_name
=
"location_15min_aiao"
redi_table_name
=
"location_15min_aiao"
else
:
table_name
=
"point_1day_electric"
redi_table_name
=
"location_1day_aiao"
if
ctnum
==
2
:
if
ctnum
==
2
:
common_items
=
[
"lf_mean"
,
"lf_min"
,
"lf_max"
,
"pttl_mean"
,
"pttl_min"
,
common_items
=
[
"lf_mean"
,
"lf_min"
,
"lf_max"
,
"pttl_mean"
,
"pttl_min"
,
"pttl_max"
,
"qttl_mean"
,
"qttl_min"
,
"qttl_max"
,
"pttl_max"
,
"qttl_mean"
,
"qttl_min"
,
"qttl_max"
,
...
@@ -463,7 +460,7 @@ async def elec_index_service(cid, point_id, start, end):
...
@@ -463,7 +460,7 @@ async def elec_index_service(cid, point_id, start, end):
mean_item_name
=
f
"{item}_mean"
mean_item_name
=
f
"{item}_mean"
avg_value
=
df
[
mean_item_name
]
.
mean
()
avg_value
=
df
[
mean_item_name
]
.
mean
()
if
not
pd
.
isna
(
avg_value
):
if
not
pd
.
isna
(
avg_value
):
avg_value
=
round
(
avg_value
,
2
)
if
avg_value
else
""
avg_value
=
round
(
avg_value
,
4
)
if
avg_value
else
""
else
:
else
:
avg_value
=
""
avg_value
=
""
elec_index
=
ElecIndex
(
elec_index
=
ElecIndex
(
...
...
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