c811f8ce by 冯轩

Merge branch 'feature/CHINARPA-4659'

2 parents c576745b d2a1f3f2
......@@ -98,6 +98,7 @@ RES_SHEET_HEADER = ('页码', '图片序号', '检测图片序号', '结果')
RES_SUCCESS = '识别成功'
RES_SUCCESS_OTHER = '识别成功(其他类)'
RES_SUCCESS_EMPTY = '识别成功(空数据)'
RES_SUCCESS_FINANCIAL_STATEMENT = '识别成功(财务报表类)'
RES_FAILED = '识别失败'
RES_FAILED_1 = '识别失败(阶段1)'
RES_FAILED_2 = '识别失败(阶段2)'
......@@ -2532,4 +2533,14 @@ FSM_ACTIVITED_STATUS = {
"APIPN": "Activated-Invoice Passed-Non PT",
"APIPP": "Activated-Invoice Passed-PT Doc Required",
"APARD": "Activated-Review done",
}
\ No newline at end of file
}
# 财务报表分类标签
FINANCIAL_STATEMENT_CLASSIFY_LIST = [97, 98, 99]
# 财务报表sheet名称
FINANCIAL_SHEET_NAME = "财务报表"
# 财报情况说明分类标签
FINANCIAL_EXPLANATION_CLASSIFY_LIST = [100]
# 财报情况说明sheet名称
FINANCIAL_EXPLANATION_SHEET_NAME = "财报情况说明"
\ No newline at end of file
......
......@@ -827,6 +827,53 @@ class BSWorkbook(Workbook):
ws.append(row)
ws.append((None, ))
def financial_rebuild(self, financial_statement_dict):
# 如果 financial_statement_dict 为空,则不创建表
if not financial_statement_dict:
return
# 如果 financial_statement_dict 不为空,则创建表
ws = self.create_sheet(consts.FINANCIAL_SHEET_NAME)
for fin_key, fin_value in financial_statement_dict.items():
table_str = "识别码"
if fin_key == "code":
table_str = "识别码"
elif fin_key == "stamp":
table_str = "印章"
for table_key, table_value in fin_value.items():
if table_key == "balance_sheet":
row = ["资产负债表" + table_str, str(table_value)]
ws.append(row)
elif table_key == "income_statement":
row = ["利润表" + table_str, str(table_value)]
ws.append(row)
elif table_key == "cash_flow_statement":
row = ["现金流量表" + table_str, str(table_value)]
ws.append(row)
def financial_explanation_rebuild(self, financial_explanation_dict):
"""
Desc:
重构财报情况说明sheet
"""
# 如果 financial_explanation_dict 为空,则不创建sheet
if not financial_explanation_dict:
return
# 如果 financial_explanation_dict 不为空, 则创建sheet
ws = self.create_sheet(consts.FINANCIAL_EXPLANATION_SHEET_NAME)
for fin_key, fin_value in financial_explanation_dict.items():
table_str = "公司名称"
if fin_key == "title":
table_str = "公司名称"
elif fin_key == "stamp":
table_str = "印章"
row = ["财报情况说明" + table_str, str(fin_value)]
ws.append(row)
@staticmethod
def remove_yuan(amount_key_set, key, src_str):
if key in amount_key_set and isinstance(src_str, str):
......@@ -926,7 +973,7 @@ class BSWorkbook(Workbook):
if len(self.sheetnames) > 1:
self.remove(self.get_sheet_by_name('Sheet'))
def rebuild(self, bs_summary, license_summary, res_list, document_scheme, contract_result, metadata):
def rebuild(self, bs_summary, license_summary, res_list, document_scheme, contract_result, metadata, financial_statement_dict, financial_explanation_dict):
res_count_tuple = self.res_sheet(res_list)
count_list = [(consts.MODEL_FIELD_BS, len(bs_summary))]
......@@ -934,10 +981,14 @@ class BSWorkbook(Workbook):
self.license_rebuild(license_summary, document_scheme, count_list)
self.contract_rebuild(contract_result)
self.bs_rebuild(bs_summary, res_count_tuple, metadata)
self.financial_rebuild(financial_statement_dict)
self.financial_explanation_rebuild(financial_explanation_dict)
else:
self.bs_rebuild(bs_summary, res_count_tuple, metadata)
self.license_rebuild(license_summary, document_scheme, count_list)
self.contract_rebuild(contract_result, True)
self.financial_rebuild(financial_statement_dict)
self.financial_explanation_rebuild(financial_explanation_dict)
self.move_res_sheet()
self.remove_base_sheet()
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!