水准数据模型一些修改
This commit is contained in:
@@ -10,6 +10,16 @@ from insert_data_online import (
|
||||
batch_import_level_data,
|
||||
batch_import_original_data
|
||||
)
|
||||
import logging
|
||||
# 配置日志
|
||||
logging.basicConfig(
|
||||
level=logging.INFO,
|
||||
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
|
||||
filename='tools.log',
|
||||
filemode='a',
|
||||
encoding='utf-8'
|
||||
)
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
# ------------------------------ 核心配置 ------------------------------
|
||||
DATA_TYPE_MAPPING = {
|
||||
@@ -286,22 +296,22 @@ def batch_import(data_list, data_type, settlement_nyids=None, progress=None):
|
||||
print(f"\n=== [入库] {data_type} 第 {batch_num} 批(共{total}条,当前{batch_len}条)===")
|
||||
|
||||
# 水准数据过滤:仅保留沉降已存在的NYID
|
||||
# if data_type == "level" and settlement_nyids is not None:
|
||||
# valid_batch = [
|
||||
# item for item in batch_data
|
||||
# if str(item.get("NYID", "")) in settlement_nyids
|
||||
# ]
|
||||
# invalid_count = batch_len - len(valid_batch)
|
||||
# if invalid_count > 0:
|
||||
# print(f"[入库] 过滤 {invalid_count} 条无效水准数据(NYID不在沉降列表中)")
|
||||
# batch_data = valid_batch
|
||||
# batch_len = len(batch_data)
|
||||
# if batch_len == 0:
|
||||
# print(f"[入库] 第 {batch_num} 批无有效数据 → 跳过")
|
||||
# # 标记为空批次已处理
|
||||
# progress["processed_batches"][data_type].append(batch_num)
|
||||
# save_progress(progress)
|
||||
# continue
|
||||
if data_type == "level" and settlement_nyids is not None:
|
||||
valid_batch = [
|
||||
item for item in batch_data
|
||||
if str(item.get("NYID", "")) in settlement_nyids
|
||||
]
|
||||
invalid_count = batch_len - len(valid_batch)
|
||||
if invalid_count > 0:
|
||||
print(f"[入库] 过滤 {invalid_count} 条无效水准数据(NYID不在沉降列表中)")
|
||||
batch_data = valid_batch
|
||||
batch_len = len(batch_data)
|
||||
if batch_len == 0:
|
||||
print(f"[入库] 第 {batch_num} 批无有效数据 → 跳过")
|
||||
# 标记为空批次已处理
|
||||
progress["processed_batches"][data_type].append(batch_num)
|
||||
save_progress(progress)
|
||||
continue
|
||||
|
||||
# 重试机制
|
||||
retry_count = 0
|
||||
|
||||
Reference in New Issue
Block a user