|
|
|
@ -16,6 +16,8 @@ import javax.imageio.ImageIO;
|
|
|
|
|
import java.awt.image.BufferedImage;
|
|
|
|
|
import java.io.File;
|
|
|
|
|
import java.io.IOException;
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
|
|
import java.math.BigInteger;
|
|
|
|
|
import java.nio.file.Files;
|
|
|
|
|
import java.nio.file.Path;
|
|
|
|
|
import java.nio.file.StandardCopyOption;
|
|
|
|
@ -198,7 +200,11 @@ public class FenpanService {
|
|
|
|
|
|
|
|
|
|
//是图片,直接从图片提取
|
|
|
|
|
List<Document> documentList = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
File sourceFile = new File(piece.getAbsolutePath());
|
|
|
|
|
if(piece.getLevelType()==LevelType.THREE&&piece.getFileTypeEnum()==FileTypeEnum.JPG){
|
|
|
|
|
sourceFile = new File(piece.getAbsolutePath()).getParentFile();
|
|
|
|
|
}
|
|
|
|
|
File[] files = sourceFile.listFiles();
|
|
|
|
|
ExecutorService executorService = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors());
|
|
|
|
|
|
|
|
|
@ -245,6 +251,11 @@ public class FenpanService {
|
|
|
|
|
for (Pieces piece : pieces) {
|
|
|
|
|
//根据文件类型
|
|
|
|
|
//填充卷
|
|
|
|
|
|
|
|
|
|
// String picesPath = piece.getAbsolutePath();
|
|
|
|
|
// if((piece.getLevelType()==LevelType.THREE&&piece.getFileTypeEnum()==FileTypeEnum.JPG)){
|
|
|
|
|
// picesPath =
|
|
|
|
|
// }
|
|
|
|
|
File file = new File(piece.getAbsolutePath());
|
|
|
|
|
File parentFile = file.getParentFile();
|
|
|
|
|
String name = parentFile.getName();
|
|
|
|
@ -276,16 +287,16 @@ public class FenpanService {
|
|
|
|
|
@Override
|
|
|
|
|
public int compare(File file1, File file2) {
|
|
|
|
|
// 使用正则表达式提取数字部分
|
|
|
|
|
long num1 = extractNumber(file1.getName());
|
|
|
|
|
long num2 = extractNumber(file2.getName());
|
|
|
|
|
BigInteger num1 = extractNumber(file1.getName());
|
|
|
|
|
BigInteger num2 = extractNumber(file2.getName());
|
|
|
|
|
|
|
|
|
|
// 比较提取的数字部分
|
|
|
|
|
return Long.compare(num1, num2);
|
|
|
|
|
return num1.compareTo(num2);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private long extractNumber(String fileName) {
|
|
|
|
|
private BigInteger extractNumber(String fileName) {
|
|
|
|
|
String numberPart = fileName.replaceAll("[^0-9]", "");
|
|
|
|
|
return numberPart.isEmpty() ? 0 : Long.parseLong(numberPart);
|
|
|
|
|
return numberPart.isEmpty() ? new BigInteger("0") : new BigInteger(numberPart);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|