Merge remote-tracking branch 'origin/master'

This commit is contained in:
2025-06-18 09:52:57 +08:00
+5 -4
View File
@@ -9,6 +9,11 @@ log = logging.getLogger(__name__)
def sync(province):
log.info(f"开始同步{province}企业数据的居委村委数据")
shape_df = DIDATA_DEV_ELASTIC_CLIENT.scan_by_sql_to_data_frame(
f"select city_name, area_name, street_name, name, shape from community where province_name='{province}'")
if len(shape_df) == 0 or 'shape' not in shape_df.columns or len(shape_df[shape_df['shape'].notna()]) == 0:
log.info(f"{province}无围栏数据")
return
# 先临时禁用索引刷新
DIDATA_DEV_ELASTIC_CLIENT.elastic_client.indices.put_settings(
index="didata_company",
@@ -19,10 +24,6 @@ def sync(province):
company_ids = ids['_id'].to_list()
else:
company_ids = list()
shape_df = DIDATA_DEV_ELASTIC_CLIENT.scan_by_sql_to_data_frame(f"select city_name, area_name, street_name, name, shape from community where province_name='{province}'")
if len(shape_df) == 0 or 'shape' not in shape_df.columns or len(shape_df[shape_df['shape'].notna()]) == 0:
log.info(f"{province}无围栏数据")
return
actions = list()
count = 0
errors = list()