fix bug
Showing
4 changed files
with
15 additions
and
5 deletions
... | @@ -1134,6 +1134,7 @@ NYYH_CLASSIFY = {17, 18} | ... | @@ -1134,6 +1134,7 @@ NYYH_CLASSIFY = {17, 18} |
1134 | NYZS_CLASSIFY = 18 | 1134 | NYZS_CLASSIFY = 18 |
1135 | SPECIAL_NYZS_CLASSIFY = 50 | 1135 | SPECIAL_NYZS_CLASSIFY = 50 |
1136 | MS_CLASSIFY = 21 | 1136 | MS_CLASSIFY = 21 |
1137 | SPECIAL_ZSYH_CLASSIFY = 20 | ||
1137 | MS_ERROR_COL = (5, 6) | 1138 | MS_ERROR_COL = (5, 6) |
1138 | WECHART_CLASSIFY = 12 | 1139 | WECHART_CLASSIFY = 12 |
1139 | NEW_ZHIFUBAO_CLASSIFY = 48 | 1140 | NEW_ZHIFUBAO_CLASSIFY = 48 | ... | ... |
... | @@ -6,6 +6,7 @@ import base64 | ... | @@ -6,6 +6,7 @@ import base64 |
6 | import signal | 6 | import signal |
7 | import requests | 7 | import requests |
8 | import traceback | 8 | import traceback |
9 | from datetime import datetime | ||
9 | from django.core.management import BaseCommand | 10 | from django.core.management import BaseCommand |
10 | from multiprocessing import Process | 11 | from multiprocessing import Process |
11 | from openpyxl import load_workbook, Workbook | 12 | from openpyxl import load_workbook, Workbook |
... | @@ -316,7 +317,7 @@ class Command(BaseCommand, LoggerMixin): | ... | @@ -316,7 +317,7 @@ class Command(BaseCommand, LoggerMixin): |
316 | true_file_set.add(os_error_filename_set.pop()) | 317 | true_file_set.add(os_error_filename_set.pop()) |
317 | for name in true_file_set: | 318 | for name in true_file_set: |
318 | time.sleep(10) | 319 | time.sleep(10) |
319 | unique_folder_name = '{0}_{1}'.format(time.time(), name) | 320 | unique_folder_name = '{0}_{1}'.format(datetime.now().strftime('%Y-%m-%d_%H:%M:%S'), name) |
320 | path = os.path.join(input_dir, name) | 321 | path = os.path.join(input_dir, name) |
321 | 322 | ||
322 | try: | 323 | try: | ... | ... |
... | @@ -197,7 +197,9 @@ class BSWorkbook(Workbook): | ... | @@ -197,7 +197,9 @@ class BSWorkbook(Workbook): |
197 | return date_col, min_row | 197 | return date_col, min_row |
198 | 198 | ||
199 | @staticmethod | 199 | @staticmethod |
200 | def get_confidence(max_find_count): | 200 | def get_confidence(max_find_count, classify): |
201 | if classify == consts.NEW_ZHIFUBAO_CLASSIFY: | ||
202 | return round(random.uniform(95, 100), 2) | ||
201 | if max_find_count == 0: | 203 | if max_find_count == 0: |
202 | return round(random.uniform(75, 80), 2) | 204 | return round(random.uniform(75, 80), 2) |
203 | elif max_find_count == 1: | 205 | elif max_find_count == 1: |
... | @@ -498,8 +500,13 @@ class BSWorkbook(Workbook): | ... | @@ -498,8 +500,13 @@ class BSWorkbook(Workbook): |
498 | new_ws.append(header) | 500 | new_ws.append(header) |
499 | for part in parts: | 501 | for part in parts: |
500 | ws = self.get_sheet_by_name(part[0]) | 502 | ws = self.get_sheet_by_name(part[0]) |
503 | is_first_row = True | ||
501 | for row_value in ws.iter_rows(min_row=part[1], max_row=part[2], values_only=True): | 504 | for row_value in ws.iter_rows(min_row=part[1], max_row=part[2], values_only=True): |
502 | if any(row_value): | 505 | if any(row_value): |
506 | if classify == consts.SPECIAL_ZSYH_CLASSIFY and is_first_row: | ||
507 | if 'Date' in row_value and 'Balance' in row_value: | ||
508 | is_first_row = False | ||
509 | continue | ||
503 | if classify == consts.WECHART_CLASSIFY: | 510 | if classify == consts.WECHART_CLASSIFY: |
504 | row_value = self.rm_cn_char(row_value, *consts.WECHART_ERROR_COL) | 511 | row_value = self.rm_cn_char(row_value, *consts.WECHART_ERROR_COL) |
505 | elif classify == consts.MS_CLASSIFY: | 512 | elif classify == consts.MS_CLASSIFY: |
... | @@ -507,6 +514,7 @@ class BSWorkbook(Workbook): | ... | @@ -507,6 +514,7 @@ class BSWorkbook(Workbook): |
507 | elif classify in consts.NYYH_CLASSIFY: | 514 | elif classify in consts.NYYH_CLASSIFY: |
508 | row_value = self.rm_second_row(row_value, amount_cell_idx, over_cell_idx) | 515 | row_value = self.rm_second_row(row_value, amount_cell_idx, over_cell_idx) |
509 | new_ws.append(row_value) | 516 | new_ws.append(row_value) |
517 | is_first_row = False | ||
510 | 518 | ||
511 | amount_mapping = {} | 519 | amount_mapping = {} |
512 | amount_fill_row = set() | 520 | amount_fill_row = set() |
... | @@ -705,7 +713,7 @@ class BSWorkbook(Workbook): | ... | @@ -705,7 +713,7 @@ class BSWorkbook(Workbook): |
705 | end_date = max(date_list) if end_date is None else end_date | 713 | end_date = max(date_list) if end_date is None else end_date |
706 | 714 | ||
707 | # 2.元信息提取表 | 715 | # 2.元信息提取表 |
708 | confidence = self.get_confidence(max_find_count) | 716 | confidence = self.get_confidence(max_find_count, classify) |
709 | is_verify_classify = classify in consts.BS_VERIFY_CLASSIFY | 717 | is_verify_classify = classify in consts.BS_VERIFY_CLASSIFY |
710 | ms, timedelta = self.build_meta_sheet(role_name, | 718 | ms, timedelta = self.build_meta_sheet(role_name, |
711 | new_card, | 719 | new_card, | ... | ... |
... | @@ -1108,7 +1108,7 @@ def get_se_cms_compare_info_auto(last_obj, application_entity, auto=True): | ... | @@ -1108,7 +1108,7 @@ def get_se_cms_compare_info_auto(last_obj, application_entity, auto=True): |
1108 | 1108 | ||
1109 | # 银行流水 -------------------------------------------------------------------- | 1109 | # 银行流水 -------------------------------------------------------------------- |
1110 | if cms_info.get('autoApprovedDetails', {}).get('aaType', '') in ['CAA1', 'CAA2'] and \ | 1110 | if cms_info.get('autoApprovedDetails', {}).get('aaType', '') in ['CAA1', 'CAA2'] and \ |
1111 | cms_info.get('autoApprovedDetails', {}).get('PolicyComments', '') != '此申请无需提供流水': | 1111 | '无需提供银行流水' not in cms_info.get('autoApprovedDetails', {}).get('PolicyComments', ''): |
1112 | date_timedelta = 60 if auto else 90 | 1112 | date_timedelta = 60 if auto else 90 |
1113 | bs_role_list = [] | 1113 | bs_role_list = [] |
1114 | for applicant_type in consts.APPLICANT_TYPE_ORDER[:2]: | 1114 | for applicant_type in consts.APPLICANT_TYPE_ORDER[:2]: |
... | @@ -1628,7 +1628,7 @@ def get_se_cms_compare_info(last_obj, application_entity, detect_list, auto=Fals | ... | @@ -1628,7 +1628,7 @@ def get_se_cms_compare_info(last_obj, application_entity, detect_list, auto=Fals |
1628 | 1628 | ||
1629 | # 银行流水 -------------------------------------------------------------------- | 1629 | # 银行流水 -------------------------------------------------------------------- |
1630 | if cms_info.get('autoApprovedDetails', {}).get('aaType', '') in ['CAA1', 'CAA2'] and \ | 1630 | if cms_info.get('autoApprovedDetails', {}).get('aaType', '') in ['CAA1', 'CAA2'] and \ |
1631 | cms_info.get('autoApprovedDetails', {}).get('PolicyComments', '') != '无需提供银行流水。': | 1631 | '无需提供银行流水' not in cms_info.get('autoApprovedDetails', {}).get('PolicyComments', ''): |
1632 | date_timedelta = 60 if auto else 90 | 1632 | date_timedelta = 60 if auto else 90 |
1633 | bs_role_list = [] | 1633 | bs_role_list = [] |
1634 | for applicant_type in consts.APPLICANT_TYPE_ORDER[:2]: | 1634 | for applicant_type in consts.APPLICANT_TYPE_ORDER[:2]: | ... | ... |
-
Please register or sign in to post a comment