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
cc6cdef0
authored
2022-06-14 14:39:12 +0800
by
周伟奇
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
fix bug
1 parent
02656f91
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
15 additions
and
5 deletions
src/apps/doc/consts.py
src/apps/doc/management/commands/folder_f3_process.py
src/apps/doc/ocr/wb.py
src/celery_compare/tasks.py
src/apps/doc/consts.py
View file @
cc6cdef
...
...
@@ -1134,6 +1134,7 @@ NYYH_CLASSIFY = {17, 18}
NYZS_CLASSIFY
=
18
SPECIAL_NYZS_CLASSIFY
=
50
MS_CLASSIFY
=
21
SPECIAL_ZSYH_CLASSIFY
=
20
MS_ERROR_COL
=
(
5
,
6
)
WECHART_CLASSIFY
=
12
NEW_ZHIFUBAO_CLASSIFY
=
48
...
...
src/apps/doc/management/commands/folder_f3_process.py
View file @
cc6cdef
...
...
@@ -6,6 +6,7 @@ import base64
import
signal
import
requests
import
traceback
from
datetime
import
datetime
from
django.core.management
import
BaseCommand
from
multiprocessing
import
Process
from
openpyxl
import
load_workbook
,
Workbook
...
...
@@ -316,7 +317,7 @@ class Command(BaseCommand, LoggerMixin):
true_file_set
.
add
(
os_error_filename_set
.
pop
())
for
name
in
true_file_set
:
time
.
sleep
(
10
)
unique_folder_name
=
'{0}_{1}'
.
format
(
time
.
time
(
),
name
)
unique_folder_name
=
'{0}_{1}'
.
format
(
datetime
.
now
()
.
strftime
(
'
%
Y-
%
m-
%
d_
%
H:
%
M:
%
S'
),
name
)
path
=
os
.
path
.
join
(
input_dir
,
name
)
try
:
...
...
src/apps/doc/ocr/wb.py
View file @
cc6cdef
...
...
@@ -197,7 +197,9 @@ class BSWorkbook(Workbook):
return
date_col
,
min_row
@staticmethod
def
get_confidence
(
max_find_count
):
def
get_confidence
(
max_find_count
,
classify
):
if
classify
==
consts
.
NEW_ZHIFUBAO_CLASSIFY
:
return
round
(
random
.
uniform
(
95
,
100
),
2
)
if
max_find_count
==
0
:
return
round
(
random
.
uniform
(
75
,
80
),
2
)
elif
max_find_count
==
1
:
...
...
@@ -498,8 +500,13 @@ class BSWorkbook(Workbook):
new_ws
.
append
(
header
)
for
part
in
parts
:
ws
=
self
.
get_sheet_by_name
(
part
[
0
])
is_first_row
=
True
for
row_value
in
ws
.
iter_rows
(
min_row
=
part
[
1
],
max_row
=
part
[
2
],
values_only
=
True
):
if
any
(
row_value
):
if
classify
==
consts
.
SPECIAL_ZSYH_CLASSIFY
and
is_first_row
:
if
'Date'
in
row_value
and
'Balance'
in
row_value
:
is_first_row
=
False
continue
if
classify
==
consts
.
WECHART_CLASSIFY
:
row_value
=
self
.
rm_cn_char
(
row_value
,
*
consts
.
WECHART_ERROR_COL
)
elif
classify
==
consts
.
MS_CLASSIFY
:
...
...
@@ -507,6 +514,7 @@ class BSWorkbook(Workbook):
elif
classify
in
consts
.
NYYH_CLASSIFY
:
row_value
=
self
.
rm_second_row
(
row_value
,
amount_cell_idx
,
over_cell_idx
)
new_ws
.
append
(
row_value
)
is_first_row
=
False
amount_mapping
=
{}
amount_fill_row
=
set
()
...
...
@@ -705,7 +713,7 @@ class BSWorkbook(Workbook):
end_date
=
max
(
date_list
)
if
end_date
is
None
else
end_date
# 2.元信息提取表
confidence
=
self
.
get_confidence
(
max_find_count
)
confidence
=
self
.
get_confidence
(
max_find_count
,
classify
)
is_verify_classify
=
classify
in
consts
.
BS_VERIFY_CLASSIFY
ms
,
timedelta
=
self
.
build_meta_sheet
(
role_name
,
new_card
,
...
...
src/celery_compare/tasks.py
View file @
cc6cdef
...
...
@@ -1108,7 +1108,7 @@ def get_se_cms_compare_info_auto(last_obj, application_entity, auto=True):
# 银行流水 --------------------------------------------------------------------
if
cms_info
.
get
(
'autoApprovedDetails'
,
{})
.
get
(
'aaType'
,
''
)
in
[
'CAA1'
,
'CAA2'
]
and
\
cms_info
.
get
(
'autoApprovedDetails'
,
{})
.
get
(
'PolicyComments'
,
''
)
!=
'此申请无需提供流水'
:
'无需提供银行流水'
not
in
cms_info
.
get
(
'autoApprovedDetails'
,
{})
.
get
(
'PolicyComments'
,
''
)
:
date_timedelta
=
60
if
auto
else
90
bs_role_list
=
[]
for
applicant_type
in
consts
.
APPLICANT_TYPE_ORDER
[:
2
]:
...
...
@@ -1628,7 +1628,7 @@ def get_se_cms_compare_info(last_obj, application_entity, detect_list, auto=Fals
# 银行流水 --------------------------------------------------------------------
if
cms_info
.
get
(
'autoApprovedDetails'
,
{})
.
get
(
'aaType'
,
''
)
in
[
'CAA1'
,
'CAA2'
]
and
\
cms_info
.
get
(
'autoApprovedDetails'
,
{})
.
get
(
'PolicyComments'
,
''
)
!=
'无需提供银行流水。'
:
'无需提供银行流水'
not
in
cms_info
.
get
(
'autoApprovedDetails'
,
{})
.
get
(
'PolicyComments'
,
''
)
:
date_timedelta
=
60
if
auto
else
90
bs_role_list
=
[]
for
applicant_type
in
consts
.
APPLICANT_TYPE_ORDER
[:
2
]:
...
...
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