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
7129b651
Commit
7129b651
authored
Jun 20, 2023
by
lcn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug修复
parent
56ab5c00
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
6 deletions
+12
-6
electric_pds.py
unify_api/modules/electric/procedures/electric_pds.py
+12
-6
No files found.
unify_api/modules/electric/procedures/electric_pds.py
View file @
7129b651
import
pendulum
from
pot_libs.settings
import
SETTING
from
pot_libs.settings
import
SETTING
from
unify_api.constants
import
CST
from
unify_api.modules.common.service.td_engine_service
import
\
from
unify_api.modules.common.service.td_engine_service
import
\
get_td_engine_data
get_td_engine_data
from
unify_api.utils.taos_new
import
parse_td_columns
from
unify_api.utils.taos_new
import
parse_td_columns
,
td3_tbl_compate
async
def
elec_current_data
(
mtids
,
cid
):
async
def
elec_current_data
(
mtids
,
cid
):
res_map
=
{}
res_map
=
{}
last_15min_time
=
pendulum
.
now
(
tz
=
CST
)
.
subtract
(
minutes
=
15
)
.
format
(
"YYYY-MM-DD HH:mm:ss"
)
url
=
f
"{SETTING.stb_url}db_electric?tz=Asia/Shanghai"
url
=
f
"{SETTING.stb_url}db_electric?tz=Asia/Shanghai"
sql
=
f
"""
select tbname,last_row(*) from electric_stb
table_name
=
[
"mt{}_ele"
.
format
(
mtid
)
for
mtid
in
mtids
]
where cpyid={cid}
td_tables
=
td3_tbl_compate
(
table_name
)
group by tbname
sql
=
f
"select last_row(*) from electric_stb "
\
"""
f
"where TBNAME IN {td_tables} and ts >= '{last_15min_time}' "
\
f
"group by tbname"
is_succ
,
results
=
await
get_td_engine_data
(
url
,
sql
)
is_succ
,
results
=
await
get_td_engine_data
(
url
,
sql
)
if
is_succ
:
if
is_succ
:
head
=
parse_td_columns
(
results
)
head
=
parse_td_columns
(
results
)
...
...
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