From 237e88d79f0534d57fb36eb381d773b7b9fd8d1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B2=88=E5=81=A5?= Date: Thu, 5 Jun 2025 17:08:03 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dags/company/company/comm.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/dags/company/company/comm.py b/dags/company/company/comm.py index ab34272..ba0fe86 100644 --- a/dags/company/company/comm.py +++ b/dags/company/company/comm.py @@ -10,8 +10,10 @@ log = logging.getLogger(__name__) def sync(province): log.info(f"开始同步{province}企业数据的居委村委数据") ids = DIDATA_DEV_ELASTIC_CLIENT.scan_by_sql_to_data_frame(f"select company_name from didata_company where province='{province}'") - company_ids = ids['_id'].to_list() - + if len(ids) > 0: + 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: log.info(f"{province}无围栏数据") @@ -76,5 +78,7 @@ def sync(province): actions.clear() #pd.DataFrame(errors)[['registered_address', 'company_name', 'province', 'city', 'district', 'gaode_location']].to_csv(f'{province}经纬度错误地址.csv', index=False) log.info(f"完成同步{province}企业数据的居委村委数据") + + for province in areautils.get_all_province(): sync(province)