add no compare
Showing
3 changed files
with
29 additions
and
14 deletions
... | @@ -1025,6 +1025,7 @@ IC_RES_MAPPING = { | ... | @@ -1025,6 +1025,7 @@ IC_RES_MAPPING = { |
1025 | # ----------------- compare --------------------- | 1025 | # ----------------- compare --------------------- |
1026 | ENTITY = ['HIL', 'AFC'] | 1026 | ENTITY = ['HIL', 'AFC'] |
1027 | CUSTOMER_TYPE = ['TCCOR', 'TCDAS', 'TCFRE', 'TCIAS', 'TCIND', 'TCSEP', 'TCURE'] | 1027 | CUSTOMER_TYPE = ['TCCOR', 'TCDAS', 'TCFRE', 'TCIAS', 'TCIND', 'TCSEP', 'TCURE'] |
1028 | NO_COMPARE_CUSTOMER_TYPE = ['TCFRE', 'TCIND'] | ||
1028 | VEHICLE_STATUS = ['PCUSD', 'PCNEW'] | 1029 | VEHICLE_STATUS = ['PCUSD', 'PCNEW'] |
1029 | 1030 | ||
1030 | APPLICANT_TYPE = ['COAPP', 'CUSTR', 'GAUTR1', 'GAUTR2'] | 1031 | APPLICANT_TYPE = ['COAPP', 'CUSTR', 'GAUTR1', 'GAUTR2'] | ... | ... |
... | @@ -17,10 +17,10 @@ log_base = '[CA Compare]' | ... | @@ -17,10 +17,10 @@ log_base = '[CA Compare]' |
17 | 17 | ||
18 | 18 | ||
19 | def get_order_dict(src_dict, order_tuple): | 19 | def get_order_dict(src_dict, order_tuple): |
20 | if consts.SECOND_ID_TYPE_FIELD in src_dict: | 20 | # if consts.SECOND_ID_TYPE_FIELD in src_dict: |
21 | if src_dict.get(consts.SECOND_ID_TYPE_FIELD) not in consts.SECOND_ID_TYPE_COMPARE: | 21 | # if src_dict.get(consts.SECOND_ID_TYPE_FIELD) not in consts.SECOND_ID_TYPE_COMPARE: |
22 | src_dict.pop(consts.SECOND_ID_TYPE_FIELD, None) | 22 | # src_dict.pop(consts.SECOND_ID_TYPE_FIELD, None) |
23 | src_dict.pop(consts.SECOND_ID_FIELD, None) | 23 | # src_dict.pop(consts.SECOND_ID_FIELD, None) |
24 | 24 | ||
25 | order_dict = OrderedDict({}) | 25 | order_dict = OrderedDict({}) |
26 | for field in order_tuple: | 26 | for field in order_tuple: |
... | @@ -29,6 +29,13 @@ def get_order_dict(src_dict, order_tuple): | ... | @@ -29,6 +29,13 @@ def get_order_dict(src_dict, order_tuple): |
29 | return order_dict | 29 | return order_dict |
30 | 30 | ||
31 | 31 | ||
32 | def do_not_compare(info_dict, compare_list): | ||
33 | for compare_tuple in compare_list: | ||
34 | info_dict[compare_tuple[4]] = consts.RESULT_NA | ||
35 | if compare_tuple[0] in info_dict: | ||
36 | del info_dict[compare_tuple[0]] | ||
37 | |||
38 | |||
32 | def field_compare(info_dict, ocr_res_dict, ocr_field, compare_list, res_set, has_expiry_date=False, sep_name=None): | 39 | def field_compare(info_dict, ocr_res_dict, ocr_field, compare_list, res_set, has_expiry_date=False, sep_name=None): |
33 | is_find = False | 40 | is_find = False |
34 | ocr_res_str = ocr_res_dict.get(ocr_field) | 41 | ocr_res_str = ocr_res_dict.get(ocr_field) |
... | @@ -208,8 +215,10 @@ def compare(application_id, application_entity, uniq_seq, ocr_res_id): | ... | @@ -208,8 +215,10 @@ def compare(application_id, application_entity, uniq_seq, ocr_res_id): |
208 | for individual_cus_info in individual_cus_info_list: | 215 | for individual_cus_info in individual_cus_info_list: |
209 | order_individual_cus_info = get_order_dict(individual_cus_info, consts.IN_ORDER) | 216 | order_individual_cus_info = get_order_dict(individual_cus_info, consts.IN_ORDER) |
210 | 217 | ||
218 | cus_type = order_individual_cus_info.get('customerType') | ||
219 | |||
211 | # 获取sep下营业执照法人代表 | 220 | # 获取sep下营业执照法人代表 |
212 | if order_individual_cus_info.get('customerType') == consts.CUSTOMER_TYPE[5]: | 221 | if cus_type == consts.CUSTOMER_TYPE[5]: |
213 | sep_name = order_individual_cus_info.get('customerChineseName') | 222 | sep_name = order_individual_cus_info.get('customerChineseName') |
214 | if isinstance(sep_name, str): | 223 | if isinstance(sep_name, str): |
215 | sep_name = sep_name.strip() | 224 | sep_name = sep_name.strip() |
... | @@ -220,17 +229,22 @@ def compare(application_id, application_entity, uniq_seq, ocr_res_id): | ... | @@ -220,17 +229,22 @@ def compare(application_id, application_entity, uniq_seq, ocr_res_id): |
220 | 229 | ||
221 | # 个人信息证件 | 230 | # 个人信息证件 |
222 | id_type = order_individual_cus_info.get('idType') | 231 | id_type = order_individual_cus_info.get('idType') |
223 | if id_type not in consts.ID_TYPE_COMPARE: | 232 | if cus_type in consts.NO_COMPARE_CUSTOMER_TYPE or id_type not in consts.ID_TYPE_COMPARE: |
224 | continue | 233 | do_not_compare(order_individual_cus_info, consts.ITPRC) |
225 | ocr_field, compare_list, has_expiry_date = consts.ID_TYPE_COMPARE.get(id_type) | 234 | else: |
226 | field_compare(order_individual_cus_info, ocr_res_dict, ocr_field, compare_list, res_set, | 235 | ocr_field, compare_list, has_expiry_date = consts.ID_TYPE_COMPARE.get(id_type) |
227 | has_expiry_date=has_expiry_date) | 236 | field_compare(order_individual_cus_info, ocr_res_dict, ocr_field, compare_list, res_set, |
237 | has_expiry_date=has_expiry_date) | ||
228 | 238 | ||
229 | # 第二证件 | 239 | # 第二证件 |
230 | second_id_type = order_individual_cus_info.get('secondIdType') | 240 | second_id_type = order_individual_cus_info.get('secondIdType') |
231 | if second_id_type is not None: | 241 | if second_id_type is not None: |
232 | second_ocr_field, second_compare_list = consts.SECOND_ID_TYPE_COMPARE.get(second_id_type) | 242 | if cus_type in consts.NO_COMPARE_CUSTOMER_TYPE or second_id_type not in consts.SECOND_ID_TYPE_COMPARE: |
233 | field_compare(order_individual_cus_info, ocr_res_dict, second_ocr_field, second_compare_list, res_set) | 243 | do_not_compare(order_individual_cus_info, consts.SECOND_ITPRC) |
244 | else: | ||
245 | second_ocr_field, second_compare_list = consts.SECOND_ID_TYPE_COMPARE.get(second_id_type) | ||
246 | field_compare(order_individual_cus_info, ocr_res_dict, second_ocr_field, | ||
247 | second_compare_list, res_set) | ||
234 | # 重新排列 | 248 | # 重新排列 |
235 | new_dict = OrderedDict({}) | 249 | new_dict = OrderedDict({}) |
236 | second_id_res = order_individual_cus_info.pop(consts.SECOND_ID_RES, consts.RESULT_NA) | 250 | second_id_res = order_individual_cus_info.pop(consts.SECOND_ID_RES, consts.RESULT_NA) |
... | @@ -241,7 +255,7 @@ def compare(application_id, application_entity, uniq_seq, ocr_res_id): | ... | @@ -241,7 +255,7 @@ def compare(application_id, application_entity, uniq_seq, ocr_res_id): |
241 | order_individual_cus_info = new_dict | 255 | order_individual_cus_info = new_dict |
242 | 256 | ||
243 | # sep营业执照 | 257 | # sep营业执照 |
244 | if order_individual_cus_info.get('customerType') == consts.CUSTOMER_TYPE[5]: | 258 | if cus_type == consts.CUSTOMER_TYPE[5]: |
245 | field_compare(order_individual_cus_info, ocr_res_dict, consts.BL_OCR_FIELD, consts.TCSEP, res_set, | 259 | field_compare(order_individual_cus_info, ocr_res_dict, consts.BL_OCR_FIELD, consts.TCSEP, res_set, |
246 | sep_name=sep_name) | 260 | sep_name=sep_name) |
247 | # field_compare(order_individual_cus_info, ocr_res_dict, consts.BL_OCR_FIELD, consts.TCSEP, res_set) | 261 | # field_compare(order_individual_cus_info, ocr_res_dict, consts.BL_OCR_FIELD, consts.TCSEP, res_set) | ... | ... |
... | @@ -109,7 +109,7 @@ class Comparison: | ... | @@ -109,7 +109,7 @@ class Comparison: |
109 | if ocr_str == '' or ocr_str.strip() == '': | 109 | if ocr_str == '' or ocr_str.strip() == '': |
110 | return self.RESULT_NA, None | 110 | return self.RESULT_NA, None |
111 | try: | 111 | try: |
112 | ocr_lower = rmb_handler.to_rmb_lower() | 112 | ocr_lower = rmb_handler.to_rmb_lower(ocr_str) |
113 | res = self.build_res(float(input_str) == ocr_lower) | 113 | res = self.build_res(float(input_str) == ocr_lower) |
114 | # input_rmb_upper = to_rmb_upper(float(input_str)) | 114 | # input_rmb_upper = to_rmb_upper(float(input_str)) |
115 | # res = self.build_res(input_rmb_upper == ocr_str) | 115 | # res = self.build_res(input_rmb_upper == ocr_str) | ... | ... |
-
Please register or sign in to post a comment