fix ht date
Showing
3 changed files
with
29 additions
and
12 deletions
... | @@ -1598,6 +1598,7 @@ SE_HIL_CON_3_FIELD = ['合同编号-每页', '承租人姓名', '承租人证件 | ... | @@ -1598,6 +1598,7 @@ SE_HIL_CON_3_FIELD = ['合同编号-每页', '承租人姓名', '承租人证件 |
1598 | 1598 | ||
1599 | 1599 | ||
1600 | ROLE_LIST = [ | 1600 | ROLE_LIST = [ |
1601 | # key_afc1, cdfl_key, app_type, id_idx, field_idx, is_force, e_write | ||
1601 | ('借款人签字及时间', '借款人签字及时间', 'Borrower', 0, 0, True, False), | 1602 | ('借款人签字及时间', '借款人签字及时间', 'Borrower', 0, 0, True, False), |
1602 | ('借款人姓名', '借款人姓名', 'Borrower', 0, 0, True, True), | 1603 | ('借款人姓名', '借款人姓名', 'Borrower', 0, 0, True, True), |
1603 | ('借款人证件号', '借款人证件号', 'Borrower', 0, 2, True, True), | 1604 | ('借款人证件号', '借款人证件号', 'Borrower', 0, 2, True, True), |
... | @@ -1996,6 +1997,7 @@ HT_COMPARE_LOGIC = { | ... | @@ -1996,6 +1997,7 @@ HT_COMPARE_LOGIC = { |
1996 | 'ASP项目详情': ('ASP项目详情', 'se_asp_compare', {}, '合同ASP名称或者金额与系统不一致'), | 1997 | 'ASP项目详情': ('ASP项目详情', 'se_asp_compare', {}, '合同ASP名称或者金额与系统不一致'), |
1997 | } | 1998 | } |
1998 | 1999 | ||
2000 | AFC_HT_DATE_FIELDS = ['主借人日期', '共借人日期', '保证人日期1', '保证人日期2'] | ||
1999 | 2001 | ||
2000 | # MVC_OCR_FIELD = 'mvc_ocr' | 2002 | # MVC_OCR_FIELD = 'mvc_ocr' |
2001 | 2003 | ... | ... |
... | @@ -928,14 +928,15 @@ class Command(BaseCommand, LoggerMixin): | ... | @@ -928,14 +928,15 @@ class Command(BaseCommand, LoggerMixin): |
928 | for classify, page_info_dict in contract_result_compare.items(): | 928 | for classify, page_info_dict in contract_result_compare.items(): |
929 | if classify == consts.CONTRACT_CLASSIFY: | 929 | if classify == consts.CONTRACT_CLASSIFY: |
930 | res = {} | 930 | res = {} |
931 | # is_asp = page_info_dict.get(consts.ASP_KEY, False) | 931 | is_asp = page_info_dict.get(consts.ASP_KEY, False) |
932 | is_asp = True | 932 | # is_asp = True |
933 | for key, (pno_not_asp, pno_asp, key1, key2) in consts.SE_AFC_CON_MAP.items(): | 933 | for key, (pno_not_asp, pno_asp, key1, key2) in consts.SE_AFC_CON_MAP.items(): |
934 | pno = pno_asp if is_asp else pno_not_asp | 934 | pno = pno_asp if is_asp else pno_not_asp |
935 | if pno is None: | 935 | if pno is None: |
936 | if isinstance(pno_asp, int): | 936 | if isinstance(pno_asp, int): |
937 | continue | 937 | continue |
938 | end_idx = 9 if is_asp else 8 | 938 | end_idx = 9 |
939 | # end_idx = 9 if is_asp else 8 | ||
939 | for i in range(1, end_idx): | 940 | for i in range(1, end_idx): |
940 | res.setdefault(key, list()).append(page_info_dict.get(str(i), {}).get(key1, '')) | 941 | res.setdefault(key, list()).append(page_info_dict.get(str(i), {}).get(key1, '')) |
941 | elif key2 is None: | 942 | elif key2 is None: | ... | ... |
... | @@ -2551,14 +2551,28 @@ def se_contract_compare(license_en, ocr_res_dict, strip_list, is_gsyh): | ... | @@ -2551,14 +2551,28 @@ def se_contract_compare(license_en, ocr_res_dict, strip_list, is_gsyh): |
2551 | # result = consts.RESULT_Y | 2551 | # result = consts.RESULT_Y |
2552 | # ocr_str = empty_str | 2552 | # ocr_str = empty_str |
2553 | # reason = compare_logic[name][3] | 2553 | # reason = compare_logic[name][3] |
2554 | # 其他字段 | 2554 | # 见证人日期 |
2555 | if isinstance(ocr_str_or_list, str) or isinstance(ocr_str_or_list, list): | 2555 | if name == consts.SE_AFC_CON_FIELD[19]: |
2556 | if is_gsyh is True and name in consts.CON_BANK_FIELD: | 2556 | if not isinstance(ocr_str_or_list, str) or len(ocr_str_or_list) == 0: |
2557 | update_args = {'is_gsyh': is_gsyh} | 2557 | result = consts.RESULT_N |
2558 | for k, v in compare_logic[name][2].items(): | 2558 | ocr_str = empty_str |
2559 | update_args[k] = v | 2559 | else: |
2560 | else: | 2560 | is_find_date = False |
2561 | update_args = compare_logic[name][2] | 2561 | all_date_list = [ocr_str_or_list] |
2562 | for date_name in consts.AFC_HT_DATE_FIELDS: | ||
2563 | all_date_list.append(ocr_res.get(compare_logic[date_name][0], '')) | ||
2564 | if not is_find_date and ocr_str_or_list == ocr_res.get(compare_logic[date_name][0], ''): | ||
2565 | is_find_date = True | ||
2566 | result = consts.RESULT_Y if is_find_date else consts.RESULT_N | ||
2567 | ocr_str = json.dumps(all_date_list, ensure_ascii=False) | ||
2568 | reason = compare_logic[name][3] | ||
2569 | elif isinstance(ocr_str_or_list, str) or isinstance(ocr_str_or_list, list): | ||
2570 | # if is_gsyh is True and name in consts.CON_BANK_FIELD: | ||
2571 | # update_args = {'is_gsyh': is_gsyh} | ||
2572 | # for k, v in compare_logic[name][2].items(): | ||
2573 | # update_args[k] = v | ||
2574 | # else: | ||
2575 | # update_args = compare_logic[name][2] | ||
2562 | if isinstance(ocr_str_or_list, list): | 2576 | if isinstance(ocr_str_or_list, list): |
2563 | # no-asp 合同编号-每页(no-asp) | 2577 | # no-asp 合同编号-每页(no-asp) |
2564 | if name == consts.SE_AFC_CON_FIELD[23]: | 2578 | 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): | ... | @@ -2567,7 +2581,7 @@ def se_contract_compare(license_en, ocr_res_dict, strip_list, is_gsyh): |
2567 | else: | 2581 | else: |
2568 | ocr_str_or_list = ocr_str_or_list.strip() | 2582 | ocr_str_or_list = ocr_str_or_list.strip() |
2569 | ocr_str = ocr_str_or_list | 2583 | ocr_str = ocr_str_or_list |
2570 | result = getattr(cp, compare_logic[name][1])(value, ocr_str_or_list, **update_args) | 2584 | result = getattr(cp, compare_logic[name][1])(value, ocr_str_or_list, **compare_logic[name][2]) |
2571 | reason = compare_logic[name][3] | 2585 | reason = compare_logic[name][3] |
2572 | else: | 2586 | else: |
2573 | result = consts.RESULT_N | 2587 | result = consts.RESULT_N | ... | ... |
-
Please register or sign in to post a comment