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
8fae28aa
Commit
8fae28aa
authored
Jun 15, 2023
by
ZZH
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix real power2023-6-15
parent
2864cf8a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
55 deletions
+28
-55
constants.py
unify_api/constants.py
+12
-6
electric_dao.py
unify_api/modules/electric/dao/electric_dao.py
+1
-1
taos_new.py
unify_api/utils/taos_new.py
+15
-48
No files found.
unify_api/constants.py
View file @
8fae28aa
...
...
@@ -17,8 +17,8 @@ PRODUCT = {
"RecognitionElectricNew"
:
7
,
# 识电U新版
"YangChen"
:
8
,
# 扬尘生态环境管理
"Ulock"
:
9
,
# 运维开锁工具
"ZhiWeiu"
:
10
,
# 智维u
"anShiU"
:
12
,
# 安识u
"ZhiWeiu"
:
10
,
# 智维u
"anShiU"
:
12
,
# 安识u
}
...
...
@@ -35,7 +35,7 @@ class Product(Enum):
RecognitionElectricNew
=
7
# 识电U新版
YangChen
=
8
# 扬尘生态环境管理
Ulock
=
9
# 运维开锁工具
AnShiU
=
12
# 安识u
AnShiU
=
12
# 安识u
# 联动控制开关状态
...
...
@@ -205,7 +205,6 @@ ADD_ELE_PRICE = {0.89: 0.5, 0.88: 1.0, 0.87: 1.5, 0.86: 2.0, 0.85: 2.5,
0.08
:
129
,
0.07
:
131
,
0.06
:
133
,
0.05
:
135
,
0.04
:
137
,
0.03
:
139
,
0.02
:
141
,
0.01
:
143
,
0
:
145
}
# U助手sid白名单
U_WHITE_LIST_SID
=
[
"ctnum2"
,
"ctnum3"
]
...
...
@@ -447,7 +446,6 @@ TDENGINE_CHILD_SUBFIX_LIST = {
"db_electric"
:
"ele"
,
}
# 温度
TEMPERATURE_MAP
=
{
"overTemp"
,
...
...
@@ -475,5 +473,13 @@ ELECTRIC_PARAM_MAP = {
"overPR"
}
CST
=
"Asia/Shanghai"
TD_TBL_POSTFIX
=
{
"electric"
:
"ele"
,
"soe"
:
"soe"
,
"scope"
:
"scp"
,
"adio"
:
"adi"
,
"appliance"
:
"app"
,
"log"
:
"log"
,
"workshop"
:
"wks"
,
"water"
:
"wat"
,
"tsp"
:
"tsp"
,
"ws"
:
"ws"
}
CST
=
"Asia/Shanghai"
\ No newline at end of file
S030_TOPIC
=
[
"electric"
,
"soe"
,
"scope"
,
"adio"
,
"scope"
,
"appliance"
,
"workshop"
,
"log"
]
WG_TOPIC
=
[
"tsp"
,
"water"
,
"water_bromake"
,
"ws"
]
unify_api/modules/electric/dao/electric_dao.py
View file @
8fae28aa
...
...
@@ -65,7 +65,7 @@ async def get_elec_mtid_sid_by_cid(cid):
FROM
monitor
WHERE
cid in
%
s;
cid in
%
s
AND demolished=0
;
"""
)
async
with
MysqlUtil
()
as
conn
:
...
...
unify_api/utils/taos_new.py
View file @
8fae28aa
...
...
@@ -7,6 +7,7 @@ from pot_libs.aiohttp_util.aiohttp_utils import AioHttpUtils
from
pot_libs.settings
import
SETTING
import
base64
from
pot_libs.mysql_util.mysql_util
import
MysqlUtil
from
unify_api.constants
import
S030_TOPIC
,
WG_TOPIC
,
TD_TBL_POSTFIX
async
def
get_td_engine_data
(
url
,
sql
):
...
...
@@ -93,22 +94,6 @@ async def elec_current_data_new16(mtids):
return
res_map
,
{}
def
get_td_table_name
(
topic
,
id
):
"""
:param topic: 需要查询的主题
:param id: 表命名使用的id
:return:
"""
topic_map
=
{
"electric"
:
"mt
%
s_ele"
,
"pv_ele"
:
"pv_ele
%
s"
,
"pv_sts"
:
"pv_sts
%
s"
,
"ws"
:
"ws
%
s"
}
table_name
=
topic_map
.
get
(
topic
)
return
table_name
%
id
# td 3.0
def
td3_tbl_compate
(
td_tables
):
if
len
(
td_tables
)
>
1
:
...
...
@@ -128,35 +113,17 @@ def parse_td_columns(rsp_data):
return
head
def
get_td_table_name
(
topic
,
id
):
"""
:param topic: 需要查询的主题
:param id: 表命名使用的id
:return:
"""
topic_map
=
{
"water"
:
"water_ele_electric_ops
%
s"
,
"electric"
:
"mt
%
s_ele_electric_ops"
,
"pv_ele"
:
"pv_ele
%
s"
,
"pv_sts"
:
"pv_sts
%
s"
,
"ws"
:
"ws
%
s"
,
"adi"
:
"mt
%
s_adi_electric_ops"
,
"pt_temp"
:
"pt_temp
%
s_electric_ops"
,
# 电容
"ent_guard_sts_stb"
:
"ent_guard_sts
%
s"
,
# 门控
"ent_guard_soe_stb"
:
"ent_guard_soe
%
s"
,
# 门控报警
"indoor_temp_stb"
:
"indoor_temp
%
s"
,
# 室内温度
"indoor_temp_soe_stb"
:
"indoor_temp_soe
%
s"
,
# 室内温度报警
"indoor_hum_stb"
:
"indoor_hum
%
s"
,
# 室内湿度
"indoor_hum_soe_stb"
:
"indoor_hum_soe
%
s"
,
# 室内湿度报警
"water_fld_sts_stb"
:
"water_fld_sts
%
s"
,
# 水浸
"water_fld_soe_stb"
:
"water_fld_soe
%
s"
,
# 水浸报警
"smoke_sts_stb"
:
"smoke_sts_stb
%
s"
,
# 烟感
"smoke_soe_stb"
:
"smoke_soe_stb
%
s"
,
# 烟感报警
"old_adio_stb"
:
"s_
%
s_a"
,
# 安电--旧 这里是%s是sid
"new_adio_stb"
:
"mt
%
s_adi"
,
# 安电——新
"old_electric_stb"
:
"s_
%
s_a"
,
"new_electric_stb"
:
"mt
%
s_ele"
,
}
table_name
=
topic_map
.
get
(
topic
)
return
table_name
%
id
def
get_td_table_name
(
topic
,
tbl_id
):
db_name
=
SETTING
.
mysql_db
if
topic
in
S030_TOPIC
:
tbl_name
=
f
"mt{tbl_id}_{TD_TBL_POSTFIX[topic]}"
if
db_name
==
"bromake"
:
tbl_name
+=
"_bromake"
elif
db_name
==
"electric_ops"
:
tbl_name
+=
"_electric_ops"
elif
topic
in
WG_TOPIC
:
tbl_name
=
f
"{topic}{tbl_id}"
else
:
return
None
return
tbl_name
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