Commit 8fae28aa authored by ZZH's avatar ZZH

fix real power2023-6-15

parent 2864cf8a
......@@ -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"]
......@@ -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:
......
......@@ -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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment