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
d24fcf2c
authored
2021-11-15 14:52:39 +0800
by
周伟奇
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
fix merge
2 parents
fdb7ca98
806c91b2
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
277 additions
and
105 deletions
src/apps/doc/consts.py
src/celery_compare/tasks.py
src/common/tools/comparison.py
src/apps/doc/consts.py
View file @
d24fcf2
...
...
@@ -1021,6 +1021,8 @@ JYPZ_FIELD_ORDER = (("type", "标题"),
CONTRACT_CN_NAME
=
'合同'
CONTRACT_CLASSIFY
=
41
# 合同编号: 每页
HIL_CONTRACT_1_CN_NAME
=
'售后回租合同'
HIL_CONTRACT_1_CLASSIFY
=
43
...
...
@@ -1379,15 +1381,49 @@ SE_CORPORATE_ALL_FIELD = ['companyName', 'legalRepName', 'firstIdNo', 'businessL
'taxRegistrationCertificateNo'
,
'establishmentDate'
,
'businessLicenseDueDate'
]
SE_NEW_FIELD
=
[
'vinNo'
,
'dealer'
,
'vehicleTransactionAmount'
]
SE_USED_FIELD
=
[
'vinNo'
,
'vehicleTransactionAmount'
]
SE_NEW_ADD_FIELD
=
[
'customerName'
,
'idNum'
,
'dateOfInvoice'
,
'stamp'
]
SE_NEW_ADD_FIELD
=
[
'customerName'
,
'idNum'
,
'dateOfInvoice'
,
'stamp'
,
'发票联'
,
'发票真伪校验'
]
SE_FPL_VALUE
=
'发票联'
SE_STAMP_VALUE
=
'有'
SE_GB_NEW_FIELD
=
[
'vinNo'
]
SE_GB_USED_FIELD
=
[
'customerName'
,
'idNum'
,
'date'
]
SE_HMH_FIELD
=
[
'
customerName'
,
'idNum'
,
'applicationId
'
]
SE_HMH_FIELD
=
[
'
借款人/承租人姓名'
,
'借款人/承租人证件号'
,
'申请号'
,
'渠道'
,
'签字
'
]
SE_BANK_FIELD
=
[
'accountNo'
,
'bankName'
]
SE_DDA_FIELD
=
[
'applicationId(1)'
,
'applicationId(2)'
,
'bankName'
,
'companyName'
,
'customerName'
,
'idNum'
,
'accountHolderName'
,
'accountNo'
]
SE_AFC_CON_FIELD
=
[
'合同编号-每页'
,
'所购车辆价格-小写-重要条款'
,
'车架号-重要条款'
,
'贷款本金金额-重要条款'
,
'贷款期限-重要条款'
,
'车辆贷款本金金额-重要条款'
,
'附加产品融资贷款本金总额-重要条款'
,
'所购车辆价格'
,
'车架号'
,
'经销商'
,
'贷款本金金额'
,
'车辆贷款本金金额'
,
'附加产品融资贷款本金总额'
,
'贷款期限'
,
'还款账号'
,
'户名'
,
'开户行'
,
'还款计划表'
,
'项目1'
,
'用途总金额'
,
'贷款本金'
,
'附加产品融资贷款本金总金额'
,
'购置税校验'
]
#
# '借款人签字-重要条款'
# '借款人姓名'
# '借款人证件号'
# '主借人签字'
# '主借人日期'
#
# '共借人姓名'
# '共借人证件号'
# '共借人签字'
# '共借人日期'
#
# '保证人姓名1'
# '保证人证件号1'
# '保证人签字1'
# '保证人日期'
#
# '保证人姓名2'
# '保证人证件号2'
# '保证人签字2'
# '保证人日期'
#
# '见证人签字'
# '见证人日期'
GZS_NAME
=
'车辆购置税'
GZS_STATUS
=
[
'Y'
,
'N'
,
'O'
]
SCHEDULE_SPLIT_STR
=
'、'
HIL_COMPANY_NAME
=
'先锋国际融资租赁有限公司'
AFC_COMPANY_NAME
=
'宝马汽车金融(中国)有限公司'
...
...
@@ -1404,24 +1440,26 @@ BC_EN = 'Bank Card'
DDA_EN
=
'DDA'
HMH_EN
=
'Mortgage Waiver Letter'
JYPZ_EN
=
'Used Car Document'
AFC_CONTRACT_EN
=
'AFC Contract'
SKIP_CARD
=
{
ID_EN
,
RP_EN
}
ID_COMPARE_LOGIC
=
{
'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'
,
{}),
'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'
,
{},
'身份证件疑似造假,需人工判断'
),
}
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
=
{
...
...
@@ -1433,55 +1471,62 @@ 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_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'
,
{},
'发票车架号与系统不一致'
),
'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
=
'价税合计小写'
UPPER_AMOUNT_FIELD
=
'价税合计大写'
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': ('转移登记日期', ),
...
...
@@ -1492,39 +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'
,
{}),
'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
=
{
'customerName'
:
(
'借款/承租人姓名'
,
'se_name_compare'
,
{}),
'idNum'
:
(
'证件号码'
,
'se_common_compare'
,
{}),
'applicationId'
:
(
'合同编号'
,
'se_contain_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 @
d24fcf2
...
...
@@ -907,7 +907,7 @@ def get_se_cms_compare_info(last_obj, application_entity, detect_list):
customer_name
=
individual_info
.
get
(
'name'
,
''
)
legal_name
=
individual_info
.
get
(
'legalRepName'
,
''
)
establishment_date
=
individual_info
.
get
(
'establishmentDate'
,
''
)
date_of_birth
=
individual_info
.
get
(
'dateOfBirth'
,
''
)
#
date_of_birth = individual_info.get('dateOfBirth', '')
for
id_info
in
individual_info
.
get
(
'IDInformation'
,
[]):
if
id_info
.
get
(
'idType'
)
in
consts
.
SE_CMS_FIRST_ID_FIELD_MAPPING
:
...
...
@@ -917,11 +917,13 @@ def get_se_cms_compare_info(last_obj, application_entity, detect_list):
field_input
=
[
(
'customerName'
,
customer_name
),
(
'idNum'
,
id_num
),
(
'dateOfBirth'
,
date_of_birth
),
(
'idExpiryDate'
,
id_info
.
get
(
'idExpiryDate'
,
''
)),
#
('dateOfBirth', date_of_birth),
#
('idExpiryDate', id_info.get('idExpiryDate', '')),
]
if
is_prc
:
field_input
.
append
((
'hukouProvince'
,
province
))
# field_input.append(('hukouProvince', province))
field_input
.
append
((
'真伪'
,
province
))
field_input
.
append
((
'idExpiryDate'
,
id_info
.
get
(
'idExpiryDate'
,
''
)))
license_dict
[
license_en
]
=
field_input
all_id_num
.
append
(
id_num
)
elif
id_info
.
get
(
'idType'
)
==
'Unified Social Credit Code'
:
...
...
@@ -975,7 +977,7 @@ def get_se_cms_compare_info(last_obj, application_entity, detect_list):
dda_num_list
.
append
(
dda_num_part
)
dda_name
=
'、'
.
join
(
dda_name_list
)
dda_num
=
'、'
.
join
(
dda_num_list
)
del
main_role_info
#
del main_role_info
if
len
(
company_info_list
)
>
0
:
company_info
=
company_info_list
[
0
]
...
...
@@ -987,20 +989,27 @@ def get_se_cms_compare_info(last_obj, application_entity, detect_list):
vehicle_status
=
cms_info
.
get
(
'vehicleStatus'
,
''
)
first_submmison_date
=
cms_info
.
get
(
'submissionDate'
,
''
)
vin_no
=
cms_info
.
get
(
'vehicleInformation'
,
{})
.
get
(
'vinNo'
,
''
)
amount
=
str
(
cms_info
.
get
(
'financialInformation'
,
{})
.
get
(
'vehiclePrice'
,
''
))
amount
=
str
(
cms_info
.
get
(
'financialInformation'
,
{})
.
get
(
'vehiclePrice'
,
'
0.0
'
))
if
vehicle_status
==
'New'
:
vehicle_field_input
.
append
((
'vinNo'
,
vin_no
))
vehicle_field_input
.
append
((
'dealer'
,
cms_info
.
get
(
'dealerName'
,
''
)))
vehicle_field_input
.
append
((
'dealer'
,
'、'
.
join
([
cms_info
.
get
(
'dealerName'
,
''
),
cms_info
.
get
(
'fapiaoIssuerDealer'
,
''
)]
)))
vehicle_field_input
.
append
((
'vehicleTransactionAmount'
,
amount
))
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
]))
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
))
vehicle_field_input
.
append
((
consts
.
SE_NEW_ADD_FIELD
[
0
],
hmh
_name
))
vehicle_field_input
.
append
((
consts
.
SE_NEW_ADD_FIELD
[
1
],
hmh_id
))
vehicle_field_input
.
append
((
consts
.
SE_NEW_ADD_FIELD
[
2
],
first_submmison_date
))
vehicle_field_input
.
append
((
consts
.
SE_NEW_ADD_FIELD
[
3
],
consts
.
SE_STAMP_VALUE
))
vehicle_field_input
.
append
((
consts
.
SE_NEW_ADD_FIELD
[
4
],
consts
.
SE_FPL_VALUE
))
bhsj
=
float
(
amount
)
/
1.13
vehicle_field_input
.
append
((
consts
.
SE_NEW_ADD_FIELD
[
5
],
consts
.
SPLIT_STR
.
join
([
str
(
bhsj
),
str
(
float
(
amount
)
-
bhsj
),
consts
.
RESULT_Y
])))
vehicle_info
[
consts
.
MVI_EN
]
=
vehicle_field_input
else
:
gb_field_input
=
[
...
...
@@ -1048,6 +1057,7 @@ def get_se_cms_compare_info(last_obj, application_entity, detect_list):
bank_field_input
=
[
(
'accountNo'
,
account_no
),
(
'bankName'
,
bank_name
),
(
'type'
,
consts
.
BC_TYPE_VALUE
),
]
bank_info
[
consts
.
BC_EN
]
=
bank_field_input
...
...
@@ -1065,16 +1075,90 @@ def get_se_cms_compare_info(last_obj, application_entity, detect_list):
bank_info
[
consts
.
DDA_EN
]
=
dda_field_input
compare_info
[
'bankInfo'
]
=
bank_info
full_no
=
cms_info
.
get
(
'settlemnetVerification'
,
{})
.
get
(
'applicationNo'
,
''
)
if
cms_info
.
get
(
'mortgageType'
,
''
)
==
'Mortgage Free'
:
other_info
=
{}
hmh_field_input
=
[
(
consts
.
SE_HMH_FIELD
[
0
],
hmh_name
),
(
consts
.
SE_HMH_FIELD
[
1
],
hmh_id
),
(
consts
.
SE_HMH_FIELD
[
2
],
last_obj
.
application_id
)
(
consts
.
SE_HMH_FIELD
[
2
],
full_no
),
(
consts
.
SE_HMH_FIELD
[
3
],
cms_info
.
get
(
'financeCompany'
,
''
)),
(
consts
.
SE_HMH_FIELD
[
4
],
consts
.
SE_STAMP_VALUE
),
]
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
return
compare_info
,
cms_info
.
get
(
'applicationVersion'
,
1
)
...
...
@@ -1446,28 +1530,35 @@ def se_compare_license(license_en, ocr_res_dict, field_list):
# 身份证、居住证 过期期限特殊处理
if
special_expiry_date
:
expiry_dates
=
set
()
expiry_dates_img_path
=
set
()
expiry_dates
=
dict
()
key
=
compare_logic
.
get
(
'idExpiryDate'
)[
0
]
for
ocr_res
in
ocr_res_list
:
for
date_tmp_idx
,
ocr_res
in
enumerate
(
ocr_res_list
)
:
if
key
in
ocr_res
:
expiry_dates
.
add
(
ocr_res
[
key
])
expiry_dates_img_path
.
add
(
ocr_res
.
get
(
consts
.
IMG_PATH_KEY_2
,
''
))
expiry_dates
[
ocr_res
[
key
]]
=
(
ocr_res
.
get
(
consts
.
IMG_PATH_KEY_2
,
''
),
date_tmp_idx
)
else
:
expiry_dates
=
set
()
expiry_dates_img_path
=
set
()
expiry_dates
=
dict
()
for
res_idx
in
range
(
length
-
1
,
-
1
,
-
1
):
if
is_find
:
break
for
idx
,
(
name
,
value
)
in
enumerate
(
field_list
):
if
ocr_field
==
consts
.
MVI_OCR_FIELD
and
name
==
consts
.
SE_NEW_ADD_FIELD
[
-
1
]:
ocr_str
=
getattr
(
cp
,
consts
.
ZW_METHOD
)(
ocr_res_list
[
res_idx
]
.
get
(
consts
.
LOWER_AMOUNT_FIELD
,
''
),
ocr_res_list
[
res_idx
]
.
get
(
consts
.
UPPER_AMOUNT_FIELD
,
''
),
ocr_res_list
[
res_idx
]
.
get
(
consts
.
BHSJ_FIELD
,
''
),
ocr_res_list
[
res_idx
]
.
get
(
consts
.
ZZSSE_FIELD
,
''
)
)
else
:
ocr_str
=
ocr_res_list
[
res_idx
]
.
get
(
compare_logic
[
name
][
0
])
if
not
isinstance
(
ocr_str
,
str
):
result
=
consts
.
RESULT_N
ocr_str
=
empty_str
no_key
=
True
else
:
result
=
getattr
(
cp
,
compare_logic
[
name
][
1
])(
value
,
ocr_str
,
**
compare_logic
[
name
][
2
])
no_key
=
False
if
idx
==
0
and
result
==
consts
.
RESULT_N
and
length
>
1
:
break
...
...
@@ -1482,31 +1573,35 @@ def se_compare_license(license_en, ocr_res_dict, field_list):
# 过期期限特殊处理
if
special_expiry_date
and
name
==
'idExpiryDate'
and
result
==
consts
.
RESULT_N
:
for
expiry_date
in
expiry_dates
:
if
no_key
:
for
expiry_date
,
(
date_img_path
,
date_res_idx
)
in
expiry_dates
.
items
():
expiry_date_res
=
getattr
(
cp
,
compare_logic
[
name
][
1
])(
value
,
expiry_date
,
**
compare_logic
[
name
][
2
])
if
expiry_date_res
==
consts
.
RESULT_Y
:
if
expiry_date_res
==
consts
.
RESULT_N
:
ocr_str
=
expiry_date
result
=
expiry_date_res
break
if
result
==
consts
.
RESULT_N
:
if
consts
.
IMG_PATH_KEY_2
in
ocr_res_list
[
res_idx
]:
img_path
=
ocr_res_list
[
res_idx
]
.
get
(
consts
.
IMG_PATH_KEY_2
,
''
)
img_path
=
date_img_path
special_expiry_date_slice
=
True
section_img_info
[
consts
.
SECTION_IMG_PATH_KEY_2
]
=
ocr_res_list
[
date_res_idx
]
.
get
(
consts
.
SECTION_IMG_PATH_KEY_2
,
''
)
section_img_info
[
consts
.
ALL_POSITION_KEY_2
]
=
ocr_res_list
[
date_res_idx
]
.
get
(
consts
.
ALL_POSITION_KEY_2
,
{})
break
else
:
img_path
=
expiry_dates_img_path
.
pop
()
if
len
(
expiry_dates_img_path
)
>
0
else
empty_str
else
:
ocr_str
=
empty_str
result
=
consts
.
RESULT_Y
img_path
=
empty_str
else
:
img_path
=
ocr_res_list
[
res_idx
]
.
get
(
consts
.
IMG_PATH_KEY_2
,
''
)
special_expiry_date_slice
=
True
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
:
...
...
@@ -1539,7 +1634,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
...
...
@@ -1656,7 +1751,7 @@ 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
=
base_img_path
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
result
==
consts
.
RESULT_N
:
failed_field
.
append
(
name
)
...
...
@@ -1687,7 +1782,7 @@ def se_mvc34_compare(license_en, ocr_res_dict, field_list):
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
,
field_img_path_dict
...
...
@@ -1702,6 +1797,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'
]:
...
...
@@ -1716,13 +1812,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
,
...
...
@@ -1752,12 +1849,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
,
...
...
@@ -1776,6 +1874,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
():
...
...
@@ -1783,7 +1882,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
):
...
...
@@ -1807,7 +1907,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
))
...
...
@@ -1872,7 +1972,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
,
...
...
@@ -1916,8 +2016,14 @@ def compare(application_id, application_entity, uniq_seq, ocr_res_id, is_ca=True
# 根据application_id查找OCR累计结果指定license字段,如果没有,结束
if
is_ca
:
result_class
=
HILOCRResult
if
application_entity
==
consts
.
HIL_PREFIX
else
AFCOCRResult
ca_ocr_res_dict
=
dict
()
else
:
result_class
=
HILSEOCRResult
if
application_entity
==
consts
.
HIL_PREFIX
else
AFCSEOCRResult
ca_result_class
=
HILOCRResult
if
application_entity
==
consts
.
HIL_PREFIX
else
AFCOCRResult
if
ocr_res_id
is
None
:
ca_ocr_res_dict
=
ca_result_class
.
objects
.
filter
(
application_id
=
application_id
)
.
values
(
consts
.
IC_OCR_FIELD
)
.
first
()
else
:
ca_ocr_res_dict
=
ca_result_class
.
objects
.
filter
(
id
=
ocr_res_id
)
.
values
(
consts
.
IC_OCR_FIELD
)
.
first
()
if
ocr_res_id
is
None
:
ocr_res_dict
=
result_class
.
objects
.
filter
(
application_id
=
application_id
)
.
values
(
*
consts
.
COMPARE_FIELDS
)
.
first
()
else
:
...
...
@@ -1931,6 +2037,12 @@ def compare(application_id, application_entity, uniq_seq, ocr_res_id, is_ca=True
if
is_ca
:
ca_compare
(
application_id
,
application_entity
,
ocr_res_id
,
last_obj
,
ocr_res_dict
)
else
:
if
isinstance
(
ca_ocr_res_dict
,
dict
)
and
isinstance
(
ca_ocr_res_dict
.
get
(
consts
.
IC_OCR_FIELD
),
str
):
tmp_ca_result
=
json
.
loads
(
ca_ocr_res_dict
.
get
(
consts
.
IC_OCR_FIELD
))
if
isinstance
(
ocr_res_dict
.
get
(
consts
.
IC_OCR_FIELD
),
str
):
tmp_se_result
=
json
.
loads
(
ocr_res_dict
.
get
(
consts
.
IC_OCR_FIELD
))
tmp_ca_result
.
extend
(
tmp_se_result
)
ocr_res_dict
[
consts
.
IC_OCR_FIELD
]
=
json
.
dumps
(
tmp_ca_result
)
se_compare
(
application_id
,
application_entity
,
ocr_res_id
,
last_obj
,
ocr_res_dict
,
is_cms
)
...
...
src/common/tools/comparison.py
View file @
d24fcf2
...
...
@@ -16,6 +16,7 @@ class Comparison:
self
.
CSIBM
=
'CSIBM'
self
.
CSSME
=
'CSSME'
self
.
CSOTH
=
'CSOTH'
self
.
SPLIT_STR
=
'_'
self
.
TYPE_MAPPING
=
(
(
r'个体工商户'
,
self
.
CSIBM
),
...
...
@@ -109,6 +110,16 @@ class Comparison:
ocr_output
=
None
return
self
.
build_res
(
input_str
==
ocr_str
),
ocr_output
def
mvi_special
(
self
,
amount_lower_str
,
amount_upper_str
,
bhsj_str
,
zzsse_str
):
# 不含税价, 增值税税额
try
:
if
float
(
amount_lower_str
)
!=
rmb_handler
.
to_rmb_lower
(
amount_upper_str
):
return
self
.
RESULT_N
except
Exception
:
return
self
.
RESULT_N
else
:
return
self
.
SPLIT_STR
.
join
([
bhsj_str
,
zzsse_str
,
self
.
RESULT_Y
])
def
rmb_compare
(
self
,
input_str
,
ocr_str
,
idx
,
**
kwargs
):
if
not
isinstance
(
ocr_str
,
str
)
or
not
isinstance
(
input_str
,
str
):
return
self
.
RESULT_NA
,
None
...
...
@@ -198,7 +209,7 @@ class Comparison:
)
dti
=
DatetimeIndex
(
dt_array
,
tz
=
None
,
name
=
None
)
ts
=
dti
[
0
]
if
isinstance
(
ts
,
NaTType
)
or
ts
.
date
()
<
datetime
.
today
(
)
.
date
():
if
isinstance
(
ts
,
NaTType
)
or
ts
.
date
()
<
(
datetime
.
today
()
+
relativedelta
(
days
=
8
)
)
.
date
():
return
False
else
:
return
True
...
...
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