feat: 不要定数削除
This commit is contained in:
parent
e690661168
commit
51955c7a84
@ -178,15 +178,11 @@ class MasterMainteCSVItem(metaclass=ABCMeta):
|
||||
|
||||
class MasterMainteNewInstEmpCSVItem(MasterMainteCSVItem):
|
||||
"""新規施設担当者登録CSV"""
|
||||
# inst_cd: str # a
|
||||
inst_name: str # b
|
||||
# ta_cd: str # c
|
||||
# emp_cd: str # d
|
||||
emp_name_family: str # e
|
||||
emp_name_first: str # f
|
||||
# bu_cd: str # g
|
||||
start_date: str # h
|
||||
end_date: str # i
|
||||
inst_name: str
|
||||
emp_name_family: str
|
||||
emp_name_first: str
|
||||
start_date: str
|
||||
end_date: str
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
@ -298,20 +294,16 @@ class MasterMainteNewInstEmpCSVItem(MasterMainteCSVItem):
|
||||
|
||||
class MasterMainteChangeInstEmpCSVItem(MasterMainteCSVItem):
|
||||
"""施設担当者変更登録CSV"""
|
||||
# bu_cd: str # a
|
||||
bu_name: str # b
|
||||
org_cd: str # c
|
||||
org_short_name: str # d
|
||||
# inst_cd: str # e
|
||||
inst_name: str # f
|
||||
# ta_cd: str # g
|
||||
explain: str # h
|
||||
# emp_cd: str # i
|
||||
emp_full_name: str # j
|
||||
inst_emp_start_date: str # k
|
||||
inst_emp_end_date: str # l
|
||||
change_end_date: str # m
|
||||
comment: str # n
|
||||
bu_name: str
|
||||
org_cd: str
|
||||
org_short_name: str
|
||||
inst_name: str
|
||||
explain: str
|
||||
emp_full_name: str
|
||||
inst_emp_start_date: str
|
||||
inst_emp_end_date: str
|
||||
change_end_date: str
|
||||
comment: str
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
@ -332,7 +324,6 @@ class MasterMainteChangeInstEmpCSVItem(MasterMainteCSVItem):
|
||||
bu_master_repository,
|
||||
emp_chginst_repository
|
||||
)
|
||||
|
||||
self.bu_cd = self.csv_row[constants.CSV_CHANGE_BU_CD_COL_NO]
|
||||
self.bu_name = self.csv_row[constants.CSV_CHANGE_BU_NAME_COL_NO]
|
||||
self.org_cd = self.csv_row[constants.CSV_CHANGE_ORG_CD_COL_NO]
|
||||
|
||||
@ -20,7 +20,7 @@ class InstEmpCsvUploadViewModel(BaseModel):
|
||||
dialog_msg: Optional[str]
|
||||
|
||||
def select_function_message(self):
|
||||
return self.__new_inst_emp() if self.select_function == 'new' else self.__change_inst_emp()
|
||||
return '新規施設登録' if self.select_function == 'new' else '施設担当者変更'
|
||||
|
||||
def select_table_message(self):
|
||||
return self.__dummy_table() if self.select_table == 'dummy' else self.__real_table()
|
||||
@ -47,16 +47,8 @@ class InstEmpCsvUploadViewModel(BaseModel):
|
||||
return constants.CHANGE_INST_EMP_MAP
|
||||
return []
|
||||
|
||||
# 定数にした方が良さそう
|
||||
|
||||
def __real_table(self):
|
||||
return '本番テーブル'
|
||||
return constants.CSV_REAL_TABLE_NAME
|
||||
|
||||
def __dummy_table(self):
|
||||
return 'ダミーテーブル'
|
||||
|
||||
def __new_inst_emp(self):
|
||||
return '新規施設登録'
|
||||
|
||||
def __change_inst_emp(self):
|
||||
return '施設担当者変更'
|
||||
return constants.CSV_CHANGE_TABLE_NAME
|
||||
|
||||
@ -16,6 +16,7 @@ from src.repositories.mst_inst_repository import MstInstRepository
|
||||
from src.repositories.bu_master_cd_repository import BuMasterRepository
|
||||
from src.repositories.emp_master_repository import EmpMasterRepository
|
||||
from src.repositories.emp_chg_inst_repository import EmpChgInstRepository
|
||||
from src.system_var import constants
|
||||
|
||||
logger = get_logger('マスターメンテ')
|
||||
|
||||
@ -45,7 +46,7 @@ class MasterMainteService(BaseService):
|
||||
csv_file_name: str,
|
||||
csv_upload_form: MasterMainteCsvUpModel) -> InstEmpCsvUploadViewModel:
|
||||
|
||||
if csv_upload_form.select_function != 'new' and csv_upload_form.select_function == 'change':
|
||||
if csv_upload_form.select_function != 'new' and csv_upload_form.select_function != 'change':
|
||||
raise Exception(f'機能の選択値が不正です: {csv_upload_form.select_function}')
|
||||
if csv_upload_form.select_table != 'dummy' and csv_upload_form.select_table != 'real':
|
||||
raise Exception(f'登録テーブルの選択値が不正です: {csv_upload_form.select_table}')
|
||||
@ -127,10 +128,10 @@ class MasterMainteService(BaseService):
|
||||
def __target_table(self, select_table: str):
|
||||
if select_table == 'dummy':
|
||||
table_name = 'src05.emp_chg_inst_wrk'
|
||||
selected_table_msg = 'ダミーテーブル'
|
||||
selected_table_msg = constants.CSV_CHANGE_TABLE_NAME
|
||||
elif select_table == 'real':
|
||||
table_name = 'src05.emp_chg_inst'
|
||||
selected_table_msg = '本番テーブル'
|
||||
selected_table_msg = constants.CSV_REAL_TABLE_NAME
|
||||
else:
|
||||
raise Exception(f'登録テーブルの選択値が不正です: {select_table}')
|
||||
return (table_name, selected_table_msg)
|
||||
|
||||
@ -164,7 +164,7 @@ CHANGE_INST_EMP_MAP = [
|
||||
'コメント' # N
|
||||
]
|
||||
|
||||
# 新規施設担当者登録CSV
|
||||
# 新規施設担当者登録CSV(マスターメンテ)
|
||||
# 施設コードの列No
|
||||
CSV_NEW_INST_CD_COL_NO = 0
|
||||
# 施設名の列No
|
||||
@ -184,7 +184,7 @@ CSV_NEW_START_DATE = 7
|
||||
# 適用終了日の列No
|
||||
CSV_NEW_END_DATE = 8
|
||||
|
||||
# 施設担当者変更登録CSV
|
||||
# 施設担当者変更登録CSV(マスターメンテ)
|
||||
# ビジネスユニットコードの列No
|
||||
CSV_CHANGE_BU_CD_COL_NO = 0
|
||||
# ビジネスユニット名の列No
|
||||
@ -214,6 +214,10 @@ CSV_CHANGE_CHANGE_END_DATE_COL_NO = 12
|
||||
# コメントの列No
|
||||
CSV_CHANGE_COMMENT = 13
|
||||
|
||||
# CSVの列数
|
||||
CSV_NEW_COL_COUNT = 9
|
||||
CSV_CHANGE_COL_COUNT = 14
|
||||
# CSVアップロードの列数(マスターメンテ)
|
||||
CSV_NEW_COL_COUNT = 9 # 新規施設担当者登録CSV
|
||||
CSV_CHANGE_COL_COUNT = 14 # 施設担当者変更登録CSV
|
||||
|
||||
# CSVアップロードテーブル名(マスターメンテ)
|
||||
CSV_REAL_TABLE_NAME = '本番テーブル'
|
||||
CSV_CHANGE_TABLE_NAME = 'ダミーテーブル'
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user