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
90b532a7
authored
2021-09-03 15:50:17 +0800
by
周伟奇
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
add license
1 parent
19f10814
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
76 additions
and
0 deletions
src/apps/doc/consts.py
src/apps/doc/models.py
src/celery_compare/tasks.py
src/common/tools/mssql_script8.py
src/apps/doc/consts.py
View file @
90b532a
...
...
@@ -1119,6 +1119,8 @@ MVI_OCR_FIELD = 'mvi_ocr'
BC_OCR_FIELD
=
'bc_ocr'
UCI_OCR_FIELD
=
'uci_ocr'
DDA_OCR_FIELD
=
'bs_ocr'
HMH_OCR_FIELD
=
'hmh_ocr'
JYPZ_OCR_FIELD
=
'jypz_ocr'
RESULT_MAPPING
=
{
MVI_CLASSIFY
:
MVI_OCR_FIELD
,
...
...
@@ -1133,6 +1135,8 @@ RESULT_MAPPING = {
MVC_CLASSIFY
:
MVC_OCR_FIELD
,
DDA_CLASSIFY
:
DDA_OCR_FIELD
,
# VAT_CLASSIFY: 'vat_ocr',
HMH_CLASSIFY
:
HMH_OCR_FIELD
,
JYPZ_CLASSIFY
:
JYPZ_OCR_FIELD
}
COMPARE_FIELDS
=
(
MVI_OCR_FIELD
,
...
...
@@ -1324,6 +1328,7 @@ SE_NEW_ADD_FIELD = ['customerName', 'idNum', 'dateOfInvoice', 'stamp']
SE_STAMP_VALUE
=
'有'
SE_GB_NEW_FIELD
=
[
'vinNo'
]
SE_GB_USED_FIELD
=
[
'customerName'
,
'idNum'
,
'date'
]
SE_HMH_FIELD
=
[
'customerName'
,
'idNum'
,
'applicationId'
]
SE_BANK_FIELD
=
[
'accountNo'
,
'bankName'
]
SE_DDA_FIELD
=
[
'applicationId(1)'
,
'applicationId(2)'
,
'bankName'
,
'companyName'
,
'customerName'
,
'idNum'
,
'accountHolderName'
,
'accountNo'
]
...
...
@@ -1342,6 +1347,9 @@ MVC_EN = 'Green Book(1/2)'
MVC34_EN
=
'Green Book(3/4)'
BC_EN
=
'Bank Card'
DDA_EN
=
'DDA'
HMH_EN
=
'Mortgage Waiver Letter'
JYPZ_EN
=
'Used Car Document'
ID_COMPARE_LOGIC
=
{
'customerName'
:
(
'姓名'
,
'se_name_compare'
,
{}),
...
...
@@ -1440,6 +1448,19 @@ DDA_COMPARE_LOGIC = {
'accountNo'
:
(
DDA_BC_ID
,
'se_common_compare'
,
{}),
}
JYPZ_COMPARE_LOGIC
=
{
'vinNo'
:
(
'vin'
,
'se_common_compare'
,
{}),
'vehicleTransactionAmount'
:
(
'price'
,
'se_amount_compare'
,
{}),
'customerName'
:
(
'buyer_name'
,
'se_name_compare'
,
{
'is_passport'
:
True
}),
'idNum'
:
(
'buyer_id'
,
'se_contain_compare_2'
,
{}),
'date'
:
(
'date'
,
'se_date_compare_2'
,
{
'three_month'
:
True
}),
}
HMH_COMPARE_LOGIC
=
{
'customerName'
:
(
'借款/承租人姓名'
,
'se_name_compare'
,
{}),
'idNum'
:
(
'证件号码'
,
'se_common_compare'
,
{}),
'applicationId'
:
(
'合同编号'
,
'se_contain_compare'
,
{}),
}
# MVC_OCR_FIELD = 'mvc_ocr'
...
...
@@ -1455,6 +1476,8 @@ SE_COMPARE_FIELD = {
MVC34_EN
:
(
MVC_OCR_FIELD
,
MVC34_COMPARE_LOGIC
,
False
),
BC_EN
:
(
BC_OCR_FIELD
,
BC_COMPARE_LOGIC
,
False
),
DDA_EN
:
(
DDA_OCR_FIELD
,
DDA_COMPARE_LOGIC
,
False
),
HMH_EN
:
(
HMH_OCR_FIELD
,
HMH_COMPARE_LOGIC
,
False
),
JYPZ_EN
:
(
JYPZ_OCR_FIELD
,
JYPZ_COMPARE_LOGIC
,
False
),
}
...
...
src/apps/doc/models.py
View file @
90b532a
...
...
@@ -284,6 +284,8 @@ class AFCOCRResult(models.Model):
pp_ocr
=
models
.
TextField
(
null
=
True
,
verbose_name
=
"护照"
)
mvc_ocr
=
models
.
TextField
(
null
=
True
,
verbose_name
=
"机动车登记证"
)
vat_ocr
=
models
.
TextField
(
null
=
True
,
verbose_name
=
"增值税发票"
)
hmh_ocr
=
models
.
TextField
(
null
=
True
,
verbose_name
=
"豁免函"
)
jypz_ocr
=
models
.
TextField
(
null
=
True
,
verbose_name
=
"二手车交易凭证"
)
update_time
=
models
.
DateTimeField
(
auto_now
=
True
,
verbose_name
=
'修改时间'
)
create_time
=
models
.
DateTimeField
(
auto_now_add
=
True
,
verbose_name
=
'创建时间'
)
...
...
@@ -311,6 +313,8 @@ class HILOCRResult(models.Model):
pp_ocr
=
models
.
TextField
(
null
=
True
,
verbose_name
=
"护照"
)
mvc_ocr
=
models
.
TextField
(
null
=
True
,
verbose_name
=
"机动车登记证"
)
vat_ocr
=
models
.
TextField
(
null
=
True
,
verbose_name
=
"增值税发票"
)
hmh_ocr
=
models
.
TextField
(
null
=
True
,
verbose_name
=
"豁免函"
)
jypz_ocr
=
models
.
TextField
(
null
=
True
,
verbose_name
=
"二手车交易凭证"
)
update_time
=
models
.
DateTimeField
(
auto_now
=
True
,
verbose_name
=
'修改时间'
)
create_time
=
models
.
DateTimeField
(
auto_now_add
=
True
,
verbose_name
=
'创建时间'
)
...
...
@@ -337,6 +341,8 @@ class AFCSEOCRResult(models.Model):
pp_ocr
=
models
.
TextField
(
null
=
True
,
verbose_name
=
"护照"
)
mvc_ocr
=
models
.
TextField
(
null
=
True
,
verbose_name
=
"机动车登记证"
)
vat_ocr
=
models
.
TextField
(
null
=
True
,
verbose_name
=
"增值税发票"
)
hmh_ocr
=
models
.
TextField
(
null
=
True
,
verbose_name
=
"豁免函"
)
jypz_ocr
=
models
.
TextField
(
null
=
True
,
verbose_name
=
"二手车交易凭证"
)
update_time
=
models
.
DateTimeField
(
auto_now
=
True
,
verbose_name
=
'修改时间'
)
create_time
=
models
.
DateTimeField
(
auto_now_add
=
True
,
verbose_name
=
'创建时间'
)
...
...
@@ -364,6 +370,8 @@ class HILSEOCRResult(models.Model):
pp_ocr
=
models
.
TextField
(
null
=
True
,
verbose_name
=
"护照"
)
mvc_ocr
=
models
.
TextField
(
null
=
True
,
verbose_name
=
"机动车登记证"
)
vat_ocr
=
models
.
TextField
(
null
=
True
,
verbose_name
=
"增值税发票"
)
hmh_ocr
=
models
.
TextField
(
null
=
True
,
verbose_name
=
"豁免函"
)
jypz_ocr
=
models
.
TextField
(
null
=
True
,
verbose_name
=
"二手车交易凭证"
)
update_time
=
models
.
DateTimeField
(
auto_now
=
True
,
verbose_name
=
'修改时间'
)
create_time
=
models
.
DateTimeField
(
auto_now_add
=
True
,
verbose_name
=
'创建时间'
)
...
...
src/celery_compare/tasks.py
View file @
90b532a
...
...
@@ -754,6 +754,7 @@ def get_se_compare_info(last_obj, application_entity):
for
applicant_type
in
consts
.
APPLICANT_TYPE
:
if
applicant_type
in
main_role_info
:
main_name
,
main_num
,
_
=
main_role_info
[
applicant_type
][
0
]
hmh_name
,
_
,
hmh_id
=
main_role_info
[
applicant_type
][
0
]
break
for
applicant_type
in
consts
.
APPLICANT_TYPE
[:
2
]:
if
applicant_type
in
main_role_info
:
...
...
@@ -806,6 +807,7 @@ def get_se_compare_info(last_obj, application_entity):
else
:
gb_field_input
=
[]
gb34_field_input
=
[]
jypz_field_input
=
[]
for
vehicle_field
in
consts
.
SE_USED_FIELD
:
vehicle_field_input
.
append
((
vehicle_field
,
vehicle_info_dict
[
vehicle_field
]))
for
gb_field
in
consts
.
SE_GB_NEW_FIELD
:
...
...
@@ -813,19 +815,27 @@ def get_se_compare_info(last_obj, application_entity):
if
isinstance
(
company_info
,
tuple
):
vehicle_field_input
.
append
((
consts
.
SE_NEW_ADD_FIELD
[
0
],
company_info
[
0
]))
vehicle_field_input
.
append
((
consts
.
SE_NEW_ADD_FIELD
[
1
],
company_info
[
1
]))
jypz_field_input
.
append
((
consts
.
SE_NEW_ADD_FIELD
[
0
],
company_info
[
0
]))
jypz_field_input
.
append
((
consts
.
SE_NEW_ADD_FIELD
[
1
],
company_info
[
1
]))
gb34_field_input
.
append
((
consts
.
SE_GB_USED_FIELD
[
0
],
company_info
[
0
]))
gb34_field_input
.
append
((
consts
.
SE_GB_USED_FIELD
[
1
],
company_info
[
1
]))
else
:
vehicle_field_input
.
append
((
consts
.
SE_NEW_ADD_FIELD
[
0
],
main_name
))
vehicle_field_input
.
append
((
consts
.
SE_NEW_ADD_FIELD
[
1
],
main_num
))
jypz_field_input
.
append
((
consts
.
SE_NEW_ADD_FIELD
[
0
],
main_name
))
jypz_field_input
.
append
((
consts
.
SE_NEW_ADD_FIELD
[
1
],
main_num
))
gb34_field_input
.
append
((
consts
.
SE_GB_USED_FIELD
[
0
],
main_name
))
gb34_field_input
.
append
((
consts
.
SE_GB_USED_FIELD
[
1
],
main_num
))
gb34_field_input
.
append
((
consts
.
SE_GB_USED_FIELD
[
2
],
last_obj
.
first_submmison_date
))
vehicle_field_input
.
append
((
consts
.
SE_NEW_ADD_FIELD
[
2
],
last_obj
.
first_submmison_date
))
vehicle_field_input
.
append
((
consts
.
SE_NEW_ADD_FIELD
[
3
],
consts
.
SE_STAMP_VALUE
))
for
jypz_field
in
consts
.
SE_USED_FIELD
:
jypz_field_input
.
append
((
jypz_field
,
vehicle_info_dict
[
jypz_field
]))
jypz_field_input
.
append
((
consts
.
SE_GB_USED_FIELD
[
-
1
],
last_obj
.
first_submmison_date
))
vehicle_info
[
consts
.
UCI_EN
]
=
vehicle_field_input
vehicle_info
[
consts
.
MVC_EN
]
=
gb_field_input
vehicle_info
[
consts
.
MVC34_EN
]
=
gb34_field_input
vehicle_info
[
consts
.
JYPZ_EN
]
=
jypz_field_input
compare_info
[
'vehicleInfo'
]
=
vehicle_info
bank_info_dict
=
json
.
loads
(
last_obj
.
bank_info
)
...
...
@@ -851,6 +861,14 @@ def get_se_compare_info(last_obj, application_entity):
bank_info
[
consts
.
DDA_EN
]
=
dda_field_input
compare_info
[
'bankInfo'
]
=
bank_info
other_info
=
{}
hmh_field_input
=
[]
hmh_field_input
.
append
((
consts
.
SE_HMH_FIELD
[
0
],
hmh_name
))
hmh_field_input
.
append
((
consts
.
SE_HMH_FIELD
[
1
],
hmh_id
))
hmh_field_input
.
append
((
consts
.
SE_HMH_FIELD
[
2
],
last_obj
.
application_id
))
other_info
[
consts
.
HMH_EN
]
=
hmh_field_input
compare_info
[
'other'
]
=
other_info
return
compare_info
...
...
src/common/tools/mssql_script8.py
0 → 100644
View file @
90b532a
import
pyodbc
hil_sql
=
"""
ALTER TABLE hil_ocr_result ADD hmh_ocr nvarchar(max), jypz_ocr nvarchar(max);
ALTER TABLE hil_se_ocr_result ADD hmh_ocr nvarchar(max), jypz_ocr nvarchar(max);
"""
afc_sql
=
"""
ALTER TABLE afc_ocr_result ADD hmh_ocr nvarchar(max), jypz_ocr nvarchar(max);
ALTER TABLE afc_se_ocr_result ADD hmh_ocr nvarchar(max), jypz_ocr nvarchar(max);
"""
hil_cnxn
=
pyodbc
.
connect
(
'DRIVER={ODBC Driver 17 for SQL Server};'
,
autocommit
=
True
)
hil_cursor
=
hil_cnxn
.
cursor
()
hil_cursor
.
execute
(
hil_sql
)
hil_cursor
.
close
()
hil_cnxn
.
close
()
afc_cnxn
=
pyodbc
.
connect
(
'DRIVER={ODBC Driver 17 for SQL Server};'
,
autocommit
=
True
)
afc_cursor
=
afc_cnxn
.
cursor
()
afc_cursor
.
execute
(
afc_sql
)
afc_cursor
.
close
()
afc_cnxn
.
close
()
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