fix bug
Showing
3 changed files
with
55 additions
and
27 deletions
... | @@ -1109,6 +1109,7 @@ OTHER_CLASSIFY_SET = {OTHER_CLASSIFY} | ... | @@ -1109,6 +1109,7 @@ OTHER_CLASSIFY_SET = {OTHER_CLASSIFY} |
1109 | LICENSE_CLASSIFY_SET_1 = {IC_CLASSIFY, VAT_CLASSIFY, MVC_CLASSIFY, MVI_CLASSIFY, UCI_CLASSIFY, DDA_CLASSIFY, HMH_CLASSIFY, JYPZ_CLASSIFY, INSURANCE_CLASSIFY} | 1109 | LICENSE_CLASSIFY_SET_1 = {IC_CLASSIFY, VAT_CLASSIFY, MVC_CLASSIFY, MVI_CLASSIFY, UCI_CLASSIFY, DDA_CLASSIFY, HMH_CLASSIFY, JYPZ_CLASSIFY, INSURANCE_CLASSIFY} |
1110 | LICENSE_CLASSIFY_SET_2 = {BL_CLASSIFY, EEP_CLASSIFY, DL_CLASSIFY, PP_CLASSIFY, BC_CLASSIFY} | 1110 | LICENSE_CLASSIFY_SET_2 = {BL_CLASSIFY, EEP_CLASSIFY, DL_CLASSIFY, PP_CLASSIFY, BC_CLASSIFY} |
1111 | 1111 | ||
1112 | BS_VERIFY_CLASSIFY = {11, 17} | ||
1112 | NYYH_CLASSIFY = {17, 18} | 1113 | NYYH_CLASSIFY = {17, 18} |
1113 | NYZS_CLASSIFY = 18 | 1114 | NYZS_CLASSIFY = 18 |
1114 | SPECIAL_NYZS_CLASSIFY = 50 | 1115 | SPECIAL_NYZS_CLASSIFY = 50 |
... | @@ -1517,7 +1518,7 @@ SE_HIL_CON_3_MAP = { | ... | @@ -1517,7 +1518,7 @@ SE_HIL_CON_3_MAP = { |
1517 | '销售经销商': (1, None, 5, '销售经销商', None), | 1518 | '销售经销商': (1, None, 5, '销售经销商', None), |
1518 | '合同编号-正文': (1, None, 5, '合同编号(正文)', None), | 1519 | '合同编号-正文': (1, None, 5, '合同编号(正文)', None), |
1519 | '姓名/名称': (4, None, 5, '签字页-承租人姓名', None), | 1520 | '姓名/名称': (4, None, 5, '签字页-承租人姓名', None), |
1520 | '自然人身份证件号码/法人执照号码': (4, None, 5, '签字页-自然人身份证件号码/法人执照号码', None), | 1521 | '自然人身份证件号码/法人执照号码': (4, None, 5, '签字页-承租人证件号码', None), |
1521 | '承租人签字': (4, None, 5, '签字页-承租人签章', None), | 1522 | '承租人签字': (4, None, 5, '签字页-承租人签章', None), |
1522 | } | 1523 | } |
1523 | 1524 | ||
... | @@ -1788,6 +1789,19 @@ BS_COMPARE_LOGIC = { | ... | @@ -1788,6 +1789,19 @@ BS_COMPARE_LOGIC = { |
1788 | 1789 | ||
1789 | SPECIAL_REASON = '主共借人未提供银行流水,含担保人需人工查看直系亲属关系' | 1790 | SPECIAL_REASON = '主共借人未提供银行流水,含担保人需人工查看直系亲属关系' |
1790 | SPECIAL_REASON_2 = '担保人未提供银行流水,需人工查看直系亲属关系' | 1791 | SPECIAL_REASON_2 = '担保人未提供银行流水,需人工查看直系亲属关系' |
1792 | SPECIAL_REASON_3 = '未提供银行流水' | ||
1793 | |||
1794 | BS_REASON = { | ||
1795 | '主共借人未提供银行流水,含担保人需人工查看直系亲属关系', | ||
1796 | '担保人未提供银行流水,需人工查看直系亲属关系', | ||
1797 | '未提供银行流水', | ||
1798 | '主共借人未提供银行流水', | ||
1799 | '担保人未提供银行流水', | ||
1800 | '主共借人银行流水打印日期超过15天', | ||
1801 | '担保人银行流水打印日期超过15天', | ||
1802 | '主共借人银行流水日期不满足3个月', | ||
1803 | '担保人银行流水日期不满足3个月' | ||
1804 | } | ||
1791 | 1805 | ||
1792 | # ['合同编号-每页', '合同编号-正文', '车辆识别代码', '车辆卖方', '车辆原始销售价格', '融资成本总额', '租期', '还款计划表', 'ASP项目详情', '购置税校验', '承租人法定代表人或授权代表'] | 1806 | # ['合同编号-每页', '合同编号-正文', '车辆识别代码', '车辆卖方', '车辆原始销售价格', '融资成本总额', '租期', '还款计划表', 'ASP项目详情', '购置税校验', '承租人法定代表人或授权代表'] |
1793 | # ['承租人姓名', '承租人证件号', '承租人签字', '共同承租人姓名', '共同承租人证件号', '共同承租人签字', '保证人姓名1', '保证人证件号1', '保证人签字1', '保证人姓名2', '保证人证件号2', '保证人签字2'] | 1807 | # ['承租人姓名', '承租人证件号', '承租人签字', '共同承租人姓名', '共同承租人证件号', '共同承租人签字', '保证人姓名1', '保证人证件号1', '保证人签字1', '保证人姓名2', '保证人证件号2', '保证人签字2'] |
... | @@ -1799,7 +1813,7 @@ HIL_CONTRACT_1_COMPARE_LOGIC = { | ... | @@ -1799,7 +1813,7 @@ HIL_CONTRACT_1_COMPARE_LOGIC = { |
1799 | '车辆原始销售价格': ('车辆原始销售价格', 'se_amount_str_compare', {}, '售后回租合同车辆原始销售价格与系统车辆价格不一致'), | 1813 | '车辆原始销售价格': ('车辆原始销售价格', 'se_amount_str_compare', {}, '售后回租合同车辆原始销售价格与系统车辆价格不一致'), |
1800 | '融资成本总额': ('融资成本总额', 'se_amount_str_compare', {}, '售后回租合同ASP融资成本总额与系统不一致'), | 1814 | '融资成本总额': ('融资成本总额', 'se_amount_str_compare', {}, '售后回租合同ASP融资成本总额与系统不一致'), |
1801 | '租期': ('租期', 'se_contain_compare', {}, '售后回租合同首页中贷款期限系统不一致'), | 1815 | '租期': ('租期', 'se_contain_compare', {}, '售后回租合同首页中贷款期限系统不一致'), |
1802 | '还款计划表': ('还款计划表', 'se_schedule_compare', {"value_idx": 3}, '售后回租合同还款计划表与系统不一致'), | 1816 | '还款计划表': ('还款计划表', 'se_schedule_compare', {"value_idx": 1}, '售后回租合同还款计划表与系统不一致'), |
1803 | 'ASP项目详情': ('ASP项目详情', 'se_asp_compare', {}, '售后回租合同ASP名称或者金额与系统不一致'), | 1817 | 'ASP项目详情': ('ASP项目详情', 'se_asp_compare', {}, '售后回租合同ASP名称或者金额与系统不一致'), |
1804 | '承租人法定代表人或授权代表': ('承租人法定代表人或授权代表', 'se_name_compare', {}, '售后回租合同承租人法定代表人或授权代表与系统不一致'), | 1818 | '承租人法定代表人或授权代表': ('承租人法定代表人或授权代表', 'se_name_compare', {}, '售后回租合同承租人法定代表人或授权代表与系统不一致'), |
1805 | 1819 | ... | ... |
... | @@ -311,29 +311,32 @@ class BSWorkbook(Workbook): | ... | @@ -311,29 +311,32 @@ class BSWorkbook(Workbook): |
311 | month_mapping.setdefault(item, []).append( | 311 | month_mapping.setdefault(item, []).append( |
312 | (ws.title, idx_list[i] + min_row, idx_list[i + 1] + min_row - 1, day_mean)) | 312 | (ws.title, idx_list[i] + min_row, idx_list[i + 1] + min_row - 1, day_mean)) |
313 | 313 | ||
314 | def build_metadata_rows(self, confidence, code, verify_list, print_time, start_date, end_date, res_count_tuple): | 314 | def build_metadata_rows(self, confidence, code, verify_list, print_time, start_date, end_date, res_count_tuple, is_verify_classify): |
315 | if start_date is None or end_date is None: | ||
316 | timedelta = None | ||
317 | else: | ||
318 | timedelta = (end_date - start_date).days | ||
319 | verify_res = '正常' | ||
320 | if len(verify_list) > 0: | ||
321 | verify_res = '疑似伪造' | ||
322 | metadata_rows = [ | 315 | metadata_rows = [ |
323 | ('流水识别置信度', confidence), | 316 | ('流水识别置信度', confidence), |
324 | ('流水检测结果', verify_res), | ||
325 | ('图片总数', res_count_tuple[0]), | 317 | ('图片总数', res_count_tuple[0]), |
326 | ('识别成功', res_count_tuple[1]), | 318 | ('识别成功', res_count_tuple[1]), |
327 | self.blank_row, | 319 | self.blank_row, |
328 | self.code_header, | ||
329 | ] | 320 | ] |
330 | metadata_rows.extend(code) | ||
331 | 321 | ||
322 | verify_highlight_row = [] | ||
323 | if is_verify_classify: | ||
324 | verify_res = '疑似伪造' if len(verify_list) > 0 else '正常' | ||
325 | metadata_rows.append(('流水检测结果', verify_res)) | ||
332 | if len(verify_list) > 0: | 326 | if len(verify_list) > 0: |
333 | metadata_rows.append(self.blank_row) | ||
334 | metadata_rows.append(self.verify_header) | 327 | metadata_rows.append(self.verify_header) |
335 | metadata_rows.extend(verify_list) | 328 | metadata_rows.extend(verify_list) |
329 | for r in range(5, len(metadata_rows)+1): | ||
330 | verify_highlight_row.append(r) | ||
331 | |||
332 | metadata_rows.append(self.blank_row) | ||
333 | metadata_rows.append(self.code_header) | ||
334 | metadata_rows.extend(code) | ||
336 | 335 | ||
336 | if start_date is None or end_date is None: | ||
337 | timedelta = None | ||
338 | else: | ||
339 | timedelta = (end_date - start_date).days | ||
337 | metadata_rows.extend( | 340 | metadata_rows.extend( |
338 | [self.blank_row, | 341 | [self.blank_row, |
339 | self.date_header, | 342 | self.date_header, |
... | @@ -341,22 +344,24 @@ class BSWorkbook(Workbook): | ... | @@ -341,22 +344,24 @@ class BSWorkbook(Workbook): |
341 | self.blank_row, | 344 | self.blank_row, |
342 | self.interest_keyword_header] | 345 | self.interest_keyword_header] |
343 | ) | 346 | ) |
344 | return metadata_rows | 347 | return metadata_rows, verify_highlight_row |
345 | 348 | ||
346 | def build_meta_sheet(self, role_name, card, confidence, code, verify_list, print_time, start_date, end_date, res_count_tuple): | 349 | def build_meta_sheet(self, role_name, card, confidence, code, verify_list, print_time, start_date, end_date, |
347 | metadata_rows = self.build_metadata_rows(confidence, code, verify_list, print_time, start_date, end_date, res_count_tuple) | 350 | res_count_tuple, is_verify_classify): |
351 | metadata_rows, verify_highlight_row = self.build_metadata_rows( | ||
352 | confidence, code, verify_list, print_time, start_date, end_date, res_count_tuple, is_verify_classify) | ||
348 | if not isinstance(role_name, str): | 353 | if not isinstance(role_name, str): |
349 | role_name = consts.UNKNOWN_ROLE | 354 | role_name = consts.UNKNOWN_ROLE |
350 | ms = self.create_sheet('{0}{1}({2})'.format(self.meta_sheet_title, role_name, card)) | 355 | ms = self.create_sheet('{0}{1}({2})'.format(self.meta_sheet_title, role_name, card)) |
351 | for row in metadata_rows: | 356 | for row in metadata_rows: |
352 | ms.append(row) | 357 | ms.append(row) |
353 | if len(verify_list) > 0: | 358 | for row in verify_highlight_row: |
354 | for cell in ms[2]: | 359 | for cell in ms[row]: |
355 | cell.fill = self.amount_fill | 360 | cell.fill = self.amount_fill |
356 | if res_count_tuple[0] != res_count_tuple[1]: | 361 | if res_count_tuple[0] != res_count_tuple[1]: |
357 | for cell in ms[3]: | 362 | for cell in ms[2]: |
358 | cell.fill = self.amount_fill | 363 | cell.fill = self.amount_fill |
359 | for cell in ms[4]: | 364 | for cell in ms[3]: |
360 | cell.fill = self.amount_fill | 365 | cell.fill = self.amount_fill |
361 | return ms | 366 | return ms |
362 | 367 | ||
... | @@ -672,6 +677,7 @@ class BSWorkbook(Workbook): | ... | @@ -672,6 +677,7 @@ class BSWorkbook(Workbook): |
672 | 677 | ||
673 | # 2.元信息提取表 | 678 | # 2.元信息提取表 |
674 | confidence = self.get_confidence(max_find_count) | 679 | confidence = self.get_confidence(max_find_count) |
680 | is_verify_classify = classify in consts.BS_VERIFY_CLASSIFY | ||
675 | ms = self.build_meta_sheet(role_name, | 681 | ms = self.build_meta_sheet(role_name, |
676 | new_card, | 682 | new_card, |
677 | confidence, | 683 | confidence, |
... | @@ -680,7 +686,8 @@ class BSWorkbook(Workbook): | ... | @@ -680,7 +686,8 @@ class BSWorkbook(Workbook): |
680 | summary.get('print_time'), | 686 | summary.get('print_time'), |
681 | start_date, | 687 | start_date, |
682 | end_date, | 688 | end_date, |
683 | res_count_tuple) | 689 | res_count_tuple, |
690 | is_verify_classify) | ||
684 | 691 | ||
685 | # 3.创建月份表、提取/高亮关键行 | 692 | # 3.创建月份表、提取/高亮关键行 |
686 | # 倒序处理 | 693 | # 倒序处理 | ... | ... |
... | @@ -1628,7 +1628,7 @@ def se_bs_compare(license_en, ocr_res_dict, strip_list): | ... | @@ -1628,7 +1628,7 @@ def se_bs_compare(license_en, ocr_res_dict, strip_list): |
1628 | if isinstance(value, list): | 1628 | if isinstance(value, list): |
1629 | value = json.dumps(value, ensure_ascii=False) | 1629 | value = json.dumps(value, ensure_ascii=False) |
1630 | result_field_list.append((name, value, consts.RESULT_N, empty_str, empty_str, ErrorType.NF.value, | 1630 | result_field_list.append((name, value, consts.RESULT_N, empty_str, empty_str, ErrorType.NF.value, |
1631 | '未提供银行流水')) | 1631 | consts.SPECIAL_REASON_3)) |
1632 | 1632 | ||
1633 | return result_field_list, field_img_path_dict | 1633 | return result_field_list, field_img_path_dict |
1634 | 1634 | ||
... | @@ -2062,6 +2062,7 @@ def se_compare_process(compare_info, ocr_res_dict): | ... | @@ -2062,6 +2062,7 @@ def se_compare_process(compare_info, ocr_res_dict): |
2062 | result_field_list, field_img_path_dict = se_bs_compare(license_en, ocr_res_dict, strip_list) | 2062 | result_field_list, field_img_path_dict = se_bs_compare(license_en, ocr_res_dict, strip_list) |
2063 | else: | 2063 | else: |
2064 | result_field_list, _, field_img_path_dict = se_compare_license(license_en, ocr_res_dict, strip_list) | 2064 | result_field_list, _, field_img_path_dict = se_compare_license(license_en, ocr_res_dict, strip_list) |
2065 | |||
2065 | for name, value, result, ocr_str, img_path, error_type, cn_reason in result_field_list: | 2066 | for name, value, result, ocr_str, img_path, error_type, cn_reason in result_field_list: |
2066 | total_fields += 1 | 2067 | total_fields += 1 |
2067 | if result == consts.RESULT_N: | 2068 | if result == consts.RESULT_N: |
... | @@ -2091,6 +2092,7 @@ def se_compare_process(compare_info, ocr_res_dict): | ... | @@ -2091,6 +2092,7 @@ def se_compare_process(compare_info, ocr_res_dict): |
2091 | if failed_count == 0: | 2092 | if failed_count == 0: |
2092 | failure_reason_str = '' | 2093 | failure_reason_str = '' |
2093 | cn_failure_reason_str = '' | 2094 | cn_failure_reason_str = '' |
2095 | bs_failure_reason_str = '' | ||
2094 | else: | 2096 | else: |
2095 | reason_list = [] | 2097 | reason_list = [] |
2096 | for key, value in failure_reason.items(): | 2098 | for key, value in failure_reason.items(): |
... | @@ -2098,16 +2100,22 @@ def se_compare_process(compare_info, ocr_res_dict): | ... | @@ -2098,16 +2100,22 @@ def se_compare_process(compare_info, ocr_res_dict): |
2098 | value_str = json.dumps(value) | 2100 | value_str = json.dumps(value) |
2099 | reason_list.append('{0}: {1}'.format(key, value_str)) | 2101 | reason_list.append('{0}: {1}'.format(key, value_str)) |
2100 | failure_reason_str = '、'.join(reason_list) | 2102 | failure_reason_str = '、'.join(reason_list) |
2103 | |||
2101 | tmp_set = set() | 2104 | tmp_set = set() |
2102 | last_cn_reason_list = [] | 2105 | last_cn_reason_list = [] |
2106 | bs_cn_reason_list = [] | ||
2103 | for i in cn_reason_list: | 2107 | for i in cn_reason_list: |
2104 | if i in tmp_set: | 2108 | if i in tmp_set: |
2105 | continue | 2109 | continue |
2110 | elif i in consts.BS_REASON: | ||
2111 | tmp_set.add(i) | ||
2112 | bs_cn_reason_list.append(i) | ||
2106 | else: | 2113 | else: |
2107 | tmp_set.add(i) | 2114 | tmp_set.add(i) |
2108 | last_cn_reason_list.append(i) | 2115 | last_cn_reason_list.append(i) |
2109 | cn_failure_reason_str = '\n'.join(last_cn_reason_list) | 2116 | cn_failure_reason_str = '\n'.join(last_cn_reason_list) |
2110 | return compare_result, total_fields, failed_count, successful_at_this_level, failure_reason_str, cn_failure_reason_str | 2117 | bs_failure_reason_str = '\n'.join(bs_cn_reason_list) |
2118 | return compare_result, total_fields, failed_count, successful_at_this_level, failure_reason_str, cn_failure_reason_str, bs_failure_reason_str | ||
2111 | 2119 | ||
2112 | 2120 | ||
2113 | def se_result_detect(ocr_res_dict): | 2121 | def se_result_detect(ocr_res_dict): |
... | @@ -2131,8 +2139,7 @@ def se_compare(application_id, application_entity, ocr_res_id, last_obj, ocr_res | ... | @@ -2131,8 +2139,7 @@ def se_compare(application_id, application_entity, ocr_res_id, last_obj, ocr_res |
2131 | else: | 2139 | else: |
2132 | compare_info = get_se_compare_info(last_obj, application_entity, detect_list) | 2140 | compare_info = get_se_compare_info(last_obj, application_entity, detect_list) |
2133 | application_version = last_obj.application_version | 2141 | application_version = last_obj.application_version |
2134 | compare_result, total_fields, failed_count, successful_at_this_level, failure_reason_str, cn_failure_reason_str = se_compare_process( | 2142 | 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) |
2135 | compare_info, ocr_res_dict) | ||
2136 | compare_log.info('{0} [SE] [compare success] [entity={1}] [id={2}] [ocr_res_id={3}] [result={4}]'.format( | 2143 | compare_log.info('{0} [SE] [compare success] [entity={1}] [id={2}] [ocr_res_id={3}] [result={4}]'.format( |
2137 | log_base, application_entity, application_id, ocr_res_id, compare_result)) | 2144 | log_base, application_entity, application_id, ocr_res_id, compare_result)) |
2138 | except Exception as e: | 2145 | except Exception as e: |
... | @@ -2198,7 +2205,7 @@ def se_compare(application_id, application_entity, ocr_res_id, last_obj, ocr_res | ... | @@ -2198,7 +2205,7 @@ def se_compare(application_id, application_entity, ocr_res_id, last_obj, ocr_res |
2198 | "Result_Message": "Pass" if successful_at_this_level else "Fail", | 2205 | "Result_Message": "Pass" if successful_at_this_level else "Fail", |
2199 | "Failure_Reason": cn_failure_reason_str, | 2206 | "Failure_Reason": cn_failure_reason_str, |
2200 | "Application_Number": application_id, | 2207 | "Application_Number": application_id, |
2201 | "Bank_Statement": "", | 2208 | "Bank_Statement": bs_failure_reason_str, |
2202 | "Link_URL": application_link, | 2209 | "Link_URL": application_link, |
2203 | "OCR_Version": 1, | 2210 | "OCR_Version": 1, |
2204 | "Origin": consts.INFO_SOURCE[1] | 2211 | "Origin": consts.INFO_SOURCE[1] | ... | ... |
-
Please register or sign in to post a comment