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
24c2e20c
authored
2021-11-16 20:04:27 +0800
by
周伟奇
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
afc ht part 1
1 parent
6a4ed2b2
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
176 additions
and
118 deletions
src/apps/doc/consts.py
src/apps/doc/management/commands/ocr_process.py
src/apps/doc/models.py
src/celery_compare/tasks.py
src/common/tools/mssql_script10.py
src/apps/doc/consts.py
View file @
24c2e20
...
...
@@ -1176,6 +1176,7 @@ UCI_OCR_FIELD = 'uci_ocr'
DDA_OCR_FIELD
=
'bs_ocr'
HMH_OCR_FIELD
=
'hmh_ocr'
JYPZ_OCR_FIELD
=
'jypz_ocr'
HT_FIELD
=
'ht_ocr'
RESULT_MAPPING
=
{
MVI_CLASSIFY
:
MVI_OCR_FIELD
,
...
...
@@ -1191,7 +1192,8 @@ RESULT_MAPPING = {
DDA_CLASSIFY
:
DDA_OCR_FIELD
,
# VAT_CLASSIFY: 'vat_ocr',
HMH_CLASSIFY
:
HMH_OCR_FIELD
,
JYPZ_CLASSIFY
:
JYPZ_OCR_FIELD
JYPZ_CLASSIFY
:
JYPZ_OCR_FIELD
,
CONTRACT_CLASSIFY
:
HT_FIELD
,
}
COMPARE_FIELDS
=
(
MVI_OCR_FIELD
,
...
...
@@ -1391,6 +1393,26 @@ SE_HMH_FIELD = ['借款人/承租人姓名', '借款人/承租人证件号', '
SE_BANK_FIELD
=
[
'accountNo'
,
'bankName'
]
SE_DDA_FIELD
=
[
'applicationId(1)'
,
'applicationId(2)'
,
'bankName'
,
'companyName'
,
'customerName'
,
'idNum'
,
'accountHolderName'
,
'accountNo'
]
SE_AFC_CON_MAP
=
{
'合同编号-每页'
:
(
None
,
'合同编号'
,
None
),
'所购车辆价格-小写-重要条款'
:
(
1
,
'所购车辆价格'
,
None
),
'车架号-重要条款'
:
(
1
,
'车架号'
,
None
),
'贷款本金金额-重要条款'
:
(
1
,
'贷款本金金额'
,
'小写'
),
'贷款期限-重要条款'
:
(
1
,
'贷款期限'
,
None
),
'车辆贷款本金金额-重要条款'
:
(
1
,
'车辆贷款本金金额'
,
None
),
'附加产品融资贷款本金总额-重要条款'
:
(
1
,
'附加产品融资贷款本金总金额'
,
None
),
'所购车辆价格'
:
(
2
,
'所购车辆价格'
,
None
),
'车架号'
:
(
2
,
'车架号'
,
None
),
'经销商'
:
(
2
,
'经销商'
,
None
),
'贷款本金金额'
:
(
2
,
'贷款本金金额'
,
'小写'
),
'车辆贷款本金金额'
:
(
2
,
'车辆贷款本金金额'
,
None
),
'附加产品融资贷款本金总额'
:
(
2
,
'附加产品融资贷款本金总额'
,
None
),
'贷款期限'
:
(
2
,
'贷款期限'
,
None
),
'还款账号'
:
(
2
,
'还款账号'
,
'账号'
),
'户名'
:
(
2
,
'还款账号'
,
'户名'
),
'开户行'
:
(
2
,
'还款账号'
,
'开户行'
),
}
SE_AFC_CON_FIELD
=
[
'合同编号-每页'
,
'所购车辆价格-小写-重要条款'
,
'车架号-重要条款'
,
'贷款本金金额-重要条款'
,
'贷款期限-重要条款'
,
'车辆贷款本金金额-重要条款'
,
'附加产品融资贷款本金总额-重要条款'
,
'所购车辆价格'
,
'车架号'
,
'经销商'
,
'贷款本金金额'
,
'车辆贷款本金金额'
,
'附加产品融资贷款本金总额'
,
'贷款期限'
,
'还款账号'
,
'户名'
,
'开户行'
,
...
...
src/apps/doc/management/commands/ocr_process.py
View file @
24c2e20
...
...
@@ -220,7 +220,8 @@ class Command(BaseCommand, LoggerMixin):
else
:
res_list
.
append
((
pno
,
ino
,
part_idx
,
consts
.
RES_SUCCESS_EMPTY
))
def
contract_process
(
self
,
classify
,
ocr_data
,
contract_result
,
res_list
,
pno
,
ino
,
part_idx
,
img_path
):
def
contract_process
(
self
,
classify
,
ocr_data
,
contract_result
,
res_list
,
pno
,
ino
,
part_idx
,
img_path
,
contract_result_compare
):
contract_dict
=
ocr_data
.
get
(
'data'
)
if
not
contract_dict
or
contract_dict
.
get
(
'page_num'
)
is
None
or
contract_dict
.
get
(
'page_info'
)
is
None
:
res_list
.
append
((
pno
,
ino
,
part_idx
,
consts
.
RES_SUCCESS_EMPTY
))
...
...
@@ -260,9 +261,30 @@ class Command(BaseCommand, LoggerMixin):
for
row_list
in
sub_value
[
text_key
]:
rebuild_page_info
.
append
(
row_list
)
# contract_result.setdefault(page_num_only, []).append(rebuild_page_info)
contract_result
.
setdefault
(
classify
,
dict
())
.
setdefault
(
page_num_only
,
[])
.
append
(
rebuild_page_info
)
page_compare_dict
=
{}
for
key
,
value
in
contract_dict
.
get
(
'page_info'
,
{})
.
items
():
if
not
isinstance
(
value
,
dict
):
continue
elif
text_key
in
value
:
if
value
[
text_key
]
is
None
:
page_compare_dict
[
key
]
=
''
elif
isinstance
(
value
[
text_key
],
str
):
page_compare_dict
[
key
]
=
value
[
text_key
]
elif
isinstance
(
value
[
text_key
],
list
):
page_compare_dict
[
key
]
=
value
[
text_key
]
else
:
page_compare_dict
[
key
]
=
{}
for
sub_key
,
sub_value
in
value
.
items
():
if
sub_value
[
text_key
]
is
None
:
page_compare_dict
[
key
][
sub_key
]
=
''
elif
isinstance
(
sub_value
[
text_key
],
str
):
page_compare_dict
[
key
][
sub_key
]
=
sub_value
[
text_key
]
contract_result_compare
.
setdefault
(
classify
,
dict
())[
page_num_only
]
=
page_compare_dict
# def rebuild_result(self, ocr_data, classify, img_path):
# license_data = ocr_data.get('data')
# if not license_data:
...
...
@@ -831,6 +853,22 @@ class Command(BaseCommand, LoggerMixin):
summary
[
'role'
]
=
self
.
get_most
(
summary
[
'role'
])
return
bs_summary
def
rebuild_contract
(
self
,
contract_result_compare
):
res_list
=
[]
for
classify
,
page_info_dict
in
contract_result_compare
.
items
():
res
=
{}
if
classify
==
consts
.
CONTRACT_CLASSIFY
:
for
key
,
(
pno
,
key1
,
key2
)
in
consts
.
SE_AFC_CON_MAP
.
items
():
if
pno
is
None
:
for
i
in
range
(
1
,
9
):
res
.
setdefault
(
key
,
list
())
.
append
(
page_info_dict
.
get
(
str
(
i
),
{})
.
get
(
key1
,
''
))
elif
key2
is
None
:
res
[
key
]
=
page_info_dict
.
get
(
str
(
pno
),
{})
.
get
(
key1
,
''
)
else
:
res
[
key
]
=
page_info_dict
.
get
(
str
(
pno
),
{})
.
get
(
key1
,
{})
.
get
(
key2
,
''
)
res_list
.
append
(
res
)
return
res_list
def
rebuild_bs_summary
(
self
,
bs_summary
,
unknown_summary
):
# bs_summary = {
# '卡号': {
...
...
@@ -1248,7 +1286,7 @@ class Command(BaseCommand, LoggerMixin):
self
.
online_log
.
error
(
'{0} [process error (store ocr res)] [img_path={1}] [error={2}]'
.
format
(
self
.
log_base
,
img_path
,
traceback
.
format_exc
()))
def
res_2_wb
(
self
,
res_dict
,
img_queue
,
finish_queue
,
lock
,
error_list
):
def
res_2_wb
(
self
,
res_dict
,
img_queue
,
finish_queue
,
error_list
):
while
len
(
error_list
)
==
0
or
not
img_queue
.
empty
()
or
not
finish_queue
.
empty
():
try
:
task_str
=
finish_queue
.
get
(
block
=
False
)
...
...
@@ -1289,6 +1327,7 @@ class Command(BaseCommand, LoggerMixin):
unknown_summary
=
{}
license_summary
=
{}
contract_result
=
{}
contract_result_compare
=
{}
res_list
=
[]
interest_keyword
=
Keywords
.
objects
.
filter
(
type
=
KeywordsType
.
INTEREST
.
value
,
on_off
=
True
)
.
values_list
(
'keyword'
,
flat
=
True
)
...
...
@@ -1441,7 +1480,7 @@ class Command(BaseCommand, LoggerMixin):
'{0} [ocr_2 failed] [img_path={1}]'
.
format
(
self
.
log_base
,
img_path
))
elif
classify
in
consts
.
CONTRACT_SET
:
self
.
contract_process
(
classify
,
ocr_data
,
contract_result
,
res_list
,
pno
,
ino
,
part_idx
,
img_path
)
ino
,
part_idx
,
img_path
,
contract_result_compare
)
else
:
# 流水处理
bs_classify_set
.
add
(
classify
)
self
.
bs_process
(
wb
,
ocr_data
,
bs_summary
,
unknown_summary
,
classify
,
res_list
,
pno
,
ino
,
part_idx
)
...
...
@@ -1554,6 +1593,10 @@ class Command(BaseCommand, LoggerMixin):
finally
:
# TODO 识别结果存一张表,方便跑报表
contract_result_compare_rebuild
=
self
.
rebuild_contract
(
contract_result_compare
)
if
len
(
contract_result_compare_rebuild
)
>
0
:
license_summary
[
consts
.
CONTRACT_CLASSIFY
]
=
contract_result_compare_rebuild
# 比对
if
len
(
license_summary
)
>
0
and
doc
.
document_scheme
!=
consts
.
DOC_SCHEME_LIST
[
2
]:
try
:
...
...
@@ -1929,7 +1972,7 @@ class Command(BaseCommand, LoggerMixin):
img_queue
,
todo_count_dict
,
res_dict
,
finish_queue
,
lock
,
url
,
error_list
))
process_list
.
append
(
ocr_1_process
)
wb_process
=
Process
(
target
=
self
.
res_2_wb
,
args
=
(
res_dict
,
img_queue
,
finish_queue
,
lock
,
error_list
))
wb_process
=
Process
(
target
=
self
.
res_2_wb
,
args
=
(
res_dict
,
img_queue
,
finish_queue
,
error_list
))
process_list
.
append
(
wb_process
)
for
p
in
process_list
:
...
...
src/apps/doc/models.py
View file @
24c2e20
...
...
@@ -313,6 +313,7 @@ class AFCOCRResult(models.Model):
vat_ocr
=
models
.
TextField
(
null
=
True
,
verbose_name
=
"增值税发票"
)
hmh_ocr
=
models
.
TextField
(
null
=
True
,
verbose_name
=
"豁免函"
)
jypz_ocr
=
models
.
TextField
(
null
=
True
,
verbose_name
=
"二手车交易凭证"
)
ht_ocr
=
models
.
TextField
(
null
=
True
,
verbose_name
=
"AFC合同"
)
update_time
=
models
.
DateTimeField
(
auto_now
=
True
,
verbose_name
=
'修改时间'
)
create_time
=
models
.
DateTimeField
(
auto_now_add
=
True
,
verbose_name
=
'创建时间'
)
...
...
@@ -342,6 +343,7 @@ class HILOCRResult(models.Model):
vat_ocr
=
models
.
TextField
(
null
=
True
,
verbose_name
=
"增值税发票"
)
hmh_ocr
=
models
.
TextField
(
null
=
True
,
verbose_name
=
"豁免函"
)
jypz_ocr
=
models
.
TextField
(
null
=
True
,
verbose_name
=
"二手车交易凭证"
)
ht_ocr
=
models
.
TextField
(
null
=
True
,
verbose_name
=
"AFC合同"
)
update_time
=
models
.
DateTimeField
(
auto_now
=
True
,
verbose_name
=
'修改时间'
)
create_time
=
models
.
DateTimeField
(
auto_now_add
=
True
,
verbose_name
=
'创建时间'
)
...
...
@@ -370,6 +372,7 @@ class AFCSEOCRResult(models.Model):
vat_ocr
=
models
.
TextField
(
null
=
True
,
verbose_name
=
"增值税发票"
)
hmh_ocr
=
models
.
TextField
(
null
=
True
,
verbose_name
=
"豁免函"
)
jypz_ocr
=
models
.
TextField
(
null
=
True
,
verbose_name
=
"二手车交易凭证"
)
ht_ocr
=
models
.
TextField
(
null
=
True
,
verbose_name
=
"AFC合同"
)
update_time
=
models
.
DateTimeField
(
auto_now
=
True
,
verbose_name
=
'修改时间'
)
create_time
=
models
.
DateTimeField
(
auto_now_add
=
True
,
verbose_name
=
'创建时间'
)
...
...
@@ -399,6 +402,7 @@ class HILSEOCRResult(models.Model):
vat_ocr
=
models
.
TextField
(
null
=
True
,
verbose_name
=
"增值税发票"
)
hmh_ocr
=
models
.
TextField
(
null
=
True
,
verbose_name
=
"豁免函"
)
jypz_ocr
=
models
.
TextField
(
null
=
True
,
verbose_name
=
"二手车交易凭证"
)
ht_ocr
=
models
.
TextField
(
null
=
True
,
verbose_name
=
"AFC合同"
)
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 @
24c2e20
...
...
@@ -1088,77 +1088,80 @@ def get_se_cms_compare_info(last_obj, application_entity, detect_list):
other_info
[
consts
.
HMH_EN
]
=
hmh_field_input
compare_info
[
'other'
]
=
other_info
# 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)
#
# 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], str(cms_info.get('financialInformation', {}).get('vehiclePrincipal', '0.0'))),
# (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], str(cms_info.get('financialInformation', {}).get('vehiclePrincipal', '0.0'))),
# (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),
# ]
#
# asp_list = []
# for asp_info in cms_info.get('associatedServices', []):
# asp_list.append(
# (
# asp_info.get('associatedServices', ''),
# asp_info.get('price', 0.0),
# asp_info.get('financed', 0.0)
# )
# )
#
# if len(asp_list) > 0:
# fin_total = 0
# gzs_status = consts.GZS_STATUS[1]
# for asp_name, asp_price, asp_fin in asp_list:
# if gzs_status == consts.GZS_STATUS[1]:
# if consts.GZS_NAME in asp_name:
# gzs_status = consts.GZS_STATUS[0]
# if gzs_status == consts.GZS_STATUS[0]:
# if consts.GZS_NAME not in asp_name:
# gzs_status = consts.GZS_STATUS[2]
# afc_contract_input.extend(
# [
# (consts.SE_AFC_CON_FIELD[18], asp_name),
# (consts.SE_AFC_CON_FIELD[19], str(asp_price)),
# (consts.SE_AFC_CON_FIELD[20], str(asp_fin)),
# ]
# )
# fin_total += asp_fin
# afc_contract_input.append((consts.SE_AFC_CON_FIELD[21], str(fin_total)))
#
# # CMS Vehicle Price / 1.13 * 10 %
# gzs_list = [gzs_status]
# if gzs_status != consts.GZS_STATUS[1]:
# gzs_value = str(cms_info.get('financialInformation', {}).get('vehiclePrincipal', 0.0) * 0.1 / 1.13)
# gzs_list.append(gzs_value)
# afc_contract_input.append((consts.SE_AFC_CON_FIELD[22], consts.SPLIT_STR.join(gzs_list)))
#
# # role_name, _, role_id = main_role_info[applicant_type][0]
#
# contract_info[consts.AFC_CONTRACT_EN] = afc_contract_input
# compare_info['contract'] = contract_info
if
application_entity
in
consts
.
HIL_SET
:
return
compare_info
,
cms_info
.
get
(
'applicationVersion'
,
1
)
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
)
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
],
str
(
cms_info
.
get
(
'financialInformation'
,
{})
.
get
(
'vehiclePrincipal'
,
'0.0'
))),
(
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
],
str
(
cms_info
.
get
(
'financialInformation'
,
{})
.
get
(
'vehiclePrincipal'
,
'0.0'
))),
(
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
),
]
asp_list
=
[]
for
asp_info
in
cms_info
.
get
(
'associatedServices'
,
[]):
asp_list
.
append
(
(
asp_info
.
get
(
'associatedServices'
,
''
),
asp_info
.
get
(
'price'
,
0.0
),
asp_info
.
get
(
'financed'
,
0.0
)
)
)
if
len
(
asp_list
)
>
0
:
fin_total
=
0
gzs_status
=
consts
.
GZS_STATUS
[
1
]
for
asp_name
,
asp_price
,
asp_fin
in
asp_list
:
if
gzs_status
==
consts
.
GZS_STATUS
[
1
]:
if
consts
.
GZS_NAME
in
asp_name
:
gzs_status
=
consts
.
GZS_STATUS
[
0
]
if
gzs_status
==
consts
.
GZS_STATUS
[
0
]:
if
consts
.
GZS_NAME
not
in
asp_name
:
gzs_status
=
consts
.
GZS_STATUS
[
2
]
afc_contract_input
.
extend
(
[
(
consts
.
SE_AFC_CON_FIELD
[
18
],
asp_name
),
(
consts
.
SE_AFC_CON_FIELD
[
19
],
str
(
asp_price
)),
(
consts
.
SE_AFC_CON_FIELD
[
20
],
str
(
asp_fin
)),
]
)
fin_total
+=
asp_fin
afc_contract_input
.
append
((
consts
.
SE_AFC_CON_FIELD
[
21
],
str
(
fin_total
)))
# CMS Vehicle Price / 1.13 * 10 %
gzs_list
=
[
gzs_status
]
if
gzs_status
!=
consts
.
GZS_STATUS
[
1
]:
gzs_value
=
str
(
cms_info
.
get
(
'financialInformation'
,
{})
.
get
(
'vehiclePrincipal'
,
0.0
)
*
0.1
/
1.13
)
gzs_list
.
append
(
gzs_value
)
afc_contract_input
.
append
((
consts
.
SE_AFC_CON_FIELD
[
22
],
consts
.
SPLIT_STR
.
join
(
gzs_list
)))
# role_name, _, role_id = main_role_info[applicant_type][0]
contract_info
[
consts
.
AFC_CONTRACT_EN
]
=
afc_contract_input
compare_info
[
'contract'
]
=
contract_info
return
compare_info
,
cms_info
.
get
(
'applicationVersion'
,
1
)
...
...
src/common/tools/mssql_script10.py
View file @
24c2e20
# import pyodbc
# afc_sql = """
# create table afc_contract
# (
# id bigint identity primary key,
# application_id nvarchar(64) not null,
# create_time datetime not null
# );
# create index afc_contract_application_id_index
# on afc_contract (application_id);
# """
# hil_sql = """
# create table hil_contract
# (
# id bigint identity primary key,
# application_id nvarchar(64) not null,
# create_time datetime not null
# );
# create index hil_contract_application_id_index
# on hil_contract (application_id);
# """
# 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()
import
pyodbc
hil_sql
=
"""
ALTER TABLE hil_ocr_result ADD ht_ocr nvarchar(max);
ALTER TABLE hil_se_ocr_result ADD ht_ocr nvarchar(max);
"""
afc_sql
=
"""
ALTER TABLE afc_ocr_result ADD ht_ocr nvarchar(max);
ALTER TABLE afc_se_ocr_result ADD ht_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