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
1d776432
authored
2021-12-06 18:26:40 +0800
by
周伟奇
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
add asp
1 parent
356977cd
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
52 additions
and
3 deletions
src/apps/doc/consts.py
src/apps/doc/management/commands/folder_ltgt_process.py
src/apps/doc/management/commands/ocr_process.py
src/celery_compare/tasks.py
src/common/tools/comparison.py
src/apps/doc/consts.py
View file @
1d77643
...
...
@@ -1438,12 +1438,15 @@ SE_AFC_CON_MAP = {
'见证人日期'
:
(
7
,
8
,
'见证人签字'
,
'日期'
),
'还款计划表'
:
(
3
,
3
,
'还款计划表'
,
None
),
'ASP项目详情-重要条款'
:
(
None
,
1
,
'附加产品融资贷款本金总金额明细'
,
None
),
'ASP项目详情'
:
(
None
,
4
,
'附加产品融资贷款本金总金额明细'
,
None
),
}
SE_AFC_CON_FIELD
=
[
'合同编号-每页'
,
'所购车辆价格-小写-重要条款'
,
'车架号-重要条款'
,
'贷款本金金额-重要条款'
,
'贷款期限-重要条款'
,
'车辆贷款本金金额-重要条款'
,
'附加产品融资贷款本金总额-重要条款'
,
'所购车辆价格'
,
'车架号'
,
'经销商'
,
'贷款本金金额'
,
'车辆贷款本金金额'
,
'附加产品融资贷款本金总额'
,
'贷款期限'
,
'还款账号'
,
'户名'
,
'开户行'
,
'还款计划表'
,
'见证人签字'
,
'见证人日期'
]
'还款计划表'
,
'见证人签字'
,
'见证人日期'
,
'ASP项目详情-重要条款'
,
'购置税校验'
,
'ASP项目详情'
]
# '项目1', '用途总金额', '贷款本金', '附加产品融资贷款本金总金额', '购置税校验'
...
...
@@ -1470,7 +1473,10 @@ ROLE_LIST = [
(
'保证人日期2'
,
'Guarantor'
,
1
,
'有'
,
False
,
False
),
]
GZS_REASON_1
=
'此申请有ASP产品,需人工核查'
GZS_REASON_2
=
'ASP购置税金额小于系统金额'
GZS_NAME
=
'车辆购置税'
ASP_SUM_NAME
=
'附加产品融资贷款本金总金额'
GZS_STATUS
=
[
'Y'
,
'N'
,
'O'
]
SCHEDULE_SPLIT_STR
=
'、'
...
...
@@ -1668,6 +1674,9 @@ HT_COMPARE_LOGIC = {
'见证人日期'
:
(
'见证人日期'
,
'se_date_contain_compare'
,
{},
'合同见证人签字日期不符合逻辑'
),
'还款计划表'
:
(
'还款计划表'
,
'se_schedule_compare'
,
{},
'还款计划表与系统不一致'
),
'ASP项目详情-重要条款'
:
(
'ASP项目详情-重要条款'
,
'se_asp_compare'
,
{},
'(重要条款)ASP名称或者金额与系统不一致'
),
'ASP项目详情'
:
(
'ASP项目详情'
,
'se_asp_compare'
,
{},
'ASP名称或者金额与系统不一致'
),
}
...
...
src/apps/doc/management/commands/folder_ltgt_process.py
View file @
1d77643
...
...
@@ -548,7 +548,7 @@ class Command(BaseCommand, LoggerMixin):
head_fields
.
append
(
a
)
else
:
head_fields
=
[]
for
a
,
b
in
side_
field_order
:
for
a
,
b
in
field_order
:
if
isinstance
(
b
,
str
):
head_fields
.
append
(
a
)
row
=
[]
...
...
src/apps/doc/management/commands/ocr_process.py
View file @
1d77643
...
...
@@ -863,6 +863,8 @@ class Command(BaseCommand, LoggerMixin):
for
key
,
(
pno_not_asp
,
pno_asp
,
key1
,
key2
)
in
consts
.
SE_AFC_CON_MAP
.
items
():
pno
=
pno_asp
if
is_asp
else
pno_not_asp
if
pno
is
None
:
if
isinstance
(
pno_asp
,
int
):
continue
end_idx
=
9
if
is_asp
else
8
for
i
in
range
(
1
,
end_idx
):
res
.
setdefault
(
key
,
list
())
.
append
(
page_info_dict
.
get
(
str
(
i
),
{})
.
get
(
key1
,
''
))
...
...
src/celery_compare/tasks.py
View file @
1d77643
This diff is collapsed.
Click to expand it.
src/common/tools/comparison.py
View file @
1d77643
...
...
@@ -185,6 +185,34 @@ class Comparison:
else
:
return
self
.
RESULT_N
def
se_asp_compare
(
self
,
input_list
,
ocr_str_or_list
,
**
kwargs
):
if
isinstance
(
ocr_str_or_list
,
list
):
try
:
for
asp_name
,
asp_price
,
asp_fin
in
input_list
[:
-
1
]:
for
row_list
in
ocr_str_or_list
:
if
len
(
row_list
)
!=
3
:
continue
if
row_list
[
0
]
.
find
(
asp_name
)
==
-
1
:
continue
if
float
(
row_list
[
1
]
.
replace
(
','
,
''
))
==
float
(
asp_price
)
and
\
float
(
row_list
[
2
]
.
replace
(
','
,
''
))
==
float
(
asp_fin
):
break
else
:
return
self
.
RESULT_N
_
,
_
,
sum_fin
=
input_list
[
-
1
]
if
float
(
ocr_str_or_list
[
-
1
][
-
1
]
.
replace
(
','
,
''
))
==
float
(
sum_fin
):
return
self
.
RESULT_Y
else
:
return
self
.
RESULT_N
except
Exception
as
e
:
return
self
.
RESULT_N
else
:
return
self
.
RESULT_N
def
se_gzs_compare
(
self
,
input_str
,
ocr_str_or_list
,
**
kwargs
):
pass
def
se_name_compare
(
self
,
input_str
,
ocr_str
,
**
kwargs
):
if
kwargs
.
get
(
'is_passport'
):
input_tmp
=
input_str
.
upper
()
.
replace
(
' '
,
''
)
...
...
@@ -265,7 +293,17 @@ class Comparison:
if
kwargs
.
get
(
'today'
,
False
):
return
self
.
build_res
(
self
.
is_after_today
(
ocr_str
))
else
:
return
self
.
build_res
(
input_str
==
ocr_str
)
res
=
self
.
build_res
(
input_str
==
ocr_str
)
if
res
==
self
.
RESULT_Y
:
return
res
else
:
try
:
ocr_date
=
datetime
.
strptime
(
ocr_str
,
"
%
Y-
%
m-
%
d"
)
input_date
=
datetime
.
strptime
(
input_str
,
"
%
Y-
%
m-
%
d"
)
return
self
.
build_res
(
input_date
==
ocr_date
)
except
Exception
as
e
:
return
self
.
RESULT_N
def
ca_date_compare
(
self
,
input_str
,
ocr_str
,
**
kwargs
):
if
kwargs
.
get
(
'long'
,
False
):
...
...
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