Merge branch 'fix-NEWDWH2021-1360' of https://nds-tyo.backlog.com/git/NEWDWH2021/newsdwh2021 into fix-NEWDWH2021-1360
This commit is contained in:
commit
6bfede2fa9
35
ecs/jskult-batch-daily/sample_create_bio_sales_lot.py
Normal file
35
ecs/jskult-batch-daily/sample_create_bio_sales_lot.py
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
# import src.batch.bio_sales.create_bio_sales_lot as create_bio_sales_lot
|
||||||
|
import src.batch.common.batch_context as batch_context
|
||||||
|
import src.batch.ultmarc.ultmarc_process as ultmarc_process
|
||||||
|
|
||||||
|
# context = batch_context.BatchContext.get_instance().is_ultmarc_imported = True
|
||||||
|
context = batch_context.BatchContext.get_instance()
|
||||||
|
context.syor_date = '2023/09/28'
|
||||||
|
|
||||||
|
# import gzip
|
||||||
|
# import os
|
||||||
|
# import tarfile
|
||||||
|
|
||||||
|
|
||||||
|
# def main():
|
||||||
|
|
||||||
|
# gzname = '/Users/shimoda.m/Downloads/bio_slip_data_20230612204112.gz'
|
||||||
|
# ret = []
|
||||||
|
# with tarfile.open(gzname, 'r') as tar:
|
||||||
|
# temp_dir = os.path.dirname(gzname)
|
||||||
|
# tar.extractall(path=temp_dir)
|
||||||
|
# extracted_files = tar.getnames()
|
||||||
|
# for extracted_file in extracted_files:
|
||||||
|
# file = os.path.join(temp_dir, extracted_file)
|
||||||
|
# ret.append(file)
|
||||||
|
# return ret
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
# main()
|
||||||
|
ultmarc_process.exec_import()
|
||||||
|
|
||||||
|
# create_bio_sales_lot.exec()
|
||||||
|
|
||||||
|
|
||||||
|
# tar -zxvf '/Users/shimoda.m/Downloads/bio_slip_data_20230612204112-1.gz'
|
||||||
@ -182,6 +182,10 @@ class ComDrWrkplaceMapper(UltmarcTableMapper):
|
|||||||
def __make_queries(self):
|
def __make_queries(self):
|
||||||
# レコードの存在確認
|
# レコードの存在確認
|
||||||
record_count = self.db.execute_select(self.RECORD_EXISTS_QUERY, self.query_parameter)
|
record_count = self.db.execute_select(self.RECORD_EXISTS_QUERY, self.query_parameter)
|
||||||
|
|
||||||
|
# 「@」による項目クリアを設定
|
||||||
|
self.__set_clearing_item()
|
||||||
|
|
||||||
# 存在しない場合はInsert
|
# 存在しない場合はInsert
|
||||||
if record_count[0]['count_num'] == 0:
|
if record_count[0]['count_num'] == 0:
|
||||||
return [self.INSERT_QUERY]
|
return [self.INSERT_QUERY]
|
||||||
@ -204,8 +208,6 @@ class ComDrWrkplaceMapper(UltmarcTableMapper):
|
|||||||
# DM不可フラグの値をセット
|
# DM不可フラグの値をセット
|
||||||
# 履歴レコード作成判断とならないため、後から設定
|
# 履歴レコード作成判断とならないため、後から設定
|
||||||
if self.record.notdm_flg != '':
|
if self.record.notdm_flg != '':
|
||||||
notdm_flg = None if self.record.notdm_flg == '@' else self.record.notdm_flg
|
|
||||||
self.query_parameter['notdm_flg'] = notdm_flg
|
|
||||||
set_clause_without_historical.append(f'notdm_flg = :notdm_flg')
|
set_clause_without_historical.append(f'notdm_flg = :notdm_flg')
|
||||||
# 何かしら更新がある場合、履歴作成クエリを作成
|
# 何かしら更新がある場合、履歴作成クエリを作成
|
||||||
if len(set_clauses_with_historical) != 0:
|
if len(set_clauses_with_historical) != 0:
|
||||||
@ -230,24 +232,16 @@ class ComDrWrkplaceMapper(UltmarcTableMapper):
|
|||||||
# 役職コード
|
# 役職コード
|
||||||
if self.record.postcode != '':
|
if self.record.postcode != '':
|
||||||
set_clauses.append('post_cd = :postcode')
|
set_clauses.append('post_cd = :postcode')
|
||||||
self.query_parameter['postcode'] = '' if self.record.postcode == '@' else self.record.postcode
|
|
||||||
# 大学順位
|
# 大学順位
|
||||||
if self.record.identitycode != '':
|
if self.record.identitycode != '':
|
||||||
set_clauses.append('identity_cd = :identitycode')
|
set_clauses.append('identity_cd = :identitycode')
|
||||||
self.query_parameter['identitycode'] = '' if self.record.identitycode == '@' else self.record.identitycode
|
|
||||||
# 所属部科(集合項目)
|
# 所属部科(集合項目)
|
||||||
if self.record.sectcode != '':
|
if self.record.sectcode != '':
|
||||||
# 所属部科コード
|
# 所属部科コード
|
||||||
self.query_parameter['sectcode'] = '9999' if self.record.sectcode == '@' else self.record.sectcode
|
|
||||||
set_clauses.append('blng_sec_cd = :sectcode')
|
set_clauses.append('blng_sec_cd = :sectcode')
|
||||||
# 所属部科(カナ)
|
# 所属部科(カナ)
|
||||||
sectname_kana = None if self.record.sectname_kana == '@' else self.record.sectname_kana
|
|
||||||
self.query_parameter['sectname_kana'] = sectname_kana
|
|
||||||
set_clauses.append(f'blng_sec_name_kana = :sectname_kana')
|
set_clauses.append(f'blng_sec_name_kana = :sectname_kana')
|
||||||
# 所属部科(漢字)
|
# 所属部科(漢字)
|
||||||
# 全角文字なので、修正項目として全角@が連携されるパターンがある
|
|
||||||
sectname = None if self.record.sectname == '@' else self.record.sectname
|
|
||||||
self.query_parameter['sectname'] = sectname
|
|
||||||
set_clauses.append(f'blng_sec_name = :sectname')
|
set_clauses.append(f'blng_sec_name = :sectname')
|
||||||
|
|
||||||
# 何かしら更新がある場合、適用開始日をセットする
|
# 何かしら更新がある場合、適用開始日をセットする
|
||||||
@ -256,3 +250,32 @@ class ComDrWrkplaceMapper(UltmarcTableMapper):
|
|||||||
set_clauses.append("aply_start_ymd = DATE_FORMAT(:syor_date, '%Y%m%d')")
|
set_clauses.append("aply_start_ymd = DATE_FORMAT(:syor_date, '%Y%m%d')")
|
||||||
|
|
||||||
return set_clauses
|
return set_clauses
|
||||||
|
|
||||||
|
def __set_clearing_item(self):
|
||||||
|
|
||||||
|
# 役職コード
|
||||||
|
if self.record.postcode == '@':
|
||||||
|
# NOT NULLのため、空文字をセット
|
||||||
|
self.query_parameter['postcode'] = ''
|
||||||
|
# 大学順位
|
||||||
|
if self.record.identitycode == '@':
|
||||||
|
# NOT NULLのため、空文字をセット
|
||||||
|
self.query_parameter['identitycode'] = ''
|
||||||
|
# DM不可フラグ
|
||||||
|
if self.record.notdm_flg == '@':
|
||||||
|
self.query_parameter['notdm_flg'] = None
|
||||||
|
|
||||||
|
# 以下、実際には項目のクリアが発生しない為不要なロジックだが、現行踏襲の為残しておく
|
||||||
|
# 所属部科コード
|
||||||
|
if self.record.sectcode == '@':
|
||||||
|
# NOT NULLのため、固定の所属部科コードをセット
|
||||||
|
self.query_parameter['sectcode'] = '9999'
|
||||||
|
# 所属部科(カナ)
|
||||||
|
if self.record.sectname_kana == '@':
|
||||||
|
self.query_parameter['sectname_kana'] = None
|
||||||
|
# 所属部科(漢字)
|
||||||
|
# 全角の項目なので、修正項目値として全角@が連携される
|
||||||
|
if self.record.sectname == '@':
|
||||||
|
self.query_parameter['sectname'] = None
|
||||||
|
|
||||||
|
return
|
||||||
|
|||||||
@ -8,3 +8,4 @@
|
|||||||
"502","01","997906","","A","00","5504428","","2","20141113","20141114","","144","7212","","",""
|
"502","01","997906","","A","00","5504428","","2","20141113","20141114","","144","7212","","",""
|
||||||
"502","01","997906","","A","00","5507600","","2","20141113","20141114","","144","9114","","",""
|
"502","01","997906","","A","00","5507600","","2","20141113","20141114","","144","9114","","",""
|
||||||
"502","01","999613","","A","00","5504428","","2","20141113","20141114","","144","5140","","",""
|
"502","01","999613","","A","00","5504428","","2","20141113","20141114","","144","5140","","",""
|
||||||
|
"502","01","995784","","B","00","5507600","","2","20170907","20170910","@","@","@","@","@","@"
|
||||||
|
|||||||
|
@ -9,3 +9,4 @@
|
|||||||
"005504428","01997906","7212",,"144","2020-02-22","ユケツ.サイボウチリヨウガク","輸血・細胞治療学",,"2022-02-02","NULL","NULL","NULL","NULL","NULL","2022-02-02 10:45:17","com_dr_wrkplace_mapper","2022-02-02 14:54:00","com_dr_wrkplace_mapper"
|
"005504428","01997906","7212",,"144","2020-02-22","ユケツ.サイボウチリヨウガク","輸血・細胞治療学",,"2022-02-02","NULL","NULL","NULL","NULL","NULL","2022-02-02 10:45:17","com_dr_wrkplace_mapper","2022-02-02 14:54:00","com_dr_wrkplace_mapper"
|
||||||
"005507600","01997906","9114",,"144","2020-02-22","サイボウイシヨクブモン","細胞移植部門",,"2022-02-02","NULL","NULL","NULL","NULL","NULL","2022-02-02 10:45:17","com_dr_wrkplace_mapper","2022-02-02 14:54:00","com_dr_wrkplace_mapper"
|
"005507600","01997906","9114",,"144","2020-02-22","サイボウイシヨクブモン","細胞移植部門",,"2022-02-02","NULL","NULL","NULL","NULL","NULL","2022-02-02 10:45:17","com_dr_wrkplace_mapper","2022-02-02 14:54:00","com_dr_wrkplace_mapper"
|
||||||
"005504428","01999613","5140",,"144","2020-02-22","ヤクリガク","薬理学",,"2022-02-02","NULL","NULL","NULL","NULL","NULL","2022-02-02 10:45:17","com_dr_wrkplace_mapper","2022-02-02 14:54:00","com_dr_wrkplace_mapper"
|
"005504428","01999613","5140",,"144","2020-02-22","ヤクリガク","薬理学",,"2022-02-02","NULL","NULL","NULL","NULL","NULL","2022-02-02 10:45:17","com_dr_wrkplace_mapper","2022-02-02 14:54:00","com_dr_wrkplace_mapper"
|
||||||
|
"005507600","01995784","9999",,,"2020-02-22","NULL","NULL","NULL","2022-02-02","NULL","NULL","NULL","NULL","NULL","2022-02-02 10:45:17","com_dr_wrkplace_mapper","2022-02-02 14:54:00","com_dr_wrkplace_mapper"
|
||||||
|
|||||||
|
Loading…
x
Reference in New Issue
Block a user