INIT:CAA2
Showing
2 changed files
with
65 additions
and
11 deletions
... | @@ -1428,6 +1428,8 @@ TCSEP = [ | ... | @@ -1428,6 +1428,8 @@ TCSEP = [ |
1428 | RESULT_Y = 'Y' | 1428 | RESULT_Y = 'Y' |
1429 | RESULT_N = 'N' | 1429 | RESULT_N = 'N' |
1430 | RESULT_NA = 'NA' | 1430 | RESULT_NA = 'NA' |
1431 | RESULT_N1 = 'N1' | ||
1432 | RESULT_N2 = 'N2' | ||
1431 | 1433 | ||
1432 | IN_ORDER = ('applicantType', 'idType', SECOND_ID_TYPE_FIELD, 'customerType', 'customerChineseName', 'idNum', | 1434 | IN_ORDER = ('applicantType', 'idType', SECOND_ID_TYPE_FIELD, 'customerType', 'customerChineseName', 'idNum', |
1433 | SECOND_ID_FIELD, "idExpiryDate", "dateOfBirth", 'companyName', "registeredCapital", 'selfEmployedSubType',) | 1435 | SECOND_ID_FIELD, "idExpiryDate", "dateOfBirth", 'companyName', "registeredCapital", 'selfEmployedSubType',) | ... | ... |
... | @@ -1922,7 +1922,7 @@ def get_se_cms_compare_info(last_obj, application_entity, detect_list, auto=Fals | ... | @@ -1922,7 +1922,7 @@ def get_se_cms_compare_info(last_obj, application_entity, detect_list, auto=Fals |
1922 | hil_contract_2_input.append((key, empty_str)) | 1922 | hil_contract_2_input.append((key, empty_str)) |
1923 | contract_info[consts.HIL_CONTRACT_2_EN] = hil_contract_2_input | 1923 | contract_info[consts.HIL_CONTRACT_2_EN] = hil_contract_2_input |
1924 | compare_info['contract'] = contract_info | 1924 | compare_info['contract'] = contract_info |
1925 | return compare_info, cms_info.get('applicationVersion', 1), is_gsyh | 1925 | return compare_info, cms_info.get('applicationVersion', 1), cms_info.get('autoApprovedDetails', {}).get('aaType', ''), is_gsyh |
1926 | else: | 1926 | else: |
1927 | # AFC合同------------------------------------------------------------------------------------------------------ | 1927 | # AFC合同------------------------------------------------------------------------------------------------------ |
1928 | vehicle_principal_str = str(cms_info.get('financialInformation', {}).get('vehiclePrincipal', '0.0')) | 1928 | vehicle_principal_str = str(cms_info.get('financialInformation', {}).get('vehiclePrincipal', '0.0')) |
... | @@ -1997,10 +1997,10 @@ def get_se_cms_compare_info(last_obj, application_entity, detect_list, auto=Fals | ... | @@ -1997,10 +1997,10 @@ def get_se_cms_compare_info(last_obj, application_entity, detect_list, auto=Fals |
1997 | afc_contract_qrs_input = [(consts.SE_AFC_CON_QRS_FIELD[0], '{0}{1}{2}'.format(role_count, consts.SPLIT_STR, full_no))] | 1997 | afc_contract_qrs_input = [(consts.SE_AFC_CON_QRS_FIELD[0], '{0}{1}{2}'.format(role_count, consts.SPLIT_STR, full_no))] |
1998 | contract_info[consts.AFC_CONTRACT_QRS_EN] = afc_contract_qrs_input | 1998 | contract_info[consts.AFC_CONTRACT_QRS_EN] = afc_contract_qrs_input |
1999 | compare_info['contract'] = contract_info | 1999 | compare_info['contract'] = contract_info |
2000 | return compare_info, cms_info.get('applicationVersion', 1), is_gsyh | 2000 | return compare_info, cms_info.get('applicationVersion', 1), cms_info.get('autoApprovedDetails', {}).get('aaType', ''), is_gsyh |
2001 | 2001 | ||
2002 | 2002 | ||
2003 | def se_bs_compare(license_en, ocr_res_dict, strip_list, is_auto): | 2003 | def se_bs_compare(license_en, ocr_res_dict, strip_list, is_auto, aa_type): |
2004 | # 主共借至少提供一个 | 2004 | # 主共借至少提供一个 |
2005 | # 有担保人,担保人必须提供。主共借没有时,修改comment:人工查看担保人亲属关系 | 2005 | # 有担保人,担保人必须提供。主共借没有时,修改comment:人工查看担保人亲属关系 |
2006 | 2006 | ||
... | @@ -2027,13 +2027,28 @@ def se_bs_compare(license_en, ocr_res_dict, strip_list, is_auto): | ... | @@ -2027,13 +2027,28 @@ def se_bs_compare(license_en, ocr_res_dict, strip_list, is_auto): |
2027 | verify_list = [] | 2027 | verify_list = [] |
2028 | verify_false_idx_list = [] | 2028 | verify_false_idx_list = [] |
2029 | 2029 | ||
2030 | auto_paper_verify_list = [] | ||
2031 | auto_elec_verify_list = [] | ||
2032 | auto_paper_verify_false_idx_list = [] | ||
2033 | auto_elec_verify_false_idx_list = [] | ||
2034 | |||
2030 | for tmp_idx, ocr_res in enumerate(ocr_res_list): | 2035 | for tmp_idx, ocr_res in enumerate(ocr_res_list): |
2031 | correct_count = 0 | 2036 | correct_count = 0 |
2032 | pre_tmp_res_part = {} | 2037 | pre_tmp_res_part = {} |
2033 | verify_bool = ocr_res.get('verify', True) | 2038 | verify_bool = ocr_res.get('verify', False) |
2039 | e_bank = ocr_res.get('e_bank', False) | ||
2034 | verify_list.append(verify_bool) | 2040 | verify_list.append(verify_bool) |
2035 | if not verify_bool: | 2041 | if not verify_bool: |
2036 | verify_false_idx_list.append(str(tmp_idx+1)) | 2042 | verify_false_idx_list.append(str(tmp_idx+1)) |
2043 | if e_bank: | ||
2044 | auto_elec_verify_list.append(verify_bool) | ||
2045 | if not verify_bool: | ||
2046 | auto_elec_verify_false_idx_list.append(str(tmp_idx+1)) | ||
2047 | else: | ||
2048 | auto_paper_verify_list.append(verify_bool) | ||
2049 | verify_list.add(False) | ||
2050 | auto_paper_verify_false_idx_list.append(str(tmp_idx+1)) | ||
2051 | |||
2037 | for idx, (name, value) in enumerate(pre_field_list): | 2052 | for idx, (name, value) in enumerate(pre_field_list): |
2038 | ocr_str_or_list = ocr_res.get(compare_logic[name][0]) | 2053 | ocr_str_or_list = ocr_res.get(compare_logic[name][0]) |
2039 | if isinstance(ocr_str_or_list, str) or isinstance(ocr_str_or_list, list) \ | 2054 | if isinstance(ocr_str_or_list, str) or isinstance(ocr_str_or_list, list) \ |
... | @@ -2061,10 +2076,47 @@ def se_bs_compare(license_en, ocr_res_dict, strip_list, is_auto): | ... | @@ -2061,10 +2076,47 @@ def se_bs_compare(license_en, ocr_res_dict, strip_list, is_auto): |
2061 | pre_best_res = pre_tmp_res_part | 2076 | pre_best_res = pre_tmp_res_part |
2062 | 2077 | ||
2063 | # 真伪 | 2078 | # 真伪 |
2064 | if not is_auto: | 2079 | # if not is_auto: |
2080 | # name = '真伪' | ||
2081 | # result = consts.RESULT_Y if all(verify_list) else consts.RESULT_N | ||
2082 | # reason = '第{0}份银行流水疑似造假,需人工核查'.format('、'.join(verify_false_idx_list)) | ||
2083 | # result_field_list.append((name, empty_str, result, json.dumps(verify_list, ensure_ascii=False), empty_str, empty_error_type, reason)) | ||
2084 | |||
2085 | # 非FSM Full CAA1 | ||
2086 | if not is_auto and aa_type == 'CAA1': | ||
2087 | name = '真伪' | ||
2088 | # 若仅提供纸质流水,则默认真伪为N2 | ||
2089 | if not auto_elec_verify_list: | ||
2090 | result = consts.RESULT_N2 | ||
2091 | reason = '第{0}份银行流水为纸质版,请核查流水真伪。'.format('、'.join(auto_paper_verify_list)) | ||
2092 | # 若仅提供电子流水,逐一比对,有false为N1,全部true为Y | ||
2093 | if not auto_paper_verify_list: | ||
2094 | result = consts.RESULT_Y if all(auto_elec_verify_list) else consts.RESULT_N1 | ||
2095 | reason = '第{0}份银行流水疑似造假,需人工核查。'.format('、'.join(auto_elec_verify_list)) | ||
2096 | #同时包含,同时返回N1,N2 | ||
2097 | if auto_elec_verify_list and auto_paper_verify_list: | ||
2098 | result = consts.RESULT_Y if all(auto_elec_verify_list) else consts.RESULT_N1 | ||
2099 | reason1 = '第{0}份银行流水疑似造假,需人工核查。'.format('、'.join(auto_elec_verify_list)) | ||
2100 | reason2 = '第{0}份银行流水为纸质版,请核查流水真伪。'.format('、'.join(auto_paper_verify_list)) | ||
2101 | reason = reason1 + reason2 | ||
2102 | result_field_list.append((name, empty_str, result, json.dumps(verify_list, ensure_ascii=False), empty_str, empty_error_type, reason)) | ||
2103 | # 非FSM Full & Auto CAA2 目前逻辑和上面的完全一样 | ||
2104 | elif aa_type == 'CAA2' : | ||
2065 | name = '真伪' | 2105 | name = '真伪' |
2066 | result = consts.RESULT_Y if all(verify_list) else consts.RESULT_N | 2106 | # 若仅提供纸质流水,则默认真伪为N2 |
2067 | reason = '第{0}份银行流水疑似造假,需人工核查'.format('、'.join(verify_false_idx_list)) | 2107 | if not auto_elec_verify_list: |
2108 | result = consts.RESULT_N2 | ||
2109 | reason = '第{0}份银行流水为纸质版,请核查流水真伪。'.format('、'.join(auto_paper_verify_list)) | ||
2110 | # 若仅提供电子流水,逐一比对,有false为N1,全部true为Y | ||
2111 | if not auto_paper_verify_list: | ||
2112 | result = consts.RESULT_Y if all(auto_elec_verify_list) else consts.RESULT_N1 | ||
2113 | reason = '第{0}份银行流水疑似造假,需人工核查。'.format('、'.join(auto_elec_verify_list)) | ||
2114 | #同时包含,同时返回N1,N2 | ||
2115 | if auto_elec_verify_list and auto_paper_verify_list: | ||
2116 | result = consts.RESULT_Y if all(auto_elec_verify_list) else consts.RESULT_N1 | ||
2117 | reason1 = '第{0}份银行流水疑似造假,需人工核查。'.format('、'.join(auto_elec_verify_list)) | ||
2118 | reason2 = '第{0}份银行流水为纸质版,请核查流水真伪。'.format('、'.join(auto_paper_verify_list)) | ||
2119 | reason = reason1 + reason2 | ||
2068 | result_field_list.append((name, empty_str, result, json.dumps(verify_list, ensure_ascii=False), empty_str, empty_error_type, reason)) | 2120 | result_field_list.append((name, empty_str, result, json.dumps(verify_list, ensure_ascii=False), empty_str, empty_error_type, reason)) |
2069 | 2121 | ||
2070 | # 担保人1 | 2122 | # 担保人1 |
... | @@ -2889,7 +2941,7 @@ def se_mvc34_compare(license_en, ocr_res_dict, field_list): | ... | @@ -2889,7 +2941,7 @@ def se_mvc34_compare(license_en, ocr_res_dict, field_list): |
2889 | return result_field_list, field_img_path_dict | 2941 | return result_field_list, field_img_path_dict |
2890 | 2942 | ||
2891 | 2943 | ||
2892 | def se_compare_process(compare_info, ocr_res_dict, is_gsyh, is_auto, id_res_list): | 2944 | def se_compare_process(compare_info, ocr_res_dict, is_gsyh, is_auto, id_res_list, aa_type): |
2893 | # individualCusInfo | 2945 | # individualCusInfo |
2894 | # corporateCusInfo | 2946 | # corporateCusInfo |
2895 | # vehicleInfo | 2947 | # vehicleInfo |
... | @@ -2983,7 +3035,7 @@ def se_compare_process(compare_info, ocr_res_dict, is_gsyh, is_auto, id_res_list | ... | @@ -2983,7 +3035,7 @@ def se_compare_process(compare_info, ocr_res_dict, is_gsyh, is_auto, id_res_list |
2983 | elif license_en == consts.AFC_CONTRACT_QRS_EN: | 3035 | elif license_en == consts.AFC_CONTRACT_QRS_EN: |
2984 | result_field_list, field_img_path_dict = se_contract_qrs_compare(license_en, ocr_res_dict, strip_list) | 3036 | result_field_list, field_img_path_dict = se_contract_qrs_compare(license_en, ocr_res_dict, strip_list) |
2985 | elif license_en == consts.BS_EN: | 3037 | elif license_en == consts.BS_EN: |
2986 | result_field_list, field_img_path_dict = se_bs_compare(license_en, ocr_res_dict, strip_list, is_auto) | 3038 | result_field_list, field_img_path_dict = se_bs_compare(license_en, ocr_res_dict, strip_list, is_auto, aa_type) |
2987 | else: | 3039 | else: |
2988 | result_field_list, _, field_img_path_dict = se_compare_license(license_en, ocr_res_dict, strip_list) | 3040 | result_field_list, _, field_img_path_dict = se_compare_license(license_en, ocr_res_dict, strip_list) |
2989 | 3041 | ||
... | @@ -3135,11 +3187,11 @@ def se_compare(application_id, application_entity, ocr_res_id, last_obj, ocr_res | ... | @@ -3135,11 +3187,11 @@ def se_compare(application_id, application_entity, ocr_res_id, last_obj, ocr_res |
3135 | # 比对逻辑 | 3187 | # 比对逻辑 |
3136 | start_time = datetime.now() | 3188 | start_time = datetime.now() |
3137 | detect_list = se_result_detect(ocr_res_dict) | 3189 | detect_list = se_result_detect(ocr_res_dict) |
3138 | compare_info, application_version, is_gsyh = get_se_cms_compare_info( | 3190 | compare_info, application_version, aa_type, is_gsyh = get_se_cms_compare_info( |
3139 | last_obj, application_entity, detect_list, ignore_bank=ignore_bank) | 3191 | last_obj, application_entity, detect_list, ignore_bank=ignore_bank) |
3140 | compare_result, total_fields, failed_count, successful_at_this_level, failure_reason_str, \ | 3192 | compare_result, total_fields, failed_count, successful_at_this_level, failure_reason_str, \ |
3141 | cn_failure_reason_str, bs_failure_reason_str, rpa_failure_reason, field_result_dict = se_compare_process( | 3193 | cn_failure_reason_str, bs_failure_reason_str, rpa_failure_reason, field_result_dict = se_compare_process( |
3142 | compare_info, ocr_res_dict, is_gsyh, False, id_res_list) | 3194 | compare_info, ocr_res_dict, is_gsyh, False, id_res_list, aa_type) |
3143 | compare_log.info('{0} [SE] [compare success] [entity={1}] [id={2}] [ocr_res_id={3}] [result={4}]'.format( | 3195 | compare_log.info('{0} [SE] [compare success] [entity={1}] [id={2}] [ocr_res_id={3}] [result={4}]'.format( |
3144 | log_base, application_entity, application_id, ocr_res_id, compare_result)) | 3196 | log_base, application_entity, application_id, ocr_res_id, compare_result)) |
3145 | except Exception as e: | 3197 | except Exception as e: | ... | ... |
-
Please register or sign in to post a comment