fix bs compare
Showing
2 changed files
with
40 additions
and
18 deletions
... | @@ -1671,7 +1671,7 @@ BD_COMPARE_LOGIC = { | ... | @@ -1671,7 +1671,7 @@ BD_COMPARE_LOGIC = { |
1671 | 1671 | ||
1672 | BS_COMPARE_LOGIC = { | 1672 | BS_COMPARE_LOGIC = { |
1673 | '户名': ('role', 'se_one_compare', {}, '主共借人未提供银行流水'), | 1673 | '户名': ('role', 'se_one_compare', {}, '主共借人未提供银行流水'), |
1674 | '(担保人)户名': ('role', 'se_one_compare', {}, '担保人未提供银行流水,需人工查看直系亲属关系'), | 1674 | '(担保人)户名': ('role', 'se_one_compare', {}, '担保人未提供银行流水'), |
1675 | '打印日期': ('print_time', 'se_bs_print_date_compare', {}, '主共借人银行流水打印日期异常'), | 1675 | '打印日期': ('print_time', 'se_bs_print_date_compare', {}, '主共借人银行流水打印日期异常'), |
1676 | '(担保人)打印日期': ('print_time', 'se_bs_print_date_compare', {}, '担保人银行流水打印日期异常'), | 1676 | '(担保人)打印日期': ('print_time', 'se_bs_print_date_compare', {}, '担保人银行流水打印日期异常'), |
1677 | '流水日期': ('date', 'se_bs_date_compare', {}, '主共借人银行流水日期异常'), | 1677 | '流水日期': ('date', 'se_bs_date_compare', {}, '主共借人银行流水日期异常'), |
... | @@ -1679,6 +1679,7 @@ BS_COMPARE_LOGIC = { | ... | @@ -1679,6 +1679,7 @@ BS_COMPARE_LOGIC = { |
1679 | } | 1679 | } |
1680 | 1680 | ||
1681 | SPECIAL_REASON = '主共借人未提供银行流水,含担保人需人工查看直系亲属关系' | 1681 | SPECIAL_REASON = '主共借人未提供银行流水,含担保人需人工查看直系亲属关系' |
1682 | SPECIAL_REASON_2 = '担保人未提供银行流水,需人工查看直系亲属关系' | ||
1682 | 1683 | ||
1683 | HT_COMPARE_LOGIC = { | 1684 | HT_COMPARE_LOGIC = { |
1684 | '合同编号-每页': ('合同编号-每页', 'se_list_compare', {}, '合同编号与系统不一致'), | 1685 | '合同编号-每页': ('合同编号-每页', 'se_list_compare', {}, '合同编号与系统不一致'), | ... | ... |
... | @@ -1484,25 +1484,9 @@ def se_bs_compare(license_en, ocr_res_dict, strip_list): | ... | @@ -1484,25 +1484,9 @@ def se_bs_compare(license_en, ocr_res_dict, strip_list): |
1484 | max_correct_count = correct_count | 1484 | max_correct_count = correct_count |
1485 | pre_best_res = pre_tmp_res_part | 1485 | pre_best_res = pre_tmp_res_part |
1486 | 1486 | ||
1487 | for name, value in pre_field_list: | ||
1488 | if len(pre_best_res) > 0: | ||
1489 | result, ocr_str, reason = pre_best_res[name] | ||
1490 | else: | ||
1491 | result = consts.RESULT_N | ||
1492 | ocr_str = empty_str | ||
1493 | if len(suf_field_list) > 0: | ||
1494 | reason = consts.SPECIAL_REASON | ||
1495 | else: | ||
1496 | reason = compare_logic[pre_field_list[0][0]][3] | ||
1497 | img_path = empty_str | ||
1498 | error_type = empty_error_type if result == consts.RESULT_Y else ErrorType.OCR.value | ||
1499 | if isinstance(value, list): | ||
1500 | value = json.dumps(value, ensure_ascii=False) | ||
1501 | result_field_list.append((name, value, result, ocr_str, img_path, error_type, reason)) | ||
1502 | |||
1503 | # 担保人 | 1487 | # 担保人 |
1504 | if len(suf_field_list) > 0: | ||
1505 | suf_best_res = {} | 1488 | suf_best_res = {} |
1489 | if len(suf_field_list) > 0: | ||
1506 | max_correct_count = 0 | 1490 | max_correct_count = 0 |
1507 | for ocr_res in ocr_res_list: | 1491 | for ocr_res in ocr_res_list: |
1508 | correct_count = 0 | 1492 | correct_count = 0 |
... | @@ -1532,18 +1516,39 @@ def se_bs_compare(license_en, ocr_res_dict, strip_list): | ... | @@ -1532,18 +1516,39 @@ def se_bs_compare(license_en, ocr_res_dict, strip_list): |
1532 | max_correct_count = correct_count | 1516 | max_correct_count = correct_count |
1533 | suf_best_res = suf_tmp_res_part | 1517 | suf_best_res = suf_tmp_res_part |
1534 | 1518 | ||
1519 | for name, value in pre_field_list: | ||
1520 | if len(pre_best_res) > 0: | ||
1521 | result, ocr_str, reason = pre_best_res[name] | ||
1522 | else: | ||
1523 | result = consts.RESULT_N | ||
1524 | ocr_str = empty_str | ||
1525 | if len(suf_field_list) > 0 and len(suf_best_res) > 0: | ||
1526 | reason = consts.SPECIAL_REASON | ||
1527 | else: | ||
1528 | reason = compare_logic[pre_field_list[0][0]][3] | ||
1529 | img_path = empty_str | ||
1530 | error_type = empty_error_type if result == consts.RESULT_Y else ErrorType.OCR.value | ||
1531 | if isinstance(value, list): | ||
1532 | value = json.dumps(value, ensure_ascii=False) | ||
1533 | result_field_list.append((name, value, result, ocr_str, img_path, error_type, reason)) | ||
1534 | |||
1535 | if len(suf_field_list) > 0: | ||
1535 | for name, value in suf_field_list: | 1536 | for name, value in suf_field_list: |
1536 | if len(suf_best_res) > 0: | 1537 | if len(suf_best_res) > 0: |
1537 | result, ocr_str, reason = suf_best_res[name] | 1538 | result, ocr_str, reason = suf_best_res[name] |
1538 | else: | 1539 | else: |
1539 | result = consts.RESULT_N | 1540 | result = consts.RESULT_N |
1540 | ocr_str = empty_str | 1541 | ocr_str = empty_str |
1542 | if len(pre_best_res) > 0: | ||
1543 | reason = consts.SPECIAL_REASON_2 | ||
1544 | else: | ||
1541 | reason = compare_logic[suf_field_list[0][0]][3] | 1545 | reason = compare_logic[suf_field_list[0][0]][3] |
1542 | img_path = empty_str | 1546 | img_path = empty_str |
1543 | error_type = empty_error_type if result == consts.RESULT_Y else ErrorType.OCR.value | 1547 | error_type = empty_error_type if result == consts.RESULT_Y else ErrorType.OCR.value |
1544 | if isinstance(value, list): | 1548 | if isinstance(value, list): |
1545 | value = json.dumps(value, ensure_ascii=False) | 1549 | value = json.dumps(value, ensure_ascii=False) |
1546 | result_field_list.append((name, value, result, ocr_str, img_path, error_type, reason)) | 1550 | result_field_list.append((name, value, result, ocr_str, img_path, error_type, reason)) |
1551 | |||
1547 | else: | 1552 | else: |
1548 | for name, value in strip_list: | 1553 | for name, value in strip_list: |
1549 | if isinstance(value, list): | 1554 | if isinstance(value, list): |
... | @@ -1921,6 +1926,14 @@ def se_compare_process(compare_info, ocr_res_dict): | ... | @@ -1921,6 +1926,14 @@ def se_compare_process(compare_info, ocr_res_dict): |
1921 | for a, b in field_list: | 1926 | for a, b in field_list: |
1922 | if isinstance(b, str): | 1927 | if isinstance(b, str): |
1923 | strip_list.append((a, b.strip())) | 1928 | strip_list.append((a, b.strip())) |
1929 | elif isinstance(b, list): | ||
1930 | c = [] | ||
1931 | for i in b: | ||
1932 | if isinstance(i, str): | ||
1933 | c.append(i.strip()) | ||
1934 | else: | ||
1935 | c.append(i) | ||
1936 | strip_list.append((a, c)) | ||
1924 | else: | 1937 | else: |
1925 | strip_list.append((a, b)) | 1938 | strip_list.append((a, b)) |
1926 | failure_field = [] | 1939 | failure_field = [] |
... | @@ -1955,6 +1968,14 @@ def se_compare_process(compare_info, ocr_res_dict): | ... | @@ -1955,6 +1968,14 @@ def se_compare_process(compare_info, ocr_res_dict): |
1955 | for a, b in field_list: | 1968 | for a, b in field_list: |
1956 | if isinstance(b, str): | 1969 | if isinstance(b, str): |
1957 | strip_list.append((a, b.strip())) | 1970 | strip_list.append((a, b.strip())) |
1971 | elif isinstance(b, list): | ||
1972 | c = [] | ||
1973 | for i in b: | ||
1974 | if isinstance(i, str): | ||
1975 | c.append(i.strip()) | ||
1976 | else: | ||
1977 | c.append(i) | ||
1978 | strip_list.append((a, c)) | ||
1958 | else: | 1979 | else: |
1959 | strip_list.append((a, b)) | 1980 | strip_list.append((a, b)) |
1960 | failure_field = [] | 1981 | failure_field = [] | ... | ... |
-
Please register or sign in to post a comment