cc6cdef0 by 周伟奇

fix bug

1 parent 02656f91
......@@ -1134,6 +1134,7 @@ NYYH_CLASSIFY = {17, 18}
NYZS_CLASSIFY = 18
SPECIAL_NYZS_CLASSIFY = 50
MS_CLASSIFY = 21
SPECIAL_ZSYH_CLASSIFY = 20
MS_ERROR_COL = (5, 6)
WECHART_CLASSIFY = 12
NEW_ZHIFUBAO_CLASSIFY = 48
......
......@@ -6,6 +6,7 @@ import base64
import signal
import requests
import traceback
from datetime import datetime
from django.core.management import BaseCommand
from multiprocessing import Process
from openpyxl import load_workbook, Workbook
......@@ -316,7 +317,7 @@ class Command(BaseCommand, LoggerMixin):
true_file_set.add(os_error_filename_set.pop())
for name in true_file_set:
time.sleep(10)
unique_folder_name = '{0}_{1}'.format(time.time(), name)
unique_folder_name = '{0}_{1}'.format(datetime.now().strftime('%Y-%m-%d_%H:%M:%S'), name)
path = os.path.join(input_dir, name)
try:
......
......@@ -197,7 +197,9 @@ class BSWorkbook(Workbook):
return date_col, min_row
@staticmethod
def get_confidence(max_find_count):
def get_confidence(max_find_count, classify):
if classify == consts.NEW_ZHIFUBAO_CLASSIFY:
return round(random.uniform(95, 100), 2)
if max_find_count == 0:
return round(random.uniform(75, 80), 2)
elif max_find_count == 1:
......@@ -498,8 +500,13 @@ class BSWorkbook(Workbook):
new_ws.append(header)
for part in parts:
ws = self.get_sheet_by_name(part[0])
is_first_row = True
for row_value in ws.iter_rows(min_row=part[1], max_row=part[2], values_only=True):
if any(row_value):
if classify == consts.SPECIAL_ZSYH_CLASSIFY and is_first_row:
if 'Date' in row_value and 'Balance' in row_value:
is_first_row = False
continue
if classify == consts.WECHART_CLASSIFY:
row_value = self.rm_cn_char(row_value, *consts.WECHART_ERROR_COL)
elif classify == consts.MS_CLASSIFY:
......@@ -507,6 +514,7 @@ class BSWorkbook(Workbook):
elif classify in consts.NYYH_CLASSIFY:
row_value = self.rm_second_row(row_value, amount_cell_idx, over_cell_idx)
new_ws.append(row_value)
is_first_row = False
amount_mapping = {}
amount_fill_row = set()
......@@ -705,7 +713,7 @@ class BSWorkbook(Workbook):
end_date = max(date_list) if end_date is None else end_date
# 2.元信息提取表
confidence = self.get_confidence(max_find_count)
confidence = self.get_confidence(max_find_count, classify)
is_verify_classify = classify in consts.BS_VERIFY_CLASSIFY
ms, timedelta = self.build_meta_sheet(role_name,
new_card,
......
......@@ -1108,7 +1108,7 @@ def get_se_cms_compare_info_auto(last_obj, application_entity, auto=True):
# 银行流水 --------------------------------------------------------------------
if cms_info.get('autoApprovedDetails', {}).get('aaType', '') in ['CAA1', 'CAA2'] and \
cms_info.get('autoApprovedDetails', {}).get('PolicyComments', '') != '此申请无需提供流水':
'无需提供银行流水' not in cms_info.get('autoApprovedDetails', {}).get('PolicyComments', ''):
date_timedelta = 60 if auto else 90
bs_role_list = []
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
# 银行流水 --------------------------------------------------------------------
if cms_info.get('autoApprovedDetails', {}).get('aaType', '') in ['CAA1', 'CAA2'] and \
cms_info.get('autoApprovedDetails', {}).get('PolicyComments', '') != '无需提供银行流水。':
'无需提供银行流水' not in cms_info.get('autoApprovedDetails', {}).get('PolicyComments', ''):
date_timedelta = 60 if auto else 90
bs_role_list = []
for applicant_type in consts.APPLICANT_TYPE_ORDER[:2]:
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!