12319785 by 周伟奇

fix ltgt

1 parent 82e1a38f
...@@ -386,12 +386,16 @@ class Command(BaseCommand, LoggerMixin): ...@@ -386,12 +386,16 @@ class Command(BaseCommand, LoggerMixin):
386 for name in true_file_set: 386 for name in true_file_set:
387 path = os.path.join(input_dir, name) 387 path = os.path.join(input_dir, name)
388 try: 388 try:
389 if os.path.isfile(path): 389 if not os.path.exists(path):
390 self.folder_log.info('{0} [path is not exists] [path={1}]'.format(self.log_base, path))
391 continue
392 elif os.path.isfile(path):
390 self.folder_log.info('{0} [file start] [path={1}]'.format(self.log_base, path)) 393 self.folder_log.info('{0} [file start] [path={1}]'.format(self.log_base, path))
391 if name.endswith('.pdf') or name.endswith('.PDF'): 394 if name.endswith('.pdf') or name.endswith('.PDF'):
392 result = self.pdf_process(name, path, img_output_dir, wb_output_dir, 395 result = self.pdf_process(name, path, img_output_dir, wb_output_dir,
393 pdf_output_dir) 396 pdf_output_dir)
394 elif name.endswith('.tif') or name.endswith('.TIF'): 397 elif name.endswith('.tif') or name.endswith('.TIF') or name.endswith('.tiff') or \
398 name.endswith('.TIFF'):
395 result = self.tif_process(name, path, img_output_dir, wb_output_dir, 399 result = self.tif_process(name, path, img_output_dir, wb_output_dir,
396 tiff_output_dir) 400 tiff_output_dir)
397 else: 401 else:
......
...@@ -561,6 +561,7 @@ class Command(BaseCommand, LoggerMixin): ...@@ -561,6 +561,7 @@ class Command(BaseCommand, LoggerMixin):
561 } 561 }
562 else: 562 else:
563 rebuild_res = self.images_process([path], classify, excel_path, seperate_path_map) 563 rebuild_res = self.images_process([path], classify, excel_path, seperate_path_map)
564 if os.path.exists(path):
564 shutil.move(path, img_save_path) 565 shutil.move(path, img_save_path)
565 return rebuild_res 566 return rebuild_res
566 567
...@@ -690,12 +691,16 @@ class Command(BaseCommand, LoggerMixin): ...@@ -690,12 +691,16 @@ class Command(BaseCommand, LoggerMixin):
690 path = os.path.join(input_dir, name) 691 path = os.path.join(input_dir, name)
691 692
692 try: 693 try:
693 if os.path.isfile(path): 694 if not os.path.exists(path):
695 self.folder_log.info('{0} [path is not exists] [path={1}]'.format(self.log_base, path))
696 continue
697 elif os.path.isfile(path):
694 self.folder_log.info('{0} [file start] [path={1}]'.format(self.log_base, path)) 698 self.folder_log.info('{0} [file start] [path={1}]'.format(self.log_base, path))
695 if name.endswith('.pdf') or name.endswith('.PDF'): 699 if name.endswith('.pdf') or name.endswith('.PDF'):
696 result = self.pdf_process(name, path, classify, img_output_dir, wb_output_dir, 700 result = self.pdf_process(name, path, classify, img_output_dir, wb_output_dir,
697 pdf_output_dir, seperate_dir_map) 701 pdf_output_dir, seperate_dir_map)
698 elif name.endswith('.tif') or name.endswith('.TIF'): 702 elif name.endswith('.tif') or name.endswith('.TIF') or name.endswith('.tiff') or \
703 name.endswith('.TIFF'):
699 if classify == consts.CONTRACT_CLASSIFY: 704 if classify == consts.CONTRACT_CLASSIFY:
700 raise LTGTException('e-contract must be pdf') 705 raise LTGTException('e-contract must be pdf')
701 result = self.tif_process(name, path, classify, img_output_dir, wb_output_dir, 706 result = self.tif_process(name, path, classify, img_output_dir, wb_output_dir,
......
...@@ -340,11 +340,15 @@ class Command(BaseCommand, LoggerMixin): ...@@ -340,11 +340,15 @@ class Command(BaseCommand, LoggerMixin):
340 path = os.path.join(input_dir, name) 340 path = os.path.join(input_dir, name)
341 341
342 try: 342 try:
343 if os.path.isfile(path): 343 if not os.path.exists(path):
344 self.folder_log.info('{0} [path is not exists] [path={1}]'.format(self.log_base, path))
345 continue
346 elif os.path.isfile(path):
344 self.folder_log.info('{0} [file start] [path={1}]'.format(self.log_base, path)) 347 self.folder_log.info('{0} [file start] [path={1}]'.format(self.log_base, path))
345 if name.endswith('.pdf') or name.endswith('.PDF'): 348 if name.endswith('.pdf') or name.endswith('.PDF'):
346 self.pdf_process(name, path, classify, img_output_dir, wb_output_dir, pdf_output_dir) 349 self.pdf_process(name, path, classify, img_output_dir, wb_output_dir, pdf_output_dir)
347 elif name.endswith('.tif') or name.endswith('.TIF'): 350 elif name.endswith('.tif') or name.endswith('.TIF') or name.endswith('.tiff') or \
351 name.endswith('.TIFF'):
348 self.tif_process(name, path, classify, img_output_dir, wb_output_dir, tiff_output_dir) 352 self.tif_process(name, path, classify, img_output_dir, wb_output_dir, tiff_output_dir)
349 else: 353 else:
350 self.img_process(name, path, classify, wb_output_dir, img_output_dir, pdf_output_dir) 354 self.img_process(name, path, classify, wb_output_dir, img_output_dir, pdf_output_dir)
......
...@@ -585,11 +585,15 @@ class Command(BaseCommand, LoggerMixin): ...@@ -585,11 +585,15 @@ class Command(BaseCommand, LoggerMixin):
585 path = os.path.join(input_dir, name) 585 path = os.path.join(input_dir, name)
586 586
587 try: 587 try:
588 if os.path.isfile(path): 588 if not os.path.exists(path):
589 self.folder_log.info('{0} [path is not exists] [path={1}]'.format(self.log_base, path))
590 continue
591 elif os.path.isfile(path):
589 self.folder_log.info('{0} [file start] [path={1}]'.format(self.log_base, path)) 592 self.folder_log.info('{0} [file start] [path={1}]'.format(self.log_base, path))
590 if name.endswith('.pdf') or name.endswith('.PDF'): 593 if name.endswith('.pdf') or name.endswith('.PDF'):
591 self.pdf_process(name, path, img_output_dir, wb_output_dir, pdf_output_dir) 594 self.pdf_process(name, path, img_output_dir, wb_output_dir, pdf_output_dir)
592 elif name.endswith('.tif') or name.endswith('.TIF'): 595 elif name.endswith('.tif') or name.endswith('.TIF') or name.endswith('.tiff') or \
596 name.endswith('.TIFF'):
593 self.tif_process(name, path, img_output_dir, wb_output_dir, tiff_output_dir) 597 self.tif_process(name, path, img_output_dir, wb_output_dir, tiff_output_dir)
594 else: 598 else:
595 self.folder_log.info('{0} [path is not pdf or tif] [path={1}]'.format( 599 self.folder_log.info('{0} [path is not pdf or tif] [path={1}]'.format(
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!