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
0c5207a0
authored
2021-12-13 16:24:55 +0800
by
周伟奇
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
hil contract part 1
1 parent
8b3fd09a
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
128 additions
and
64 deletions
src/apps/doc/consts.py
src/apps/doc/models.py
src/celery_compare/tasks.py
src/common/tools/mssql_script12.py
src/apps/doc/consts.py
View file @
0c5207a
...
...
@@ -1180,6 +1180,9 @@ JYPZ_OCR_FIELD = 'jypz_ocr'
HT_FIELD
=
'ht_ocr'
BD_FIELD
=
'bd_ocr'
BS_FIELD
=
'bss_ocr'
HIL_CONTRACT_1_FIELD
=
'hil_contract_1_ocr'
HIL_CONTRACT_2_FIELD
=
'hil_contract_2_ocr'
HIL_CONTRACT_3_FIELD
=
'hil_contract_3_ocr'
BS_CLASSIFY
=
10087
RESULT_MAPPING
=
{
...
...
@@ -1200,6 +1203,9 @@ RESULT_MAPPING = {
CONTRACT_CLASSIFY
:
HT_FIELD
,
INSURANCE_CLASSIFY
:
BD_FIELD
,
BS_CLASSIFY
:
BS_FIELD
,
HIL_CONTRACT_1_CLASSIFY
:
HIL_CONTRACT_1_FIELD
,
HIL_CONTRACT_2_CLASSIFY
:
HIL_CONTRACT_2_FIELD
,
HIL_CONTRACT_3_CLASSIFY
:
HIL_CONTRACT_3_FIELD
,
}
CA_ADD_COMPARE_FIELDS
=
(
IC_OCR_FIELD
,
BL_OCR_FIELD
,
BS_FIELD
)
...
...
@@ -1220,6 +1226,9 @@ COMPARE_FIELDS = (MVI_OCR_FIELD,
HT_FIELD
,
BD_FIELD
,
BS_FIELD
,
HIL_CONTRACT_1_FIELD
,
HIL_CONTRACT_2_FIELD
,
HIL_CONTRACT_3_FIELD
,
)
# 身份证
...
...
@@ -1514,6 +1523,9 @@ JYPZ_EN = 'Used Car Document'
AFC_CONTRACT_EN
=
'AFC Contract'
BD_EN
=
'Insurance'
BS_EN
=
'Bank Statement'
HIL_CONTRACT_1_EN
=
'售后回租合同'
HIL_CONTRACT_2_EN
=
'车辆租赁抵押合同'
HIL_CONTRACT_3_EN
=
'车辆处置协议'
SKIP_CARD
=
{
SME_BL_EN
}
...
...
@@ -1750,6 +1762,9 @@ SE_COMPARE_FIELD = {
AFC_CONTRACT_EN
:
(
HT_FIELD
,
HT_COMPARE_LOGIC
,
False
),
BD_EN
:
(
BD_FIELD
,
BD_COMPARE_LOGIC
,
False
),
BS_EN
:
(
BS_FIELD
,
BS_COMPARE_LOGIC
,
False
),
HIL_CONTRACT_1_EN
:
(
HIL_CONTRACT_1_FIELD
,
HIL_CONTRACT_1_COMPARE_LOGIC
,
False
),
HIL_CONTRACT_2_EN
:
(
HIL_CONTRACT_1_FIELD
,
HIL_CONTRACT_2_COMPARE_LOGIC
,
False
),
HIL_CONTRACT_3_EN
:
(
HIL_CONTRACT_1_FIELD
,
HIL_CONTRACT_3_COMPARE_LOGIC
,
False
),
}
...
...
@@ -2007,4 +2022,4 @@ HIL_CONTRACT_TYPE_MAP = {
str
(
HIL_CONTRACT_1_CLASSIFY
):
0
,
str
(
HIL_CONTRACT_2_CLASSIFY
):
2
,
str
(
HIL_CONTRACT_3_CLASSIFY
):
1
,
}
\ No newline at end of file
}
...
...
src/apps/doc/models.py
View file @
0c5207a
...
...
@@ -316,6 +316,9 @@ class AFCOCRResult(models.Model):
ht_ocr
=
models
.
TextField
(
null
=
True
,
verbose_name
=
"AFC合同"
)
bd_ocr
=
models
.
TextField
(
null
=
True
,
verbose_name
=
"保单"
)
bss_ocr
=
models
.
TextField
(
null
=
True
,
verbose_name
=
"银行流水"
)
hil_contract_1_ocr
=
models
.
TextField
(
null
=
True
,
verbose_name
=
"HIL合同1"
)
hil_contract_2_ocr
=
models
.
TextField
(
null
=
True
,
verbose_name
=
"HIL合同2"
)
hil_contract_3_ocr
=
models
.
TextField
(
null
=
True
,
verbose_name
=
"HIL合同3"
)
update_time
=
models
.
DateTimeField
(
auto_now
=
True
,
verbose_name
=
'修改时间'
)
create_time
=
models
.
DateTimeField
(
auto_now_add
=
True
,
verbose_name
=
'创建时间'
)
...
...
@@ -348,6 +351,9 @@ class HILOCRResult(models.Model):
ht_ocr
=
models
.
TextField
(
null
=
True
,
verbose_name
=
"AFC合同"
)
bd_ocr
=
models
.
TextField
(
null
=
True
,
verbose_name
=
"保单"
)
bss_ocr
=
models
.
TextField
(
null
=
True
,
verbose_name
=
"银行流水"
)
hil_contract_1_ocr
=
models
.
TextField
(
null
=
True
,
verbose_name
=
"HIL合同1"
)
hil_contract_2_ocr
=
models
.
TextField
(
null
=
True
,
verbose_name
=
"HIL合同2"
)
hil_contract_3_ocr
=
models
.
TextField
(
null
=
True
,
verbose_name
=
"HIL合同3"
)
update_time
=
models
.
DateTimeField
(
auto_now
=
True
,
verbose_name
=
'修改时间'
)
create_time
=
models
.
DateTimeField
(
auto_now_add
=
True
,
verbose_name
=
'创建时间'
)
...
...
@@ -379,6 +385,9 @@ class AFCSEOCRResult(models.Model):
ht_ocr
=
models
.
TextField
(
null
=
True
,
verbose_name
=
"AFC合同"
)
bd_ocr
=
models
.
TextField
(
null
=
True
,
verbose_name
=
"保单"
)
bss_ocr
=
models
.
TextField
(
null
=
True
,
verbose_name
=
"银行流水"
)
hil_contract_1_ocr
=
models
.
TextField
(
null
=
True
,
verbose_name
=
"HIL合同1"
)
hil_contract_2_ocr
=
models
.
TextField
(
null
=
True
,
verbose_name
=
"HIL合同2"
)
hil_contract_3_ocr
=
models
.
TextField
(
null
=
True
,
verbose_name
=
"HIL合同3"
)
update_time
=
models
.
DateTimeField
(
auto_now
=
True
,
verbose_name
=
'修改时间'
)
create_time
=
models
.
DateTimeField
(
auto_now_add
=
True
,
verbose_name
=
'创建时间'
)
...
...
@@ -411,6 +420,9 @@ class HILSEOCRResult(models.Model):
ht_ocr
=
models
.
TextField
(
null
=
True
,
verbose_name
=
"AFC合同"
)
bd_ocr
=
models
.
TextField
(
null
=
True
,
verbose_name
=
"保单"
)
bss_ocr
=
models
.
TextField
(
null
=
True
,
verbose_name
=
"银行流水"
)
hil_contract_1_ocr
=
models
.
TextField
(
null
=
True
,
verbose_name
=
"HIL合同1"
)
hil_contract_2_ocr
=
models
.
TextField
(
null
=
True
,
verbose_name
=
"HIL合同2"
)
hil_contract_3_ocr
=
models
.
TextField
(
null
=
True
,
verbose_name
=
"HIL合同3"
)
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 @
0c5207a
...
...
@@ -1191,73 +1191,75 @@ def get_se_cms_compare_info(last_obj, application_entity, detect_list):
compare_info
[
'other'
]
=
other_info
if
application_entity
in
consts
.
HIL_SET
:
return
compare_info
,
cms_info
.
get
(
'applicationVersion'
,
1
)
# AFC合同-----------------------------------------------------------------------------------------------------------
contract_info
=
{}
schedule_list
=
[]
for
schedule_dict
in
cms_info
.
get
(
'paymentSchedule'
,
[]):
tmp_str
=
"{1}{0}{2}"
.
format
(
consts
.
SPLIT_STR
,
str
(
schedule_dict
.
get
(
'no'
,
''
)),
str
(
schedule_dict
.
get
(
'grossRentalAmount'
,
''
)))
schedule_list
.
append
(
tmp_str
)
schedule_list_str
=
consts
.
SCHEDULE_SPLIT_STR
.
join
(
schedule_list
)
vehicle_principal_str
=
str
(
cms_info
.
get
(
'financialInformation'
,
{})
.
get
(
'vehiclePrincipal'
,
'0.0'
))
afc_contract_input
=
[
(
consts
.
SE_AFC_CON_FIELD
[
0
],
full_no
),
(
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'
))),
(
consts
.
SE_AFC_CON_FIELD
[
4
],
str
(
cms_info
.
get
(
'terms'
,
'0'
))),
(
consts
.
SE_AFC_CON_FIELD
[
5
],
vehicle_principal_str
),
(
consts
.
SE_AFC_CON_FIELD
[
6
],
str
(
cms_info
.
get
(
'financialInformation'
,
{})
.
get
(
'associatedServicePrincipal'
,
'0.0'
))),
(
consts
.
SE_AFC_CON_FIELD
[
7
],
amount
),
(
consts
.
SE_AFC_CON_FIELD
[
8
],
vin_no
),
(
consts
.
SE_AFC_CON_FIELD
[
9
],
cms_info
.
get
(
'dealerName'
,
''
)),
(
consts
.
SE_AFC_CON_FIELD
[
10
],
str
(
cms_info
.
get
(
'financialInformation'
,
{})
.
get
(
'originationPrincipal'
,
'0.0'
))),
(
consts
.
SE_AFC_CON_FIELD
[
11
],
vehicle_principal_str
),
(
consts
.
SE_AFC_CON_FIELD
[
12
],
str
(
cms_info
.
get
(
'financialInformation'
,
{})
.
get
(
'associatedServicePrincipal'
,
'0.0'
))),
(
consts
.
SE_AFC_CON_FIELD
[
13
],
str
(
cms_info
.
get
(
'terms'
,
'0'
))),
(
consts
.
SE_AFC_CON_FIELD
[
14
],
account_no
),
(
consts
.
SE_AFC_CON_FIELD
[
15
],
cms_info
.
get
(
'bankAccountDetails'
,
{})
.
get
(
'accountHolderName'
,
''
)),
(
consts
.
SE_AFC_CON_FIELD
[
16
],
bank_name
),
(
consts
.
SE_AFC_CON_FIELD
[
17
],
schedule_list_str
),
]
# HIL合同-----------------------------------------------------------------------------------------
if
is_asp
:
afc_contract_input
.
append
((
consts
.
SE_AFC_CON_FIELD
[
20
],
asp_list
))
afc_contract_input
.
append
((
consts
.
SE_AFC_CON_FIELD
[
22
],
asp_list
))
afc_contract_input
.
append
((
consts
.
SE_AFC_CON_FIELD
[
21
],
gzs_list
))
return
compare_info
,
cms_info
.
get
(
'applicationVersion'
,
1
)
else
:
afc_contract_input
.
pop
(
5
)
afc_contract_input
.
pop
(
5
)
afc_contract_input
.
pop
(
9
)
afc_contract_input
.
pop
(
9
)
# '借款人签字及时间', 'Borrower', 0, 0, True
online_sign
=
cms_info
.
get
(
'contractSource'
,
'Online Sign'
)
==
'Online Sign'
for
key
,
app_type
,
id_idx
,
field_idx
,
is_force
,
e_write
in
consts
.
ROLE_LIST
:
if
not
e_write
and
not
online_sign
:
continue
is_find
=
False
if
app_type
in
main_role_info
:
if
len
(
main_role_info
[
app_type
])
>=
id_idx
+
1
:
is_find
=
True
if
isinstance
(
field_idx
,
int
):
afc_contract_input
.
append
((
key
,
main_role_info
[
app_type
][
id_idx
][
field_idx
]))
else
:
afc_contract_input
.
append
((
key
,
field_idx
))
if
not
is_find
and
is_force
:
afc_contract_input
.
append
((
key
,
empty_str
))
# AFC合同-----------------------------------------------------------------------------------------------------------
contract_info
=
{}
schedule_list
=
[]
for
schedule_dict
in
cms_info
.
get
(
'paymentSchedule'
,
[]):
tmp_str
=
"{1}{0}{2}"
.
format
(
consts
.
SPLIT_STR
,
str
(
schedule_dict
.
get
(
'no'
,
''
)),
str
(
schedule_dict
.
get
(
'grossRentalAmount'
,
''
)))
schedule_list
.
append
(
tmp_str
)
schedule_list_str
=
consts
.
SCHEDULE_SPLIT_STR
.
join
(
schedule_list
)
vehicle_principal_str
=
str
(
cms_info
.
get
(
'financialInformation'
,
{})
.
get
(
'vehiclePrincipal'
,
'0.0'
))
afc_contract_input
=
[
(
consts
.
SE_AFC_CON_FIELD
[
0
],
full_no
),
(
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'
))),
(
consts
.
SE_AFC_CON_FIELD
[
4
],
str
(
cms_info
.
get
(
'terms'
,
'0'
))),
(
consts
.
SE_AFC_CON_FIELD
[
5
],
vehicle_principal_str
),
(
consts
.
SE_AFC_CON_FIELD
[
6
],
str
(
cms_info
.
get
(
'financialInformation'
,
{})
.
get
(
'associatedServicePrincipal'
,
'0.0'
))),
(
consts
.
SE_AFC_CON_FIELD
[
7
],
amount
),
(
consts
.
SE_AFC_CON_FIELD
[
8
],
vin_no
),
(
consts
.
SE_AFC_CON_FIELD
[
9
],
cms_info
.
get
(
'dealerName'
,
''
)),
(
consts
.
SE_AFC_CON_FIELD
[
10
],
str
(
cms_info
.
get
(
'financialInformation'
,
{})
.
get
(
'originationPrincipal'
,
'0.0'
))),
(
consts
.
SE_AFC_CON_FIELD
[
11
],
vehicle_principal_str
),
(
consts
.
SE_AFC_CON_FIELD
[
12
],
str
(
cms_info
.
get
(
'financialInformation'
,
{})
.
get
(
'associatedServicePrincipal'
,
'0.0'
))),
(
consts
.
SE_AFC_CON_FIELD
[
13
],
str
(
cms_info
.
get
(
'terms'
,
'0'
))),
(
consts
.
SE_AFC_CON_FIELD
[
14
],
account_no
),
(
consts
.
SE_AFC_CON_FIELD
[
15
],
cms_info
.
get
(
'bankAccountDetails'
,
{})
.
get
(
'accountHolderName'
,
''
)),
(
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
))
afc_contract_input
.
append
((
consts
.
SE_AFC_CON_FIELD
[
22
],
asp_list
))
afc_contract_input
.
append
((
consts
.
SE_AFC_CON_FIELD
[
21
],
gzs_list
))
else
:
afc_contract_input
.
pop
(
5
)
afc_contract_input
.
pop
(
5
)
afc_contract_input
.
pop
(
9
)
afc_contract_input
.
pop
(
9
)
# '借款人签字及时间', 'Borrower', 0, 0, True
online_sign
=
cms_info
.
get
(
'contractSource'
,
'Online Sign'
)
==
'Online Sign'
for
key
,
app_type
,
id_idx
,
field_idx
,
is_force
,
e_write
in
consts
.
ROLE_LIST
:
if
not
e_write
and
not
online_sign
:
continue
is_find
=
False
if
app_type
in
main_role_info
:
if
len
(
main_role_info
[
app_type
])
>=
id_idx
+
1
:
is_find
=
True
if
isinstance
(
field_idx
,
int
):
afc_contract_input
.
append
((
key
,
main_role_info
[
app_type
][
id_idx
][
field_idx
]))
else
:
afc_contract_input
.
append
((
key
,
field_idx
))
if
not
is_find
and
is_force
:
afc_contract_input
.
append
((
key
,
empty_str
))
if
online_sign
:
afc_contract_input
.
append
((
consts
.
SE_AFC_CON_FIELD
[
18
],
consts
.
SE_STAMP_VALUE
))
afc_contract_input
.
append
((
consts
.
SE_AFC_CON_FIELD
[
19
],
empty_str
))
if
online_sign
:
afc_contract_input
.
append
((
consts
.
SE_AFC_CON_FIELD
[
18
],
consts
.
SE_STAMP_VALUE
))
afc_contract_input
.
append
((
consts
.
SE_AFC_CON_FIELD
[
19
],
empty_str
))
contract_info
[
consts
.
AFC_CONTRACT_EN
]
=
afc_contract_input
compare_info
[
'contract'
]
=
contract_info
return
compare_info
,
cms_info
.
get
(
'applicationVersion'
,
1
)
contract_info
[
consts
.
AFC_CONTRACT_EN
]
=
afc_contract_input
compare_info
[
'contract'
]
=
contract_info
return
compare_info
,
cms_info
.
get
(
'applicationVersion'
,
1
)
def
get_se_compare_info
(
last_obj
,
application_entity
,
detect_list
):
...
...
src/common/tools/mssql_script12.py
0 → 100644
View file @
0c5207a
import
pyodbc
hil_sql
=
"""
ALTER TABLE hil_ocr_result ADD hil_contract_1_ocr nvarchar(max);
ALTER TABLE hil_ocr_result ADD hil_contract_2_ocr nvarchar(max);
ALTER TABLE hil_ocr_result ADD hil_contract_3_ocr nvarchar(max);
ALTER TABLE hil_se_ocr_result ADD hil_contract_1_ocr nvarchar(max);
ALTER TABLE hil_se_ocr_result ADD hil_contract_2_ocr nvarchar(max);
ALTER TABLE hil_se_ocr_result ADD hil_contract_3_ocr nvarchar(max);
"""
afc_sql
=
"""
ALTER TABLE afc_ocr_result ADD hil_contract_1_ocr nvarchar(max);
ALTER TABLE afc_ocr_result ADD hil_contract_2_ocr nvarchar(max);
ALTER TABLE afc_ocr_result ADD hil_contract_3_ocr nvarchar(max);
ALTER TABLE afc_se_ocr_result ADD hil_contract_1_ocr nvarchar(max);
ALTER TABLE afc_se_ocr_result ADD hil_contract_2_ocr nvarchar(max);
ALTER TABLE afc_se_ocr_result ADD hil_contract_3_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