Quellcode durchsuchen

档案自动OCR识别

cr vor 19 Stunden
Ursprung
Commit
13c2859211

+ 2 - 2
blade-service/blade-archive/src/main/java/org/springblade/archive/controller/ArchivesAutoController.java

@@ -277,10 +277,10 @@ public class ArchivesAutoController extends BladeController {
         archivesAutoService.fileNumberFlush(projectId,contractId,ids,isArchive,startNumber);
         return R.success("正在刷新档号中,请稍后刷新");
     }
-	@GetMapping("/atuoOCR")
+	@PostMapping("/atuoOCR")
 	@ApiOperationSupport(order = 5)
 	@ApiOperation(value = "档案自动识别")
-	public R atuoOCR(String ids) throws Exception {
+	public R atuoOCR(List<String> ids) throws Exception {
 		archivesAutoService.atuoOCR(ids);
 		return R.success("正在识别中");
 	}

+ 1 - 1
blade-service/blade-archive/src/main/java/org/springblade/archive/service/IArchivesAutoService.java

@@ -188,5 +188,5 @@ public interface IArchivesAutoService extends BaseService<ArchivesAuto> {
 
     void reCreateArchiveAuto1(String ids);
 
-	boolean atuoOCR(String ids) throws Exception;
+	boolean atuoOCR(List<String> ids) throws Exception;
 }

+ 8 - 9
blade-service/blade-archive/src/main/java/org/springblade/archive/service/impl/ArchivesAutoServiceImpl.java

@@ -5262,11 +5262,10 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
 
 	@Override
 	@Async
-	public boolean atuoOCR(String ids) throws Exception {
-		String url="/mnt/sdc/AutoPdf/";
-		//String url="D:\\AutoPdf\\";
-		List<Long> idsList = Func.toLongList(ids);
-		List<ArchivesAuto> archivesAutoList = this.list(new LambdaQueryWrapper<ArchivesAuto>().in(ArchivesAuto::getId, idsList));
+	public boolean atuoOCR(List<String> ids) throws Exception {
+		//String url="/mnt/sdc/AutoPdf/";
+		String url="D:\\AutoPdf\\";
+		List<ArchivesAuto> archivesAutoList = this.list(new LambdaQueryWrapper<ArchivesAuto>().in(ArchivesAuto::getId, ids));
 		for (ArchivesAuto auto : archivesAutoList) {
 			String fileUrl=auto.getOutUrl().substring(0,auto.getOutUrl().indexOf("@"));
 			String filePath=url+auto.getName()+".pdf";
@@ -5332,11 +5331,11 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
 	}
 
 	public List<String> extractTextFromPDF(String pdfFilePath) throws IOException, InterruptedException {
-//		String PYTHON_SCRIPT_PATH = "C:\\Users\\hc01\\AppData\\Local\\Programs\\Python\\Python310\\Python\\pdfTextExtractorWindows.py";
-//		String PYTHON_INTERPRETER = "C:\\Users\\hc01\\AppData\\Local\\Programs\\Python\\Python310\\python.exe";
+		String PYTHON_SCRIPT_PATH = "C:\\Users\\hc01\\AppData\\Local\\Programs\\Python\\Python310\\Python\\pdfTextExtractorWindows.py";
+		String PYTHON_INTERPRETER = "C:\\Users\\hc01\\AppData\\Local\\Programs\\Python\\Python310\\python.exe";
 
-		String PYTHON_SCRIPT_PATH = "/www/wwwlogs/python/pdfTextExtractorWindows.py";
-		String PYTHON_INTERPRETER = "python3";
+		//String PYTHON_SCRIPT_PATH = "/www/wwwlogs/python/pdfTextExtractorWindows.py";
+		//String PYTHON_INTERPRETER = "python3";
 		String[] command = {
 				PYTHON_INTERPRETER,
 				PYTHON_SCRIPT_PATH,