0b550510 by 王聪

Merge branch 'feature/uat-tmp' of http://gitlab.situdata.com/zhouweiqi/bmw-ocr into feature/uat-tmp

2 parents 2d500b7a 76b3bbd5
......@@ -1168,6 +1168,7 @@ MS_ERROR_COL = (5, 6)
WECHART_CLASSIFY = 12
NEW_ZHIFUBAO_CLASSIFY = 48
ALI_WECHART_CLASSIFY = {12, 13, 48}
JSYH_CLASSIFY = {11, 27, 34}
WECHART_ERROR_COL = (1, 2)
SPECIAL_HEADERS_MAPPING = copy.deepcopy(HEADERS_MAPPING)
SPECIAL_HEADERS_MAPPING.update(
......
......@@ -2009,6 +2009,9 @@ class Command(BaseCommand, LoggerMixin):
report_list[5] = BSCheckResult.CHECK_FAILED.value
finally:
self.online_log.info('{0} [task={1}] [license_summary={2}] '
'[contract_result_compare={3}]'.format(self.log_base, task_str,
license_summary, contract_result_compare))
self.rebuild_contract(license_summary, contract_result_compare)
bs_rebuild = self.rebuild_bs(merged_bs_summary)
......
......@@ -27,6 +27,7 @@ class RequestTeam(NamedEnum):
SETTLEMENT = (1, 'SETTLEMENT')
CONTRACTMANAGEMENT = (2, 'CONTRACTMANAGEMENT')
CONTROLLING = (3, 'CONTROLLING')
INSURANCE = (4, 'INSURANCE')
class RequestTrigger(NamedEnum):
......
......@@ -39,6 +39,18 @@ class BSWorkbook(Workbook):
self.MAX_MEAN = 31
self.need_follow = False
# @staticmethod
# def date_calibration(date_str):
# result = True
# try:
# if date_str[-2] not in ['20', '21']:
# result = False
# if date_str[-5:-3] not in ['03', '06', '09', '12']:
# result = False
# except Exception as e:
# result = False
# return result
@staticmethod
def replace_newline(queryset_value):
new_set = set()
......@@ -338,7 +350,7 @@ class BSWorkbook(Workbook):
metadata_rows.append(('Producer', producer))
if len(author) > 0:
metadata_highlight_row.append(6)
if 'iText' not in producer and 'Qt' not in producer and 'Haru Free' not in producer:
if 'iText' not in producer and 'Qt' not in producer and 'Haru Free' not in producer and 'OpenPDF' not in producer:
metadata_highlight_row.append(7)
metadata_rows.append(self.blank_row)
......@@ -496,6 +508,7 @@ class BSWorkbook(Workbook):
tmp_ws = self.create_sheet('tmp_ws')
tmp2_ws = self.create_sheet('tmp2_ws')
tmp3_ws = self.create_sheet('tmp3_ws')
if classify in consts.ALI_WECHART_CLASSIFY:
high_light_keyword = self.wechat_keyword
else:
......@@ -629,7 +642,7 @@ class BSWorkbook(Workbook):
# 关键词1提取
if summary_cell_value in self.interest_keyword:
new_amount_cell_value = None if amount_cell is None else amount_cell.value
ms.append((summary_cell_value, date_cell_value, new_amount_cell_value))
tmp3_ws.append((summary_cell_value, date_cell_value, new_amount_cell_value))
# 关键词2提取至临时表
elif summary_cell_value in self.salary_keyword:
new_amount_cell_value = None if amount_cell is None else amount_cell.value
......@@ -657,6 +670,18 @@ class BSWorkbook(Workbook):
# if summary_cell_idx is not None:
# new_ws[row][summary_cell_idx].fill = self.amount_fill
# 关键词1信息提取:结息
for row in tmp3_ws.iter_rows(values_only=True):
ms.append(row)
# # 建设银行
# if classify in consts.JSYH_CLASSIFY:
# if isinstance(row[1], str) and self.date_calibration(row[1]):
# pass
# else:
# for cell in ms[ms.max_row]:
# cell.fill = self.amount_fill
self.remove(tmp3_ws)
# 关键词2信息提取
ms.append(self.blank_row)
ms.append(self.salary_keyword_header)
......
......@@ -257,6 +257,7 @@ se_compare_content = {
'fsmSpecialCar': fields.Boolean(required=False),
'fsmBestPrice': fields.Boolean(required=False),
'isAutoSettlement': fields.Boolean(required=False),
'fsmLandingDealer': fields.Str(required=False, validate=validate.Length(max=1024)),
'individualCusInfo': fields.List(fields.Nested(se_individual_args),
required=True, validate=validate.Length(min=1, max=4)),
......@@ -592,12 +593,12 @@ class UploadDocView(GenericView, DocHandler):
if business_type == consts.HIL_PREFIX:
if document_scheme == RequestTeam.ACCEPTANCE.name:
result_class = HILOCRResult
elif document_scheme == RequestTeam.SETTLEMENT.name:
elif document_scheme == RequestTeam.SETTLEMENT.name or document_scheme == RequestTeam.INSURANCE.name:
result_class = HILSEOCRResult
elif business_type == consts.AFC_PREFIX:
if document_scheme == RequestTeam.ACCEPTANCE.name:
result_class = AFCOCRResult
elif document_scheme == RequestTeam.SETTLEMENT.name:
elif document_scheme == RequestTeam.SETTLEMENT.name or document_scheme == RequestTeam.INSURANCE.name:
result_class = AFCSEOCRResult
ocr_result_obj = result_class.objects.filter(application_id=application_id).first()
......@@ -610,6 +611,7 @@ class UploadDocView(GenericView, DocHandler):
ocr_result_obj.fsm_activited = 1
ocr_result_obj.save()
self.running_log.info('[doc upload applicationId-{0}] [ocr result saved]'.format(application_id))
if data_source == consts.DATA_SOURCE_LIST[1]:
if document_name.endswith('-证书.pdf') or document_name.endswith('-证书'):
self.running_log.info('[doc upload success] [eapp license skip] [args={0}]'.format(args))
......@@ -880,6 +882,7 @@ class SECompareView(GenericView, PreSEHandler):
fsm_flag = content.get('fsmFlag', False)
fsm_special_car = content.get('fsmSpecialCar', False)
fsm_best_price = content.get('fsmBestPrice', False)
fsm_landing_dealer = content.get('fsmLandingDealer')
if fsm_special_car:
compare_result = {
......
......@@ -6,6 +6,7 @@ class HMHRetriever:
def __init__(self):
self.words_str = 'words'
self.position_str = 'location'
self.fix_hava_str = '有'
self.default_position = [0, 0, 0, 0]
self.search_fields_list = [
('借款/承租人姓名', ''),
......@@ -51,7 +52,8 @@ class HMHRetriever:
for name_date_tuple in name_date_list:
if len(name_date_tuple) == 2:
result[self.search_fields_list[4][0]] = {
self.words_str: '{0} {1}'.format(name_date_tuple[0].replace('\u3000', '').strip(), name_date_tuple[1]),
# self.words_str: '{0} {1}'.format(name_date_tuple[0].replace('\u3000', '').strip(), name_date_tuple[1]),
self.words_str: self.fix_hava_str,
self.position_str: bbox
}
is_find_name_date = True
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!