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
806c91b2
authored
2021-11-15 14:45:38 +0800
by
周伟奇
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
part 2
1 parent
5ae1abb7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
156 additions
and
151 deletions
src/apps/doc/consts.py
src/celery_compare/tasks.py
src/apps/doc/consts.py
View file @
806c91b
...
...
@@ -1446,20 +1446,20 @@ SKIP_CARD = {ID_EN, RP_EN}
ID_COMPARE_LOGIC
=
{
'customerName'
:
(
'姓名'
,
'se_name_compare'
,
{}),
'idNum'
:
(
'公民身份号码'
,
'se_common_compare'
,
{}),
'customerName'
:
(
'姓名'
,
'se_name_compare'
,
{}
,
'身份证姓名与系统不一致'
),
'idNum'
:
(
'公民身份号码'
,
'se_common_compare'
,
{}
,
'身份证号码与系统不一致'
),
# 'dateOfBirth': ('出生年月', 'se_date_compare', {'input_replace': ''}),
'idExpiryDate'
:
(
'有效期限'
,
'se_date_compare'
,
{
'long'
:
True
,
'ocr_split'
:
True
,
'input_replace'
:
''
,
'today'
:
True
}),
'hukouProvince'
:
(
'住址'
,
'se_contain_compare'
,
{}),
'hukouCity'
:
(
'住址'
,
'se_contain_compare'
,
{}),
IC_TURE_OR_FALSE
:
(
IC_TURE_OR_FALSE
,
'se_common_compare'
,
{}),
'idExpiryDate'
:
(
'有效期限'
,
'se_date_compare'
,
{
'long'
:
True
,
'ocr_split'
:
True
,
'input_replace'
:
''
,
'today'
:
True
}
,
'身份证有效期疑似过期'
),
'hukouProvince'
:
(
'住址'
,
'se_contain_compare'
,
{}
,
'身份证住址与系统不一致'
),
'hukouCity'
:
(
'住址'
,
'se_contain_compare'
,
{}
,
'身份证住址与系统不一致'
),
IC_TURE_OR_FALSE
:
(
IC_TURE_OR_FALSE
,
'se_common_compare'
,
{}
,
'身份证件疑似造假,需人工判断'
),
}
PP_COMPARE_LOGIC
=
{
'customerName'
:
(
'英文姓名'
,
'se_name_compare'
,
{
'is_passport'
:
True
}),
# 1
'idNum'
:
(
'护照号码'
,
'se_common_compare'
,
{}),
# 2
'dateOfBirth'
:
(
'出生日期'
,
'se_date_compare'
,
{
'input_replace'
:
''
}),
# 2
'idExpiryDate'
:
(
'有效期至'
,
'se_date_compare'
,
{
'input_replace'
:
''
,
'today'
:
True
}),
# 2
'customerName'
:
(
'英文姓名'
,
'se_name_compare'
,
{
'is_passport'
:
True
}
,
'护照姓名与系统不一致'
),
# 1
'idNum'
:
(
'护照号码'
,
'se_common_compare'
,
{}
,
'护照号码与系统不一致'
),
# 2
'dateOfBirth'
:
(
'出生日期'
,
'se_date_compare'
,
{
'input_replace'
:
''
}
,
'护照出生日期与系统不一致'
),
# 2
'idExpiryDate'
:
(
'有效期至'
,
'se_date_compare'
,
{
'input_replace'
:
''
,
'today'
:
True
}
,
'护照有效期疑似过期'
),
# 2
}
PP_SLICE_MAP
=
{
...
...
@@ -1471,44 +1471,44 @@ PP_SLICE_MAP = {
}
EEP_COMPARE_LOGIC
=
{
'customerName'
:
(
'中文名'
,
'se_common_compare'
,
{}),
'idNum'
:
(
'证件号码'
,
'se_common_compare'
,
{}),
'dateOfBirth'
:
(
'出生日期'
,
'se_date_compare'
,
{
'input_replace'
:
'.'
}),
'idExpiryDate'
:
(
'有效期限'
,
'se_date_compare'
,
{
'ocr_split'
:
True
,
'input_replace'
:
'.'
,
'today'
:
True
}),
'customerName'
:
(
'中文名'
,
'se_common_compare'
,
{}
,
'港澳台姓名与系统不一致'
),
'idNum'
:
(
'证件号码'
,
'se_common_compare'
,
{}
,
'港澳台证件号码与系统不一致'
),
'dateOfBirth'
:
(
'出生日期'
,
'se_date_compare'
,
{
'input_replace'
:
'.'
}
,
'港澳台出生日期与系统不一致'
),
'idExpiryDate'
:
(
'有效期限'
,
'se_date_compare'
,
{
'ocr_split'
:
True
,
'input_replace'
:
'.'
,
'today'
:
True
}
,
'港澳台证件有效期疑似过期'
),
}
RP_COMPARE_LOGIC
=
{
'customerName'
:
(
'姓名'
,
'se_name_compare'
,
{}),
'idNum'
:
(
'公民身份号码'
,
'se_common_compare'
,
{}),
'dateOfBirth'
:
(
'出生年月'
,
'se_date_compare'
,
{
'input_replace'
:
''
}),
'idExpiryDate'
:
(
'有效期限'
,
'se_date_compare'
,
{
'ocr_split'
:
True
,
'input_replace'
:
''
,
'today'
:
True
}),
'hukouProvince'
:
(
'住址'
,
'se_contain_compare'
,
{}),
'hukouCity'
:
(
'住址'
,
'se_contain_compare'
,
{}),
'customerName'
:
(
'姓名'
,
'se_name_compare'
,
{}
,
'居住证姓名与系统不一致'
),
'idNum'
:
(
'公民身份号码'
,
'se_common_compare'
,
{}
,
'居住证公民号码与系统不一致'
),
'dateOfBirth'
:
(
'出生年月'
,
'se_date_compare'
,
{
'input_replace'
:
'
居住证出生年月与系统不一致
'
}),
'idExpiryDate'
:
(
'有效期限'
,
'se_date_compare'
,
{
'ocr_split'
:
True
,
'input_replace'
:
''
,
'today'
:
True
}
,
'居住证有效期疑似过期'
),
'hukouProvince'
:
(
'住址'
,
'se_contain_compare'
,
{}
,
'居住证住址与系统不一致'
),
'hukouCity'
:
(
'住址'
,
'se_contain_compare'
,
{}
,
'居住证住址与系统不一致'
),
}
BL_COMPARE_LOGIC
=
{
'companyName'
:
(
'企业名称'
,
'se_company_compare'
,
{}),
'legalRepName'
:
(
'经营者姓名'
,
'se_name_compare'
,
{}),
'firstIdNo'
:
(
'注册号'
,
'se_common_compare'
,
{}),
'businessLicenseNo'
:
(
'注册号'
,
'se_common_compare'
,
{}),
'organizationCreditCode'
:
(
'注册号'
,
'se_common_compare'
,
{}),
'taxRegistrationCertificateNo'
:
(
'注册号'
,
'se_common_compare'
,
{}),
'establishmentDate'
:
(
'成立日期'
,
'se_date_compare'
,
{
'ocr_replace'
:
True
}),
'businessLicenseDueDate'
:
(
'营业期限'
,
'se_date_compare'
,
{
'ocr_split'
:
True
,
'long'
:
True
,
'ocr_replace'
:
True
,
'today'
:
True
}),
'organizationType'
:
(
'企业类型'
,
'se_type_compare'
,
{}),
'registeredCapital'
:
(
'注册资本'
,
'se_rmb_compare'
,
{}),
'companyName'
:
(
'企业名称'
,
'se_company_compare'
,
{}
,
'营业执照公司名称与系统不一致'
),
'legalRepName'
:
(
'经营者姓名'
,
'se_name_compare'
,
{}
,
'营业执照法定代表人与系统不一致'
),
'firstIdNo'
:
(
'注册号'
,
'se_common_compare'
,
{}
,
'营业执照统一社会信用代码与系统不一致'
),
'businessLicenseNo'
:
(
'注册号'
,
'se_common_compare'
,
{}
,
'营业执照统一社会信用代码与系统不一致'
),
'organizationCreditCode'
:
(
'注册号'
,
'se_common_compare'
,
{}
,
'营业执照统一社会信用代码与系统不一致'
),
'taxRegistrationCertificateNo'
:
(
'注册号'
,
'se_common_compare'
,
{}
,
'营业执照统一社会信用代码与系统不一致'
),
'establishmentDate'
:
(
'成立日期'
,
'se_date_compare'
,
{
'ocr_replace'
:
True
}
,
'营业执照显示公司成立不满足2年'
),
'businessLicenseDueDate'
:
(
'营业期限'
,
'se_date_compare'
,
{
'ocr_split'
:
True
,
'long'
:
True
,
'ocr_replace'
:
True
,
'today'
:
True
}
,
'公司营业期限疑似过期'
),
'organizationType'
:
(
'企业类型'
,
'se_type_compare'
,
{}
,
'营业执照企业类型与系统不一致'
),
'registeredCapital'
:
(
'注册资本'
,
'se_rmb_compare'
,
{}
,
'营业执照注册资本与系统不一致'
),
}
MVI_COMPARE_LOGIC
=
{
'vinNo'
:
(
'车辆识别代码'
,
'se_common_compare'
,
{}),
'dealer'
:
(
'销方名称'
,
'se_contain_compare_2'
,
{}),
'vehicleTransactionAmount'
:
(
'价税合计小写'
,
'se_amount_compare'
,
{}),
'customerName'
:
(
'购方名称'
,
'se_common_compare'
,
{}),
'idNum'
:
(
'购买方身份证号或组织机构代码'
,
'se_common_compare'
,
{}),
'dateOfInvoice'
:
(
'开票日期'
,
'se_date_compare_2'
,
{
'three_month'
:
True
}),
'stamp'
:
(
'销售单位章'
,
'se_common_compare'
,
{}),
'发票联'
:
(
'发票类型'
,
'se_common_compare'
,
{}),
'发票真伪校验'
:
(
'发票真伪校验'
,
'se_common_compare'
,
{}),
'vinNo'
:
(
'车辆识别代码'
,
'se_common_compare'
,
{}
,
'发票车架号与系统不一致'
),
'dealer'
:
(
'销方名称'
,
'se_contain_compare_2'
,
{}
,
'发票销货单位名称与系统不一致'
),
'vehicleTransactionAmount'
:
(
'价税合计小写'
,
'se_amount_compare'
,
{}
,
'发票车辆价格与系统不一致'
),
'customerName'
:
(
'购方名称'
,
'se_common_compare'
,
{}
,
'发票购买方姓名与系统不一致'
),
'idNum'
:
(
'购买方身份证号或组织机构代码'
,
'se_common_compare'
,
{}
,
'发票购买方证件号码与系统不一致'
),
'dateOfInvoice'
:
(
'开票日期'
,
'se_date_compare_2'
,
{
'three_month'
:
True
}
,
'发票开票日期早于首次提交申请日期'
),
'stamp'
:
(
'销售单位章'
,
'se_common_compare'
,
{}
,
'发票无章'
),
'发票联'
:
(
'发票类型'
,
'se_common_compare'
,
{}
,
'发票疑似非发票联'
),
'发票真伪校验'
:
(
'发票真伪校验'
,
'se_common_compare'
,
{}
,
'发票疑似造假,需人工核算'
),
}
ZW_METHOD
=
'mvi_special'
LOWER_AMOUNT_FIELD
=
'价税合计小写'
...
...
@@ -1517,16 +1517,16 @@ BHSJ_FIELD = '不含税价'
ZZSSE_FIELD
=
'增值税税额'
UCI_COMPARE_LOGIC
=
{
'vinNo'
:
(
'车架号'
,
'se_common_compare'
,
{}),
'vehicleTransactionAmount'
:
(
'价税合计小写'
,
'se_amount_compare'
,
{}),
'customerName'
:
(
'购方名称'
,
'se_name_compare'
,
{
'is_passport'
:
True
}),
'idNum'
:
(
'购方纳税人识别号'
,
'se_contain_compare_2'
,
{}),
'dateOfInvoice'
:
(
'开票日期'
,
'se_date_compare_2'
,
{
'three_month'
:
True
}),
'stamp'
:
(
'发票章'
,
'se_common_compare'
,
{}),
'vinNo'
:
(
'车架号'
,
'se_common_compare'
,
{}
,
'二手车发票车架号与系统不一致'
),
'vehicleTransactionAmount'
:
(
'价税合计小写'
,
'se_amount_compare'
,
{}
,
'二手车发票车价合计与系统车辆价格不一致'
),
'customerName'
:
(
'购方名称'
,
'se_name_compare'
,
{
'is_passport'
:
True
}
,
'二手车发票买方姓名与系统不一致'
),
'idNum'
:
(
'购方纳税人识别号'
,
'se_contain_compare_2'
,
{}
,
'二手车发票买方证件号码与系统不一致'
),
'dateOfInvoice'
:
(
'开票日期'
,
'se_date_compare_2'
,
{
'three_month'
:
True
}
,
'二手车发票开票日期早于首次提交申请日期'
),
'stamp'
:
(
'发票章'
,
'se_common_compare'
,
{}
,
'二手车发票章需人工核查'
),
}
MVC_COMPARE_LOGIC
=
{
'vinNo'
:
(
'9.车辆识别代号/车架号'
,
'se_common_compare'
,
{}),
'vinNo'
:
(
'9.车辆识别代号/车架号'
,
'se_common_compare'
,
{}
,
'绿本车架号与系统车架号不一致'
),
# 'customerName': ('姓名/名称', ),
# 'idNum': ('身份证明名称/号码', ),
# 'date': ('转移登记日期', ),
...
...
@@ -1537,43 +1537,43 @@ TRANSFER_NUM = '身份证明名称/号码'
TRANSFER_DATE
=
'转移登记日期'
MVC34_COMPARE_LOGIC
=
{
'customerName'
:
(
TRANSFER_NAME
,
'se_company_compare'
,
{}),
'idNum'
:
(
TRANSFER_NUM
,
'se_contain_compare_2'
,
{}),
'date'
:
(
TRANSFER_DATE
,
'se_date_compare_2'
,
{}),
'customerName'
:
(
TRANSFER_NAME
,
'se_company_compare'
,
{}
,
'绿本最新转移登记人姓名与系统主借人不一致'
),
'idNum'
:
(
TRANSFER_NUM
,
'se_contain_compare_2'
,
{}
,
'绿本最新转移登记日证件号码与系统主借人证件号码不一致'
),
'date'
:
(
TRANSFER_DATE
,
'se_date_compare_2'
,
{}
,
'转移登记日期早于第一次提交申请日期'
),
}
BC_TYPE_VALUE
=
'借记卡'
BC_COMPARE_LOGIC
=
{
'accountNo'
:
(
'CardNum'
,
'se_common_compare'
,
{
'remove_space'
:
True
}),
'bankName'
:
(
'BankName'
,
'se_both_contain_compare'
,
{}),
'type'
:
(
'CardType'
,
'se_common_compare'
,
{}),
'accountNo'
:
(
'CardNum'
,
'se_common_compare'
,
{
'remove_space'
:
True
}
,
'银行卡卡号与系统不一致'
),
'bankName'
:
(
'BankName'
,
'se_both_contain_compare'
,
{}
,
'银行卡开户行与系统不一致'
),
'type'
:
(
'CardType'
,
'se_common_compare'
,
{}
,
'银行卡非借记卡'
),
}
DDA_COMPARE_LOGIC
=
{
'applicationId(1)'
:
(
'check_Num'
,
'se_common_compare'
,
{}),
'applicationId(2)'
:
(
'check_Num'
,
'se_common_compare'
,
{}),
'bankName'
:
(
'to_bank'
,
'se_both_contain_compare'
,
{}),
'companyName'
:
(
'to_company'
,
'se_company_compare'
,
{}),
'customerName'
:
(
DDA_IC_NAME
,
'se_contain_compare_2'
,
{}),
'idNum'
:
(
DDA_IC_ID
,
'se_contain_compare_2'
,
{}),
'accountHolderName'
:
(
DDA_BC_NAME
,
'se_common_compare'
,
{}),
'accountNo'
:
(
DDA_BC_ID
,
'se_common_compare'
,
{
'remove_space'
:
True
}),
'applicationId(1)'
:
(
'check_Num'
,
'se_common_compare'
,
{}
,
'DDA缴费编号与系统不一致'
),
'applicationId(2)'
:
(
'check_Num'
,
'se_common_compare'
,
{}
,
'DDA签署编号系统不一致'
),
'bankName'
:
(
'to_bank'
,
'se_both_contain_compare'
,
{}
,
'DDA非工商银行'
),
'companyName'
:
(
'to_company'
,
'se_company_compare'
,
{}
,
'DDA渠道与系统不一致'
),
'customerName'
:
(
DDA_IC_NAME
,
'se_contain_compare_2'
,
{}
,
'DDA客户姓名与系统不一致'
),
'idNum'
:
(
DDA_IC_ID
,
'se_contain_compare_2'
,
{}
,
'DDA身份证号码与系统不一致'
),
'accountHolderName'
:
(
DDA_BC_NAME
,
'se_common_compare'
,
{}
,
'DDA账户名与系统不一致'
),
'accountNo'
:
(
DDA_BC_ID
,
'se_common_compare'
,
{
'remove_space'
:
True
}
,
'DDA账号与系统不一致'
),
}
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'
,
{}),
'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'
,
{}
,
'二手车凭证购买方交易价格早于submissionDate'
),
}
HMH_COMPARE_LOGIC
=
{
'借款人/承租人姓名'
:
(
'借款/承租人姓名'
,
'se_name_compare'
,
{}),
'借款人/承租人证件号'
:
(
'证件号码'
,
'se_common_compare'
,
{}),
'申请号'
:
(
'合同编号'
,
'se_common_compare'
,
{}),
'渠道'
:
(
'渠道'
,
'se_common_compare'
,
{}),
'签字'
:
(
'借款人签字/盖章'
,
'se_common_compare'
,
{}),
'借款人/承租人姓名'
:
(
'借款/承租人姓名'
,
'se_name_compare'
,
{}
,
'抵押登记豁免函借款人/承租人姓名与系统不符'
),
'借款人/承租人证件号'
:
(
'证件号码'
,
'se_common_compare'
,
{}
,
'抵押登记豁免函借款人/承租人证件号码与系统不符'
),
'申请号'
:
(
'合同编号'
,
'se_common_compare'
,
{}
,
'抵押登记豁免函申请号与系统不符'
),
'渠道'
:
(
'渠道'
,
'se_common_compare'
,
{}
,
'抵押登记豁免函渠道与系统不符'
),
'签字'
:
(
'借款人签字/盖章'
,
'se_common_compare'
,
{}
,
'抵押登记豁免函签字需人工核查'
),
}
# MVC_OCR_FIELD = 'mvc_ocr'
...
...
src/celery_compare/tasks.py
View file @
806c91b
...
...
@@ -1084,77 +1084,77 @@ 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
#
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
)
...
...
@@ -1581,13 +1581,13 @@ def se_compare_license(license_en, ocr_res_dict, field_list):
else
:
img_path
=
ocr_res_list
[
res_idx
]
.
get
(
consts
.
IMG_PATH_KEY
,
''
)
if
result
==
consts
.
RESULT_N
else
empty_str
error_type
=
empty_error_type
if
result
==
consts
.
RESULT_Y
else
ErrorType
.
OCR
.
value
result_field_list
.
append
((
name
,
value
,
result
,
ocr_str
,
img_path
,
error_type
))
result_field_list
.
append
((
name
,
value
,
result
,
ocr_str
,
img_path
,
error_type
,
compare_logic
[
name
][
3
]
))
else
:
no_ocr_result
=
True
if
not
is_find
:
for
name
,
value
in
field_list
:
result_field_list
.
append
((
name
,
value
,
consts
.
RESULT_N
,
empty_str
,
empty_str
,
ErrorType
.
NF
.
value
))
result_field_list
.
append
((
name
,
value
,
consts
.
RESULT_N
,
empty_str
,
empty_str
,
ErrorType
.
NF
.
value
,
'{0}未找到'
.
format
(
license_en
)
))
if
is_find
:
if
special_expiry_date_slice
:
...
...
@@ -1620,7 +1620,7 @@ def se_compare_license(license_en, ocr_res_dict, field_list):
if
os
.
path
.
exists
(
section_img_path
):
failed_field
=
[]
base_img_path
=
empty_str
for
name
,
_
,
result
,
_
,
img_path
,
_
in
result_field_list
:
for
name
,
_
,
result
,
_
,
img_path
,
_
,
_
in
result_field_list
:
if
result
==
consts
.
RESULT_N
:
if
special_expiry_date_slice
and
name
==
'idExpiryDate'
:
continue
...
...
@@ -1712,11 +1712,11 @@ def se_mvc34_compare(license_en, ocr_res_dict, field_list):
result
=
getattr
(
cp
,
compare_logic
[
name
][
1
])(
value
,
ocr_str
,
**
compare_logic
[
name
][
2
])
img_path
=
ocr_res
.
get
(
consts
.
IMG_PATH_KEY
,
''
)
if
result
==
consts
.
RESULT_N
else
empty_str
error_type
=
empty_error_type
if
result
==
consts
.
RESULT_Y
else
ErrorType
.
OCR
.
value
result_field_list
.
append
((
name
,
value
,
result
,
ocr_str
,
img_path
,
error_type
))
result_field_list
.
append
((
name
,
value
,
result
,
ocr_str
,
img_path
,
error_type
,
compare_logic
[
name
][
3
]
))
if
not
is_find
:
for
name
,
value
in
field_list
:
result_field_list
.
append
((
name
,
value
,
consts
.
RESULT_N
,
empty_str
,
empty_str
,
ErrorType
.
NF
.
value
))
result_field_list
.
append
((
name
,
value
,
consts
.
RESULT_N
,
empty_str
,
empty_str
,
ErrorType
.
NF
.
value
,
'{0}未找到'
.
format
(
license_en
)
))
return
result_field_list
,
dict
()
...
...
@@ -1731,6 +1731,7 @@ def se_compare_process(compare_info, ocr_res_dict):
failed_count
=
0
successful_at_this_level
=
True
failure_reason
=
{}
cn_reason_list
=
[]
for
info_key
,
info_value
in
compare_info
.
items
():
if
info_key
in
[
'individualCusInfo'
,
'applicantInformation'
]:
...
...
@@ -1745,13 +1746,14 @@ def se_compare_process(compare_info, ocr_res_dict):
strip_list
.
append
((
a
,
b
))
failure_field
=
[]
result_field_list
,
no_ocr_result
,
field_img_path_dict
=
se_compare_license
(
license_en
,
ocr_res_dict
,
strip_list
)
for
name
,
value
,
result
,
ocr_str
,
img_path
,
error_type
in
result_field_list
:
for
name
,
value
,
result
,
ocr_str
,
img_path
,
error_type
,
cn_reason
in
result_field_list
:
if
license_en
not
in
consts
.
SKIP_CARD
or
not
no_ocr_result
:
total_fields
+=
1
if
result
==
consts
.
RESULT_N
:
failed_count
+=
1
successful_at_this_level
=
False
failure_field
.
append
(
name
)
cn_reason_list
.
append
(
cn_reason
)
compare_result
.
append
(
{
consts
.
HEAD_LIST
[
0
]:
info_key
,
...
...
@@ -1781,12 +1783,13 @@ def se_compare_process(compare_info, ocr_res_dict):
result_field_list
,
field_img_path_dict
=
se_mvc34_compare
(
license_en
,
ocr_res_dict
,
strip_list
)
else
:
result_field_list
,
_
,
field_img_path_dict
=
se_compare_license
(
license_en
,
ocr_res_dict
,
strip_list
)
for
name
,
value
,
result
,
ocr_str
,
img_path
,
error_type
in
result_field_list
:
for
name
,
value
,
result
,
ocr_str
,
img_path
,
error_type
,
cn_reason
in
result_field_list
:
total_fields
+=
1
if
result
==
consts
.
RESULT_N
:
failed_count
+=
1
successful_at_this_level
=
False
failure_field
.
append
(
name
)
cn_reason_list
.
append
(
cn_reason
)
compare_result
.
append
(
{
consts
.
HEAD_LIST
[
0
]:
info_key
,
...
...
@@ -1805,6 +1808,7 @@ def se_compare_process(compare_info, ocr_res_dict):
failure_reason
.
setdefault
(
info_key
,
[])
.
append
(
';'
.
join
(
failure_field
))
if
failed_count
==
0
:
failure_reason_str
=
''
cn_failure_reason_str
=
''
else
:
reason_list
=
[]
for
key
,
value
in
failure_reason
.
items
():
...
...
@@ -1812,7 +1816,8 @@ def se_compare_process(compare_info, ocr_res_dict):
value_str
=
json
.
dumps
(
value
)
reason_list
.
append
(
'{0}: {1}'
.
format
(
key
,
value_str
))
failure_reason_str
=
'、'
.
join
(
reason_list
)
return
compare_result
,
total_fields
,
failed_count
,
successful_at_this_level
,
failure_reason_str
cn_failure_reason_str
=
'、'
.
join
(
set
(
cn_reason_list
))
return
compare_result
,
total_fields
,
failed_count
,
successful_at_this_level
,
failure_reason_str
,
cn_failure_reason_str
def
se_result_detect
(
ocr_res_dict
):
...
...
@@ -1836,7 +1841,7 @@ def se_compare(application_id, application_entity, ocr_res_id, last_obj, ocr_res
else
:
compare_info
=
get_se_compare_info
(
last_obj
,
application_entity
,
detect_list
)
application_version
=
last_obj
.
application_version
compare_result
,
total_fields
,
failed_count
,
successful_at_this_level
,
failure_reason_str
=
se_compare_process
(
compare_result
,
total_fields
,
failed_count
,
successful_at_this_level
,
failure_reason_str
,
cn_failure_reason_str
=
se_compare_process
(
compare_info
,
ocr_res_dict
)
compare_log
.
info
(
'{0} [SE] [compare success] [entity={1}] [id={2}] [ocr_res_id={3}] [result={4}]'
.
format
(
log_base
,
application_entity
,
application_id
,
ocr_res_id
,
compare_result
))
...
...
@@ -1901,7 +1906,7 @@ def se_compare(application_id, application_entity, ocr_res_id, last_obj, ocr_res
"SubtenantId"
:
consts
.
TENANT_MAP
[
application_entity
],
"Data"
:
{
"Result_Message"
:
"Pass"
if
successful_at_this_level
else
"Fail"
,
"Failure_Reason"
:
failure_reason_str
,
"Failure_Reason"
:
cn_
failure_reason_str
,
"Application_Number"
:
application_id
,
"Bank_Statement"
:
""
,
"Link_URL"
:
application_link
,
...
...
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