メール作成機能変更
This commit is contained in:
parent
384e069fb8
commit
fd975d55c8
@ -102,19 +102,17 @@ def put_success_messages_to_dynamo_db(batch_success_items: list[str]) -> bool:
|
||||
return True
|
||||
|
||||
|
||||
def substitute_mail_template(mail_template: str, receive_timing: str, mail_msg: str) -> str:
|
||||
def substitute_mail_template(mail_template: str, mail_msg: str) -> str:
|
||||
"""メールテンプレートのプレースホルダーを置き換える
|
||||
|
||||
Args:
|
||||
mail_template (str): 置き換え前のメールテンプレート
|
||||
receive_timing (str): メールテンプレートのプレースホルダーを置き換える文言(受信タイミング)
|
||||
mail_msg (str): メールテンプレートのプレースホルダーを置き換える文言(ファイル一覧)
|
||||
|
||||
Returns:
|
||||
str: 置き換え後のメール本文
|
||||
"""
|
||||
substitute_dict = {
|
||||
"receive_timing": receive_timing,
|
||||
"notice_file_names": mail_msg
|
||||
}
|
||||
mail_str = mail_template.format_map(substitute_dict)
|
||||
@ -179,9 +177,9 @@ def daily_data_unreceive_check(records: list, execute_date: str) -> tuple[list[d
|
||||
continue
|
||||
|
||||
# ④ 受領チェック処理を行う
|
||||
receive_timing = execute_date.strftime('%Y/%m/%d')
|
||||
receive_date = execute_date.strftime('%Y/%m/%d')
|
||||
logger.info(f'I-04-01 日次データ受領チェック ({event_parameter['data_source_name']}) 処理開始')
|
||||
object_prefix = f'{event_parameter["check_folder_prefix"]}/{receive_timing}/'
|
||||
object_prefix = f'{event_parameter["check_folder_prefix"]}/{receive_date}/'
|
||||
|
||||
# 1.日次データバックアップ保管バケットの処理稼働月に該当するサブフォルダにあるファイル一覧を取得する
|
||||
logger.info(f'I-04-02 オブジェクトリストの取得 取得先:{event_parameter['check_bucket_name']}/{object_prefix}')
|
||||
@ -238,8 +236,7 @@ def daily_data_unreceive_check(records: list, execute_date: str) -> tuple[list[d
|
||||
)
|
||||
mail_title_template = (mail_title_response['Body'].read().decode('utf-8'))
|
||||
# 改行を取り除く
|
||||
mail_title = substitute_mail_template(mail_title_template, receive_timing, mail_message)
|
||||
mail_title_without_line_break = mail_title.splitlines()[0]
|
||||
mail_title_without_line_break = mail_title_template.splitlines()[0]
|
||||
logger.info('I-05-04 通知メール(タイトル)テンプレートファイルを読み込みました')
|
||||
except Exception as e:
|
||||
logger.exception(
|
||||
@ -256,7 +253,7 @@ def daily_data_unreceive_check(records: list, execute_date: str) -> tuple[list[d
|
||||
)
|
||||
mail_body_template = (mail_body_template_response['Body'].read().decode('utf-8'))
|
||||
# メール本文内のプレースホルダーを置き換える
|
||||
mail_body = substitute_mail_template(mail_body_template, receive_timing, mail_message)
|
||||
mail_body = substitute_mail_template(mail_body_template, mail_message)
|
||||
logger.info('I-05-06 通知メール(本文)テンプレートファイルを読み込みました')
|
||||
except Exception as e:
|
||||
logger.exception(f'E-05-02 通知メール(本文)テンプレートファイルの読み込みに失敗しました エラー内容:{e}')
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user