929f1efe by 周伟奇

Merge branch 'fix/1213' into feature/se

2 parents 0c5207a0 6e11b40d
...@@ -1683,7 +1683,7 @@ BD_COMPARE_LOGIC = { ...@@ -1683,7 +1683,7 @@ BD_COMPARE_LOGIC = {
1683 1683
1684 BS_COMPARE_LOGIC = { 1684 BS_COMPARE_LOGIC = {
1685 '户名': ('role', 'se_one_compare', {}, '主共借人未提供银行流水'), 1685 '户名': ('role', 'se_one_compare', {}, '主共借人未提供银行流水'),
1686 '(担保人)户名': ('role', 'se_one_compare', {}, '担保人未提供银行流水,需人工查看直系亲属关系'), 1686 '(担保人)户名': ('role', 'se_one_compare', {}, '担保人未提供银行流水'),
1687 '打印日期': ('print_time', 'se_bs_print_date_compare', {}, '主共借人银行流水打印日期异常'), 1687 '打印日期': ('print_time', 'se_bs_print_date_compare', {}, '主共借人银行流水打印日期异常'),
1688 '(担保人)打印日期': ('print_time', 'se_bs_print_date_compare', {}, '担保人银行流水打印日期异常'), 1688 '(担保人)打印日期': ('print_time', 'se_bs_print_date_compare', {}, '担保人银行流水打印日期异常'),
1689 '流水日期': ('date', 'se_bs_date_compare', {}, '主共借人银行流水日期异常'), 1689 '流水日期': ('date', 'se_bs_date_compare', {}, '主共借人银行流水日期异常'),
...@@ -1691,6 +1691,7 @@ BS_COMPARE_LOGIC = { ...@@ -1691,6 +1691,7 @@ BS_COMPARE_LOGIC = {
1691 } 1691 }
1692 1692
1693 SPECIAL_REASON = '主共借人未提供银行流水,含担保人需人工查看直系亲属关系' 1693 SPECIAL_REASON = '主共借人未提供银行流水,含担保人需人工查看直系亲属关系'
1694 SPECIAL_REASON_2 = '担保人未提供银行流水,需人工查看直系亲属关系'
1694 1695
1695 HT_COMPARE_LOGIC = { 1696 HT_COMPARE_LOGIC = {
1696 '合同编号-每页': ('合同编号-每页', 'se_list_compare', {}, '合同编号与系统不一致'), 1697 '合同编号-每页': ('合同编号-每页', 'se_list_compare', {}, '合同编号与系统不一致'),
......
...@@ -1486,25 +1486,9 @@ def se_bs_compare(license_en, ocr_res_dict, strip_list): ...@@ -1486,25 +1486,9 @@ def se_bs_compare(license_en, ocr_res_dict, strip_list):
1486 max_correct_count = correct_count 1486 max_correct_count = correct_count
1487 pre_best_res = pre_tmp_res_part 1487 pre_best_res = pre_tmp_res_part
1488 1488
1489 for name, value in pre_field_list:
1490 if len(pre_best_res) > 0:
1491 result, ocr_str, reason = pre_best_res[name]
1492 else:
1493 result = consts.RESULT_N
1494 ocr_str = empty_str
1495 if len(suf_field_list) > 0:
1496 reason = consts.SPECIAL_REASON
1497 else:
1498 reason = compare_logic[pre_field_list[0][0]][3]
1499 img_path = empty_str
1500 error_type = empty_error_type if result == consts.RESULT_Y else ErrorType.OCR.value
1501 if isinstance(value, list):
1502 value = json.dumps(value, ensure_ascii=False)
1503 result_field_list.append((name, value, result, ocr_str, img_path, error_type, reason))
1504
1505 # 担保人 1489 # 担保人
1490 suf_best_res = {}
1506 if len(suf_field_list) > 0: 1491 if len(suf_field_list) > 0:
1507 suf_best_res = {}
1508 max_correct_count = 0 1492 max_correct_count = 0
1509 for ocr_res in ocr_res_list: 1493 for ocr_res in ocr_res_list:
1510 correct_count = 0 1494 correct_count = 0
...@@ -1534,18 +1518,39 @@ def se_bs_compare(license_en, ocr_res_dict, strip_list): ...@@ -1534,18 +1518,39 @@ def se_bs_compare(license_en, ocr_res_dict, strip_list):
1534 max_correct_count = correct_count 1518 max_correct_count = correct_count
1535 suf_best_res = suf_tmp_res_part 1519 suf_best_res = suf_tmp_res_part
1536 1520
1521 for name, value in pre_field_list:
1522 if len(pre_best_res) > 0:
1523 result, ocr_str, reason = pre_best_res[name]
1524 else:
1525 result = consts.RESULT_N
1526 ocr_str = empty_str
1527 if len(suf_field_list) > 0 and len(suf_best_res) > 0:
1528 reason = consts.SPECIAL_REASON
1529 else:
1530 reason = compare_logic[pre_field_list[0][0]][3]
1531 img_path = empty_str
1532 error_type = empty_error_type if result == consts.RESULT_Y else ErrorType.OCR.value
1533 if isinstance(value, list):
1534 value = json.dumps(value, ensure_ascii=False)
1535 result_field_list.append((name, value, result, ocr_str, img_path, error_type, reason))
1536
1537 if len(suf_field_list) > 0:
1537 for name, value in suf_field_list: 1538 for name, value in suf_field_list:
1538 if len(suf_best_res) > 0: 1539 if len(suf_best_res) > 0:
1539 result, ocr_str, reason = suf_best_res[name] 1540 result, ocr_str, reason = suf_best_res[name]
1540 else: 1541 else:
1541 result = consts.RESULT_N 1542 result = consts.RESULT_N
1542 ocr_str = empty_str 1543 ocr_str = empty_str
1543 reason = compare_logic[suf_field_list[0][0]][3] 1544 if len(pre_best_res) > 0:
1545 reason = consts.SPECIAL_REASON_2
1546 else:
1547 reason = compare_logic[suf_field_list[0][0]][3]
1544 img_path = empty_str 1548 img_path = empty_str
1545 error_type = empty_error_type if result == consts.RESULT_Y else ErrorType.OCR.value 1549 error_type = empty_error_type if result == consts.RESULT_Y else ErrorType.OCR.value
1546 if isinstance(value, list): 1550 if isinstance(value, list):
1547 value = json.dumps(value, ensure_ascii=False) 1551 value = json.dumps(value, ensure_ascii=False)
1548 result_field_list.append((name, value, result, ocr_str, img_path, error_type, reason)) 1552 result_field_list.append((name, value, result, ocr_str, img_path, error_type, reason))
1553
1549 else: 1554 else:
1550 for name, value in strip_list: 1555 for name, value in strip_list:
1551 if isinstance(value, list): 1556 if isinstance(value, list):
...@@ -1594,7 +1599,7 @@ def se_compare_license(license_en, ocr_res_dict, field_list): ...@@ -1594,7 +1599,7 @@ def se_compare_license(license_en, ocr_res_dict, field_list):
1594 break 1599 break
1595 1600
1596 for idx, (name, value) in enumerate(field_list): 1601 for idx, (name, value) in enumerate(field_list):
1597 if ocr_field == consts.MVI_OCR_FIELD and name == consts.SE_NEW_ADD_FIELD[-1]: 1602 if ocr_field == consts.MVI_OCR_FIELD and name == consts.SE_NEW_ADD_FIELD[5]:
1598 ocr_str = getattr(cp, consts.ZW_METHOD)( 1603 ocr_str = getattr(cp, consts.ZW_METHOD)(
1599 ocr_res_list[res_idx].get(consts.LOWER_AMOUNT_FIELD, ''), 1604 ocr_res_list[res_idx].get(consts.LOWER_AMOUNT_FIELD, ''),
1600 ocr_res_list[res_idx].get(consts.UPPER_AMOUNT_FIELD, ''), 1605 ocr_res_list[res_idx].get(consts.UPPER_AMOUNT_FIELD, ''),
...@@ -1923,6 +1928,14 @@ def se_compare_process(compare_info, ocr_res_dict): ...@@ -1923,6 +1928,14 @@ def se_compare_process(compare_info, ocr_res_dict):
1923 for a, b in field_list: 1928 for a, b in field_list:
1924 if isinstance(b, str): 1929 if isinstance(b, str):
1925 strip_list.append((a, b.strip())) 1930 strip_list.append((a, b.strip()))
1931 elif isinstance(b, list):
1932 c = []
1933 for i in b:
1934 if isinstance(i, str):
1935 c.append(i.strip())
1936 else:
1937 c.append(i)
1938 strip_list.append((a, c))
1926 else: 1939 else:
1927 strip_list.append((a, b)) 1940 strip_list.append((a, b))
1928 failure_field = [] 1941 failure_field = []
...@@ -1957,6 +1970,14 @@ def se_compare_process(compare_info, ocr_res_dict): ...@@ -1957,6 +1970,14 @@ def se_compare_process(compare_info, ocr_res_dict):
1957 for a, b in field_list: 1970 for a, b in field_list:
1958 if isinstance(b, str): 1971 if isinstance(b, str):
1959 strip_list.append((a, b.strip())) 1972 strip_list.append((a, b.strip()))
1973 elif isinstance(b, list):
1974 c = []
1975 for i in b:
1976 if isinstance(i, str):
1977 c.append(i.strip())
1978 else:
1979 c.append(i)
1980 strip_list.append((a, c))
1960 else: 1981 else:
1961 strip_list.append((a, b)) 1982 strip_list.append((a, b))
1962 failure_field = [] 1983 failure_field = []
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!