add se oct

1 parent 07c844aa master ... CHINARPA-4562 OCR-recognition-for-FSM-related-documents feature/202506-monixiadan feature/4058 feature/CHINAPRA-4447 feature/CHINARPA-3290-FSM-AUTO feature/CHINARPA-3443 feature/CHINARPA-3523 feature/CHINARPA-3528 feature/CHINARPA-3529 feature/CHINARPA-3577 feature/CHINARPA-3786 feature/CHINARPA-3964 feature/CHINARPA-4137 feature/CHINARPA-4277 feature/CHINARPA-4302/all-pass feature/CHINARPA-4341 feature/CHINARPA-4357 feature/CHINARPA-4358 feature/CHINARPA-4395 feature/CHINARPA-4495 feature/CHINARPA-4546 feature/CHINARPA-4623 feature/CHINARPA-4659 feature/CHINARPA-4660 feature/CHINARPA-4731 feature/CHINARPA-4846 feature/CHINARPA-4941 feature/CHINARPA-4942 feature/CHINARPA-4944 feature/CHINARPA-4962 feature/CHINARPA-5015 feature/CHINARPA-5075 feature/CHINARPA-5092 feature/CHINARPA-5117 feature/CHINARPA-5118 feature/CHINARPA-5131-5234 feature/CHINARPA-5153 feature/CHINARPA-5155 feature/CHINARPA-5296 feature/CHINARPA-5504 feature/CHINARPA-5619 feature/CHINARPA-5620-dzfp feature/CHINARPA_5015_SQL feature/KWOM_July feature/add_log_20240924 feature/add_try_except feature/enhancement-file-name-change feature/filter-file feature/fix_label_40_dydjhmh feature/fsm-contract feature/fsm-full feature/hotfix_insurance feature/mssql-encrypt feature/new-pwd feature/pdftoimg feature/pres feature/pres-3034 feature/qrs feature/report2 feature/sc feature/seOct feature/uat-new feature/uat-tmp feature/uat-tmp-cms-yace feature/uat-tmp-cy feature/uat-tmp-wblog feature/upgrade_cut_img feature/weixin-bs feature/weixin-bs-2 feature_add_down_payment feature_add_income_keywords_cy feature_add_insurance_sec_page fix/1118上线问题反馈 fix/2024-05-pen-test fix/20240424 fix/hil_excel_sql fix/new_hil_contract fix/report_ca hotfix/2025-02 hotfix/2025-04 hotfix/2025-06 master-0117
......@@ -2377,9 +2377,10 @@ def se_compare_license_id(license_en, id_res_list, field_list):
result_field_list = []
section_img_info = dict()
field_img_path_dict = dict()
field_last_idx = len(field_list) - 1
# ocr_res_str = ocr_res_dict.get(ocr_field)
for ocr_res_str in id_res_list:
for ca_or_se_idx, ocr_res_str in enumerate(id_res_list):
if is_find:
break
......@@ -2428,16 +2429,11 @@ def se_compare_license_id(license_en, id_res_list, field_list):
result = getattr(cp, compare_logic[name][1])(value, ocr_str, **compare_logic[name][2])
no_key = False
if idx == 0 and result == consts.RESULT_N and length > 1:
break
is_find = True
section_img_info[consts.SECTION_IMG_PATH_KEY] = ocr_res_list[res_idx].get(consts.SECTION_IMG_PATH_KEY, '')
section_img_info[consts.ALL_POSITION_KEY] = ocr_res_list[res_idx].get(consts.ALL_POSITION_KEY, {})
if special_expiry_date:
section_img_info[consts.SECTION_IMG_PATH_KEY_2] = ocr_res_list[res_idx].get(
consts.SECTION_IMG_PATH_KEY_2, '')
section_img_info[consts.ALL_POSITION_KEY_2] = ocr_res_list[res_idx].get(consts.ALL_POSITION_KEY_2, {})
if idx == 0 and result == consts.RESULT_N:
if ca_or_se_idx == 0:
break
elif length > 1:
break
# 过期期限特殊处理
if special_expiry_date and name == 'idExpiryDate' and result == consts.RESULT_N:
......@@ -2448,14 +2444,17 @@ def se_compare_license_id(license_en, id_res_list, field_list):
img_path = empty_str
else:
for expiry_date, (date_img_path, date_res_idx) in expiry_dates.items():
expiry_date_res = getattr(cp, compare_logic[name][1])(value, expiry_date, **compare_logic[name][2])
expiry_date_res = getattr(cp, compare_logic[name][1])(value, expiry_date,
**compare_logic[name][2])
if expiry_date_res == consts.RESULT_N:
ocr_str = expiry_date
img_path = date_img_path
special_expiry_date_slice = True
section_img_info[consts.SECTION_IMG_PATH_KEY_2] = ocr_res_list[date_res_idx].get(
section_img_info[consts.SECTION_IMG_PATH_KEY_2] = ocr_res_list[
date_res_idx].get(
consts.SECTION_IMG_PATH_KEY_2, '')
section_img_info[consts.ALL_POSITION_KEY_2] = ocr_res_list[date_res_idx].get(
section_img_info[consts.ALL_POSITION_KEY_2] = ocr_res_list[
date_res_idx].get(
consts.ALL_POSITION_KEY_2, {})
break
else:
......@@ -2466,7 +2465,27 @@ def se_compare_license_id(license_en, id_res_list, field_list):
img_path = ocr_res_list[res_idx].get(consts.IMG_PATH_KEY_2, '')
special_expiry_date_slice = True
else:
img_path = ocr_res_list[res_idx].get(consts.IMG_PATH_KEY, '') if result == consts.RESULT_N else empty_str
img_path = ocr_res_list[res_idx].get(consts.IMG_PATH_KEY,
'') if result == consts.RESULT_N else empty_str
if ca_or_se_idx == 0 and result == consts.RESULT_N:
special_expiry_date_slice = False
section_img_info.pop(consts.SECTION_IMG_PATH_KEY_2, None)
section_img_info.pop(consts.ALL_POSITION_KEY_2, None)
break
if ca_or_se_idx == 1:
is_find = True
elif idx == field_last_idx:
is_find = True
section_img_info[consts.SECTION_IMG_PATH_KEY] = ocr_res_list[res_idx].get(consts.SECTION_IMG_PATH_KEY, '')
section_img_info[consts.ALL_POSITION_KEY] = ocr_res_list[res_idx].get(consts.ALL_POSITION_KEY, {})
if special_expiry_date and consts.SECTION_IMG_PATH_KEY_2 not in section_img_info:
section_img_info[consts.SECTION_IMG_PATH_KEY_2] = ocr_res_list[res_idx].get(
consts.SECTION_IMG_PATH_KEY_2, '')
section_img_info[consts.ALL_POSITION_KEY_2] = ocr_res_list[res_idx].get(consts.ALL_POSITION_KEY_2, {})
if isinstance(value, list):
value = json.dumps(value, ensure_ascii=False)
error_type = empty_error_type if result == consts.RESULT_Y else ErrorType.OCR.value
......@@ -3148,8 +3167,8 @@ def compare(application_id, application_entity, uniq_seq, ocr_res_id, is_ca=True
id_res_list = []
for field_name in consts.CA_ADD_COMPARE_FIELDS:
if field_name == consts.IC_OCR_FIELD:
id_res_list.append(ocr_res_dict.get(field_name))
id_res_list.append(ca_ocr_res_dict.get(field_name) if isinstance(ca_ocr_res_dict, dict) else None)
id_res_list.append(ocr_res_dict.get(field_name))
if isinstance(ca_ocr_res_dict, dict) and isinstance(ca_ocr_res_dict.get(field_name), str):
tmp_ca_result = json.loads(ca_ocr_res_dict.get(field_name))
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!