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
e4460765
authored
2021-06-14 22:37:32 +0800
by
周伟奇
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
add second name check
1 parent
ae029c03
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
1 deletions
src/apps/doc/consts.py
src/celery_compare/tasks.py
src/apps/doc/consts.py
View file @
e446076
...
...
@@ -1114,6 +1114,7 @@ ID_TYPE_COMPARE = {
ID_RES
=
'idNumResult'
SECOND_ID_TYPE_FIELD
=
'secondIdType'
NAME_FIELD
=
'customerChineseName'
SECOND_ID_FIELD
=
'secondIdNum'
SECOND_ID_RES
=
'secondIdNumResult'
...
...
src/celery_compare/tasks.py
View file @
e446076
...
...
@@ -16,6 +16,21 @@ compare_log = logging.getLogger('compare')
log_base
=
'[CA Compare]'
def
name_check
(
ocr_res_dict
,
second_ocr_field
,
second_compare_list
,
second_id_num
,
name
):
id_field
=
second_compare_list
[
1
][
1
]
name_field
=
second_compare_list
[
0
][
1
]
ocr_res_str
=
ocr_res_dict
.
get
(
second_ocr_field
)
if
ocr_res_str
is
not
None
:
ocr_res_list
=
json
.
loads
(
ocr_res_str
)
for
ocr_res
in
ocr_res_list
:
ocr_second_id_num
=
ocr_res
.
get
(
id_field
)
if
ocr_second_id_num
==
second_id_num
:
ocr_name
=
ocr_res
.
get
(
name_field
)
if
ocr_name
==
name
:
return
True
return
False
def
get_order_dict
(
src_dict
,
order_tuple
):
# if consts.SECOND_ID_TYPE_FIELD in src_dict:
# if src_dict.get(consts.SECOND_ID_TYPE_FIELD) not in consts.SECOND_ID_TYPE_COMPARE:
...
...
@@ -247,9 +262,22 @@ def compare(application_id, application_entity, uniq_seq, ocr_res_id):
second_ocr_field
,
second_compare_list
=
consts
.
SECOND_ID_TYPE_COMPARE
.
get
(
second_id_type
)
field_compare
(
order_individual_cus_info
,
ocr_res_dict
,
second_ocr_field
,
second_compare_list
,
res_set
)
# 姓名比对
second_id_res
=
order_individual_cus_info
.
pop
(
consts
.
SECOND_ID_RES
,
consts
.
RESULT_NA
)
if
second_id_res
==
consts
.
RESULT_Y
:
second_id_num
=
order_individual_cus_info
.
get
(
consts
.
SECOND_ID_FIELD
)
name
=
order_individual_cus_info
.
get
(
consts
.
NAME_FIELD
)
if
isinstance
(
second_id_num
,
str
)
and
isinstance
(
name
,
str
):
second_ocr_field
,
second_compare_list
,
_
=
consts
.
ID_TYPE_COMPARE
.
get
(
second_id_type
)
name_right
=
name_check
(
ocr_res_dict
,
second_ocr_field
,
second_compare_list
,
second_id_num
,
name
)
if
not
name_right
:
res_set
.
add
(
consts
.
RESULT_N
)
second_id_res
=
consts
.
RESULT_N
order_individual_cus_info
[
consts
.
SECOND_ID_FIELD
]
=
'{0}-{1}'
.
format
(
second_id_num
,
name
)
# 重新排列
new_dict
=
OrderedDict
({})
second_id_res
=
order_individual_cus_info
.
pop
(
consts
.
SECOND_ID_RES
,
consts
.
RESULT_NA
)
for
key
,
value
in
order_individual_cus_info
.
items
():
new_dict
[
key
]
=
value
if
key
==
consts
.
ID_RES
:
...
...
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