From e39c52849c9ead01e145c6241c741179fea15a23 Mon Sep 17 00:00:00 2001 From: "shenjian@fangjia.com" Date: Thu, 6 Apr 2023 13:47:44 +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/business/business/change_new_to_old_seaweed.py | 8 ++++---- dags/mt/supply/comm.py | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/dags/business/business/change_new_to_old_seaweed.py b/dags/business/business/change_new_to_old_seaweed.py index 14e6e21..2396db7 100644 --- a/dags/business/business/change_new_to_old_seaweed.py +++ b/dags/business/business/change_new_to_old_seaweed.py @@ -29,16 +29,16 @@ def do(): global count is_old = False time_now = int(time.mktime(time.strptime(datetime.datetime.now().strftime('%Y-%m-%d'), '%Y-%m-%d'))) - if 'open_date' in x and pd.notna(x['open_date']): + if 'open_date' in x and pd.notna(x['open_date']) and str(x['open_date']) != '': time_old = int(time.mktime(time.strptime(dateutils.format_date(dateutils.add_months(x['open_date'], years=3), '%Y-%m-%d'), '%Y-%m-%d'))) if time_old < time_now: is_old = True - if is_old is False and 'live_date' in x and pd.notna(x['live_date']): + if is_old is False and 'live_date' in x and pd.notna(x['live_date']) and str(x['live_date']) != '': time_old = int(time.mktime(time.strptime(dateutils.format_date(dateutils.add_months(dateutils.parse_date(x['live_date']), years=3), '%Y-%m-%d'), '%Y-%m-%d'))) if time_old < time_now: is_old = True - if is_old is False and 'create_year' in x and pd.notna(x['create_year']): - time_old = int(time.mktime(time.strptime(dateutils.format_date(dateutils.add_months(dateutils.parse_date(x['create_year'], '%Y-%m'), years=3), '%Y-%m-%d'), '%Y-%m-%d'))) + if is_old is False and 'create_year' in x and pd.notna(x['create_year']) and str(x['create_year']) != '': + time_old = int(time.mktime(time.strptime(dateutils.format_date(dateutils.add_months(dateutils.parse_date(x['create_year'], '%Y'), years=3), '%Y-%m-%d'), '%Y-%m-%d'))) if time_old < time_now: is_old = True # 查询样本库 diff --git a/dags/mt/supply/comm.py b/dags/mt/supply/comm.py index 50daf40..8bb5858 100644 --- a/dags/mt/supply/comm.py +++ b/dags/mt/supply/comm.py @@ -22,7 +22,7 @@ print("输出日期" + output_date) seaweed_df = pd.DataFrame() for city in cities: - temp_df = pd.DataFrame(list(seaweed_conn.find({'cat': 'district', 'status': 0, 'city': city}).batch_size(10000))) + temp_df = pd.DataFrame(list(seaweed_conn.find({'cat': 'district', 'status': 0, 'city': city}).batch_size(100000))) seaweed_df = pd.concat([seaweed_df, temp_df]) seaweed_result_df = seaweed_df[