94c1a856 by 周伟奇

add jypz date

1 parent edb7a19b
...@@ -1031,9 +1031,9 @@ JYPZ_FIELD_ORDER = (("type", "标题"), ...@@ -1031,9 +1031,9 @@ JYPZ_FIELD_ORDER = (("type", "标题"),
1031 ("buyer_id", "购买方身份证号码/营业执照号码"), 1031 ("buyer_id", "购买方身份证号码/营业执照号码"),
1032 ("vin", "车辆识别代号/车架号码"), 1032 ("vin", "车辆识别代号/车架号码"),
1033 ("price", "车辆价格"), 1033 ("price", "车辆价格"),
1034 ("date", "购买方交易日期"), 1034 ("buyer_date", "购买方交易日期"),
1035 ("date", "出卖方交易日期"), 1035 ("seller_date", "出卖方交易日期"),
1036 ("date", "经销商交易日期"), 1036 ("agent_date", "经销商交易日期"),
1037 ("stamp_signature_buyer", "购买方签字/盖章"), 1037 ("stamp_signature_buyer", "购买方签字/盖章"),
1038 ("stamp_signature_seller", "出卖方签字/盖章"), 1038 ("stamp_signature_seller", "出卖方签字/盖章"),
1039 ("stamp_signature_agent", "经销商签字/盖章"),) 1039 ("stamp_signature_agent", "经销商签字/盖章"),)
...@@ -1820,9 +1820,15 @@ JYPZ_COMPARE_LOGIC = { ...@@ -1820,9 +1820,15 @@ JYPZ_COMPARE_LOGIC = {
1820 'vehicleTransactionAmount': ('price', 'se_amount_compare', {}, '二手车凭证购买方交易价格与系统车辆价格不一致'), 1820 'vehicleTransactionAmount': ('price', 'se_amount_compare', {}, '二手车凭证购买方交易价格与系统车辆价格不一致'),
1821 'customerName': ('buyer_name', 'se_name_compare', {'is_passport': True}, '二手车凭证购买方姓名与系统主借人姓名不一致'), 1821 'customerName': ('buyer_name', 'se_name_compare', {'is_passport': True}, '二手车凭证购买方姓名与系统主借人姓名不一致'),
1822 'idNum': ('buyer_id', 'se_contain_compare_2', {}, '二手车凭证购买方证件号与系统主借人证件号不一致'), 1822 'idNum': ('buyer_id', 'se_contain_compare_2', {}, '二手车凭证购买方证件号与系统主借人证件号不一致'),
1823 'date': ('date', 'se_date_compare_2', {'three_month': True}, '二手车凭证交易日期早于submissionDate'), 1823 # 'date': ('date', 'se_date_compare_2', {'three_month': True}, '二手车凭证交易日期早于submissionDate'),
1824 'date': ('buyer_date', 'se_jypz_date_compare', {}, '二手车交易凭证交易日期不一致或二手车凭证交易日期早于submissionDate'),
1824 } 1825 }
1825 1826
1827 JYPZ_DATE_FIELD_1 = 'date'
1828 JYPZ_DATE_FIELD_2 = 'buyer_date'
1829 JYPZ_DATE_FIELD_3 = 'seller_date'
1830 JYPZ_DATE_FIELD_4 = 'agent_date'
1831
1826 HMH_COMPARE_LOGIC = { 1832 HMH_COMPARE_LOGIC = {
1827 '借款人/承租人姓名': ('借款/承租人姓名', 'se_name_compare', {}, '抵押登记豁免函借款人/承租人姓名与系统不符'), 1833 '借款人/承租人姓名': ('借款/承租人姓名', 'se_name_compare', {}, '抵押登记豁免函借款人/承租人姓名与系统不符'),
1828 '借款人/承租人证件号': ('证件号码', 'se_common_compare', {}, '抵押登记豁免函借款人/承租人证件号码与系统不符'), 1834 '借款人/承租人证件号': ('证件号码', 'se_common_compare', {}, '抵押登记豁免函借款人/承租人证件号码与系统不符'),
......
...@@ -2218,20 +2218,36 @@ def se_compare_license(license_en, ocr_res_dict, field_list): ...@@ -2218,20 +2218,36 @@ def se_compare_license(license_en, ocr_res_dict, field_list):
2218 break 2218 break
2219 2219
2220 for idx, (name, value) in enumerate(field_list): 2220 for idx, (name, value) in enumerate(field_list):
2221 if ocr_field == consts.MVI_OCR_FIELD and name == consts.SE_NEW_ADD_FIELD[9]: 2221 # 二手车交易凭证 日期
2222 if ocr_field == consts.JYPZ_OCR_FIELD and name == consts.SE_GB_USED_FIELD[2]:
2223 date_1 = ocr_res_list[res_idx].get(consts.JYPZ_DATE_FIELD_1, '')
2224 if len(date_1) > 0:
2225 date_2 = date_3 = ''
2226 else:
2227 date_1 = ocr_res_list[res_idx].get(consts.JYPZ_DATE_FIELD_2, '')
2228 date_2 = ocr_res_list[res_idx].get(consts.JYPZ_DATE_FIELD_3, '')
2229 date_3 = ocr_res_list[res_idx].get(consts.JYPZ_DATE_FIELD_4, '')
2230 ocr_str = [date_1, date_2, date_3]
2231 # 购车发票 价税合计大小写检验
2232 elif ocr_field == consts.MVI_OCR_FIELD and name == consts.SE_NEW_ADD_FIELD[9]:
2222 ocr_str = getattr(cp, consts.ZW_METHOD)( 2233 ocr_str = getattr(cp, consts.ZW_METHOD)(
2223 ocr_res_list[res_idx].get(consts.LOWER_AMOUNT_FIELD, ''), 2234 ocr_res_list[res_idx].get(consts.LOWER_AMOUNT_FIELD, ''),
2224 ocr_res_list[res_idx].get(consts.UPPER_AMOUNT_FIELD, ''), 2235 ocr_res_list[res_idx].get(consts.UPPER_AMOUNT_FIELD, ''),
2225 ) 2236 )
2226 else: 2237 else:
2227 ocr_str = ocr_res_list[res_idx].get(compare_logic[name][0]) 2238 ocr_str = ocr_res_list[res_idx].get(compare_logic[name][0])
2228 if not isinstance(ocr_str, str): 2239
2240 if isinstance(ocr_str, str):
2241 result = getattr(cp, compare_logic[name][1])(value, ocr_str, **compare_logic[name][2])
2242 no_key = False
2243 # 二手车交易凭证 日期
2244 elif ocr_field == consts.JYPZ_OCR_FIELD and name == consts.SE_GB_USED_FIELD[2]:
2245 result = getattr(cp, compare_logic[name][1])(value, ocr_str, **compare_logic[name][2])
2246 no_key = False
2247 else:
2229 result = consts.RESULT_N 2248 result = consts.RESULT_N
2230 ocr_str = empty_str 2249 ocr_str = empty_str
2231 no_key = True 2250 no_key = True
2232 else:
2233 result = getattr(cp, compare_logic[name][1])(value, ocr_str, **compare_logic[name][2])
2234 no_key = False
2235 2251
2236 if idx == 0 and result == consts.RESULT_N and length > 1: 2252 if idx == 0 and result == consts.RESULT_N and length > 1:
2237 break 2253 break
......
...@@ -600,6 +600,14 @@ class Comparison: ...@@ -600,6 +600,14 @@ class Comparison:
600 def se_self_compare_other_asp(self, input_str, ocr_str, **kwargs): 600 def se_self_compare_other_asp(self, input_str, ocr_str, **kwargs):
601 return self.RESULT_N 601 return self.RESULT_N
602 602
603 def se_jypz_date_compare(self, input_str, ocr_date_list, **kwargs):
604 ocr_date_set = set(ocr_date_list)
605 if len(ocr_date_set) > 1:
606 return self.RESULT_N
607 if not any(ocr_date_set):
608 return self.RESULT_N
609 return self.se_date_compare_2(input_str, ocr_date_set.pop(), three_month=True)
610
603 611
604 cp = Comparison() 612 cp = Comparison()
605 613
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!