From 87e15d87413f56f1a3dc105dedc9ab0ff53a8529 Mon Sep 17 00:00:00 2001 From: "shenjian@fangjia.com" Date: Wed, 16 Nov 2022 10:15:08 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=B1=85=E4=BD=8F=E4=BA=BA?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dags/business/business/community/other.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/dags/business/business/community/other.py b/dags/business/business/community/other.py index d336fcf..35351b1 100644 --- a/dags/business/business/community/other.py +++ b/dags/business/business/community/other.py @@ -58,6 +58,8 @@ def deal(actions, x): doc_info['estate_charge_ranking'] = estate_charge_ranking if pd.notna(x['avg_price']) and pd.notna(x['rent_price']): doc_info['sell_to_rent'] = int(x['avg_price'] / x['rent_price']) + if pd.notna(x['household_count']): + doc_info['person_num'] = int(x['household_count'] * 2.3) action_doc = { "_op_type": "update", @@ -70,14 +72,14 @@ def deal(actions, x): if len(actions) == 5000: helpers.bulk(es206_client.elastic_client, actions) count += len(actions) - log.info(f"物业费等级、售租比已更新{count}") + log.info(f"物业费等级、售租比、人口数已更新{count}") actions.clear() def sync(city=None): - log.info(f"开始同步物业费等级、售租比至206 {index_name}") + log.info(f"开始同步物业费等级、售租比、人口数至206 {index_name}") - sql = "select city, region, name, estate_charge, finish_building_date, build_type, avg_price, rent_price from community_summary" + sql = "select city, region, name, estate_charge, finish_building_date, build_type, avg_price, rent_price, household_count from community_summary" if pd.notna(city): sql += " where city='" + city + "'" community_summary_df = es206_client.scan_by_sql_to_data_frame(sql) @@ -89,7 +91,7 @@ def sync(city=None): helpers.bulk(es206_client.elastic_client, actions) actions.clear() - log.info(f"完成同步物业费等级、售租比至206 {index_name}") + log.info(f"完成同步物业费等级、售租比、人口数至206 {index_name}") sync() \ No newline at end of file