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
8e146fd9
authored
2021-12-06 19:55:00 +0800
by
周伟奇
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
add sme bl
1 parent
1d776432
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
11 deletions
src/apps/doc/consts.py
src/celery_compare/tasks.py
src/apps/doc/consts.py
View file @
8e146fd
...
...
@@ -1196,6 +1196,8 @@ RESULT_MAPPING = {
CONTRACT_CLASSIFY
:
HT_FIELD
,
}
CA_ADD_COMPARE_FIELDS
=
(
IC_OCR_FIELD
,
BL_OCR_FIELD
)
COMPARE_FIELDS
=
(
MVI_OCR_FIELD
,
IC_OCR_FIELD
,
RP_OCR_FIELD
,
...
...
@@ -1488,6 +1490,7 @@ PP_EN = 'Passport'
EEP_EN
=
'Resident Permit to Mainland'
RP_EN
=
'Resident ID'
BL_EN
=
'Business permit'
SME_BL_EN
=
'SME Business permit'
MVI_EN
=
'newCar Invoice'
UCI_EN
=
'usedCar Invoice'
MVC_EN
=
'Green Book(1/2)'
...
...
@@ -1498,7 +1501,7 @@ HMH_EN = 'Mortgage Waiver Letter'
JYPZ_EN
=
'Used Car Document'
AFC_CONTRACT_EN
=
'AFC Contract'
SKIP_CARD
=
{
ID_EN
,
RP_EN
}
SKIP_CARD
=
{
ID_EN
,
RP_EN
,
SME_BL_EN
}
ID_COMPARE_LOGIC
=
{
...
...
@@ -1555,6 +1558,11 @@ BL_COMPARE_LOGIC = {
'registeredCapital'
:
(
'注册资本'
,
'se_rmb_compare'
,
{},
'营业执照注册资本与系统不一致'
),
}
BL_COMPARE_LOGIC
=
{
'legalRepName'
:
(
'经营者姓名'
,
'se_name_compare'
,
{},
'营业执照法定代表人与系统不一致'
),
'businessLicenseDueDate'
:
(
'营业期限'
,
'se_date_compare'
,
{
'ocr_split'
:
True
,
'long'
:
True
,
'ocr_replace'
:
True
,
'today'
:
True
},
'公司营业期限疑似过期'
),
}
MVI_COMPARE_LOGIC
=
{
'vinNo'
:
(
'车辆识别代码'
,
'se_common_compare'
,
{},
'发票车架号与系统不一致'
),
'dealer'
:
(
'销方名称'
,
'se_contain_compare_2'
,
{},
'发票销货单位名称与系统不一致'
),
...
...
@@ -1690,6 +1698,7 @@ SE_COMPARE_FIELD = {
EEP_EN
:
(
EEP_OCR_FIELD
,
EEP_COMPARE_LOGIC
,
False
),
RP_EN
:
(
RP_OCR_FIELD
,
RP_COMPARE_LOGIC
,
True
),
BL_EN
:
(
BL_OCR_FIELD
,
BL_COMPARE_LOGIC
,
False
),
SME_BL_EN
:
(
BL_OCR_FIELD
,
SME_BL_COMPARE_LOGIC
,
False
),
MVI_EN
:
(
MVI_OCR_FIELD
,
MVI_COMPARE_LOGIC
,
False
),
UCI_EN
:
(
UCI_OCR_FIELD
,
UCI_COMPARE_LOGIC
,
False
),
MVC_EN
:
(
MVC_OCR_FIELD
,
MVC_COMPARE_LOGIC
,
False
),
...
...
src/celery_compare/tasks.py
View file @
8e146fd
...
...
@@ -928,10 +928,10 @@ def get_se_cms_compare_info(last_obj, application_entity, detect_list):
if
individual_info
.
get
(
'customersubType'
,
''
)
.
startswith
(
'Self Employed'
):
sep_field_input
=
[
(
'
company
Name'
,
customer_name
),
(
'
organizationType'
,
individual_info
.
get
(
'selfEmployedSubType'
,
''
)
),
(
'
legalRep
Name'
,
customer_name
),
(
'
businessLicenseDueDate'
,
''
),
]
license_dict
[
consts
.
BL_EN
]
=
sep_field_input
license_dict
[
consts
.
SME_
BL_EN
]
=
sep_field_input
if
len
(
all_id_num
)
>
0
:
main_role_info
.
setdefault
(
individual_info
[
'applicantType'
],
[])
.
append
(
...
...
@@ -1940,9 +1940,11 @@ def compare(application_id, application_entity, uniq_seq, ocr_res_id, is_ca=True
result_class
=
HILSEOCRResult
if
application_entity
==
consts
.
HIL_PREFIX
else
AFCSEOCRResult
ca_result_class
=
HILOCRResult
if
application_entity
==
consts
.
HIL_PREFIX
else
AFCOCRResult
if
ocr_res_id
is
None
:
ca_ocr_res_dict
=
ca_result_class
.
objects
.
filter
(
application_id
=
application_id
)
.
values
(
consts
.
IC_OCR_FIELD
)
.
first
()
ca_ocr_res_dict
=
ca_result_class
.
objects
.
filter
(
application_id
=
application_id
)
.
values
(
*
consts
.
CA_ADD_COMPARE_FIELDS
)
.
first
()
else
:
ca_ocr_res_dict
=
ca_result_class
.
objects
.
filter
(
id
=
ocr_res_id
)
.
values
(
consts
.
IC_OCR_FIELD
)
.
first
()
ca_ocr_res_dict
=
ca_result_class
.
objects
.
filter
(
id
=
ocr_res_id
)
.
values
(
*
consts
.
CA_ADD_COMPARE_FIELDS
)
.
first
()
if
ocr_res_id
is
None
:
ocr_res_dict
=
result_class
.
objects
.
filter
(
application_id
=
application_id
)
.
values
(
*
consts
.
COMPARE_FIELDS
)
.
first
()
else
:
...
...
@@ -1956,10 +1958,11 @@ def compare(application_id, application_entity, uniq_seq, ocr_res_id, is_ca=True
if
is_ca
:
ca_compare
(
application_id
,
application_entity
,
ocr_res_id
,
last_obj
,
ocr_res_dict
)
else
:
if
isinstance
(
ca_ocr_res_dict
,
dict
)
and
isinstance
(
ca_ocr_res_dict
.
get
(
consts
.
IC_OCR_FIELD
),
str
):
tmp_ca_result
=
json
.
loads
(
ca_ocr_res_dict
.
get
(
consts
.
IC_OCR_FIELD
))
if
isinstance
(
ocr_res_dict
.
get
(
consts
.
IC_OCR_FIELD
),
str
):
tmp_se_result
=
json
.
loads
(
ocr_res_dict
.
get
(
consts
.
IC_OCR_FIELD
))
for
field_name
in
consts
.
CA_ADD_COMPARE_FIELDS
:
if
isinstance
(
ca_ocr_res_dict
,
dict
)
and
isinstance
(
ca_ocr_res_dict
.
get
(
field_name
),
str
):
tmp_ca_result
=
json
.
loads
(
ca_ocr_res_dict
.
get
(
field_name
))
if
isinstance
(
ocr_res_dict
.
get
(
field_name
),
str
):
tmp_se_result
=
json
.
loads
(
ocr_res_dict
.
get
(
field_name
))
tmp_ca_result
.
extend
(
tmp_se_result
)
ocr_res_dict
[
consts
.
IC_OCR_FIELD
]
=
json
.
dumps
(
tmp_ca_result
)
ocr_res_dict
[
field_name
]
=
json
.
dumps
(
tmp_ca_result
)
se_compare
(
application_id
,
application_entity
,
ocr_res_id
,
last_obj
,
ocr_res_dict
,
is_cms
)
...
...
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