def parse_excel(report: SendReport): if isinstance(report, IndividualSendReport): elements1 = bl_ind.get_base_elements(CODE) elements2 = bl_ind.get_base_elements(CODE_ADDITIONAL1) n0 = OrderedDict() n1 = OrderedDict() for element in elements1: if element['data_type'] == 'STRING': n0[element['element_name']] = str for element in elements2: if element['data_type'] == 'STRING': n1[element['element_name']] = str file_data_0 = excel_data.get_excel_data(n0, CODE, "sheet_0", report) file_data_1 = excel_data.get_excel_data(n1, CODE, "sheet_1", report) df1 = pd.DataFrame(elements1) df2 = pd.DataFrame(elements2) main_datas = bl_ind.extract_data(file_data_0, df1['element_name'].to_list()) additional_datas1 = bl_ind.extract_data(file_data_1, df2['element_name'].to_list()) elif isinstance(report, EnterpriseSendReport): elements1 = bl_ent.get_base_elements(CODE) elements2 = bl_ent.get_base_elements(CODE_ADDITIONAL1) n0 = OrderedDict() n1 = OrderedDict() for element in elements1: if element['data_type'] == 'STRING': n0[element['element_name']] = str for element in elements2: if element['data_type'] == 'STRING': n1[element['element_name']] = str file_data_0 = excel_data.get_excel_data(n0, CODE, "sheet_0", report) file_data_1 = excel_data.get_excel_data(n1, CODE, "sheet_1", report) df1 = pd.DataFrame(elements1) df2 = pd.DataFrame(elements2) main_datas = bl_ent.extract_data(file_data_0, df1['element_name'].to_list()) additional_datas1 = bl_ent.extract_data(file_data_1, df2['element_name'].to_list()) else: logging.error('report type error:{0}'.format(report)) datas = build_master_agrmt( main_datas, additional_datas1, df1[df1['status'] == '0']['element_name'].to_list(), df2[df2['status'] == '0']['element_name'].to_list()) report.jsonData = datas
def parse_excel(report: SendReport): if isinstance(report, IndividualSendReport): elements1 = bl_ind.get_base_elements(CODE) elements2 = bl_ind.get_base_elements(CODE_ADDITIONAL1) elements3 = bl_ind.get_base_elements(CODE_ADDITIONAL2) elements4 = bl_ind.get_base_elements(CODE_ADDITIONAL3) elements5 = bl_ind.get_base_elements(CODE_ADDITIONAL4) elements6 = bl_ind.get_base_elements(CODE_ADDITIONAL5) elements7 = bl_ind.get_base_elements(CODE_ADDITIONAL6) elements8 = bl_ind.get_base_elements(CODE_ADDITIONAL7) elements9 = bl_ind.get_base_elements(CODE_ADDITIONAL8) n0 = OrderedDict() n1 = OrderedDict() n2 = OrderedDict() n3 = OrderedDict() n4 = OrderedDict() n5 = OrderedDict() n6 = OrderedDict() n7 = OrderedDict() n8 = OrderedDict() for element in elements1: if element['data_type'] == 'STRING': n0[element['element_name']] = str for element in elements2: if element['data_type'] == 'STRING': n1[element['element_name']] = str for element in elements3: if element['data_type'] == 'STRING': n2[element['element_name']] = str for element in elements4: if element['data_type'] == 'STRING': n3[element['element_name']] = str for element in elements5: if element['data_type'] == 'STRING': n4[element['element_name']] = str for element in elements6: if element['data_type'] == 'STRING': n5[element['element_name']] = str for element in elements7: if element['data_type'] == 'STRING': n6[element['element_name']] = str for element in elements8: if element['data_type'] == 'STRING': n7[element['element_name']] = str for element in elements9: if element['data_type'] == 'STRING': n8[element['element_name']] = str file_data_0 = excel_data.get_excel_data(n0, CODE, "sheet_0", report) file_data_1 = excel_data.get_excel_data(n1, CODE, "sheet_1", report) file_data_2 = excel_data.get_excel_data(n2, CODE, "sheet_2", report) file_data_3 = excel_data.get_excel_data(n3, CODE, "sheet_3", report) file_data_4 = excel_data.get_excel_data(n4, CODE, "sheet_4", report) file_data_5 = excel_data.get_excel_data(n5, CODE, "sheet_5", report) file_data_6 = excel_data.get_excel_data(n6, CODE, "sheet_6", report) file_data_7 = excel_data.get_excel_data(n7, CODE, "sheet_7", report) file_data_8 = excel_data.get_excel_data(n8, CODE, "sheet_8", report) df1 = pd.DataFrame(elements1) df2 = pd.DataFrame(elements2) df3 = pd.DataFrame(elements3) df4 = pd.DataFrame(elements4) df5 = pd.DataFrame(elements5) df6 = pd.DataFrame(elements6) df7 = pd.DataFrame(elements7) df8 = pd.DataFrame(elements8) df9 = pd.DataFrame(elements9) main_datas = bl_ind.extract_data(file_data_0, df1['element_name'].to_list()) additional_datas1 = bl_ind.extract_data(file_data_1, df2['element_name'].to_list()) additional_datas2 = bl_ind.extract_data(file_data_2, df3['element_name'].to_list()) additional_datas3 = bl_ind.extract_data(file_data_3, df4['element_name'].to_list()) additional_datas4 = bl_ind.extract_data(file_data_4, df5['element_name'].to_list()) additional_datas5 = bl_ind.extract_data(file_data_5, df6['element_name'].to_list()) additional_datas6 = bl_ind.extract_data(file_data_6, df7['element_name'].to_list()) additional_datas7 = bl_ind.extract_data(file_data_7, df8['element_name'].to_list()) additional_datas8 = bl_ind.extract_data(file_data_8, df9['element_name'].to_list()) elif isinstance(report, EnterpriseSendReport): elements1 = bl_ent.get_base_elements(CODE) elements2 = bl_ent.get_base_elements(CODE_ADDITIONAL1) elements3 = bl_ent.get_base_elements(CODE_ADDITIONAL2) elements4 = bl_ent.get_base_elements(CODE_ADDITIONAL3) elements5 = bl_ent.get_base_elements(CODE_ADDITIONAL4) elements6 = bl_ent.get_base_elements(CODE_ADDITIONAL5) elements7 = bl_ent.get_base_elements(CODE_ADDITIONAL6) elements8 = bl_ent.get_base_elements(CODE_ADDITIONAL7) elements9 = bl_ent.get_base_elements(CODE_ADDITIONAL8) n0 = OrderedDict() n1 = OrderedDict() n2 = OrderedDict() n3 = OrderedDict() n4 = OrderedDict() n5 = OrderedDict() n6 = OrderedDict() n7 = OrderedDict() n8 = OrderedDict() for element in elements1: if element['data_type'] == 'STRING': n0[element['element_name']] = str for element in elements2: if element['data_type'] == 'STRING': n1[element['element_name']] = str for element in elements3: if element['data_type'] == 'STRING': n2[element['element_name']] = str for element in elements4: if element['data_type'] == 'STRING': n3[element['element_name']] = str for element in elements5: if element['data_type'] == 'STRING': n4[element['element_name']] = str for element in elements6: if element['data_type'] == 'STRING': n5[element['element_name']] = str for element in elements7: if element['data_type'] == 'STRING': n6[element['element_name']] = str for element in elements8: if element['data_type'] == 'STRING': n7[element['element_name']] = str for element in elements9: if element['data_type'] == 'STRING': n8[element['element_name']] = str file_data_0 = excel_data.get_excel_data(n0, CODE, "sheet_0", report) file_data_1 = excel_data.get_excel_data(n1, CODE, "sheet_1", report) file_data_2 = excel_data.get_excel_data(n2, CODE, "sheet_2", report) file_data_3 = excel_data.get_excel_data(n3, CODE, "sheet_3", report) file_data_4 = excel_data.get_excel_data(n4, CODE, "sheet_4", report) file_data_5 = excel_data.get_excel_data(n5, CODE, "sheet_5", report) file_data_6 = excel_data.get_excel_data(n6, CODE, "sheet_6", report) file_data_7 = excel_data.get_excel_data(n7, CODE, "sheet_7", report) file_data_8 = excel_data.get_excel_data(n8, CODE, "sheet_8", report) df1 = pd.DataFrame(elements1) df2 = pd.DataFrame(elements2) df3 = pd.DataFrame(elements3) df4 = pd.DataFrame(elements4) df5 = pd.DataFrame(elements5) df6 = pd.DataFrame(elements6) df7 = pd.DataFrame(elements7) df8 = pd.DataFrame(elements8) df9 = pd.DataFrame(elements9) main_datas = bl_ent.extract_data(file_data_0, df1['element_name'].to_list()) additional_datas1 = bl_ent.extract_data(file_data_1, df2['element_name'].to_list()) additional_datas2 = bl_ent.extract_data(file_data_2, df3['element_name'].to_list()) additional_datas3 = bl_ent.extract_data(file_data_3, df4['element_name'].to_list()) additional_datas4 = bl_ent.extract_data(file_data_4, df5['element_name'].to_list()) additional_datas5 = bl_ent.extract_data(file_data_5, df6['element_name'].to_list()) additional_datas6 = bl_ent.extract_data(file_data_6, df7['element_name'].to_list()) additional_datas7 = bl_ent.extract_data(file_data_7, df8['element_name'].to_list()) additional_datas8 = bl_ent.extract_data(file_data_8, df9['element_name'].to_list()) else: logging.error('report type error:{0}'.format(report)) datas = build_master_agrmt( main_datas, additional_datas1, additional_datas2, additional_datas3, additional_datas4, additional_datas5, additional_datas6, additional_datas7, additional_datas8, df1[df1['status'] == '0']['element_name'].to_list(), df2[df2['status'] == '0']['element_name'].to_list(), df3[df3['status'] == '0']['element_name'].to_list(), df4[df4['status'] == '0']['element_name'].to_list(), df5[df5['status'] == '0']['element_name'].to_list(), df6[df6['status'] == '0']['element_name'].to_list(), df7[df7['status'] == '0']['element_name'].to_list(), df8[df8['status'] == '0']['element_name'].to_list(), df9[df9['status'] == '0']['element_name'].to_list()) report.jsonData = datas
def parse_excel(report: SendReport): if isinstance(report, IndividualSendReport): elements1 = bl_ind.get_base_elements(CODE) elements2 = bl_ind.get_base_elements(CODE_ADDITIONAL1) elements3 = bl_ind.get_base_elements(CODE_ADDITIONAL2) elements4 = bl_ind.get_base_elements(CODE_ADDITIONAL3) elements5 = bl_ind.get_base_elements(CODE_ADDITIONAL4) n0 = OrderedDict() n1 = OrderedDict() n2 = OrderedDict() n3 = OrderedDict() n4 = OrderedDict() for element in elements1: if element['data_type'] == 'STRING': n0[element['element_name']] = str for element in elements2: if element['data_type'] == 'STRING': n1[element['element_name']] = str for element in elements3: if element['data_type'] == 'STRING': n2[element['element_name']] = str for element in elements4: if element['data_type'] == 'STRING': n3[element['element_name']] = str for element in elements5: if element['data_type'] == 'STRING': n4[element['element_name']] = str file_data_0 = excel_data.get_excel_data(n0, CODE, "sheet_0", report) file_data_1 = excel_data.get_excel_data(n1, CODE, "sheet_1", report) file_data_2 = excel_data.get_excel_data(n2, CODE, "sheet_2", report) file_data_3 = excel_data.get_excel_data(n3, CODE, "sheet_3", report) file_data_4 = excel_data.get_excel_data(n4, CODE, "sheet_4", report) df1 = pd.DataFrame(elements1) df2 = pd.DataFrame(elements2) df3 = pd.DataFrame(elements3) df4 = pd.DataFrame(elements4) df5 = pd.DataFrame(elements5) main_datas = bl_ind.extract_data(file_data_0, df1['element_name'].to_list()) additional_datas1 = bl_ind.extract_data(file_data_1, df2['element_name'].to_list()) additional_datas2 = bl_ind.extract_data(file_data_2, df3['element_name'].to_list()) additional_datas3 = bl_ind.extract_data(file_data_3, df4['element_name'].to_list()) additional_datas4 = bl_ind.extract_data(file_data_4, df5['element_name'].to_list()) elif isinstance(report, EnterpriseSendReport): elements1 = bl_ent.get_base_elements(CODE) elements2 = bl_ent.get_base_elements(CODE_ADDITIONAL1) elements3 = bl_ent.get_base_elements(CODE_ADDITIONAL2) elements4 = bl_ent.get_base_elements(CODE_ADDITIONAL3) elements5 = bl_ent.get_base_elements(CODE_ADDITIONAL4) n0 = OrderedDict() n1 = OrderedDict() n2 = OrderedDict() n3 = OrderedDict() n4 = OrderedDict() for element in elements1: if element['data_type'] == 'STRING': n0[element['element_name']] = str for element in elements2: if element['data_type'] == 'STRING': n1[element['element_name']] = str for element in elements3: if element['data_type'] == 'STRING': n2[element['element_name']] = str for element in elements4: if element['data_type'] == 'STRING': n3[element['element_name']] = str for element in elements5: if element['data_type'] == 'STRING': n4[element['element_name']] = str file_data_0 = excel_data.get_excel_data(n0, CODE, "sheet_0", report) file_data_1 = excel_data.get_excel_data(n1, CODE, "sheet_1", report) file_data_2 = excel_data.get_excel_data(n2, CODE, "sheet_2", report) file_data_3 = excel_data.get_excel_data(n3, CODE, "sheet_3", report) file_data_4 = excel_data.get_excel_data(n4, CODE, "sheet_4", report) df1 = pd.DataFrame(elements1) df2 = pd.DataFrame(elements2) df3 = pd.DataFrame(elements3) df4 = pd.DataFrame(elements4) df5 = pd.DataFrame(elements5) main_datas = bl_ent.extract_data(file_data_0, df1['element_name'].to_list()) additional_datas1 = bl_ent.extract_data(file_data_1, df2['element_name'].to_list()) additional_datas2 = bl_ent.extract_data(file_data_2, df3['element_name'].to_list()) additional_datas3 = bl_ent.extract_data(file_data_3, df4['element_name'].to_list()) additional_datas4 = bl_ent.extract_data(file_data_4, df5['element_name'].to_list()) else: logging.error('report type error:{0}'.format(report)) datas = build_master_agrmt( main_datas, additional_datas1, additional_datas2, additional_datas3, additional_datas4, df1[df1['status'] == '0']['element_name'].to_list(), df2[df2['status'] == '0']['element_name'].to_list(), df3[df3['status'] == '0']['element_name'].to_list(), df4[df4['status'] == '0']['element_name'].to_list(), df5[df5['status'] == '0']['element_name'].to_list()) report.jsonData = datas