96178db6 by 周伟奇

add max img count

1 parent 23c4a341
...@@ -613,6 +613,26 @@ class Command(BaseCommand, LoggerMixin): ...@@ -613,6 +613,26 @@ class Command(BaseCommand, LoggerMixin):
613 self.online_log.warn('{0} [pdf to img failed (pdf img empty)] [task={1}]'.format( 613 self.online_log.warn('{0} [pdf to img failed (pdf img empty)] [task={1}]'.format(
614 self.log_base, task_str)) 614 self.log_base, task_str))
615 raise Exception('pdf img empty') 615 raise Exception('pdf img empty')
616 elif img_count >= max_img_count:
617 self.online_log.info('{0} [too many pdf image] [task={1}] [img_count={2}]'.format(
618 self.log_base, task_str, img_count))
619
620 try:
621 report_table = HILOCRReport if business_type == consts.HIL_PREFIX else AFCOCRReport
622 report_table.objects.create(
623 case_number=doc.application_id,
624 request_team=RequestTeam.get_value(doc.document_scheme, 0),
625 request_trigger=RequestTrigger.get_value(doc.data_source, 0),
626 input_file=doc.document_name,
627 transaction_start=doc.start_time,
628 transaction_end=time.time(),
629 successful_at_this_level=False,
630 failure_reason=FailureReason.IMG_LIMIT.value,
631 process_name=ProcessName.ALL.value,
632 )
633 except Exception as e:
634 self.online_log.error('{0} [process error (report db save)] [error={1}]'.format(
635 self.log_base, traceback.format_exc()))
616 else: 636 else:
617 with lock: 637 with lock:
618 todo_count_dict[task_str] = img_count 638 todo_count_dict[task_str] = img_count
......
...@@ -41,6 +41,7 @@ class FailureReason(NamedEnum): ...@@ -41,6 +41,7 @@ class FailureReason(NamedEnum):
41 PDF = (0, 'PDF处理失败') 41 PDF = (0, 'PDF处理失败')
42 EXCEL = (1, '构建excel失败') 42 EXCEL = (1, '构建excel失败')
43 EDMS = (2, 'EDMS上传失败') 43 EDMS = (2, 'EDMS上传失败')
44 IMG_LIMIT = (3, 'PDF图片过多')
44 45
45 46
46 class ProcessName(NamedEnum): 47 class ProcessName(NamedEnum):
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!