c811f8ce by 冯轩

Merge branch 'feature/CHINARPA-4659'

2 parents c576745b d2a1f3f2
...@@ -98,6 +98,7 @@ RES_SHEET_HEADER = ('页码', '图片序号', '检测图片序号', '结果') ...@@ -98,6 +98,7 @@ RES_SHEET_HEADER = ('页码', '图片序号', '检测图片序号', '结果')
98 RES_SUCCESS = '识别成功' 98 RES_SUCCESS = '识别成功'
99 RES_SUCCESS_OTHER = '识别成功(其他类)' 99 RES_SUCCESS_OTHER = '识别成功(其他类)'
100 RES_SUCCESS_EMPTY = '识别成功(空数据)' 100 RES_SUCCESS_EMPTY = '识别成功(空数据)'
101 RES_SUCCESS_FINANCIAL_STATEMENT = '识别成功(财务报表类)'
101 RES_FAILED = '识别失败' 102 RES_FAILED = '识别失败'
102 RES_FAILED_1 = '识别失败(阶段1)' 103 RES_FAILED_1 = '识别失败(阶段1)'
103 RES_FAILED_2 = '识别失败(阶段2)' 104 RES_FAILED_2 = '识别失败(阶段2)'
...@@ -2532,4 +2533,14 @@ FSM_ACTIVITED_STATUS = { ...@@ -2532,4 +2533,14 @@ FSM_ACTIVITED_STATUS = {
2532 "APIPN": "Activated-Invoice Passed-Non PT", 2533 "APIPN": "Activated-Invoice Passed-Non PT",
2533 "APIPP": "Activated-Invoice Passed-PT Doc Required", 2534 "APIPP": "Activated-Invoice Passed-PT Doc Required",
2534 "APARD": "Activated-Review done", 2535 "APARD": "Activated-Review done",
2535 }
...\ No newline at end of file ...\ No newline at end of file
2536 }
2537
2538 # 财务报表分类标签
2539 FINANCIAL_STATEMENT_CLASSIFY_LIST = [97, 98, 99]
2540 # 财务报表sheet名称
2541 FINANCIAL_SHEET_NAME = "财务报表"
2542
2543 # 财报情况说明分类标签
2544 FINANCIAL_EXPLANATION_CLASSIFY_LIST = [100]
2545 # 财报情况说明sheet名称
2546 FINANCIAL_EXPLANATION_SHEET_NAME = "财报情况说明"
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -827,6 +827,53 @@ class BSWorkbook(Workbook): ...@@ -827,6 +827,53 @@ class BSWorkbook(Workbook):
827 ws.append(row) 827 ws.append(row)
828 ws.append((None, )) 828 ws.append((None, ))
829 829
830
831 def financial_rebuild(self, financial_statement_dict):
832 # 如果 financial_statement_dict 为空,则不创建表
833 if not financial_statement_dict:
834 return
835 # 如果 financial_statement_dict 不为空,则创建表
836 ws = self.create_sheet(consts.FINANCIAL_SHEET_NAME)
837 for fin_key, fin_value in financial_statement_dict.items():
838 table_str = "识别码"
839 if fin_key == "code":
840 table_str = "识别码"
841 elif fin_key == "stamp":
842 table_str = "印章"
843
844 for table_key, table_value in fin_value.items():
845 if table_key == "balance_sheet":
846 row = ["资产负债表" + table_str, str(table_value)]
847 ws.append(row)
848 elif table_key == "income_statement":
849 row = ["利润表" + table_str, str(table_value)]
850 ws.append(row)
851 elif table_key == "cash_flow_statement":
852 row = ["现金流量表" + table_str, str(table_value)]
853 ws.append(row)
854
855
856 def financial_explanation_rebuild(self, financial_explanation_dict):
857 """
858 Desc:
859 重构财报情况说明sheet
860 """
861 # 如果 financial_explanation_dict 为空,则不创建sheet
862 if not financial_explanation_dict:
863 return
864 # 如果 financial_explanation_dict 不为空, 则创建sheet
865 ws = self.create_sheet(consts.FINANCIAL_EXPLANATION_SHEET_NAME)
866 for fin_key, fin_value in financial_explanation_dict.items():
867 table_str = "公司名称"
868 if fin_key == "title":
869 table_str = "公司名称"
870 elif fin_key == "stamp":
871 table_str = "印章"
872
873 row = ["财报情况说明" + table_str, str(fin_value)]
874 ws.append(row)
875
876
830 @staticmethod 877 @staticmethod
831 def remove_yuan(amount_key_set, key, src_str): 878 def remove_yuan(amount_key_set, key, src_str):
832 if key in amount_key_set and isinstance(src_str, str): 879 if key in amount_key_set and isinstance(src_str, str):
...@@ -926,7 +973,7 @@ class BSWorkbook(Workbook): ...@@ -926,7 +973,7 @@ class BSWorkbook(Workbook):
926 if len(self.sheetnames) > 1: 973 if len(self.sheetnames) > 1:
927 self.remove(self.get_sheet_by_name('Sheet')) 974 self.remove(self.get_sheet_by_name('Sheet'))
928 975
929 def rebuild(self, bs_summary, license_summary, res_list, document_scheme, contract_result, metadata): 976 def rebuild(self, bs_summary, license_summary, res_list, document_scheme, contract_result, metadata, financial_statement_dict, financial_explanation_dict):
930 res_count_tuple = self.res_sheet(res_list) 977 res_count_tuple = self.res_sheet(res_list)
931 978
932 count_list = [(consts.MODEL_FIELD_BS, len(bs_summary))] 979 count_list = [(consts.MODEL_FIELD_BS, len(bs_summary))]
...@@ -934,10 +981,14 @@ class BSWorkbook(Workbook): ...@@ -934,10 +981,14 @@ class BSWorkbook(Workbook):
934 self.license_rebuild(license_summary, document_scheme, count_list) 981 self.license_rebuild(license_summary, document_scheme, count_list)
935 self.contract_rebuild(contract_result) 982 self.contract_rebuild(contract_result)
936 self.bs_rebuild(bs_summary, res_count_tuple, metadata) 983 self.bs_rebuild(bs_summary, res_count_tuple, metadata)
984 self.financial_rebuild(financial_statement_dict)
985 self.financial_explanation_rebuild(financial_explanation_dict)
937 else: 986 else:
938 self.bs_rebuild(bs_summary, res_count_tuple, metadata) 987 self.bs_rebuild(bs_summary, res_count_tuple, metadata)
939 self.license_rebuild(license_summary, document_scheme, count_list) 988 self.license_rebuild(license_summary, document_scheme, count_list)
940 self.contract_rebuild(contract_result, True) 989 self.contract_rebuild(contract_result, True)
990 self.financial_rebuild(financial_statement_dict)
991 self.financial_explanation_rebuild(financial_explanation_dict)
941 self.move_res_sheet() 992 self.move_res_sheet()
942 self.remove_base_sheet() 993 self.remove_base_sheet()
943 return count_list, self.need_follow 994 return count_list, self.need_follow
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!