d204dc5f by 周伟奇

fix bug F3

1 parent 0f197a8b
......@@ -1139,7 +1139,7 @@ EN_HEADER_LIST = ['Date', 'Currency', 'Amount', 'Balance', 'TransactionType']
MS_ERROR_COL = (5, 6)
WECHART_CLASSIFY = 12
NEW_ZHIFUBAO_CLASSIFY = 48
ALI_WECHART_CLASSIFY = {12, 13}
ALI_WECHART_CLASSIFY = {12, 13, 48}
WECHART_ERROR_COL = (1, 2)
SPECIAL_HEADERS_MAPPING = copy.deepcopy(HEADERS_MAPPING)
SPECIAL_HEADERS_MAPPING.update(
......
......@@ -35,6 +35,7 @@ class Command(BaseCommand, LoggerMixin):
self.field_map = {
# sheet_name, key_field, side_field_order, src_field_order
consts.IC_CLASSIFY: (consts.IC_CN_NAME, '有效期限', consts.IC_FIELD_ORDER_3, consts.IC_FIELD_ORDER_2),
consts.BL_CLASSIFY: (consts.BL_CN_NAME, None, None, consts.BL_FIELD_ORDER),
}
self.pdf_name_map = {
......@@ -119,14 +120,14 @@ class Command(BaseCommand, LoggerMixin):
if ocr_res_2.get('ErrorCode') in consts.SUCCESS_CODE_SET:
if pid == consts.BC_PID:
ocr_res.append(ocr_res_2)
ocr_res.setdefault(classify, []).append(ocr_res_2)
else:
# 营业执照等
for result_dict in ocr_res_2.get('ResultList', []):
res_dict = {}
for field_dict in result_dict.get('FieldList', []):
res_dict[field_dict.get('chn_key', '')] = field_dict.get('value', '')
ocr_res.append(res_dict)
ocr_res.setdefault(classify, []).append(res_dict)
break
def wb_process(self, ocr_res, output_dir):
......@@ -139,6 +140,8 @@ class Command(BaseCommand, LoggerMixin):
wb = Workbook()
for c, res_list in ocr_res.items():
if c not in self.field_map:
continue
sheet_name, key_field, side_field_order, src_field_order = self.field_map.get(c)
if sheet_name in wb.sheetnames:
ws = wb.get_sheet_by_name(sheet_name)
......
......@@ -2664,7 +2664,7 @@ def se_compare_auto(application_id, application_entity, ocr_res_id, last_obj, oc
# detect_list = se_result_detect(ocr_res_dict)
compare_info, aa_type, is_gsyh = get_se_cms_compare_info_auto(
last_obj, application_entity)
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, is_gsyh, True)
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, is_gsyh, True)
compare_log.info('{0} [Auto SE] [compare success] [entity={1}] [id={2}] [ocr_res_id={3}] [result={4}]'.format(
log_base, application_entity, application_id, ocr_res_id, compare_result))
except Exception as e:
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!