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
e199bcb2
authored
2021-12-15 11:45:35 +0800
by
周伟奇
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
add hil contract compare
1 parent
7dafa058
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
282 additions
and
37 deletions
src/apps/doc/consts.py
src/apps/doc/management/commands/ocr_process.py
src/celery_compare/tasks.py
src/common/tools/comparison.py
src/apps/doc/consts.py
View file @
e199bcb
...
...
@@ -1466,12 +1466,79 @@ SE_AFC_CON_MAP = {
'ASP项目详情'
:
(
None
,
4
,
'附加产品融资贷款本金总金额明细'
,
None
),
}
# key, (pno1, pno2, max_pno+1, key1, key2)
SE_HIL_CON_1_MAP
=
{
'合同编号-每页'
:
(
None
,
None
,
7
,
'合同编号'
,
None
),
'合同编号-正文'
:
(
5
,
4
,
7
,
'合同编号(正文)'
,
None
),
'车辆识别代码'
:
(
5
,
4
,
7
,
'车辆识别代码'
,
None
),
'车辆卖方'
:
(
5
,
4
,
7
,
'车辆卖方(经销商)'
,
None
),
'车辆原始销售价格'
:
(
5
,
4
,
7
,
'车辆原始销售价格(《机动车销售统一发票》所列金额)'
,
None
),
'融资成本总额'
:
(
5
,
4
,
7
,
'融资成本总额'
,
None
),
'租期'
:
(
5
,
4
,
7
,
'租期'
,
None
),
'还款计划表'
:
(
5
,
5
,
7
,
'付款计划表'
,
None
),
'ASP项目详情'
:
(
5
,
4
,
7
,
'车辆附加产品明细表'
,
None
),
'承租人法定代表人或授权代表'
:
(
1
,
1
,
7
,
'承租人-法定代表人或授权代表'
,
None
),
'承租人姓名'
:
(
1
,
1
,
7
,
'承租人-姓名'
,
None
),
'承租人证件号'
:
(
1
,
1
,
7
,
'承租人-证件号码'
,
None
),
'承租人签字'
:
(
6
,
6
,
7
,
'签字页-承租人姓名'
,
None
),
'共同承租人姓名'
:
(
1
,
1
,
7
,
'共同承租人-姓名'
,
None
),
'共同承租人证件号'
:
(
1
,
1
,
7
,
'共同承租人-证件号码'
,
None
),
'共同承租人签字'
:
(
6
,
6
,
7
,
'签字页-共同承租人姓名'
,
None
),
'保证人姓名1'
:
(
1
,
1
,
7
,
'保证人1-姓名'
,
None
),
'保证人证件号1'
:
(
1
,
1
,
7
,
'保证人1-证件号码'
,
None
),
'保证人签字1'
:
(
6
,
6
,
7
,
'签字页-保证人1姓名'
,
None
),
'保证人姓名2'
:
(
1
,
1
,
7
,
'保证人2-姓名'
,
None
),
'保证人证件号2'
:
(
1
,
1
,
7
,
'保证人2-证件号码'
,
None
),
'保证人签字2'
:
(
6
,
6
,
7
,
'签字页-保证人2姓名'
,
None
),
}
SE_HIL_CON_2_MAP
=
{
'合同编号'
:
(
1
,
None
,
3
,
'合同编号'
,
None
),
'合同编号-正文'
:
(
1
,
None
,
3
,
'合同编号(正文)'
,
None
),
'车辆识别代码'
:
(
1
,
None
,
3
,
'车辆识别代码'
,
None
),
'租金总额'
:
(
1
,
None
,
3
,
'租金总额'
,
None
),
'融资租赁期限'
:
(
1
,
None
,
3
,
'融资租赁期限'
,
None
),
'抵押人'
:
(
1
,
None
,
3
,
'抵押人姓名/名称'
,
None
),
'抵押人证件号码'
:
(
1
,
None
,
3
,
'抵押人证件号码'
,
None
),
'抵押人签字'
:
(
2
,
None
,
3
,
'签字页-抵押人姓名'
,
None
),
'抵押人配偶'
:
(
1
,
None
,
3
,
'抵押人配偶姓名/名称'
,
None
),
'抵押人配偶证件号码'
:
(
1
,
None
,
3
,
'抵押人配偶证件号码'
,
None
),
'抵押人配偶签字'
:
(
2
,
None
,
3
,
'签字页-抵押人配偶姓名'
,
None
),
}
SE_HIL_CON_3_MAP
=
{
'合同编号-每页'
:
(
None
,
None
,
5
,
'合同编号'
,
None
),
'承租人姓名'
:
(
1
,
None
,
5
,
'承租人-姓名'
,
None
),
'承租人证件号码'
:
(
1
,
None
,
5
,
'承租人-证件号码'
,
None
),
'销售经销商'
:
(
1
,
None
,
5
,
'销售经销商'
,
None
),
'合同编号-正文'
:
(
1
,
None
,
5
,
'合同编号(正文)'
,
None
),
'姓名/名称'
:
(
4
,
None
,
5
,
'签字页-承租人姓名'
,
None
),
'自然人身份证件号码/法人执照号码'
:
(
4
,
None
,
5
,
'签字页-自然人身份证件号码/法人执照号码'
,
None
),
'承租人签字'
:
(
4
,
None
,
5
,
'签字页-承租人签章'
,
None
),
}
SE_HIL_CON_MAP
=
{
HIL_CONTRACT_1_CLASSIFY
:
SE_HIL_CON_1_MAP
,
HIL_CONTRACT_2_CLASSIFY
:
SE_HIL_CON_2_MAP
,
HIL_CONTRACT_3_CLASSIFY
:
SE_HIL_CON_3_MAP
,
}
SE_AFC_CON_FIELD
=
[
'合同编号-每页'
,
'所购车辆价格-小写-重要条款'
,
'车架号-重要条款'
,
'贷款本金金额-重要条款'
,
'贷款期限-重要条款'
,
'车辆贷款本金金额-重要条款'
,
'附加产品融资贷款本金总额-重要条款'
,
'所购车辆价格'
,
'车架号'
,
'经销商'
,
'贷款本金金额'
,
'车辆贷款本金金额'
,
'附加产品融资贷款本金总额'
,
'贷款期限'
,
'还款账号'
,
'户名'
,
'开户行'
,
'还款计划表'
,
'见证人签字'
,
'见证人日期'
,
'ASP项目详情-重要条款'
,
'购置税校验'
,
'ASP项目详情'
]
# '项目1', '用途总金额', '贷款本金', '附加产品融资贷款本金总金额', '购置税校验'
# '承租人姓名', '承租人证件号码', '承租人法定代表人或授权代表'
SE_HIL_CON_1_FIELD
=
[
'合同编号-每页'
,
'合同编号-正文'
,
'车辆识别代码'
,
'车辆卖方'
,
'车辆原始销售价格'
,
'融资成本总额'
,
'租期'
,
'还款计划表'
,
'ASP项目详情'
,
'购置税校验'
,
'承租人法定代表人或授权代表'
]
SE_HIL_CON_2_FIELD
=
[
'合同编号'
,
'合同编号-正文'
,
'车辆识别代码'
,
'租金总额'
,
'融资租赁期限'
]
SE_HIL_CON_3_FIELD
=
[
'合同编号-每页'
,
'承租人姓名'
,
'承租人证件号码'
,
'销售经销商'
,
'合同编号-正文'
,
'姓名/名称'
,
'自然人身份证件号码/法人执照号码'
,
'承租人签字'
]
ROLE_LIST
=
[
(
'借款人签字及时间'
,
'Borrower'
,
0
,
0
,
True
,
False
),
...
...
@@ -1496,6 +1563,35 @@ ROLE_LIST = [
(
'保证人日期2'
,
'Guarantor'
,
1
,
'有'
,
False
,
False
),
]
# key, app_type, id_idx, field_idx, is_force, e_write
ROLE_LIST_2
=
[
(
'抵押人'
,
'Borrower'
,
0
,
0
,
True
,
True
),
(
'抵押人证件号码'
,
'Borrower'
,
0
,
2
,
True
,
True
),
(
'抵押人签字'
,
'Borrower'
,
0
,
0
,
True
,
False
),
(
'抵押人配偶'
,
'Co-Borrower'
,
0
,
0
,
False
,
True
),
(
'抵押人配偶证件号码'
,
'Co-Borrower'
,
0
,
2
,
False
,
True
),
(
'抵押人配偶签字'
,
'Co-Borrower'
,
0
,
0
,
False
,
False
),
]
ROLE_LIST_1
=
[
(
'承租人姓名'
,
'Borrower'
,
0
,
0
,
True
,
True
),
(
'承租人证件号'
,
'Borrower'
,
0
,
2
,
True
,
True
),
(
'承租人签字'
,
'Borrower'
,
0
,
0
,
True
,
False
),
(
'共同承租人姓名'
,
'Co-Borrower'
,
0
,
0
,
False
,
True
),
(
'共同承租人证件号'
,
'Co-Borrower'
,
0
,
2
,
False
,
True
),
(
'共同承租人签字'
,
'Co-Borrower'
,
0
,
0
,
False
,
False
),
(
'保证人姓名1'
,
'Guarantor'
,
0
,
0
,
False
,
True
),
(
'保证人证件号1'
,
'Guarantor'
,
0
,
2
,
False
,
True
),
(
'保证人签字1'
,
'Guarantor'
,
0
,
0
,
False
,
False
),
(
'保证人姓名2'
,
'Guarantor'
,
1
,
0
,
False
,
True
),
(
'保证人证件号2'
,
'Guarantor'
,
1
,
2
,
False
,
True
),
(
'保证人签字2'
,
'Guarantor'
,
1
,
0
,
False
,
False
),
]
GZS_REASON_1
=
'此申请有ASP产品,需人工核查'
GZS_REASON_2
=
'ASP购置税金额小于系统金额'
GZS_NAME
=
'车辆购置税'
...
...
@@ -1678,7 +1774,7 @@ BD_COMPARE_LOGIC = {
'保险截止日期'
:
(
'保险截止日期'
,
'se_bd_date_compare'
,
{},
'保单截止时间有误'
),
'保单章'
:
(
'保单章'
,
'se_common_compare'
,
{},
'保单无保单章'
),
'第一受益人'
:
(
'特别约定第一受益人'
,
'se_common_compare'
,
{},
'保单第一受益人需人工核查'
),
'保险费合计'
:
(
'保险费合计'
,
'se_amount_compare'
,
{},
'保单保费疑似无法覆盖ASP保险融资'
),
'保险费合计'
:
(
'保险费合计'
,
'se_amount_
lte_
compare'
,
{},
'保单保费疑似无法覆盖ASP保险融资'
),
}
BS_COMPARE_LOGIC
=
{
...
...
@@ -1693,13 +1789,72 @@ BS_COMPARE_LOGIC = {
SPECIAL_REASON
=
'主共借人未提供银行流水,含担保人需人工查看直系亲属关系'
SPECIAL_REASON_2
=
'担保人未提供银行流水,需人工查看直系亲属关系'
# ['合同编号-每页', '合同编号-正文', '车辆识别代码', '车辆卖方', '车辆原始销售价格', '融资成本总额', '租期', '还款计划表', 'ASP项目详情', '购置税校验', '承租人法定代表人或授权代表']
# ['承租人姓名', '承租人证件号', '承租人签字', '共同承租人姓名', '共同承租人证件号', '共同承租人签字', '保证人姓名1', '保证人证件号1', '保证人签字1', '保证人姓名2', '保证人证件号2', '保证人签字2']
HIL_CONTRACT_1_COMPARE_LOGIC
=
{
'合同编号-每页'
:
(
'合同编号-每页'
,
'se_list_compare'
,
{},
'售后回租合同中合同编号系统不一致'
),
'合同编号-正文'
:
(
'合同编号-正文'
,
'se_common_compare'
,
{},
'售后回租合同第一页正文中合同编号系统不一致'
),
'车辆识别代码'
:
(
'车辆识别代码'
,
'se_common_compare'
,
{},
'售后回租合同车辆识别代码与系统车架号不一致'
),
'车辆卖方'
:
(
'车辆卖方'
,
'se_common_compare'
,
{},
'售后回租合同车辆卖方与系统经销商不一致'
),
'车辆原始销售价格'
:
(
'车辆原始销售价格'
,
'se_amount_str_compare'
,
{},
'售后回租合同车辆原始销售价格与系统车辆价格不一致'
),
'融资成本总额'
:
(
'融资成本总额'
,
'se_amount_str_compare'
,
{},
'售后回租合同ASP融资成本总额与系统不一致'
),
'租期'
:
(
'租期'
,
'se_contain_compare_2'
,
{},
'售后回租合同首页中贷款期限系统不一致'
),
'还款计划表'
:
(
'还款计划表'
,
'se_schedule_compare'
,
{
"value_idx"
:
3
},
'售后回租合同还款计划表与系统不一致'
),
'ASP项目详情'
:
(
'ASP项目详情'
,
'se_asp_compare'
,
{},
'售后回租合同ASP名称或者金额与系统不一致'
),
'承租人法定代表人或授权代表'
:
(
'承租人法定代表人或授权代表'
,
'se_name_compare'
,
{},
'售后回租合同承租人法定代表人或授权代表与系统不一致'
),
'承租人姓名'
:
(
'承租人姓名'
,
'se_name_compare'
,
{},
'售后回租合同承租人姓名与系统不一致'
),
'承租人证件号'
:
(
'承租人证件号'
,
'se_common_compare'
,
{},
'售后回租合同承租人证件号与系统不一致'
),
'承租人签字'
:
(
'承租人签字'
,
'se_contain_compare'
,
{},
'售后回租合同承租人签字与系统不一致'
),
'共同承租人姓名'
:
(
'共同承租人姓名'
,
'se_name_compare'
,
{},
'售后回租合同共同承租人姓名与系统不一致'
),
'共同承租人证件号'
:
(
'共同承租人证件号'
,
'se_common_compare'
,
{},
'售后回租合同共同承租人证件号与系统不一致'
),
'共同承租人签字'
:
(
'共同承租人签字'
,
'se_contain_compare'
,
{},
'售后回租合同共同承租人签字与系统不一致'
),
'保证人姓名1'
:
(
'保证人姓名1'
,
'se_name_compare'
,
{},
'售后回租合同保证人姓名1与系统不一致'
),
'保证人证件号1'
:
(
'保证人证件号1'
,
'se_common_compare'
,
{},
'售后回租合同保证人证件号1与系统不一致'
),
'保证人签字1'
:
(
'保证人签字1'
,
'se_contain_compare'
,
{},
'售后回租合同保证人签字1与系统不一致'
),
'保证人姓名2'
:
(
'保证人姓名2'
,
'se_name_compare'
,
{},
'售后回租合同保证人姓名2与系统不一致'
),
'保证人证件号2'
:
(
'保证人证件号2'
,
'se_common_compare'
,
{},
'售后回租合同保证人证件号2与系统不一致'
),
'保证人签字2'
:
(
'保证人签字2'
,
'se_contain_compare'
,
{},
'售后回租合同保证人签字2与系统不一致'
),
}
# ['合同编号', '合同编号-正文', '车辆识别代码', '租金总额', '融资租赁期限']
# ['抵押人', '抵押人证件号码', '抵押人签字', '抵押人配偶', '抵押人配偶证件号码', '抵押人配偶签字']
HIL_CONTRACT_2_COMPARE_LOGIC
=
{
'合同编号'
:
(
'合同编号'
,
'se_common_compare'
,
{},
'车辆租赁抵押合同合同编号与系统合同编号不一致'
),
'合同编号-正文'
:
(
'合同编号-正文'
,
'se_common_compare'
,
{},
'车辆租赁抵押合同正文合同编号与系统合同编号不一致'
),
'车辆识别代码'
:
(
'车辆识别代码'
,
'se_common_compare'
,
{},
'车辆租赁抵押合同车辆识别代码与系统车架号不一致'
),
'租金总额'
:
(
'租金总额'
,
'se_amount_str_compare'
,
{},
'车辆租赁抵押合同租金总额与系统租金总额不一致'
),
'融资租赁期限'
:
(
'融资租赁期限'
,
'se_common_compare'
,
{},
'车辆租赁抵押合同融资租赁期限与系统不一致'
),
'抵押人'
:
(
'抵押人'
,
'se_name_compare'
,
{},
'车辆租赁抵押合同抵押人姓名与系统不一致'
),
'抵押人证件号码'
:
(
'抵押人证件号码'
,
'se_common_compare'
,
{},
'车辆租赁抵押合同抵押人证件号码与系统不一致'
),
'抵押人签字'
:
(
'抵押人签字'
,
'se_contain_compare'
,
{},
'车辆租赁抵押合同抵押人签字与系统承租人姓名不一致'
),
'抵押人配偶'
:
(
'抵押人配偶'
,
'se_name_compare'
,
{},
'车辆租赁抵押合同抵押人配偶姓名与系统不一致'
),
'抵押人配偶证件号码'
:
(
'抵押人配偶证件号码'
,
'se_common_compare'
,
{},
'车辆租赁抵押合同抵押人配偶证件号码与系统不一致'
),
'抵押人配偶签字'
:
(
'抵押人配偶签字'
,
'se_contain_compare'
,
{},
'车辆租赁抵押合同抵押人签字与系统承租人配偶姓名不一致'
),
}
# ['合同编号-每页', '承租人姓名', '承租人证件号码', '销售经销商', '合同编号-正文', '姓名/名称', '自然人身份证件号码/法人执照号码', '承租人签字']
HIL_CONTRACT_3_COMPARE_LOGIC
=
{
'合同编号-每页'
:
(
'合同编号-每页'
,
'se_list_compare'
,
{},
'车辆处置协议合同编号与系统不一致'
),
'承租人姓名'
:
(
'承租人姓名'
,
'se_name_compare'
,
{},
'车辆处置协议承租人姓名与系统不一致'
),
'承租人证件号码'
:
(
'承租人证件号码'
,
'se_common_compare'
,
{},
'车辆处置协议承租人证件号码与系统不一致'
),
'销售经销商'
:
(
'销售经销商'
,
'se_common_compare'
,
{},
'车辆处置协议经销商与系统不一致'
),
'合同编号-正文'
:
(
'合同编号-正文'
,
'se_common_compare'
,
{},
'车辆处置协议正文合同编号与系统不一致'
),
'姓名/名称'
:
(
'姓名/名称'
,
'se_name_compare'
,
{},
'车辆处置协议签字页客户姓名与系统不一致'
),
'自然人身份证件号码/法人执照号码'
:
(
'自然人身份证件号码/法人执照号码'
,
'se_common_compare'
,
{},
'车辆处置协议签字页客户证件号码与系统不一致'
),
'承租人签字'
:
(
'承租人签字'
,
'se_contain_compare'
,
{},
'车辆处置协议承租人签字与系统承租人姓名不一致'
),
}
HT_COMPARE_LOGIC
=
{
'合同编号-每页'
:
(
'合同编号-每页'
,
'se_list_compare'
,
{},
'合同编号与系统不一致'
),
'所购车辆价格-小写-重要条款'
:
(
'所购车辆价格-小写-重要条款'
,
'se_amount_str_compare'
,
{},
'合同首页中车辆价格与系统不一致'
),
'车架号-重要条款'
:
(
'车架号-重要条款'
,
'se_common_compare'
,
{},
'合同首页中车架号与系统不一致'
),
'贷款本金金额-重要条款'
:
(
'贷款本金金额-重要条款'
,
'se_amount_str_compare'
,
{},
'合同首页中贷款本金与系统不一致'
),
'贷款期限-重要条款'
:
(
'贷款期限-重要条款'
,
'se_common_compare'
,
{},
'合同首页中贷款期限与系统不一致'
),
'车辆贷款本金金额-重要条款'
:
(
'车辆贷款本金金额-重要条款'
,
'se_amount_str_compare'
,
{},
'车辆贷款本金金额-重要条款'
),
'车辆贷款本金金额-重要条款'
:
(
'车辆贷款本金金额-重要条款'
,
'se_amount_str_compare'
,
{},
'
合同
车辆贷款本金金额-重要条款'
),
'附加产品融资贷款本金总额-重要条款'
:
(
'附加产品融资贷款本金总额-重要条款'
,
'se_amount_str_compare'
,
{},
'合同首页中附加产品融资金额与系统不一致'
),
'所购车辆价格'
:
(
'所购车辆价格'
,
'se_amount_str_compare'
,
{},
'主合同页中车辆价格与系统不一致'
),
'车架号'
:
(
'车架号'
,
'se_common_compare'
,
{},
'主合同页中车架号与系统不一致'
),
...
...
@@ -1734,10 +1889,10 @@ HT_COMPARE_LOGIC = {
'见证人签字'
:
(
'见证人签字'
,
'se_have_compare'
,
{},
'合同见证人无'
),
'见证人日期'
:
(
'见证人日期'
,
'se_date_contain_compare'
,
{},
'合同见证人签字日期不符合逻辑'
),
'还款计划表'
:
(
'还款计划表'
,
'se_schedule_compare'
,
{
},
'
还款计划表与系统不一致'
),
'还款计划表'
:
(
'还款计划表'
,
'se_schedule_compare'
,
{
"value_idx"
:
1
},
'合同
还款计划表与系统不一致'
),
'ASP项目详情-重要条款'
:
(
'ASP项目详情-重要条款'
,
'se_asp_compare'
,
{},
'(重要条款)ASP名称或者金额与系统不一致'
),
'ASP项目详情'
:
(
'ASP项目详情'
,
'se_asp_compare'
,
{},
'ASP名称或者金额与系统不一致'
),
'ASP项目详情-重要条款'
:
(
'ASP项目详情-重要条款'
,
'se_asp_compare'
,
{},
'
合同
(重要条款)ASP名称或者金额与系统不一致'
),
'ASP项目详情'
:
(
'ASP项目详情'
,
'se_asp_compare'
,
{},
'
合同
ASP名称或者金额与系统不一致'
),
}
...
...
@@ -1764,8 +1919,8 @@ SE_COMPARE_FIELD = {
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
),
HIL_CONTRACT_2_EN
:
(
HIL_CONTRACT_
2
_FIELD
,
HIL_CONTRACT_2_COMPARE_LOGIC
,
False
),
HIL_CONTRACT_3_EN
:
(
HIL_CONTRACT_
3
_FIELD
,
HIL_CONTRACT_3_COMPARE_LOGIC
,
False
),
}
...
...
src/apps/doc/management/commands/ocr_process.py
View file @
e199bcb
...
...
@@ -909,11 +909,10 @@ class Command(BaseCommand, LoggerMixin):
)
return
res
def
rebuild_contract
(
self
,
contract_result_compare
):
res_list
=
[]
def
rebuild_contract
(
self
,
license_summary
,
contract_result_compare
):
for
classify
,
page_info_dict
in
contract_result_compare
.
items
():
res
=
{}
if
classify
==
consts
.
CONTRACT_CLASSIFY
:
res
=
{}
is_asp
=
page_info_dict
.
get
(
consts
.
ASP_KEY
,
False
)
for
key
,
(
pno_not_asp
,
pno_asp
,
key1
,
key2
)
in
consts
.
SE_AFC_CON_MAP
.
items
():
pno
=
pno_asp
if
is_asp
else
pno_not_asp
...
...
@@ -927,8 +926,26 @@ class Command(BaseCommand, LoggerMixin):
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
license_summary
[
classify
]
=
[
res
]
else
:
res
=
{}
for
key
,
(
pno1
,
pno2
,
end_idx
,
key1
,
key2
)
in
consts
.
SE_HIL_CON_MAP
[
classify
]
.
items
():
if
pno1
is
None
:
for
i
in
range
(
1
,
end_idx
):
res
.
setdefault
(
key
,
list
())
.
append
(
page_info_dict
.
get
(
str
(
i
),
{})
.
get
(
key1
,
''
))
elif
key2
is
None
:
tmp_res
=
page_info_dict
.
get
(
str
(
pno1
),
{})
.
get
(
key1
)
if
tmp_res
is
None
and
isinstance
(
pno2
,
int
):
tmp_res
=
page_info_dict
.
get
(
str
(
pno2
),
{})
.
get
(
key1
,
''
)
res
[
key
]
=
tmp_res
else
:
tmp_res
=
page_info_dict
.
get
(
str
(
pno1
),
{})
.
get
(
key1
,
{})
.
get
(
key2
)
if
tmp_res
is
None
and
isinstance
(
pno2
,
int
):
tmp_res
=
page_info_dict
.
get
(
str
(
pno2
),
{})
.
get
(
key1
,
{})
.
get
(
key2
,
''
)
res
[
key
]
=
tmp_res
license_summary
[
classify
]
=
[
res
]
def
rebuild_bs_summary
(
self
,
bs_summary
,
unknown_summary
):
# bs_summary = {
...
...
@@ -1659,9 +1676,7 @@ 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
self
.
rebuild_contract
(
license_summary
,
contract_result_compare
)
bs_rebuild
=
self
.
rebuild_bs
(
merged_bs_summary
)
if
len
(
bs_rebuild
)
>
0
:
...
...
src/celery_compare/tasks.py
View file @
e199bcb
...
...
@@ -925,7 +925,7 @@ def get_se_cms_compare_info(last_obj, application_entity, detect_list):
license_dict
[
consts
.
BL_EN
]
=
bl_field_input
all_id_num
.
append
(
id_num
)
if
individual_info
.
get
(
'customersubType'
,
''
)
==
'Corporate'
:
company_info_list
.
append
((
customer_name
,
id_num
))
company_info_list
.
append
((
customer_name
,
id_num
,
legal_name
))
# SME营业执照---------------------------------------------------------------------------------------------------
if
individual_info
.
get
(
'customersubType'
,
''
)
.
startswith
(
'Self Employed'
):
...
...
@@ -1091,7 +1091,6 @@ def get_se_cms_compare_info(last_obj, application_entity, detect_list):
bs_info
[
consts
.
BS_EN
]
=
bs_field_input
compare_info
[
'Bank Statement'
]
=
bs_info
# 抵押登记豁免函----------------------------------------------------------------------------------------------------
other_info
=
{}
full_no
=
cms_info
.
get
(
'settlemnetVerification'
,
{})
.
get
(
'applicationNo'
,
''
)
...
...
@@ -1156,13 +1155,13 @@ def get_se_cms_compare_info(last_obj, application_entity, detect_list):
# 保单 -----------------------------------------------------------------------------------------------------------
is_insurance
=
0
fp_campaign
=
cms_info
.
get
(
'fpCampaign'
,
''
)
insurance_type
=
cms_info
.
get
(
'insuranceDetails'
,
{})
.
get
(
'insuranceType'
,
''
)
if
insurance_type
==
'Waive Insurance'
and
isinstance
(
insurance_price
,
str
):
is_insurance
=
1
elif
insurance_type
==
'Comprehensive Insurance'
:
is_insurance
=
2
if
is_insurance
!=
0
:
fp_campaign
=
cms_info
.
get
(
'fpCampaign'
,
''
)
if
fp_campaign
.
find
(
'OCU'
)
==
-
1
:
ssx_amount
=
amount
else
:
...
...
@@ -1190,21 +1189,93 @@ def get_se_cms_compare_info(last_obj, application_entity, detect_list):
if
len
(
other_info
)
>
0
:
compare_info
[
'other'
]
=
other_info
if
application_entity
in
consts
.
HIL_SET
:
# HIL合同-----------------------------------------------------------------------------------------
return
compare_info
,
cms_info
.
get
(
'applicationVersion'
,
1
)
else
:
# AFC合同-----------------------------------------------------------------------------------------------------------
contract_info
=
{}
schedule_list
=
[]
total_amount
=
0
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
)
total_amount
+=
float
(
schedule_dict
.
get
(
'grossRentalAmount'
,
'0.0'
))
schedule_list_str
=
consts
.
SCHEDULE_SPLIT_STR
.
join
(
schedule_list
)
online_sign
=
cms_info
.
get
(
'contractSource'
,
'Online Sign'
)
==
'Online Sign'
contract_info
=
{}
if
application_entity
in
consts
.
HIL_SET
:
# HIL合同 售后回租合同 --------------------------------------------------------------------------------------
hil_contract_1_input
=
[
(
consts
.
SE_HIL_CON_1_FIELD
[
0
],
[
full_no
]
if
online_sign
else
full_no
),
(
consts
.
SE_HIL_CON_1_FIELD
[
1
],
full_no
),
(
consts
.
SE_HIL_CON_1_FIELD
[
2
],
vin_no
),
(
consts
.
SE_HIL_CON_1_FIELD
[
3
],
cms_info
.
get
(
'dealerName'
,
''
)),
(
consts
.
SE_HIL_CON_1_FIELD
[
4
],
amount
),
(
consts
.
SE_HIL_CON_1_FIELD
[
5
],
str
(
cms_info
.
get
(
'financialInformation'
,
{})
.
get
(
'originationPrincipal'
,
'0.0'
))),
(
consts
.
SE_HIL_CON_1_FIELD
[
6
],
str
(
cms_info
.
get
(
'terms'
,
'0'
))),
(
consts
.
SE_HIL_CON_1_FIELD
[
7
],
schedule_list_str
),
(
consts
.
SE_HIL_CON_1_FIELD
[
8
],
asp_list
),
(
consts
.
SE_HIL_CON_1_FIELD
[
9
],
gzs_list
),
]
if
isinstance
(
company_info
,
tuple
):
hil_contract_1_input
.
append
((
consts
.
SE_HIL_CON_1_FIELD
[
10
],
company_info
[
2
]))
for
key
,
app_type
,
id_idx
,
field_idx
,
is_force
,
e_write
in
consts
.
ROLE_LIST_1
:
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
):
hil_contract_1_input
.
append
((
key
,
main_role_info
[
app_type
][
id_idx
][
field_idx
]))
else
:
hil_contract_1_input
.
append
((
key
,
field_idx
))
if
not
is_find
and
is_force
:
hil_contract_1_input
.
append
((
key
,
empty_str
))
contract_info
[
consts
.
HIL_CONTRACT_1_EN
]
=
hil_contract_1_input
# HIL合同 车辆处置协议 --------------------------------------------------------------------------------------
if
fp_campaign
.
find
(
'Joy_Select'
)
!=
-
1
:
hil_contract_3_input
=
[
(
consts
.
SE_HIL_CON_3_FIELD
[
0
],
[
full_no
]
if
online_sign
else
full_no
),
(
consts
.
SE_HIL_CON_3_FIELD
[
1
],
hmh_name
),
(
consts
.
SE_HIL_CON_3_FIELD
[
2
],
hmh_id
),
(
consts
.
SE_HIL_CON_3_FIELD
[
3
],
cms_info
.
get
(
'dealerName'
,
''
)),
(
consts
.
SE_HIL_CON_3_FIELD
[
4
],
full_no
),
(
consts
.
SE_HIL_CON_3_FIELD
[
5
],
hmh_name
),
(
consts
.
SE_HIL_CON_3_FIELD
[
6
],
hmh_id
),
]
if
online_sign
:
hil_contract_3_input
.
append
((
consts
.
SE_HIL_CON_3_FIELD
[
7
],
hmh_name
))
contract_info
[
consts
.
HIL_CONTRACT_3_EN
]
=
hil_contract_3_input
# HIL合同 车辆租赁抵押合同 --------------------------------------------------------------------------------------
hil_contract_2_input
=
[
(
consts
.
SE_HIL_CON_2_FIELD
[
0
],
full_no
),
(
consts
.
SE_HIL_CON_2_FIELD
[
1
],
full_no
),
(
consts
.
SE_HIL_CON_2_FIELD
[
2
],
vin_no
),
(
consts
.
SE_HIL_CON_2_FIELD
[
3
],
format
(
total_amount
,
'.2f'
)),
(
consts
.
SE_HIL_CON_2_FIELD
[
4
],
str
(
cms_info
.
get
(
'terms'
,
'0'
))),
]
for
key
,
app_type
,
id_idx
,
field_idx
,
is_force
,
e_write
in
consts
.
ROLE_LIST_2
:
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
):
hil_contract_2_input
.
append
((
key
,
main_role_info
[
app_type
][
id_idx
][
field_idx
]))
else
:
hil_contract_2_input
.
append
((
key
,
field_idx
))
if
not
is_find
and
is_force
:
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
)
else
:
# AFC合同-----------------------------------------------------------------------------------------------------------
vehicle_principal_str
=
str
(
cms_info
.
get
(
'financialInformation'
,
{})
.
get
(
'vehiclePrincipal'
,
'0.0'
))
afc_contract_input
=
[
(
consts
.
SE_AFC_CON_FIELD
[
0
],
full_no
),
...
...
@@ -1238,7 +1309,6 @@ def get_se_cms_compare_info(last_obj, application_entity, detect_list):
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
...
...
@@ -1729,7 +1799,7 @@ def se_compare_license(license_en, ocr_res_dict, field_list):
return
result_field_list
,
no_ocr_result
,
field_img_path_dict
def
se_
afc_
contract_compare
(
license_en
,
ocr_res_dict
,
strip_list
):
def
se_contract_compare
(
license_en
,
ocr_res_dict
,
strip_list
):
ocr_field
,
compare_logic
,
_
=
consts
.
SE_COMPARE_FIELD
[
license_en
]
ocr_res_str
=
ocr_res_dict
.
get
(
ocr_field
)
...
...
@@ -1983,8 +2053,8 @@ def se_compare_process(compare_info, ocr_res_dict):
failure_field
=
[]
if
license_en
==
consts
.
MVC34_EN
:
result_field_list
,
field_img_path_dict
=
se_mvc34_compare
(
license_en
,
ocr_res_dict
,
strip_list
)
elif
license_en
==
consts
.
AFC_CONTRACT_EN
:
result_field_list
,
field_img_path_dict
=
se_
afc_
contract_compare
(
license_en
,
ocr_res_dict
,
strip_list
)
elif
license_en
in
[
consts
.
HIL_CONTRACT_1_EN
,
consts
.
HIL_CONTRACT_2_EN
,
consts
.
HIL_CONTRACT_3_EN
,
consts
.
AFC_CONTRACT_EN
]
:
result_field_list
,
field_img_path_dict
=
se_contract_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
)
else
:
...
...
src/common/tools/comparison.py
View file @
e199bcb
...
...
@@ -159,10 +159,15 @@ class Comparison:
return
self
.
build_res
(
input_str
==
compare_str
),
compare_str
def
se_list_compare
(
self
,
input_str
,
ocr_str_or_list
,
**
kwargs
):
if
isinstance
(
ocr_str_or_list
,
list
):
def
se_list_compare
(
self
,
input_str_or_list
,
ocr_str_or_list
,
**
kwargs
):
if
isinstance
(
ocr_str_or_list
,
list
)
and
len
(
ocr_str_or_list
)
>
0
:
if
isinstance
(
input_str_or_list
,
list
)
and
len
(
input_str_or_list
)
>
0
:
if
input_str_or_list
[
0
]
==
ocr_str_or_list
[
0
]:
return
self
.
RESULT_Y
return
self
.
RESULT_N
else
:
for
item
in
ocr_str_or_list
:
if
item
!=
input_str
:
if
item
!=
input_str_or_list
:
return
self
.
RESULT_N
return
self
.
RESULT_Y
else
:
...
...
@@ -177,7 +182,8 @@ class Comparison:
ocr_str_or_list
.
pop
(
0
)
schedule_list
=
[]
for
row_list
in
ocr_str_or_list
:
tmp_str
=
"{1}{0}{2}"
.
format
(
self
.
SPLIT_STR
,
row_list
[
0
],
row_list
[
1
]
.
replace
(
','
,
''
))
tmp_str
=
"{1}{0}{2}"
.
format
(
self
.
SPLIT_STR
,
row_list
[
0
],
row_list
[
kwargs
.
get
(
'value_idx'
,
1
)]
.
replace
(
','
,
''
))
schedule_list
.
append
(
tmp_str
)
return
self
.
build_res
(
self
.
SCHEDULE_SPLIT_STR
.
join
(
schedule_list
)
==
input_str
)
else
:
...
...
@@ -304,7 +310,6 @@ class Comparison:
except
Exception
as
e
:
return
self
.
RESULT_N
def
ca_date_compare
(
self
,
input_str
,
ocr_str
,
**
kwargs
):
if
kwargs
.
get
(
'long'
,
False
):
if
'长期'
in
ocr_str
or
'永久'
in
ocr_str
:
...
...
@@ -366,7 +371,7 @@ class Comparison:
def
se_amount_lte_compare
(
self
,
input_str
,
ocr_str
,
**
kwargs
):
try
:
float_input
=
float
(
input_str
)
float_ocr
=
float
(
ocr_str
)
float_ocr
=
float
(
ocr_str
.
replace
(
'元'
,
''
)
.
replace
(
','
,
''
)
)
except
Exception
as
e
:
return
self
.
RESULT_N
else
:
...
...
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