fix se compare bug
Showing
2 changed files
with
10 additions
and
9 deletions
| ... | @@ -1150,6 +1150,8 @@ COMPARE_FIELDS = (MVI_OCR_FIELD, | ... | @@ -1150,6 +1150,8 @@ COMPARE_FIELDS = (MVI_OCR_FIELD, |
| 1150 | PP_OCR_FIELD, | 1150 | PP_OCR_FIELD, |
| 1151 | MVC_OCR_FIELD, | 1151 | MVC_OCR_FIELD, |
| 1152 | DDA_OCR_FIELD, | 1152 | DDA_OCR_FIELD, |
| 1153 | HMH_OCR_FIELD, | ||
| 1154 | JYPZ_OCR_FIELD, | ||
| 1153 | ) | 1155 | ) |
| 1154 | 1156 | ||
| 1155 | # 身份证 | 1157 | # 身份证 |
| ... | @@ -1466,7 +1468,7 @@ HMH_COMPARE_LOGIC = { | ... | @@ -1466,7 +1468,7 @@ HMH_COMPARE_LOGIC = { |
| 1466 | 1468 | ||
| 1467 | # MVC_OCR_FIELD = 'mvc_ocr' | 1469 | # MVC_OCR_FIELD = 'mvc_ocr' |
| 1468 | 1470 | ||
| 1469 | SE_DETECT_CARD = [UCI_EN, JYPZ_EN, HMH_EN] | 1471 | SE_DETECT_CARD = [UCI_EN, JYPZ_EN, HMH_EN, DDA_EN] |
| 1470 | 1472 | ||
| 1471 | SE_COMPARE_FIELD = { | 1473 | SE_COMPARE_FIELD = { |
| 1472 | ID_EN: (IC_OCR_FIELD, ID_COMPARE_LOGIC, True), | 1474 | ID_EN: (IC_OCR_FIELD, ID_COMPARE_LOGIC, True), | ... | ... |
| ... | @@ -853,6 +853,7 @@ def get_se_compare_info(last_obj, application_entity, detect_list): | ... | @@ -853,6 +853,7 @@ def get_se_compare_info(last_obj, application_entity, detect_list): |
| 853 | is_gsyh = False | 853 | is_gsyh = False |
| 854 | bank_info[consts.BC_EN] = bank_field_input | 854 | bank_info[consts.BC_EN] = bank_field_input |
| 855 | 855 | ||
| 856 | if is_gsyh or not detect_list[-1]: | ||
| 856 | dda_field_input = [] | 857 | dda_field_input = [] |
| 857 | for dda_field in consts.SE_DDA_FIELD: | 858 | for dda_field in consts.SE_DDA_FIELD: |
| 858 | if dda_field.startswith('applicationId'): | 859 | if dda_field.startswith('applicationId'): |
| ... | @@ -869,7 +870,7 @@ def get_se_compare_info(last_obj, application_entity, detect_list): | ... | @@ -869,7 +870,7 @@ def get_se_compare_info(last_obj, application_entity, detect_list): |
| 869 | bank_info[consts.DDA_EN] = dda_field_input | 870 | bank_info[consts.DDA_EN] = dda_field_input |
| 870 | compare_info['bankInfo'] = bank_info | 871 | compare_info['bankInfo'] = bank_info |
| 871 | 872 | ||
| 872 | if not detect_list[-1]: | 873 | if not detect_list[2]: |
| 873 | other_info = {} | 874 | other_info = {} |
| 874 | hmh_field_input = [] | 875 | hmh_field_input = [] |
| 875 | hmh_field_input.append((consts.SE_HMH_FIELD[0], hmh_name)) | 876 | hmh_field_input.append((consts.SE_HMH_FIELD[0], hmh_name)) |
| ... | @@ -878,7 +879,7 @@ def get_se_compare_info(last_obj, application_entity, detect_list): | ... | @@ -878,7 +879,7 @@ def get_se_compare_info(last_obj, application_entity, detect_list): |
| 878 | other_info[consts.HMH_EN] = hmh_field_input | 879 | other_info[consts.HMH_EN] = hmh_field_input |
| 879 | compare_info['other'] = other_info | 880 | compare_info['other'] = other_info |
| 880 | 881 | ||
| 881 | return compare_info, is_gsyh | 882 | return compare_info |
| 882 | 883 | ||
| 883 | 884 | ||
| 884 | def se_compare_license(license_en, ocr_res_dict, field_list): | 885 | def se_compare_license(license_en, ocr_res_dict, field_list): |
| ... | @@ -1007,7 +1008,7 @@ def se_mvc34_compare(license_en, ocr_res_dict, field_list): | ... | @@ -1007,7 +1008,7 @@ def se_mvc34_compare(license_en, ocr_res_dict, field_list): |
| 1007 | return result_field_list | 1008 | return result_field_list |
| 1008 | 1009 | ||
| 1009 | 1010 | ||
| 1010 | def se_compare_process(compare_info, ocr_res_dict, is_gsyh): | 1011 | def se_compare_process(compare_info, ocr_res_dict): |
| 1011 | # individualCusInfo | 1012 | # individualCusInfo |
| 1012 | # corporateCusInfo | 1013 | # corporateCusInfo |
| 1013 | # vehicleInfo | 1014 | # vehicleInfo |
| ... | @@ -1053,11 +1054,9 @@ def se_compare_process(compare_info, ocr_res_dict, is_gsyh): | ... | @@ -1053,11 +1054,9 @@ def se_compare_process(compare_info, ocr_res_dict, is_gsyh): |
| 1053 | failure_field = [] | 1054 | failure_field = [] |
| 1054 | if license_en == consts.MVC34_EN: | 1055 | if license_en == consts.MVC34_EN: |
| 1055 | result_field_list = se_mvc34_compare(license_en, ocr_res_dict, field_list) | 1056 | result_field_list = se_mvc34_compare(license_en, ocr_res_dict, field_list) |
| 1056 | no_ocr_result = False | ||
| 1057 | else: | 1057 | else: |
| 1058 | result_field_list, no_ocr_result = se_compare_license(license_en, ocr_res_dict, field_list) | 1058 | result_field_list, _ = se_compare_license(license_en, ocr_res_dict, field_list) |
| 1059 | for name, value, result, ocr_str, img_path, error_type in result_field_list: | 1059 | for name, value, result, ocr_str, img_path, error_type in result_field_list: |
| 1060 | if license_en != consts.DDA_EN or not no_ocr_result or is_gsyh: | ||
| 1061 | total_fields += 1 | 1060 | total_fields += 1 |
| 1062 | if result == consts.RESULT_N: | 1061 | if result == consts.RESULT_N: |
| 1063 | failed_count += 1 | 1062 | failed_count += 1 |
| ... | @@ -1099,9 +1098,9 @@ def se_compare(application_id, application_entity, ocr_res_id, last_obj, ocr_res | ... | @@ -1099,9 +1098,9 @@ def se_compare(application_id, application_entity, ocr_res_id, last_obj, ocr_res |
| 1099 | # 比对逻辑 | 1098 | # 比对逻辑 |
| 1100 | start_time = datetime.now() | 1099 | start_time = datetime.now() |
| 1101 | detect_list = se_result_detect(ocr_res_dict) | 1100 | detect_list = se_result_detect(ocr_res_dict) |
| 1102 | compare_info, is_gsyh = get_se_compare_info(last_obj, application_entity, detect_list) | 1101 | compare_info = get_se_compare_info(last_obj, application_entity, detect_list) |
| 1103 | compare_result, total_fields, failed_count, successful_at_this_level, failure_reason_str = se_compare_process( | 1102 | compare_result, total_fields, failed_count, successful_at_this_level, failure_reason_str = se_compare_process( |
| 1104 | compare_info, ocr_res_dict, is_gsyh) | 1103 | compare_info, ocr_res_dict) |
| 1105 | compare_log.info('{0} [SE] [compare success] [entity={1}] [id={2}] [ocr_res_id={3}] [result={4}]'.format( | 1104 | compare_log.info('{0} [SE] [compare success] [entity={1}] [id={2}] [ocr_res_id={3}] [result={4}]'.format( |
| 1106 | log_base, application_entity, application_id, ocr_res_id, compare_result)) | 1105 | log_base, application_entity, application_id, ocr_res_id, compare_result)) |
| 1107 | except Exception as e: | 1106 | except Exception as e: | ... | ... |
-
Please register or sign in to post a comment