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
49f61cbc
Commit
49f61cbc
authored
Apr 11, 2023
by
wang.wenrong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
安电u+
parent
884ef9e5
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
16 additions
and
2 deletions
+16
-2
elec_charge_cps.py
unify_api/modules/elec_charge/components/elec_charge_cps.py
+12
-1
electric_service.py
unify_api/modules/electric/service/electric_service.py
+1
-1
electric.py
unify_api/modules/electric/views/electric.py
+1
-0
taos_new.py
unify_api/utils/taos_new.py
+2
-0
No files found.
unify_api/modules/elec_charge/components/elec_charge_cps.py
View file @
49f61cbc
...
@@ -3,7 +3,7 @@ from dataclasses import dataclass
...
@@ -3,7 +3,7 @@ from dataclasses import dataclass
from
pot_libs.common.components.fields
import
Cid
from
pot_libs.common.components.fields
import
Cid
from
pot_libs.sanic_api
import
Model
from
pot_libs.sanic_api
import
Model
from
pot_libs.sanic_api.column
import
Float
,
List
,
Str
,
Opt
,
Int
,
Dict
from
pot_libs.sanic_api.column
import
Float
,
List
,
Str
,
Opt
,
Int
,
Dict
from
unify_api.utils.response_code
import
DbErr
from
unify_api.utils.response_code
import
DbErr
,
ServerErr
@
dataclass
@
dataclass
...
@@ -186,3 +186,14 @@ class KclReq(Model):
...
@@ -186,3 +186,14 @@ class KclReq(Model):
class
ProductProxyReq
(
Model
):
class
ProductProxyReq
(
Model
):
product
:
int
=
Opt
(
Int
(
"项目id"
))
product
:
int
=
Opt
(
Int
(
"项目id"
))
proxy_id
:
int
=
Opt
(
Int
(
"代理id, 当product是管理版3,5时 必传"
))
proxy_id
:
int
=
Opt
(
Int
(
"代理id, 当product是管理版3,5时 必传"
))
@
dataclass
class
LoadInfoReq
(
Model
):
product
:
int
=
Opt
(
Int
(
"项目id"
))
proxy_id
:
int
=
Opt
(
Int
(
"代理id, 当product是管理版3,5时 必传"
))
@
dataclass
class
LoadInfoResp
(
Model
,
DbErr
,
ServerErr
):
current_load
:
float
=
Opt
(
Float
(
"今日实时负荷, 单位kW"
)
.
eg
(
8263.2
))
yesterday_load
:
float
=
Opt
(
Float
(
"昨日同时负荷, 单位kW"
)
.
eg
(
8000
))
load_percent
:
float
=
Opt
(
Float
(
"对比昨日,百分比"
)
.
eg
(
1
))
unify_api/modules/electric/service/electric_service.py
View file @
49f61cbc
...
@@ -888,7 +888,7 @@ async def elec_current_service_new15(point_id):
...
@@ -888,7 +888,7 @@ async def elec_current_service_new15(point_id):
url
=
f
"{SETTING.stb_url}db_electric?tz=Asia/Shanghai"
url
=
f
"{SETTING.stb_url}db_electric?tz=Asia/Shanghai"
sql
=
f
"select last_row(*) from mt{mtid}_ele where pid={point_id}"
sql
=
f
"select last_row(*) from mt{mtid}_ele where pid={point_id}"
is_succ
,
results
=
await
get_td_engine_data
(
url
,
sql
)
is_succ
,
results
=
await
get_td_engine_data
(
url
,
sql
)
if
not
is_succ
:
if
not
is_succ
or
not
results
:
return
''
,
{}
return
''
,
{}
head
=
parse_td_columns
(
results
)
head
=
parse_td_columns
(
results
)
if
not
results
[
"data"
]:
if
not
results
[
"data"
]:
...
...
unify_api/modules/electric/views/electric.py
View file @
49f61cbc
...
@@ -58,6 +58,7 @@ from unify_api.modules.electric.components.electric import (
...
@@ -58,6 +58,7 @@ from unify_api.modules.electric.components.electric import (
from
unify_api.utils.request_util
import
filed_value_from_list
from
unify_api.utils.request_util
import
filed_value_from_list
from
unify_api.modules.electric.dao.electric_dao
import
get_qual_history_dao
,
\
from
unify_api.modules.electric.dao.electric_dao
import
get_qual_history_dao
,
\
get_elec_history_dao
get_elec_history_dao
from
unify_api.utils.taos_new
import
parse_td_columns
METERDATA_CURRENT_KEY
=
"meterdata_current"
METERDATA_CURRENT_KEY
=
"meterdata_current"
METERDATA_CURRENT_HR_KEY
=
"meterdata_hr_current"
METERDATA_CURRENT_HR_KEY
=
"meterdata_hr_current"
...
...
unify_api/utils/taos_new.py
View file @
49f61cbc
...
@@ -118,6 +118,8 @@ def td3_tbl_compate(td_tables):
...
@@ -118,6 +118,8 @@ def td3_tbl_compate(td_tables):
def
parse_td_columns
(
rsp_data
):
def
parse_td_columns
(
rsp_data
):
head
=
[]
head
=
[]
if
not
rsp_data
.
get
(
"column_meta"
):
return
[]
for
col
in
rsp_data
[
"column_meta"
]:
for
col
in
rsp_data
[
"column_meta"
]:
r
=
re
.
findall
(
r'last_row\((.*)\)'
,
col
[
0
])
r
=
re
.
findall
(
r'last_row\((.*)\)'
,
col
[
0
])
tbl_field
=
r
[
0
]
if
r
else
col
[
0
]
tbl_field
=
r
[
0
]
if
r
else
col
[
0
]
...
...
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