cr 1 päivä sitten
vanhempi
commit
f7b61361e9

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

@@ -188,7 +188,9 @@ public interface IArchivesAutoService extends BaseService<ArchivesAuto> {
 
     void reCreateArchiveAuto1(String ids);
 
+	boolean atuoOCR(List<Long> ids) throws Exception;
+
 	void reCreateArchiveAuto2(List<ArchivesAuto> archivesAutoList, String ids, String name);
 
-	boolean atuoOCR(String ids) throws Exception;
+
 }

+ 32 - 25
blade-service/blade-archive/src/main/java/org/springblade/archive/service/impl/ArchivesAutoServiceImpl.java

@@ -5182,21 +5182,22 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
 	@Override
 	@Async
 	public void reCreateArchiveAuto1(String ids) {
-		Set<Long> idsSet = new HashSet<>();
 		for (Long id : Func.toLongList(ids)) {
-			idsSet.add(id);
-			//先查出勾选的案卷
-			ArchivesAuto archivesAuto=this.getById(id);
-			//查出所有案卷文件
-			List<ArchiveFile>archiveFileList=archiveFileClient.getArchiveFileByArchiveIds(id+"");
-			//设置案卷页码和四要素
-			if (archiveFileList != null && !archiveFileList.isEmpty()) {
-				this.reCreateArchiveAuto(archivesAuto, archiveFileList);
+			try {
+				//先查出勾选的案卷
+				ArchivesAuto archivesAuto=this.getById(id);
+				//查出所有案卷文件
+				List<ArchiveFile>archiveFileList=archiveFileClient.getArchiveFileByArchiveIds(id+"");
+				//设置案卷页码和四要素
+				if (archiveFileList != null && !archiveFileList.isEmpty()) {
+					this.reCreateArchiveAuto(archivesAuto, archiveFileList);
+				}
+				this.update(Wrappers.<ArchivesAuto>lambdaUpdate().set(ArchivesAuto::getActionType, 0).eq(ArchivesAuto::getId, id));
+			} catch (Exception e) {
+				log.error("案卷重组失败," + "案卷ID:" + id, e);
+				this.update(Wrappers.<ArchivesAuto>lambdaUpdate().set(ArchivesAuto::getActionType, -2).eq(ArchivesAuto::getId, id));
 			}
 		}
-		if (!idsSet.isEmpty()) {
-			this.update(Wrappers.<ArchivesAuto>lambdaUpdate().set(ArchivesAuto::getActionType, 0).in(ArchivesAuto::getId, idsSet));
-		}
 	}
 	@Override
 	@Async
@@ -5241,13 +5242,18 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
 			file.setArchiveSort(i++);
 			waitArchiveFiles.add(file);
 		}
-		archiveFileClient.updateArchiveFile(waitArchiveFiles);
-		archivesAuto.setName(name);
-		//删除其他案卷
-		archivesAutoList.remove(archivesAuto);
-		this.deleteLogic(archivesAutoList.stream().map(o->o.getId()).collect(Collectors.toList()));
-		this.reCreateArchiveAuto(archivesAuto, archiveFileList);
-		this.update(Wrappers.<ArchivesAuto>lambdaUpdate().set(ArchivesAuto::getActionType, 0).in(ArchivesAuto::getId, ids));
+		try {
+			archiveFileClient.updateArchiveFile(waitArchiveFiles);
+			archivesAuto.setName(name);
+			//删除其他案卷
+			archivesAutoList.remove(archivesAuto);
+			this.deleteLogic(archivesAutoList.stream().map(o->o.getId()).collect(Collectors.toList()));
+			this.reCreateArchiveAuto(archivesAuto, archiveFileList);
+			this.update(Wrappers.<ArchivesAuto>lambdaUpdate().set(ArchivesAuto::getActionType, 0).in(ArchivesAuto::getId, ids));
+		} catch (Exception e) {
+			log.error("案卷并卷失败," + "案卷Ids:" + ids, e);
+			this.update(Wrappers.<ArchivesAuto>lambdaUpdate().set(ArchivesAuto::getActionType, -1).in(ArchivesAuto::getId, ids));
+		}
 	}
 
 	/**
@@ -5336,10 +5342,9 @@ 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);
+	public boolean atuoOCR(List<Long> idsList) throws Exception {
+		String url="/mnt/sdc/AutoPdf/";
+		//String url="D:\\AutoPdf\\";
 		List<ArchivesAuto> archivesAutoList = this.list(new LambdaQueryWrapper<ArchivesAuto>().in(ArchivesAuto::getId, idsList));
 		for (ArchivesAuto auto : archivesAutoList) {
 			String fileUrl=auto.getOutUrl().substring(0,auto.getOutUrl().indexOf("@"));
@@ -5406,9 +5411,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[] command = {
 				PYTHON_INTERPRETER,
 				PYTHON_SCRIPT_PATH,