3478cf88 by 周伟奇

fix ht date

1 parent 430ce72e
......@@ -1598,6 +1598,7 @@ SE_HIL_CON_3_FIELD = ['合同编号-每页', '承租人姓名', '承租人证件
ROLE_LIST = [
# key_afc1, cdfl_key, app_type, id_idx, field_idx, is_force, e_write
('借款人签字及时间', '借款人签字及时间', 'Borrower', 0, 0, True, False),
('借款人姓名', '借款人姓名', 'Borrower', 0, 0, True, True),
('借款人证件号', '借款人证件号', 'Borrower', 0, 2, True, True),
......@@ -1996,6 +1997,7 @@ HT_COMPARE_LOGIC = {
'ASP项目详情': ('ASP项目详情', 'se_asp_compare', {}, '合同ASP名称或者金额与系统不一致'),
}
AFC_HT_DATE_FIELDS = ['主借人日期', '共借人日期', '保证人日期1', '保证人日期2']
# MVC_OCR_FIELD = 'mvc_ocr'
......
......@@ -928,14 +928,15 @@ class Command(BaseCommand, LoggerMixin):
for classify, page_info_dict in contract_result_compare.items():
if classify == consts.CONTRACT_CLASSIFY:
res = {}
# is_asp = page_info_dict.get(consts.ASP_KEY, False)
is_asp = True
is_asp = page_info_dict.get(consts.ASP_KEY, False)
# is_asp = True
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
if pno is None:
if isinstance(pno_asp, int):
continue
end_idx = 9 if is_asp else 8
end_idx = 9
# end_idx = 9 if is_asp else 8
for i in range(1, end_idx):
res.setdefault(key, list()).append(page_info_dict.get(str(i), {}).get(key1, ''))
elif key2 is None:
......
......@@ -2551,14 +2551,28 @@ def se_contract_compare(license_en, ocr_res_dict, strip_list, is_gsyh):
# result = consts.RESULT_Y
# ocr_str = empty_str
# reason = compare_logic[name][3]
# 其他字段
if isinstance(ocr_str_or_list, str) or isinstance(ocr_str_or_list, list):
if is_gsyh is True and name in consts.CON_BANK_FIELD:
update_args = {'is_gsyh': is_gsyh}
for k, v in compare_logic[name][2].items():
update_args[k] = v
# 见证人日期
if name == consts.SE_AFC_CON_FIELD[19]:
if not isinstance(ocr_str_or_list, str) or len(ocr_str_or_list) == 0:
result = consts.RESULT_N
ocr_str = empty_str
else:
update_args = compare_logic[name][2]
is_find_date = False
all_date_list = [ocr_str_or_list]
for date_name in consts.AFC_HT_DATE_FIELDS:
all_date_list.append(ocr_res.get(compare_logic[date_name][0], ''))
if not is_find_date and ocr_str_or_list == ocr_res.get(compare_logic[date_name][0], ''):
is_find_date = True
result = consts.RESULT_Y if is_find_date else consts.RESULT_N
ocr_str = json.dumps(all_date_list, ensure_ascii=False)
reason = compare_logic[name][3]
elif isinstance(ocr_str_or_list, str) or isinstance(ocr_str_or_list, list):
# if is_gsyh is True and name in consts.CON_BANK_FIELD:
# update_args = {'is_gsyh': is_gsyh}
# for k, v in compare_logic[name][2].items():
# update_args[k] = v
# else:
# update_args = compare_logic[name][2]
if isinstance(ocr_str_or_list, list):
# no-asp 合同编号-每页(no-asp)
if name == consts.SE_AFC_CON_FIELD[23]:
......@@ -2567,7 +2581,7 @@ def se_contract_compare(license_en, ocr_res_dict, strip_list, is_gsyh):
else:
ocr_str_or_list = ocr_str_or_list.strip()
ocr_str = ocr_str_or_list
result = getattr(cp, compare_logic[name][1])(value, ocr_str_or_list, **update_args)
result = getattr(cp, compare_logic[name][1])(value, ocr_str_or_list, **compare_logic[name][2])
reason = compare_logic[name][3]
else:
result = consts.RESULT_N
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!