94c1a856 by 周伟奇

add jypz date

1 parent edb7a19b
......@@ -1031,9 +1031,9 @@ JYPZ_FIELD_ORDER = (("type", "标题"),
("buyer_id", "购买方身份证号码/营业执照号码"),
("vin", "车辆识别代号/车架号码"),
("price", "车辆价格"),
("date", "购买方交易日期"),
("date", "出卖方交易日期"),
("date", "经销商交易日期"),
("buyer_date", "购买方交易日期"),
("seller_date", "出卖方交易日期"),
("agent_date", "经销商交易日期"),
("stamp_signature_buyer", "购买方签字/盖章"),
("stamp_signature_seller", "出卖方签字/盖章"),
("stamp_signature_agent", "经销商签字/盖章"),)
......@@ -1820,9 +1820,15 @@ JYPZ_COMPARE_LOGIC = {
'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', {'three_month': True}, '二手车凭证交易日期早于submissionDate'),
# 'date': ('date', 'se_date_compare_2', {'three_month': True}, '二手车凭证交易日期早于submissionDate'),
'date': ('buyer_date', 'se_jypz_date_compare', {}, '二手车交易凭证交易日期不一致或二手车凭证交易日期早于submissionDate'),
}
JYPZ_DATE_FIELD_1 = 'date'
JYPZ_DATE_FIELD_2 = 'buyer_date'
JYPZ_DATE_FIELD_3 = 'seller_date'
JYPZ_DATE_FIELD_4 = 'agent_date'
HMH_COMPARE_LOGIC = {
'借款人/承租人姓名': ('借款/承租人姓名', 'se_name_compare', {}, '抵押登记豁免函借款人/承租人姓名与系统不符'),
'借款人/承租人证件号': ('证件号码', 'se_common_compare', {}, '抵押登记豁免函借款人/承租人证件号码与系统不符'),
......
......@@ -2218,20 +2218,36 @@ def se_compare_license(license_en, ocr_res_dict, field_list):
break
for idx, (name, value) in enumerate(field_list):
if ocr_field == consts.MVI_OCR_FIELD and name == consts.SE_NEW_ADD_FIELD[9]:
# 二手车交易凭证 日期
if ocr_field == consts.JYPZ_OCR_FIELD and name == consts.SE_GB_USED_FIELD[2]:
date_1 = ocr_res_list[res_idx].get(consts.JYPZ_DATE_FIELD_1, '')
if len(date_1) > 0:
date_2 = date_3 = ''
else:
date_1 = ocr_res_list[res_idx].get(consts.JYPZ_DATE_FIELD_2, '')
date_2 = ocr_res_list[res_idx].get(consts.JYPZ_DATE_FIELD_3, '')
date_3 = ocr_res_list[res_idx].get(consts.JYPZ_DATE_FIELD_4, '')
ocr_str = [date_1, date_2, date_3]
# 购车发票 价税合计大小写检验
elif ocr_field == consts.MVI_OCR_FIELD and name == consts.SE_NEW_ADD_FIELD[9]:
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, ''),
)
else:
ocr_str = ocr_res_list[res_idx].get(compare_logic[name][0])
if not isinstance(ocr_str, str):
if isinstance(ocr_str, str):
result = getattr(cp, compare_logic[name][1])(value, ocr_str, **compare_logic[name][2])
no_key = False
# 二手车交易凭证 日期
elif ocr_field == consts.JYPZ_OCR_FIELD and name == consts.SE_GB_USED_FIELD[2]:
result = getattr(cp, compare_logic[name][1])(value, ocr_str, **compare_logic[name][2])
no_key = False
else:
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
......
......@@ -600,6 +600,14 @@ class Comparison:
def se_self_compare_other_asp(self, input_str, ocr_str, **kwargs):
return self.RESULT_N
def se_jypz_date_compare(self, input_str, ocr_date_list, **kwargs):
ocr_date_set = set(ocr_date_list)
if len(ocr_date_set) > 1:
return self.RESULT_N
if not any(ocr_date_set):
return self.RESULT_N
return self.se_date_compare_2(input_str, ocr_date_set.pop(), three_month=True)
cp = Comparison()
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!