add auto bs
Showing
4 changed files
with
75 additions
and
33 deletions
... | @@ -1189,7 +1189,7 @@ BS_FIELD = 'bss_ocr' | ... | @@ -1189,7 +1189,7 @@ BS_FIELD = 'bss_ocr' |
1189 | HIL_CONTRACT_1_FIELD = 'hil_contract_1_ocr' | 1189 | HIL_CONTRACT_1_FIELD = 'hil_contract_1_ocr' |
1190 | HIL_CONTRACT_2_FIELD = 'hil_contract_2_ocr' | 1190 | HIL_CONTRACT_2_FIELD = 'hil_contract_2_ocr' |
1191 | HIL_CONTRACT_3_FIELD = 'hil_contract_3_ocr' | 1191 | HIL_CONTRACT_3_FIELD = 'hil_contract_3_ocr' |
1192 | BS_CLASSIFY = 10087 | 1192 | BS_CLASSIFY = 10089 |
1193 | 1193 | ||
1194 | RESULT_MAPPING = { | 1194 | RESULT_MAPPING = { |
1195 | MVI_CLASSIFY: MVI_OCR_FIELD, | 1195 | MVI_CLASSIFY: MVI_OCR_FIELD, |
... | @@ -1653,6 +1653,8 @@ HIL_CONTRACT_1_EN = '售后回租合同' | ... | @@ -1653,6 +1653,8 @@ HIL_CONTRACT_1_EN = '售后回租合同' |
1653 | HIL_CONTRACT_2_EN = '车辆租赁抵押合同' | 1653 | HIL_CONTRACT_2_EN = '车辆租赁抵押合同' |
1654 | HIL_CONTRACT_3_EN = '车辆处置协议' | 1654 | HIL_CONTRACT_3_EN = '车辆处置协议' |
1655 | 1655 | ||
1656 | DDA_NO_FIND = '需人工查看DDA或截图' | ||
1657 | |||
1656 | SKIP_CARD = {SME_BL_EN} | 1658 | SKIP_CARD = {SME_BL_EN} |
1657 | 1659 | ||
1658 | 1660 | ||
... | @@ -1808,17 +1810,29 @@ BD_COMPARE_LOGIC = { | ... | @@ -1808,17 +1810,29 @@ BD_COMPARE_LOGIC = { |
1808 | } | 1810 | } |
1809 | 1811 | ||
1810 | BS_COMPARE_LOGIC = { | 1812 | BS_COMPARE_LOGIC = { |
1811 | '户名': ('role', 'se_one_compare', {}, '主共借人未提供银行流水'), | 1813 | '户名': ('role', 'se_bs_one_compare', {}, '主共借人未提供银行流水'), |
1812 | '(担保人1)户名': ('role', 'se_name_compare', {}, '担保人1未提供银行流水'), | 1814 | '(担保人1)户名': ('role', 'se_bs_name_compare', {}, '担保人1未提供银行流水'), |
1813 | '(担保人2)户名': ('role', 'se_name_compare', {}, '担保人2未提供银行流水'), | 1815 | '(担保人2)户名': ('role', 'se_bs_name_compare', {}, '担保人2未提供银行流水'), |
1814 | '打印日期': ('print_time', 'se_bs_print_date_compare', {}, '主共借人银行流水打印日期超过15天'), | 1816 | '打印日期': ('print_time', 'se_bs_print_date_compare', {'days': 15}, '主共借人银行流水打印日期超过15天'), |
1815 | '(担保人1)打印日期': ('print_time', 'se_bs_print_date_compare', {}, '担保人1银行流水打印日期超过15天'), | 1817 | '(担保人1)打印日期': ('print_time', 'se_bs_print_date_compare', {'days': 15}, '担保人1银行流水打印日期超过15天'), |
1816 | '(担保人2)打印日期': ('print_time', 'se_bs_print_date_compare', {}, '担保人2银行流水打印日期超过15天'), | 1818 | '(担保人2)打印日期': ('print_time', 'se_bs_print_date_compare', {'days': 15}, '担保人2银行流水打印日期超过15天'), |
1817 | '流水日期': ('timedelta', 'se_bs_date_compare', {}, '主共借人银行流水日期不满足3个月'), | 1819 | '流水日期': ('timedelta', 'se_bs_date_compare', {}, '主共借人银行流水日期不满足3个月'), |
1818 | '(担保人1)流水日期': ('timedelta', 'se_bs_date_compare', {}, '担保人1银行流水日期不满足3个月'), | 1820 | '(担保人1)流水日期': ('timedelta', 'se_bs_date_compare', {}, '担保人1银行流水日期不满足3个月'), |
1819 | '(担保人2)流水日期': ('timedelta', 'se_bs_date_compare', {}, '担保人2银行流水日期不满足3个月'), | 1821 | '(担保人2)流水日期': ('timedelta', 'se_bs_date_compare', {}, '担保人2银行流水日期不满足3个月'), |
1820 | } | 1822 | } |
1821 | 1823 | ||
1824 | BS_COMPARE_LOGIC_AUTO = { | ||
1825 | '户名': ('role', 'se_bs_one_compare', {}, '主共借人未提供银行流水'), | ||
1826 | '(担保人1)户名': ('role', 'se_bs_name_compare', {}, '担保人1未提供银行流水'), | ||
1827 | '(担保人2)户名': ('role', 'se_bs_name_compare', {}, '担保人2未提供银行流水'), | ||
1828 | '打印日期': ('print_time', 'se_bs_print_date_compare', {'days': 30}, '主共借人银行流水打印日期超过30天'), | ||
1829 | '(担保人1)打印日期': ('print_time', 'se_bs_print_date_compare', {'days': 30}, '担保人1银行流水打印日期超过30天'), | ||
1830 | '(担保人2)打印日期': ('print_time', 'se_bs_print_date_compare', {'days': 30}, '担保人2银行流水打印日期超过30天'), | ||
1831 | '流水日期': ('timedelta', 'se_bs_date_compare', {}, '主共借人银行流水日期不满足2个月'), | ||
1832 | '(担保人1)流水日期': ('timedelta', 'se_bs_date_compare', {}, '担保人1银行流水日期不满足2个月'), | ||
1833 | '(担保人2)流水日期': ('timedelta', 'se_bs_date_compare', {}, '担保人2银行流水日期不满足2个月'), | ||
1834 | } | ||
1835 | |||
1822 | SPECIAL_REASON = '主共借人未提供银行流水,含担保人需人工查看直系亲属关系' | 1836 | SPECIAL_REASON = '主共借人未提供银行流水,含担保人需人工查看直系亲属关系' |
1823 | SPECIAL_REASON_2 = '担保人未提供银行流水,需人工查看直系亲属关系' | 1837 | SPECIAL_REASON_2 = '担保人未提供银行流水,需人工查看直系亲属关系' |
1824 | SPECIAL_REASON_3 = '未提供银行流水' | 1838 | SPECIAL_REASON_3 = '未提供银行流水' |
... | @@ -1968,6 +1982,10 @@ SE_COMPARE_FIELD = { | ... | @@ -1968,6 +1982,10 @@ SE_COMPARE_FIELD = { |
1968 | HIL_CONTRACT_3_EN: (HIL_CONTRACT_3_FIELD, HIL_CONTRACT_3_COMPARE_LOGIC, False), | 1982 | HIL_CONTRACT_3_EN: (HIL_CONTRACT_3_FIELD, HIL_CONTRACT_3_COMPARE_LOGIC, False), |
1969 | } | 1983 | } |
1970 | 1984 | ||
1985 | SE_COMPARE_FIELD_AUTO = { | ||
1986 | BS_EN: (BS_FIELD, BS_COMPARE_LOGIC_AUTO, False), | ||
1987 | } | ||
1988 | |||
1971 | 1989 | ||
1972 | SE_FIRST_ID_FIELD_MAPPING = { | 1990 | SE_FIRST_ID_FIELD_MAPPING = { |
1973 | 'ITPRC': (ID_EN, SE_ID_CARD_FIELD), | 1991 | 'ITPRC': (ID_EN, SE_ID_CARD_FIELD), | ... | ... |
... | @@ -362,8 +362,9 @@ class Command(BaseCommand, LoggerMixin): | ... | @@ -362,8 +362,9 @@ class Command(BaseCommand, LoggerMixin): |
362 | consts.IMG_PATH_KEY: img_path, | 362 | consts.IMG_PATH_KEY: img_path, |
363 | consts.SECTION_IMG_PATH_KEY: section_img_path, | 363 | consts.SECTION_IMG_PATH_KEY: section_img_path, |
364 | } | 364 | } |
365 | # 'position': {'left': 470, 'top': 671, 'right': 542, 'bottom': 694} | ||
365 | # position_dict = { | 366 | # position_dict = { |
366 | # '': {consts.FIELD_POSITION_KEY: {}} | 367 | # '被保险人姓名': {consts.FIELD_POSITION_KEY: {}} |
367 | # } | 368 | # } |
368 | # insurance_ocr_result[consts.ALL_POSITION_KEY] = position_dict | 369 | # insurance_ocr_result[consts.ALL_POSITION_KEY] = position_dict |
369 | license_summary.setdefault(classify, []).append(insurance_ocr_result) | 370 | license_summary.setdefault(classify, []).append(insurance_ocr_result) | ... | ... |
... | @@ -872,7 +872,7 @@ def ca_compare(application_id, application_entity, ocr_res_id, last_obj, ocr_res | ... | @@ -872,7 +872,7 @@ def ca_compare(application_id, application_entity, ocr_res_id, last_obj, ocr_res |
872 | traceback.format_exc())) | 872 | traceback.format_exc())) |
873 | 873 | ||
874 | 874 | ||
875 | def get_se_cms_compare_info_auto(last_obj, application_entity): | 875 | def get_se_cms_compare_info_auto(last_obj, application_entity, auto=True): |
876 | cms_info = json.loads(last_obj.content) | 876 | cms_info = json.loads(last_obj.content) |
877 | 877 | ||
878 | compare_info = {} | 878 | compare_info = {} |
... | @@ -1072,6 +1072,7 @@ def get_se_cms_compare_info_auto(last_obj, application_entity): | ... | @@ -1072,6 +1072,7 @@ def get_se_cms_compare_info_auto(last_obj, application_entity): |
1072 | 1072 | ||
1073 | # 银行流水 -------------------------------------------------------------------- | 1073 | # 银行流水 -------------------------------------------------------------------- |
1074 | if cms_info.get('autoApprovedDetails', {}).get('aaType', '') in ['CAA1', 'CAA2']: | 1074 | if cms_info.get('autoApprovedDetails', {}).get('aaType', '') in ['CAA1', 'CAA2']: |
1075 | date_timedelta = 60 if auto else 90 | ||
1075 | bs_role_list = [] | 1076 | bs_role_list = [] |
1076 | for applicant_type in consts.APPLICANT_TYPE_ORDER[:2]: | 1077 | for applicant_type in consts.APPLICANT_TYPE_ORDER[:2]: |
1077 | if applicant_type in main_role_info: | 1078 | if applicant_type in main_role_info: |
... | @@ -1082,7 +1083,7 @@ def get_se_cms_compare_info_auto(last_obj, application_entity): | ... | @@ -1082,7 +1083,7 @@ def get_se_cms_compare_info_auto(last_obj, application_entity): |
1082 | bs_field_input = [ | 1083 | bs_field_input = [ |
1083 | (consts.SE_BS_FIELD[0], bs_role_list), | 1084 | (consts.SE_BS_FIELD[0], bs_role_list), |
1084 | (consts.SE_BS_FIELD[1], first_submission_date), | 1085 | (consts.SE_BS_FIELD[1], first_submission_date), |
1085 | (consts.SE_BS_FIELD[2], 90), | 1086 | (consts.SE_BS_FIELD[2], date_timedelta), |
1086 | ] | 1087 | ] |
1087 | 1088 | ||
1088 | dbr_bs_role_list = [] | 1089 | dbr_bs_role_list = [] |
... | @@ -1093,13 +1094,13 @@ def get_se_cms_compare_info_auto(last_obj, application_entity): | ... | @@ -1093,13 +1094,13 @@ def get_se_cms_compare_info_auto(last_obj, application_entity): |
1093 | bs_field_input.extend([ | 1094 | bs_field_input.extend([ |
1094 | (consts.SE_BS_FIELD[3], dbr_bs_role_list[0]), | 1095 | (consts.SE_BS_FIELD[3], dbr_bs_role_list[0]), |
1095 | (consts.SE_BS_FIELD[4], first_submission_date), | 1096 | (consts.SE_BS_FIELD[4], first_submission_date), |
1096 | (consts.SE_BS_FIELD[5], 90), | 1097 | (consts.SE_BS_FIELD[5], date_timedelta), |
1097 | ]) | 1098 | ]) |
1098 | if len(dbr_bs_role_list) >= 2: | 1099 | if len(dbr_bs_role_list) >= 2: |
1099 | bs_field_input.extend([ | 1100 | bs_field_input.extend([ |
1100 | (consts.SE_BS_FIELD[6], dbr_bs_role_list[1]), | 1101 | (consts.SE_BS_FIELD[6], dbr_bs_role_list[1]), |
1101 | (consts.SE_BS_FIELD[7], first_submission_date), | 1102 | (consts.SE_BS_FIELD[7], first_submission_date), |
1102 | (consts.SE_BS_FIELD[8], 90), | 1103 | (consts.SE_BS_FIELD[8], date_timedelta), |
1103 | ]) | 1104 | ]) |
1104 | bs_info[consts.BS_EN] = bs_field_input | 1105 | bs_info[consts.BS_EN] = bs_field_input |
1105 | compare_info['Bank Statement'] = bs_info | 1106 | compare_info['Bank Statement'] = bs_info |
... | @@ -1358,7 +1359,7 @@ def get_se_cms_compare_info_auto(last_obj, application_entity): | ... | @@ -1358,7 +1359,7 @@ def get_se_cms_compare_info_auto(last_obj, application_entity): |
1358 | return compare_info, cms_info.get('autoApprovedDetails', {}).get('aaType', ''), is_gsyh | 1359 | return compare_info, cms_info.get('autoApprovedDetails', {}).get('aaType', ''), is_gsyh |
1359 | 1360 | ||
1360 | 1361 | ||
1361 | def get_se_cms_compare_info(last_obj, application_entity, detect_list): | 1362 | def get_se_cms_compare_info(last_obj, application_entity, detect_list, auto=False): |
1362 | cms_info = json.loads(last_obj.content) | 1363 | cms_info = json.loads(last_obj.content) |
1363 | 1364 | ||
1364 | compare_info = {} | 1365 | compare_info = {} |
... | @@ -1402,13 +1403,17 @@ def get_se_cms_compare_info(last_obj, application_entity, detect_list): | ... | @@ -1402,13 +1403,17 @@ def get_se_cms_compare_info(last_obj, application_entity, detect_list): |
1402 | ('businessLicenseNo', id_num), | 1403 | ('businessLicenseNo', id_num), |
1403 | ('organizationCreditCode', id_num), | 1404 | ('organizationCreditCode', id_num), |
1404 | ('taxRegistrationCertificateNo', id_num), | 1405 | ('taxRegistrationCertificateNo', id_num), |
1405 | ('establishmentDate', establishment_date), | ||
1406 | ('businessLicenseDueDate', id_info.get('idExpiryDate', '')), | 1406 | ('businessLicenseDueDate', id_info.get('idExpiryDate', '')), |
1407 | ] | 1407 | ] |
1408 | license_dict[consts.BL_EN] = bl_field_input | 1408 | |
1409 | all_id_num.append(id_num) | ||
1410 | if individual_info.get('customersubType', '') == 'Corporate': | 1409 | if individual_info.get('customersubType', '') == 'Corporate': |
1411 | company_info_list.append((customer_name, id_num, legal_name)) | 1410 | company_info_list.append((customer_name, id_num, legal_name)) |
1411 | else: | ||
1412 | bl_field_input.append(('establishmentDate', establishment_date)) | ||
1413 | |||
1414 | license_dict[consts.BL_EN] = bl_field_input | ||
1415 | all_id_num.append(id_num) | ||
1416 | |||
1412 | 1417 | ||
1413 | # SME营业执照--------------------------------------------------------------------------------------------------- | 1418 | # SME营业执照--------------------------------------------------------------------------------------------------- |
1414 | # if individual_info.get('customersubType', '').startswith('Self Employed'): | 1419 | # if individual_info.get('customersubType', '').startswith('Self Employed'): |
... | @@ -1437,7 +1442,14 @@ def get_se_cms_compare_info(last_obj, application_entity, detect_list): | ... | @@ -1437,7 +1442,14 @@ def get_se_cms_compare_info(last_obj, application_entity, detect_list): |
1437 | 1442 | ||
1438 | dda_name_list = [] | 1443 | dda_name_list = [] |
1439 | dda_num_list = [] | 1444 | dda_num_list = [] |
1440 | for applicant_type in consts.APPLICANT_TYPE_ORDER[:2]: | 1445 | if len(company_info_list) > 0: |
1446 | tmp_idx = 1 | ||
1447 | company_info = company_info_list[0] | ||
1448 | else: | ||
1449 | tmp_idx = 0 | ||
1450 | company_info = None | ||
1451 | |||
1452 | for applicant_type in consts.APPLICANT_TYPE_ORDER[tmp_idx: tmp_idx + 2]: | ||
1441 | if applicant_type in main_role_info: | 1453 | if applicant_type in main_role_info: |
1442 | for dda_name_part, _, dda_num_part in main_role_info[applicant_type]: | 1454 | for dda_name_part, _, dda_num_part in main_role_info[applicant_type]: |
1443 | dda_name_list.append(dda_name_part) | 1455 | dda_name_list.append(dda_name_part) |
... | @@ -1446,11 +1458,6 @@ def get_se_cms_compare_info(last_obj, application_entity, detect_list): | ... | @@ -1446,11 +1458,6 @@ def get_se_cms_compare_info(last_obj, application_entity, detect_list): |
1446 | dda_num = '、'.join(dda_num_list) | 1458 | dda_num = '、'.join(dda_num_list) |
1447 | # del main_role_info | 1459 | # del main_role_info |
1448 | 1460 | ||
1449 | if len(company_info_list) > 0: | ||
1450 | company_info = company_info_list[0] | ||
1451 | else: | ||
1452 | company_info = None | ||
1453 | |||
1454 | vehicle_info = {} | 1461 | vehicle_info = {} |
1455 | vehicle_field_input = [] | 1462 | vehicle_field_input = [] |
1456 | vehicle_status = cms_info.get('vehicleStatus', '') | 1463 | vehicle_status = cms_info.get('vehicleStatus', '') |
... | @@ -1555,6 +1562,7 @@ def get_se_cms_compare_info(last_obj, application_entity, detect_list): | ... | @@ -1555,6 +1562,7 @@ def get_se_cms_compare_info(last_obj, application_entity, detect_list): |
1555 | 1562 | ||
1556 | # 银行流水 -------------------------------------------------------------------- | 1563 | # 银行流水 -------------------------------------------------------------------- |
1557 | if cms_info.get('autoApprovedDetails', {}).get('aaType', '') in ['CAA1', 'CAA2']: | 1564 | if cms_info.get('autoApprovedDetails', {}).get('aaType', '') in ['CAA1', 'CAA2']: |
1565 | date_timedelta = 60 if auto else 90 | ||
1558 | bs_role_list = [] | 1566 | bs_role_list = [] |
1559 | for applicant_type in consts.APPLICANT_TYPE_ORDER[:2]: | 1567 | for applicant_type in consts.APPLICANT_TYPE_ORDER[:2]: |
1560 | if applicant_type in main_role_info: | 1568 | if applicant_type in main_role_info: |
... | @@ -1565,7 +1573,7 @@ def get_se_cms_compare_info(last_obj, application_entity, detect_list): | ... | @@ -1565,7 +1573,7 @@ def get_se_cms_compare_info(last_obj, application_entity, detect_list): |
1565 | bs_field_input = [ | 1573 | bs_field_input = [ |
1566 | (consts.SE_BS_FIELD[0], bs_role_list), | 1574 | (consts.SE_BS_FIELD[0], bs_role_list), |
1567 | (consts.SE_BS_FIELD[1], first_submission_date), | 1575 | (consts.SE_BS_FIELD[1], first_submission_date), |
1568 | (consts.SE_BS_FIELD[2], 90), | 1576 | (consts.SE_BS_FIELD[2], date_timedelta), |
1569 | ] | 1577 | ] |
1570 | 1578 | ||
1571 | dbr_bs_role_list = [] | 1579 | dbr_bs_role_list = [] |
... | @@ -1576,13 +1584,13 @@ def get_se_cms_compare_info(last_obj, application_entity, detect_list): | ... | @@ -1576,13 +1584,13 @@ def get_se_cms_compare_info(last_obj, application_entity, detect_list): |
1576 | bs_field_input.extend([ | 1584 | bs_field_input.extend([ |
1577 | (consts.SE_BS_FIELD[3], dbr_bs_role_list[0]), | 1585 | (consts.SE_BS_FIELD[3], dbr_bs_role_list[0]), |
1578 | (consts.SE_BS_FIELD[4], first_submission_date), | 1586 | (consts.SE_BS_FIELD[4], first_submission_date), |
1579 | (consts.SE_BS_FIELD[5], 90), | 1587 | (consts.SE_BS_FIELD[5], date_timedelta), |
1580 | ]) | 1588 | ]) |
1581 | if len(dbr_bs_role_list) >= 2: | 1589 | if len(dbr_bs_role_list) >= 2: |
1582 | bs_field_input.extend([ | 1590 | bs_field_input.extend([ |
1583 | (consts.SE_BS_FIELD[6], dbr_bs_role_list[1]), | 1591 | (consts.SE_BS_FIELD[6], dbr_bs_role_list[1]), |
1584 | (consts.SE_BS_FIELD[7], first_submission_date), | 1592 | (consts.SE_BS_FIELD[7], first_submission_date), |
1585 | (consts.SE_BS_FIELD[8], 90), | 1593 | (consts.SE_BS_FIELD[8], date_timedelta), |
1586 | ]) | 1594 | ]) |
1587 | bs_info[consts.BS_EN] = bs_field_input | 1595 | bs_info[consts.BS_EN] = bs_field_input |
1588 | compare_info['Bank Statement'] = bs_info | 1596 | compare_info['Bank Statement'] = bs_info |
... | @@ -2012,11 +2020,14 @@ def get_se_compare_info(last_obj, application_entity, detect_list): | ... | @@ -2012,11 +2020,14 @@ def get_se_compare_info(last_obj, application_entity, detect_list): |
2012 | return compare_info, is_gsyh | 2020 | return compare_info, is_gsyh |
2013 | 2021 | ||
2014 | 2022 | ||
2015 | def se_bs_compare(license_en, ocr_res_dict, strip_list): | 2023 | def se_bs_compare(license_en, ocr_res_dict, strip_list, is_auto): |
2016 | # 主共借至少提供一个 | 2024 | # 主共借至少提供一个 |
2017 | # 有担保人,担保人必须提供。主共借没有时,修改comment:人工查看担保人亲属关系 | 2025 | # 有担保人,担保人必须提供。主共借没有时,修改comment:人工查看担保人亲属关系 |
2018 | 2026 | ||
2019 | ocr_field, compare_logic, _ = consts.SE_COMPARE_FIELD[license_en] | 2027 | if is_auto: |
2028 | ocr_field, compare_logic, _ = consts.SE_COMPARE_FIELD_AUTO[license_en] | ||
2029 | else: | ||
2030 | ocr_field, compare_logic, _ = consts.SE_COMPARE_FIELD[license_en] | ||
2020 | ocr_res_str = ocr_res_dict.get(ocr_field) | 2031 | ocr_res_str = ocr_res_dict.get(ocr_field) |
2021 | 2032 | ||
2022 | result_field_list = [] | 2033 | result_field_list = [] |
... | @@ -2311,7 +2322,8 @@ def se_compare_license(license_en, ocr_res_dict, field_list): | ... | @@ -2311,7 +2322,8 @@ def se_compare_license(license_en, ocr_res_dict, field_list): |
2311 | for name, value in field_list: | 2322 | for name, value in field_list: |
2312 | if isinstance(value, list): | 2323 | if isinstance(value, list): |
2313 | value = json.dumps(value, ensure_ascii=False) | 2324 | value = json.dumps(value, ensure_ascii=False) |
2314 | result_field_list.append((name, value, consts.RESULT_N, empty_str, empty_str, ErrorType.NF.value, '{0}未找到'.format(license_en))) | 2325 | no_find_str = consts.DDA_NO_FIND if license_en == consts.DDA_EN else '{0}未找到'.format(license_en) |
2326 | result_field_list.append((name, value, consts.RESULT_N, empty_str, empty_str, ErrorType.NF.value, no_find_str)) | ||
2315 | 2327 | ||
2316 | if is_find: | 2328 | if is_find: |
2317 | if special_expiry_date_slice: | 2329 | if special_expiry_date_slice: |
... | @@ -2573,7 +2585,7 @@ def se_mvc34_compare(license_en, ocr_res_dict, field_list): | ... | @@ -2573,7 +2585,7 @@ def se_mvc34_compare(license_en, ocr_res_dict, field_list): |
2573 | return result_field_list, field_img_path_dict | 2585 | return result_field_list, field_img_path_dict |
2574 | 2586 | ||
2575 | 2587 | ||
2576 | def se_compare_process(compare_info, ocr_res_dict, is_gsyh): | 2588 | def se_compare_process(compare_info, ocr_res_dict, is_gsyh, is_auto): |
2577 | # individualCusInfo | 2589 | # individualCusInfo |
2578 | # corporateCusInfo | 2590 | # corporateCusInfo |
2579 | # vehicleInfo | 2591 | # vehicleInfo |
... | @@ -2652,7 +2664,7 @@ def se_compare_process(compare_info, ocr_res_dict, is_gsyh): | ... | @@ -2652,7 +2664,7 @@ def se_compare_process(compare_info, ocr_res_dict, is_gsyh): |
2652 | elif license_en in [consts.HIL_CONTRACT_1_EN, consts.HIL_CONTRACT_2_EN, consts.HIL_CONTRACT_3_EN, consts.AFC_CONTRACT_EN]: | 2664 | elif license_en in [consts.HIL_CONTRACT_1_EN, consts.HIL_CONTRACT_2_EN, consts.HIL_CONTRACT_3_EN, consts.AFC_CONTRACT_EN]: |
2653 | result_field_list, field_img_path_dict = se_contract_compare(license_en, ocr_res_dict, strip_list, is_gsyh) | 2665 | result_field_list, field_img_path_dict = se_contract_compare(license_en, ocr_res_dict, strip_list, is_gsyh) |
2654 | elif license_en == consts.BS_EN: | 2666 | elif license_en == consts.BS_EN: |
2655 | result_field_list, field_img_path_dict = se_bs_compare(license_en, ocr_res_dict, strip_list) | 2667 | result_field_list, field_img_path_dict = se_bs_compare(license_en, ocr_res_dict, strip_list, is_auto) |
2656 | else: | 2668 | else: |
2657 | result_field_list, _, field_img_path_dict = se_compare_license(license_en, ocr_res_dict, strip_list) | 2669 | result_field_list, _, field_img_path_dict = se_compare_license(license_en, ocr_res_dict, strip_list) |
2658 | 2670 | ||
... | @@ -2726,7 +2738,7 @@ def se_compare_auto(application_id, application_entity, ocr_res_id, last_obj, oc | ... | @@ -2726,7 +2738,7 @@ def se_compare_auto(application_id, application_entity, ocr_res_id, last_obj, oc |
2726 | # detect_list = se_result_detect(ocr_res_dict) | 2738 | # detect_list = se_result_detect(ocr_res_dict) |
2727 | compare_info, aa_type, is_gsyh = get_se_cms_compare_info_auto( | 2739 | compare_info, aa_type, is_gsyh = get_se_cms_compare_info_auto( |
2728 | last_obj, application_entity) | 2740 | last_obj, application_entity) |
2729 | compare_result, total_fields, failed_count, successful_at_this_level, failure_reason_str, cn_failure_reason_str, bs_failure_reason_str = se_compare_process(compare_info, ocr_res_dict, is_gsyh) | 2741 | compare_result, total_fields, failed_count, successful_at_this_level, failure_reason_str, cn_failure_reason_str, bs_failure_reason_str = se_compare_process(compare_info, ocr_res_dict, is_gsyh, True) |
2730 | compare_log.info('{0} [Auto SE] [compare success] [entity={1}] [id={2}] [ocr_res_id={3}] [result={4}]'.format( | 2742 | compare_log.info('{0} [Auto SE] [compare success] [entity={1}] [id={2}] [ocr_res_id={3}] [result={4}]'.format( |
2731 | log_base, application_entity, application_id, ocr_res_id, compare_result)) | 2743 | log_base, application_entity, application_id, ocr_res_id, compare_result)) |
2732 | except Exception as e: | 2744 | except Exception as e: |
... | @@ -2773,7 +2785,7 @@ def se_compare(application_id, application_entity, ocr_res_id, last_obj, ocr_res | ... | @@ -2773,7 +2785,7 @@ def se_compare(application_id, application_entity, ocr_res_id, last_obj, ocr_res |
2773 | else: | 2785 | else: |
2774 | compare_info, is_gsyh = get_se_compare_info(last_obj, application_entity, detect_list) | 2786 | compare_info, is_gsyh = get_se_compare_info(last_obj, application_entity, detect_list) |
2775 | application_version = last_obj.application_version | 2787 | application_version = last_obj.application_version |
2776 | compare_result, total_fields, failed_count, successful_at_this_level, failure_reason_str, cn_failure_reason_str, bs_failure_reason_str = se_compare_process(compare_info, ocr_res_dict, is_gsyh) | 2788 | compare_result, total_fields, failed_count, successful_at_this_level, failure_reason_str, cn_failure_reason_str, bs_failure_reason_str = se_compare_process(compare_info, ocr_res_dict, is_gsyh, False) |
2777 | compare_log.info('{0} [SE] [compare success] [entity={1}] [id={2}] [ocr_res_id={3}] [result={4}]'.format( | 2789 | compare_log.info('{0} [SE] [compare success] [entity={1}] [id={2}] [ocr_res_id={3}] [result={4}]'.format( |
2778 | log_base, application_entity, application_id, ocr_res_id, compare_result)) | 2790 | log_base, application_entity, application_id, ocr_res_id, compare_result)) |
2779 | except Exception as e: | 2791 | except Exception as e: | ... | ... |
... | @@ -249,6 +249,10 @@ class Comparison: | ... | @@ -249,6 +249,10 @@ class Comparison: |
249 | ocr_s = ocr_str.translate(self.TRANS) | 249 | ocr_s = ocr_str.translate(self.TRANS) |
250 | return self.build_res(input_s == ocr_s) | 250 | return self.build_res(input_s == ocr_s) |
251 | 251 | ||
252 | def se_bs_name_compare(self, input_str, ocr_str, **kwargs): | ||
253 | new_ocr_str = re.sub(r'[^\u4e00-\u9fa5]+', '', ocr_str) | ||
254 | return self.build_res(input_str == new_ocr_str) | ||
255 | |||
252 | def ca_name_compare(self, input_str, ocr_str, **kwargs): | 256 | def ca_name_compare(self, input_str, ocr_str, **kwargs): |
253 | if kwargs.get('is_passport'): | 257 | if kwargs.get('is_passport'): |
254 | input_tmp = input_str.upper().replace(' ', '') | 258 | input_tmp = input_str.upper().replace(' ', '') |
... | @@ -438,6 +442,13 @@ class Comparison: | ... | @@ -438,6 +442,13 @@ class Comparison: |
438 | return self.RESULT_Y | 442 | return self.RESULT_Y |
439 | return self.RESULT_N | 443 | return self.RESULT_N |
440 | 444 | ||
445 | def se_bs_one_compare(self, input_list, ocr_str, **kwargs): | ||
446 | if isinstance(input_list, list): | ||
447 | new_ocr_str = re.sub(r'[^\u4e00-\u9fa5]+', '', ocr_str) | ||
448 | if new_ocr_str in input_list: | ||
449 | return self.RESULT_Y | ||
450 | return self.RESULT_N | ||
451 | |||
441 | def se_company_compare(self, input_str, ocr_str, **kwargs): | 452 | def se_company_compare(self, input_str, ocr_str, **kwargs): |
442 | input_tmp = re.sub(self.re_obj, '', input_str).strip() | 453 | input_tmp = re.sub(self.re_obj, '', input_str).strip() |
443 | ocr_tmp = re.sub(self.re_obj, '', ocr_str).strip() | 454 | ocr_tmp = re.sub(self.re_obj, '', ocr_str).strip() |
... | @@ -524,7 +535,7 @@ class Comparison: | ... | @@ -524,7 +535,7 @@ class Comparison: |
524 | try: | 535 | try: |
525 | input_date = datetime.strptime(input_str, "%Y-%m-%d") | 536 | input_date = datetime.strptime(input_str, "%Y-%m-%d") |
526 | ocr_date = datetime.strptime(ocr_str, "%Y-%m-%d") | 537 | ocr_date = datetime.strptime(ocr_str, "%Y-%m-%d") |
527 | if ocr_date >= input_date - relativedelta(days=15): | 538 | if ocr_date >= input_date - relativedelta(days=kwargs.get('days', 15)): |
528 | return self.RESULT_Y | 539 | return self.RESULT_Y |
529 | return self.RESULT_N | 540 | return self.RESULT_N |
530 | except Exception as e: | 541 | except Exception as e: | ... | ... |
-
Please register or sign in to post a comment