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)