Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
周伟奇
/
bmw-ocr
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Network
Create a new issue
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
7f9efd41
authored
2024-08-12 14:20:29 +0800
by
冯轩
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
Merge branch 'feature/CHINARPA-4659' into feature/uat-tmp
2 parents
040c5381
d2a1f3f2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
2 deletions
src/apps/doc/consts.py
src/apps/doc/management/commands/ocr_process.py
src/apps/doc/ocr/wb.py
src/apps/doc/consts.py
View file @
7f9efd4
...
...
@@ -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)'
...
...
@@ -2562,4 +2563,9 @@ FSM_ACTIVITED_STATUS = {
# 财务报表分类标签
FINANCIAL_STATEMENT_CLASSIFY_LIST
=
[
97
,
98
,
99
]
# 财务报表sheet名称
FINANCIAL_SHEET_NAME
=
"财务报表"
\ No newline at end of file
FINANCIAL_SHEET_NAME
=
"财务报表"
# 财报情况说明分类标签
FINANCIAL_EXPLANATION_CLASSIFY_LIST
=
[
100
]
# 财报情况说明sheet名称
FINANCIAL_EXPLANATION_SHEET_NAME
=
"财报情况说明"
\ No newline at end of file
...
...
src/apps/doc/management/commands/ocr_process.py
View file @
7f9efd4
This diff is collapsed.
Click to expand it.
src/apps/doc/ocr/wb.py
View file @
7f9efd4
...
...
@@ -829,6 +829,10 @@ class BSWorkbook(Workbook):
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
=
"识别码"
...
...
@@ -849,6 +853,27 @@ class BSWorkbook(Workbook):
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
):
...
...
@@ -948,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
,
financial_statement_dict
):
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
))]
...
...
@@ -957,11 +982,13 @@ class BSWorkbook(Workbook):
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
...
...
Write
Preview
Styling with
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment