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
3478cf88
authored
2022-08-08 18:55:32 +0800
by
周伟奇
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
fix ht date
1 parent
430ce72e
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
12 deletions
src/apps/doc/consts.py
src/apps/doc/management/commands/ocr_process.py
src/celery_compare/tasks.py
src/apps/doc/consts.py
View file @
3478cf8
...
...
@@ -1598,6 +1598,7 @@ SE_HIL_CON_3_FIELD = ['合同编号-每页', '承租人姓名', '承租人证件
ROLE_LIST
=
[
# key_afc1, cdfl_key, app_type, id_idx, field_idx, is_force, e_write
(
'借款人签字及时间'
,
'借款人签字及时间'
,
'Borrower'
,
0
,
0
,
True
,
False
),
(
'借款人姓名'
,
'借款人姓名'
,
'Borrower'
,
0
,
0
,
True
,
True
),
(
'借款人证件号'
,
'借款人证件号'
,
'Borrower'
,
0
,
2
,
True
,
True
),
...
...
@@ -1996,6 +1997,7 @@ HT_COMPARE_LOGIC = {
'ASP项目详情'
:
(
'ASP项目详情'
,
'se_asp_compare'
,
{},
'合同ASP名称或者金额与系统不一致'
),
}
AFC_HT_DATE_FIELDS
=
[
'主借人日期'
,
'共借人日期'
,
'保证人日期1'
,
'保证人日期2'
]
# MVC_OCR_FIELD = 'mvc_ocr'
...
...
src/apps/doc/management/commands/ocr_process.py
View file @
3478cf8
...
...
@@ -928,14 +928,15 @@ class Command(BaseCommand, LoggerMixin):
for
classify
,
page_info_dict
in
contract_result_compare
.
items
():
if
classify
==
consts
.
CONTRACT_CLASSIFY
:
res
=
{}
#
is_asp = page_info_dict.get(consts.ASP_KEY, False)
is_asp
=
True
is_asp
=
page_info_dict
.
get
(
consts
.
ASP_KEY
,
False
)
#
is_asp = True
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
end_idx
=
9
# 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
,
''
))
elif
key2
is
None
:
...
...
src/celery_compare/tasks.py
View file @
3478cf8
...
...
@@ -2551,14 +2551,28 @@ def se_contract_compare(license_en, ocr_res_dict, strip_list, is_gsyh):
# result = consts.RESULT_Y
# ocr_str = empty_str
# reason = compare_logic[name][3]
# 其他字段
if
isinstance
(
ocr_str_or_list
,
str
)
or
isinstance
(
ocr_str_or_list
,
list
):
if
is_gsyh
is
True
and
name
in
consts
.
CON_BANK_FIELD
:
update_args
=
{
'is_gsyh'
:
is_gsyh
}
for
k
,
v
in
compare_logic
[
name
][
2
]
.
items
():
update_args
[
k
]
=
v
else
:
update_args
=
compare_logic
[
name
][
2
]
# 见证人日期
if
name
==
consts
.
SE_AFC_CON_FIELD
[
19
]:
if
not
isinstance
(
ocr_str_or_list
,
str
)
or
len
(
ocr_str_or_list
)
==
0
:
result
=
consts
.
RESULT_N
ocr_str
=
empty_str
else
:
is_find_date
=
False
all_date_list
=
[
ocr_str_or_list
]
for
date_name
in
consts
.
AFC_HT_DATE_FIELDS
:
all_date_list
.
append
(
ocr_res
.
get
(
compare_logic
[
date_name
][
0
],
''
))
if
not
is_find_date
and
ocr_str_or_list
==
ocr_res
.
get
(
compare_logic
[
date_name
][
0
],
''
):
is_find_date
=
True
result
=
consts
.
RESULT_Y
if
is_find_date
else
consts
.
RESULT_N
ocr_str
=
json
.
dumps
(
all_date_list
,
ensure_ascii
=
False
)
reason
=
compare_logic
[
name
][
3
]
elif
isinstance
(
ocr_str_or_list
,
str
)
or
isinstance
(
ocr_str_or_list
,
list
):
# if is_gsyh is True and name in consts.CON_BANK_FIELD:
# update_args = {'is_gsyh': is_gsyh}
# for k, v in compare_logic[name][2].items():
# update_args[k] = v
# else:
# update_args = compare_logic[name][2]
if
isinstance
(
ocr_str_or_list
,
list
):
# no-asp 合同编号-每页(no-asp)
if
name
==
consts
.
SE_AFC_CON_FIELD
[
23
]:
...
...
@@ -2567,7 +2581,7 @@ def se_contract_compare(license_en, ocr_res_dict, strip_list, is_gsyh):
else
:
ocr_str_or_list
=
ocr_str_or_list
.
strip
()
ocr_str
=
ocr_str_or_list
result
=
getattr
(
cp
,
compare_logic
[
name
][
1
])(
value
,
ocr_str_or_list
,
**
update_args
)
result
=
getattr
(
cp
,
compare_logic
[
name
][
1
])(
value
,
ocr_str_or_list
,
**
compare_logic
[
name
][
2
]
)
reason
=
compare_logic
[
name
][
3
]
else
:
result
=
consts
.
RESULT_N
...
...
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