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
1b812e1f
authored
2022-07-27 15:45:15 +0800
by
周伟奇
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
add se bs jypz
1 parent
055e3ca9
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
31 additions
and
6 deletions
src/apps/doc/consts.py
src/apps/doc/management/commands/ocr_process.py
src/apps/doc/ocr/wb.py
src/celery_compare/tasks.py
src/apps/doc/consts.py
View file @
1b812e1
...
...
@@ -1439,6 +1439,8 @@ SE_BS_FIELD = ['户名', '打印日期', '流水日期', '(担保人1)户名', '
SE_HMH_FIELD
=
[
'借款人/承租人姓名'
,
'借款人/承租人证件号'
,
'申请号'
,
'渠道'
,
'签字'
]
SE_BD_FIELD
=
[
'被保险人姓名'
,
'被保险人证件号码'
,
'车架号'
,
'机动车损失保险金额'
,
'第三者责任保险金额'
,
'绝对免赔率'
,
'保险起始日期'
,
'保险截止日期'
,
'保单章'
,
'第一受益人'
,
'保险费合计'
]
JDMPV_VALUE
=
[
'-'
,
'--'
,
'0
%
'
,
'0.00'
,
'/'
,
'0'
,
''
]
JYPZ_TYPE_1
=
[
'二手车交易凭证'
]
JYPZ_TYPE_2
=
[
'BMW官方认证二手车交易凭证'
,
'二手车交易凭证'
]
SE_BANK_FIELD
=
[
'accountNo'
,
'bankName'
]
SE_DDA_FIELD
=
[
'applicationId(1)'
,
'applicationId(2)'
,
'bankName'
,
'companyName'
,
'customerName'
,
'idNum'
,
'accountHolderName'
,
'accountNo'
]
...
...
@@ -1811,6 +1813,7 @@ DDA_COMPARE_LOGIC = {
}
JYPZ_COMPARE_LOGIC
=
{
'type'
:
(
'type'
,
'super_list_compare'
,
{},
'二手车凭证类型与产品不符'
),
'vinNo'
:
(
'vin'
,
'se_common_compare'
,
{},
'二手车凭证车辆识别代号与系统车架号不一致'
),
'dealerName'
:
(
'authorized_dealer'
,
'se_common_compare'
,
{},
'二手车凭证经销商与系统经销商不一致'
),
'vehicleTransactionAmount'
:
(
'price'
,
'se_amount_compare'
,
{},
'二手车凭证购买方交易价格与系统车辆价格不一致'
),
...
...
src/apps/doc/management/commands/ocr_process.py
View file @
1b812e1
...
...
@@ -919,6 +919,7 @@ class Command(BaseCommand, LoggerMixin):
'role'
:
bs_info
.
get
(
'role'
,
''
),
'print_time'
:
print_date
,
'timedelta'
:
bs_info
.
get
(
'timedelta'
,
''
),
'verify'
:
bs_info
.
get
(
'verify'
,
True
)
}
)
return
res
...
...
src/apps/doc/ocr/wb.py
View file @
1b812e1
...
...
@@ -392,7 +392,9 @@ class BSWorkbook(Workbook):
cell
.
fill
=
self
.
amount_fill
for
cell
in
ms
[
4
]:
cell
.
fill
=
self
.
amount_fill
return
ms
,
timedelta
verify_res
=
False
if
len
(
metadata_highlight_row
)
>
0
or
len
(
verify_highlight_row
)
>
0
else
True
return
ms
,
timedelta
,
verify_res
@staticmethod
def
amount_format
(
amount_str
):
...
...
@@ -723,7 +725,7 @@ class BSWorkbook(Workbook):
# 2.元信息提取表
confidence
=
self
.
get_confidence
(
max_find_count
,
classify
)
is_verify_classify
=
classify
in
consts
.
BS_VERIFY_CLASSIFY
ms
,
timedelta
=
self
.
build_meta_sheet
(
role_name
,
ms
,
timedelta
,
verify_res
=
self
.
build_meta_sheet
(
role_name
,
new_card
,
confidence
,
summary
.
get
(
'code'
),
...
...
@@ -737,6 +739,7 @@ class BSWorkbook(Workbook):
summary
[
'timedelta'
]
=
timedelta
summary
[
'end_date'
]
=
end_date
summary
[
'verify'
]
=
verify_res
# 3.创建月份表、提取/高亮关键行
# 倒序处理
...
...
src/celery_compare/tasks.py
View file @
1b812e1
...
...
@@ -1062,7 +1062,7 @@ def get_se_cms_compare_info_auto(last_obj, application_entity, auto=True):
# jypz_field_input.append(('dealerName', dealer_name))
# jypz_field_input.append(('vinNo', vin_no))
# jypz_field_input.append(('vehicleTransactionAmount', amount))
# jypz_field_input.append((consts.SE_GB_USED_FIELD[
-1
], first_submission_date))
# jypz_field_input.append((consts.SE_GB_USED_FIELD[
2
], first_submission_date))
#
# vehicle_info[consts.MVC_EN] = gb_field_input
# vehicle_info[consts.MVC34_EN] = gb34_field_input
...
...
@@ -1531,6 +1531,7 @@ def get_se_cms_compare_info(last_obj, application_entity, detect_list, auto=Fals
# dda_num = '、'.join(dda_num_list)
# del main_role_info
fp_group
=
cms_info
.
get
(
'fpGroup'
,
''
)
vehicle_info
=
{}
vehicle_field_input
=
[]
vehicle_status
=
cms_info
.
get
(
'vehicleStatus'
,
''
)
...
...
@@ -1592,7 +1593,11 @@ def get_se_cms_compare_info(last_obj, application_entity, detect_list, auto=Fals
jypz_field_input
.
append
((
'dealerName'
,
dealer_name
))
jypz_field_input
.
append
((
'vinNo'
,
vin_no
))
jypz_field_input
.
append
((
'vehicleTransactionAmount'
,
amount
))
jypz_field_input
.
append
((
consts
.
SE_GB_USED_FIELD
[
-
1
],
first_submission_date
))
jypz_field_input
.
append
((
consts
.
SE_GB_USED_FIELD
[
2
],
first_submission_date
))
if
fp_group
.
find
(
'Non-OCU Product Group'
)
!=
-
1
:
jypz_field_input
.
append
((
'type'
,
consts
.
JYPZ_TYPE_1
))
elif
fp_group
.
find
(
'OCU Product Group'
)
!=
-
1
:
jypz_field_input
.
append
((
'type'
,
consts
.
JYPZ_TYPE_2
))
vehicle_info
[
consts
.
MVC_EN
]
=
gb_field_input
vehicle_info
[
consts
.
MVC34_EN
]
=
gb34_field_input
...
...
@@ -1739,7 +1744,6 @@ def get_se_cms_compare_info(last_obj, application_entity, detect_list, auto=Fals
# 保单 -----------------------------------------------------------------------------------------------------------
is_insurance
=
0
fp_campaign
=
cms_info
.
get
(
'fpCampaign'
,
''
)
fp_group
=
cms_info
.
get
(
'fpGroup'
,
''
)
insurance_type
=
cms_info
.
get
(
'insuranceDetails'
,
{})
.
get
(
'insuranceType'
,
''
)
if
isinstance
(
insurance_price
,
str
):
is_insurance
=
1
...
...
@@ -1961,9 +1965,16 @@ def se_bs_compare(license_en, ocr_res_dict, strip_list, is_auto):
# 主共借人
pre_best_res
=
{}
max_correct_count
=
0
for
ocr_res
in
ocr_res_list
:
verify_list
=
[]
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_list
.
append
(
verify_bool
)
if
not
verify_bool
:
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
)
\
...
...
@@ -1990,6 +2001,13 @@ def se_bs_compare(license_en, ocr_res_dict, strip_list, is_auto):
max_correct_count
=
correct_count
pre_best_res
=
pre_tmp_res_part
# 真伪
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
))
# 担保人1
dbr1_best_res
=
{}
if
len
(
dbr1_field_list
)
>
0
:
...
...
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