d204dc5f by 周伟奇

fix bug F3

1 parent 0f197a8b
...@@ -1139,7 +1139,7 @@ EN_HEADER_LIST = ['Date', 'Currency', 'Amount', 'Balance', 'TransactionType'] ...@@ -1139,7 +1139,7 @@ EN_HEADER_LIST = ['Date', 'Currency', 'Amount', 'Balance', 'TransactionType']
1139 MS_ERROR_COL = (5, 6) 1139 MS_ERROR_COL = (5, 6)
1140 WECHART_CLASSIFY = 12 1140 WECHART_CLASSIFY = 12
1141 NEW_ZHIFUBAO_CLASSIFY = 48 1141 NEW_ZHIFUBAO_CLASSIFY = 48
1142 ALI_WECHART_CLASSIFY = {12, 13} 1142 ALI_WECHART_CLASSIFY = {12, 13, 48}
1143 WECHART_ERROR_COL = (1, 2) 1143 WECHART_ERROR_COL = (1, 2)
1144 SPECIAL_HEADERS_MAPPING = copy.deepcopy(HEADERS_MAPPING) 1144 SPECIAL_HEADERS_MAPPING = copy.deepcopy(HEADERS_MAPPING)
1145 SPECIAL_HEADERS_MAPPING.update( 1145 SPECIAL_HEADERS_MAPPING.update(
......
...@@ -35,6 +35,7 @@ class Command(BaseCommand, LoggerMixin): ...@@ -35,6 +35,7 @@ class Command(BaseCommand, LoggerMixin):
35 self.field_map = { 35 self.field_map = {
36 # sheet_name, key_field, side_field_order, src_field_order 36 # sheet_name, key_field, side_field_order, src_field_order
37 consts.IC_CLASSIFY: (consts.IC_CN_NAME, '有效期限', consts.IC_FIELD_ORDER_3, consts.IC_FIELD_ORDER_2), 37 consts.IC_CLASSIFY: (consts.IC_CN_NAME, '有效期限', consts.IC_FIELD_ORDER_3, consts.IC_FIELD_ORDER_2),
38 consts.BL_CLASSIFY: (consts.BL_CN_NAME, None, None, consts.BL_FIELD_ORDER),
38 } 39 }
39 40
40 self.pdf_name_map = { 41 self.pdf_name_map = {
...@@ -119,14 +120,14 @@ class Command(BaseCommand, LoggerMixin): ...@@ -119,14 +120,14 @@ class Command(BaseCommand, LoggerMixin):
119 120
120 if ocr_res_2.get('ErrorCode') in consts.SUCCESS_CODE_SET: 121 if ocr_res_2.get('ErrorCode') in consts.SUCCESS_CODE_SET:
121 if pid == consts.BC_PID: 122 if pid == consts.BC_PID:
122 ocr_res.append(ocr_res_2) 123 ocr_res.setdefault(classify, []).append(ocr_res_2)
123 else: 124 else:
124 # 营业执照等 125 # 营业执照等
125 for result_dict in ocr_res_2.get('ResultList', []): 126 for result_dict in ocr_res_2.get('ResultList', []):
126 res_dict = {} 127 res_dict = {}
127 for field_dict in result_dict.get('FieldList', []): 128 for field_dict in result_dict.get('FieldList', []):
128 res_dict[field_dict.get('chn_key', '')] = field_dict.get('value', '') 129 res_dict[field_dict.get('chn_key', '')] = field_dict.get('value', '')
129 ocr_res.append(res_dict) 130 ocr_res.setdefault(classify, []).append(res_dict)
130 break 131 break
131 132
132 def wb_process(self, ocr_res, output_dir): 133 def wb_process(self, ocr_res, output_dir):
...@@ -139,6 +140,8 @@ class Command(BaseCommand, LoggerMixin): ...@@ -139,6 +140,8 @@ class Command(BaseCommand, LoggerMixin):
139 wb = Workbook() 140 wb = Workbook()
140 141
141 for c, res_list in ocr_res.items(): 142 for c, res_list in ocr_res.items():
143 if c not in self.field_map:
144 continue
142 sheet_name, key_field, side_field_order, src_field_order = self.field_map.get(c) 145 sheet_name, key_field, side_field_order, src_field_order = self.field_map.get(c)
143 if sheet_name in wb.sheetnames: 146 if sheet_name in wb.sheetnames:
144 ws = wb.get_sheet_by_name(sheet_name) 147 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 ...@@ -2664,7 +2664,7 @@ def se_compare_auto(application_id, application_entity, ocr_res_id, last_obj, oc
2664 # detect_list = se_result_detect(ocr_res_dict) 2664 # detect_list = se_result_detect(ocr_res_dict)
2665 compare_info, aa_type, is_gsyh = get_se_cms_compare_info_auto( 2665 compare_info, aa_type, is_gsyh = get_se_cms_compare_info_auto(
2666 last_obj, application_entity) 2666 last_obj, application_entity)
2667 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) 2667 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)
2668 compare_log.info('{0} [Auto SE] [compare success] [entity={1}] [id={2}] [ocr_res_id={3}] [result={4}]'.format( 2668 compare_log.info('{0} [Auto SE] [compare success] [entity={1}] [id={2}] [ocr_res_id={3}] [result={4}]'.format(
2669 log_base, application_entity, application_id, ocr_res_id, compare_result)) 2669 log_base, application_entity, application_id, ocr_res_id, compare_result))
2670 except Exception as e: 2670 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!