fix: king insert mplogx 参数1获取

This commit is contained in:
caoqianming 2024-04-23 16:18:50 +08:00
parent 41cd2f343d
commit 339fc639e8
1 changed files with 4 additions and 4 deletions

View File

@ -249,8 +249,8 @@ def insert_mplogx_from_king_mqtt(data: dict, is_offset=True):
# num_chunks = (len(objs) + chunk_size - 1) // chunk_size # num_chunks = (len(objs) + chunk_size - 1) // chunk_size
otime_obj = timezone.make_aware(datetime.strptime(pvs["2"], "%Y-%m-%d %H:%M:%S.%f")).replace(microsecond=0) # 只保留到秒级的精度 otime_obj = timezone.make_aware(datetime.strptime(pvs["2"], "%Y-%m-%d %H:%M:%S.%f")).replace(microsecond=0) # 只保留到秒级的精度
oval = pvs["1"]
insert_mplogx_from_king_mqtt_chunk(objs, otime_obj, is_offset) insert_mplogx_from_king_mqtt_chunk(objs, oval, otime_obj, is_offset)
# with concurrent.futures.ThreadPoolExecutor(max_workers=4) as executor: # with concurrent.futures.ThreadPoolExecutor(max_workers=4) as executor:
# futures = [] # futures = []
# for i in range(num_chunks): # for i in range(num_chunks):
@ -263,7 +263,7 @@ def insert_mplogx_from_king_mqtt(data: dict, is_offset=True):
# print(future.result(), end=', ') # print(future.result(), end=', ')
def insert_mplogx_from_king_mqtt_chunk(objs: list, otime_obj: datetime, is_offset=True): def insert_mplogx_from_king_mqtt_chunk(objs: list, oval, otime_obj: datetime, is_offset=True):
""" """
分批存库, 亚控 38.00,00000.11011 版本偏移只是时间戳偏移另外其实可以不在乎 分批存库, 亚控 38.00,00000.11011 版本偏移只是时间戳偏移另外其实可以不在乎
""" """
@ -271,7 +271,7 @@ def insert_mplogx_from_king_mqtt_chunk(objs: list, otime_obj: datetime, is_offse
enp_mpoints_dict = {} # 这个地方主要是需要更新envdata表里的数据 enp_mpoints_dict = {} # 这个地方主要是需要更新envdata表里的数据
for obj in objs: for obj in objs:
n = obj["N"] n = obj["N"]
val = obj["1"] val = obj.get("1", oval)
# timex = obj.get("2", None) # timex = obj.get("2", None)
code = f"K_{n}" code = f"K_{n}"
cache_key = Mpoint.cache_key(code) cache_key = Mpoint.cache_key(code)