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
8d9628e9
authored
2023-07-24 17:38:37 +0800
by
冯轩
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
INIT:CAA2
1 parent
a8dad649
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
65 additions
and
11 deletions
src/apps/doc/consts.py
src/celery_compare/tasks.py
src/apps/doc/consts.py
View file @
8d9628e
...
...
@@ -1428,6 +1428,8 @@ TCSEP = [
RESULT_Y
=
'Y'
RESULT_N
=
'N'
RESULT_NA
=
'NA'
RESULT_N1
=
'N1'
RESULT_N2
=
'N2'
IN_ORDER
=
(
'applicantType'
,
'idType'
,
SECOND_ID_TYPE_FIELD
,
'customerType'
,
'customerChineseName'
,
'idNum'
,
SECOND_ID_FIELD
,
"idExpiryDate"
,
"dateOfBirth"
,
'companyName'
,
"registeredCapital"
,
'selfEmployedSubType'
,)
...
...
src/celery_compare/tasks.py
View file @
8d9628e
...
...
@@ -1922,7 +1922,7 @@ def get_se_cms_compare_info(last_obj, application_entity, detect_list, auto=Fals
hil_contract_2_input
.
append
((
key
,
empty_str
))
contract_info
[
consts
.
HIL_CONTRACT_2_EN
]
=
hil_contract_2_input
compare_info
[
'contract'
]
=
contract_info
return
compare_info
,
cms_info
.
get
(
'applicationVersion'
,
1
),
is_gsyh
return
compare_info
,
cms_info
.
get
(
'applicationVersion'
,
1
),
cms_info
.
get
(
'autoApprovedDetails'
,
{})
.
get
(
'aaType'
,
''
),
is_gsyh
else
:
# AFC合同------------------------------------------------------------------------------------------------------
vehicle_principal_str
=
str
(
cms_info
.
get
(
'financialInformation'
,
{})
.
get
(
'vehiclePrincipal'
,
'0.0'
))
...
...
@@ -1997,10 +1997,10 @@ def get_se_cms_compare_info(last_obj, application_entity, detect_list, auto=Fals
afc_contract_qrs_input
=
[(
consts
.
SE_AFC_CON_QRS_FIELD
[
0
],
'{0}{1}{2}'
.
format
(
role_count
,
consts
.
SPLIT_STR
,
full_no
))]
contract_info
[
consts
.
AFC_CONTRACT_QRS_EN
]
=
afc_contract_qrs_input
compare_info
[
'contract'
]
=
contract_info
return
compare_info
,
cms_info
.
get
(
'applicationVersion'
,
1
),
is_gsyh
return
compare_info
,
cms_info
.
get
(
'applicationVersion'
,
1
),
cms_info
.
get
(
'autoApprovedDetails'
,
{})
.
get
(
'aaType'
,
''
),
is_gsyh
def
se_bs_compare
(
license_en
,
ocr_res_dict
,
strip_list
,
is_auto
):
def
se_bs_compare
(
license_en
,
ocr_res_dict
,
strip_list
,
is_auto
,
aa_type
):
# 主共借至少提供一个
# 有担保人,担保人必须提供。主共借没有时,修改comment:人工查看担保人亲属关系
...
...
@@ -2027,13 +2027,28 @@ def se_bs_compare(license_en, ocr_res_dict, strip_list, is_auto):
verify_list
=
[]
verify_false_idx_list
=
[]
auto_paper_verify_list
=
[]
auto_elec_verify_list
=
[]
auto_paper_verify_false_idx_list
=
[]
auto_elec_verify_false_idx_list
=
[]
for
tmp_idx
,
ocr_res
in
enumerate
(
ocr_res_list
):
correct_count
=
0
pre_tmp_res_part
=
{}
verify_bool
=
ocr_res
.
get
(
'verify'
,
True
)
verify_bool
=
ocr_res
.
get
(
'verify'
,
False
)
e_bank
=
ocr_res
.
get
(
'e_bank'
,
False
)
verify_list
.
append
(
verify_bool
)
if
not
verify_bool
:
verify_false_idx_list
.
append
(
str
(
tmp_idx
+
1
))
if
e_bank
:
auto_elec_verify_list
.
append
(
verify_bool
)
if
not
verify_bool
:
auto_elec_verify_false_idx_list
.
append
(
str
(
tmp_idx
+
1
))
else
:
auto_paper_verify_list
.
append
(
verify_bool
)
verify_list
.
add
(
False
)
auto_paper_verify_false_idx_list
.
append
(
str
(
tmp_idx
+
1
))
for
idx
,
(
name
,
value
)
in
enumerate
(
pre_field_list
):
ocr_str_or_list
=
ocr_res
.
get
(
compare_logic
[
name
][
0
])
if
isinstance
(
ocr_str_or_list
,
str
)
or
isinstance
(
ocr_str_or_list
,
list
)
\
...
...
@@ -2061,10 +2076,47 @@ def se_bs_compare(license_en, ocr_res_dict, strip_list, is_auto):
pre_best_res
=
pre_tmp_res_part
# 真伪
if
not
is_auto
:
# if not is_auto:
# name = '真伪'
# result = consts.RESULT_Y if all(verify_list) else consts.RESULT_N
# reason = '第{0}份银行流水疑似造假,需人工核查'.format('、'.join(verify_false_idx_list))
# result_field_list.append((name, empty_str, result, json.dumps(verify_list, ensure_ascii=False), empty_str, empty_error_type, reason))
# 非FSM Full CAA1
if
not
is_auto
and
aa_type
==
'CAA1'
:
name
=
'真伪'
# 若仅提供纸质流水,则默认真伪为N2
if
not
auto_elec_verify_list
:
result
=
consts
.
RESULT_N2
reason
=
'第{0}份银行流水为纸质版,请核查流水真伪。'
.
format
(
'、'
.
join
(
auto_paper_verify_list
))
# 若仅提供电子流水,逐一比对,有false为N1,全部true为Y
if
not
auto_paper_verify_list
:
result
=
consts
.
RESULT_Y
if
all
(
auto_elec_verify_list
)
else
consts
.
RESULT_N1
reason
=
'第{0}份银行流水疑似造假,需人工核查。'
.
format
(
'、'
.
join
(
auto_elec_verify_list
))
#同时包含,同时返回N1,N2
if
auto_elec_verify_list
and
auto_paper_verify_list
:
result
=
consts
.
RESULT_Y
if
all
(
auto_elec_verify_list
)
else
consts
.
RESULT_N1
reason1
=
'第{0}份银行流水疑似造假,需人工核查。'
.
format
(
'、'
.
join
(
auto_elec_verify_list
))
reason2
=
'第{0}份银行流水为纸质版,请核查流水真伪。'
.
format
(
'、'
.
join
(
auto_paper_verify_list
))
reason
=
reason1
+
reason2
result_field_list
.
append
((
name
,
empty_str
,
result
,
json
.
dumps
(
verify_list
,
ensure_ascii
=
False
),
empty_str
,
empty_error_type
,
reason
))
# 非FSM Full & Auto CAA2 目前逻辑和上面的完全一样
elif
aa_type
==
'CAA2'
:
name
=
'真伪'
result
=
consts
.
RESULT_Y
if
all
(
verify_list
)
else
consts
.
RESULT_N
reason
=
'第{0}份银行流水疑似造假,需人工核查'
.
format
(
'、'
.
join
(
verify_false_idx_list
))
# 若仅提供纸质流水,则默认真伪为N2
if
not
auto_elec_verify_list
:
result
=
consts
.
RESULT_N2
reason
=
'第{0}份银行流水为纸质版,请核查流水真伪。'
.
format
(
'、'
.
join
(
auto_paper_verify_list
))
# 若仅提供电子流水,逐一比对,有false为N1,全部true为Y
if
not
auto_paper_verify_list
:
result
=
consts
.
RESULT_Y
if
all
(
auto_elec_verify_list
)
else
consts
.
RESULT_N1
reason
=
'第{0}份银行流水疑似造假,需人工核查。'
.
format
(
'、'
.
join
(
auto_elec_verify_list
))
#同时包含,同时返回N1,N2
if
auto_elec_verify_list
and
auto_paper_verify_list
:
result
=
consts
.
RESULT_Y
if
all
(
auto_elec_verify_list
)
else
consts
.
RESULT_N1
reason1
=
'第{0}份银行流水疑似造假,需人工核查。'
.
format
(
'、'
.
join
(
auto_elec_verify_list
))
reason2
=
'第{0}份银行流水为纸质版,请核查流水真伪。'
.
format
(
'、'
.
join
(
auto_paper_verify_list
))
reason
=
reason1
+
reason2
result_field_list
.
append
((
name
,
empty_str
,
result
,
json
.
dumps
(
verify_list
,
ensure_ascii
=
False
),
empty_str
,
empty_error_type
,
reason
))
# 担保人1
...
...
@@ -2889,7 +2941,7 @@ def se_mvc34_compare(license_en, ocr_res_dict, field_list):
return
result_field_list
,
field_img_path_dict
def
se_compare_process
(
compare_info
,
ocr_res_dict
,
is_gsyh
,
is_auto
,
id_res_list
):
def
se_compare_process
(
compare_info
,
ocr_res_dict
,
is_gsyh
,
is_auto
,
id_res_list
,
aa_type
):
# individualCusInfo
# corporateCusInfo
# vehicleInfo
...
...
@@ -2983,7 +3035,7 @@ def se_compare_process(compare_info, ocr_res_dict, is_gsyh, is_auto, id_res_list
elif
license_en
==
consts
.
AFC_CONTRACT_QRS_EN
:
result_field_list
,
field_img_path_dict
=
se_contract_qrs_compare
(
license_en
,
ocr_res_dict
,
strip_list
)
elif
license_en
==
consts
.
BS_EN
:
result_field_list
,
field_img_path_dict
=
se_bs_compare
(
license_en
,
ocr_res_dict
,
strip_list
,
is_auto
)
result_field_list
,
field_img_path_dict
=
se_bs_compare
(
license_en
,
ocr_res_dict
,
strip_list
,
is_auto
,
aa_type
)
else
:
result_field_list
,
_
,
field_img_path_dict
=
se_compare_license
(
license_en
,
ocr_res_dict
,
strip_list
)
...
...
@@ -3135,11 +3187,11 @@ def se_compare(application_id, application_entity, ocr_res_id, last_obj, ocr_res
# 比对逻辑
start_time
=
datetime
.
now
()
detect_list
=
se_result_detect
(
ocr_res_dict
)
compare_info
,
application_version
,
is_gsyh
=
get_se_cms_compare_info
(
compare_info
,
application_version
,
aa_type
,
is_gsyh
=
get_se_cms_compare_info
(
last_obj
,
application_entity
,
detect_list
,
ignore_bank
=
ignore_bank
)
compare_result
,
total_fields
,
failed_count
,
successful_at_this_level
,
failure_reason_str
,
\
cn_failure_reason_str
,
bs_failure_reason_str
,
rpa_failure_reason
,
field_result_dict
=
se_compare_process
(
compare_info
,
ocr_res_dict
,
is_gsyh
,
False
,
id_res_list
)
compare_info
,
ocr_res_dict
,
is_gsyh
,
False
,
id_res_list
,
aa_type
)
compare_log
.
info
(
'{0} [SE] [compare success] [entity={1}] [id={2}] [ocr_res_id={3}] [result={4}]'
.
format
(
log_base
,
application_entity
,
application_id
,
ocr_res_id
,
compare_result
))
except
Exception
as
e
:
...
...
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