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
055e3ca9
authored
2022-07-26 18:11:29 +0800
by
周伟奇
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
SE
1 parent
f75cb473
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
31 additions
and
37 deletions
src/apps/doc/consts.py
src/apps/doc/management/commands/ocr_process.py
src/apps/doc/views.py
src/celery_compare/tasks.py
src/common/tools/comparison.py
src/apps/doc/consts.py
View file @
055e3ca
...
...
@@ -1582,7 +1582,8 @@ SE_HIL_CON_MAP = {
SE_AFC_CON_FIELD
=
[
'合同编号-每页'
,
'所购车辆价格-小写-重要条款'
,
'车架号-重要条款'
,
'贷款本金金额-重要条款'
,
'贷款期限-重要条款'
,
'车辆贷款本金金额-重要条款'
,
'附加产品融资贷款本金总额-重要条款'
,
'所购车辆价格'
,
'车架号'
,
'经销商'
,
'贷款本金金额'
,
'车辆贷款本金金额'
,
'附加产品融资贷款本金总额'
,
'贷款期限'
,
'还款账号'
,
'户名'
,
'开户行'
,
'还款计划表'
,
'见证人签字'
,
'见证人日期'
,
'ASP项目详情-重要条款'
,
'购置税校验'
,
'ASP项目详情'
]
'还款计划表'
,
'见证人签字'
,
'见证人日期'
,
'ASP项目详情-重要条款'
,
'购置税校验'
,
'ASP项目详情'
,
'合同编号-每页(no-asp)'
]
CON_BANK_FIELD
=
[
'还款账号'
,
'户名'
,
'开户行'
]
# '承租人姓名', '承租人证件号码', '承租人法定代表人或授权代表'
...
...
@@ -1943,6 +1944,7 @@ HIL_CONTRACT_3_COMPARE_LOGIC = {
HT_COMPARE_LOGIC
=
{
'合同编号-每页'
:
(
'合同编号-每页'
,
'se_list_compare'
,
{},
'合同编号与系统不一致'
),
'合同编号-每页(no-asp)'
:
(
'合同编号-每页'
,
'se_list_compare'
,
{
'pop_last'
:
True
},
'合同编号与系统不一致'
),
'所购车辆价格-小写-重要条款'
:
(
'所购车辆价格-小写-重要条款'
,
'se_amount_str_compare'
,
{},
'合同首页中车辆价格与系统不一致'
),
'车架号-重要条款'
:
(
'车架号-重要条款'
,
'se_common_compare'
,
{},
'合同首页中车架号与系统不一致'
),
'贷款本金金额-重要条款'
:
(
'贷款本金金额-重要条款'
,
'se_amount_str_compare'
,
{},
'合同首页中贷款本金与系统不一致'
),
...
...
src/apps/doc/management/commands/ocr_process.py
View file @
055e3ca
...
...
@@ -310,7 +310,7 @@ class Command(BaseCommand, LoggerMixin):
elif
isinstance
(
sub_value
[
text_key
],
str
):
page_compare_dict
[
key
][
sub_key
]
=
sub_value
[
text_key
]
contract_result_compare
.
setdefault
(
classify
,
dict
())[
consts
.
ASP_KEY
]
=
contract_dict
.
get
(
consts
.
ASP_KEY
,
False
)
#
contract_result_compare.setdefault(classify, dict())[consts.ASP_KEY] = contract_dict.get(consts.ASP_KEY, False)
# "position" = [xmin, ymin, xmax, ymax]
contract_result_compare
.
setdefault
(
classify
,
dict
())[
page_num_only
]
=
page_compare_dict
...
...
@@ -927,7 +927,8 @@ 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 = 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
:
...
...
src/apps/doc/views.py
View file @
055e3ca
...
...
@@ -773,37 +773,6 @@ class SECompareView(GenericView):
# auto_obj.save()
return
response
.
ok
()
# uniq_seq = content.get('uniqSeq')
# business_type = content.get('applicationEntity')
# application_id = content.get('applicationId')
#
# individual_cus_info = json.dumps(content.get('individualCusInfo'))
# vehicle_info = json.dumps(content.get('vehicleInfo'))
# insurance_info = json.dumps(content.get('insuranceInfo'))
# bank_info = json.dumps(content.get('bankInfo'))
# quotationt_info = json.dumps(content.get('quotationtInfo'))
# corporate_cus_info = json.dumps(content.get('corporateCusInfo')) if isinstance(
# content.get('corporateCusInfo'), dict) else None
# comparison_class = HILSEComparisonInfo if business_type in consts.HIL_SET else AFCSEComparisonInfo
# comparison_class.objects.create(
# uniq_seq=uniq_seq,
# application_id=application_id,
# application_version=content.get('applicationVersion'),
# customer_type=content.get('customerType'),
# first_submmison_date=content.get('firstSubmmisonDate'),
# property_doc_policy=content.get('propertyDocumentPolicy', None),
# individual_cus_info=individual_cus_info,
# corporate_cus_info=corporate_cus_info,
# vehicle_info=vehicle_info,
# insurance_info=insurance_info,
# bank_info=bank_info,
# quotationt_info=quotationt_info
# )
# 触发比对
# compare.apply_async((application_id, business_type, uniq_seq, None, False, False),
# queue='queue_compare')
post
.
openapi_doc
=
'''
tags: [info]
summary: POS上传SE比对信息
...
...
src/celery_compare/tasks.py
View file @
055e3ca
...
...
@@ -1343,8 +1343,17 @@ def get_se_cms_compare_info_auto(last_obj, application_entity, auto=True):
else
:
# AFC合同------------------------------------------------------------------------------------------------------
vehicle_principal_str
=
str
(
cms_info
.
get
(
'financialInformation'
,
{})
.
get
(
'vehiclePrincipal'
,
'0.0'
))
if
is_asp
:
afc_contract_input
=
[
(
consts
.
SE_AFC_CON_FIELD
[
0
],
full_no
),
]
else
:
afc_contract_input
=
[
(
consts
.
SE_AFC_CON_FIELD
[
23
],
full_no
),
]
afc_contract_input
.
extend
([
(
consts
.
SE_AFC_CON_FIELD
[
1
],
amount
),
(
consts
.
SE_AFC_CON_FIELD
[
2
],
vin_no
),
(
consts
.
SE_AFC_CON_FIELD
[
3
],
str
(
cms_info
.
get
(
'financialInformation'
,
{})
.
get
(
'originationPrincipal'
,
'0.0'
))),
...
...
@@ -1362,7 +1371,7 @@ def get_se_cms_compare_info_auto(last_obj, application_entity, auto=True):
(
consts
.
SE_AFC_CON_FIELD
[
15
],
account_holder_name
),
(
consts
.
SE_AFC_CON_FIELD
[
16
],
bank_name
),
(
consts
.
SE_AFC_CON_FIELD
[
17
],
schedule_list_str
),
]
]
)
if
is_asp
:
afc_contract_input
.
append
((
consts
.
SE_AFC_CON_FIELD
[
20
],
asp_list
))
...
...
@@ -1732,7 +1741,7 @@ def get_se_cms_compare_info(last_obj, application_entity, detect_list, auto=Fals
fp_campaign
=
cms_info
.
get
(
'fpCampaign'
,
''
)
fp_group
=
cms_info
.
get
(
'fpGroup'
,
''
)
insurance_type
=
cms_info
.
get
(
'insuranceDetails'
,
{})
.
get
(
'insuranceType'
,
''
)
if
i
nsurance_type
==
'Waive Insurance'
and
i
sinstance
(
insurance_price
,
str
):
if
isinstance
(
insurance_price
,
str
):
is_insurance
=
1
elif
insurance_type
==
'Comprehensive Insurance'
:
is_insurance
=
2
...
...
@@ -1864,8 +1873,16 @@ def get_se_cms_compare_info(last_obj, application_entity, detect_list, auto=Fals
else
:
# AFC合同------------------------------------------------------------------------------------------------------
vehicle_principal_str
=
str
(
cms_info
.
get
(
'financialInformation'
,
{})
.
get
(
'vehiclePrincipal'
,
'0.0'
))
if
is_asp
:
afc_contract_input
=
[
(
consts
.
SE_AFC_CON_FIELD
[
0
],
full_no
),
]
else
:
afc_contract_input
=
[
(
consts
.
SE_AFC_CON_FIELD
[
23
],
full_no
),
]
afc_contract_input
.
extend
([
(
consts
.
SE_AFC_CON_FIELD
[
1
],
amount
),
(
consts
.
SE_AFC_CON_FIELD
[
2
],
vin_no
),
(
consts
.
SE_AFC_CON_FIELD
[
3
],
str
(
cms_info
.
get
(
'financialInformation'
,
{})
.
get
(
'originationPrincipal'
,
'0.0'
))),
...
...
@@ -1883,7 +1900,7 @@ def get_se_cms_compare_info(last_obj, application_entity, detect_list, auto=Fals
(
consts
.
SE_AFC_CON_FIELD
[
15
],
account_holder_name
),
(
consts
.
SE_AFC_CON_FIELD
[
16
],
bank_name
),
(
consts
.
SE_AFC_CON_FIELD
[
17
],
schedule_list_str
),
]
]
)
if
is_asp
:
afc_contract_input
.
append
((
consts
.
SE_AFC_CON_FIELD
[
20
],
asp_list
))
...
...
src/common/tools/comparison.py
View file @
055e3ca
...
...
@@ -173,6 +173,11 @@ class Comparison:
return
self
.
RESULT_Y
return
self
.
RESULT_N
else
:
if
kwargs
.
get
(
'pop_last'
,
False
):
for
item
in
ocr_str_or_list
[:
-
1
]:
if
item
!=
input_str_or_list
:
return
self
.
RESULT_N
else
:
for
item
in
ocr_str_or_list
:
if
item
!=
input_str_or_list
:
return
self
.
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