添加缩略,详细索引模式

master
zhanghai 2 years ago
parent a27faaf96c
commit 0e7555a932

@ -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);
}
};

@ -37,7 +37,7 @@ public class CheckService {
public void index(String path,String savepath, LevelType levelType) throws IOException {
Map<String, IndexPlate> map = new HashMap<>();
findAllDir(path, map);
findAllDir(path, map,levelType);
//计算出宗
@ -262,14 +262,14 @@ public class CheckService {
}
private void findAllDir(String absolutePath, Map<String, IndexPlate> map) {
private void findAllDir(String absolutePath, Map<String, IndexPlate> map, LevelType levelType) {
File sourceFile = new File(absolutePath);
File[] files = sourceFile.listFiles();
for (File o : files) {
if (o.isDirectory()) {
findAllDir(o.getAbsolutePath(), map);
findAllDir(o.getAbsolutePath(), map,levelType);
}
if (o.isFile()) {
@ -297,8 +297,6 @@ public class CheckService {
if (o.getParentFile().getName().equals("片头") || o.getParentFile().getName().equals("片尾")) {
continue;
}
//件
File parentFile = o.getParentFile()
//卷
@ -306,6 +304,12 @@ public class CheckService {
//盘
.getParentFile();
if(levelType==LevelType.THREE){
parentFile = o.getParentFile()
//卷
.getParentFile();
}
if (map.get(parentFile.getAbsolutePath()) == null) {
IndexPlate indexPlate = new IndexPlate(parentFile.getAbsolutePath(), parentFile.getName(), parentFile.getParentFile().getName());
map.put(parentFile.getAbsolutePath(), indexPlate);

@ -33,7 +33,7 @@ public class SuoyinService {
public void index(String path, String indexType,LevelType levelType) throws IOException {
Map<String, IndexPlate> map = new HashMap<>();
findAllDir(path, map);
findAllDir(path, map,levelType);
//计算出宗
@ -457,14 +457,14 @@ public class SuoyinService {
}
private void findAllDir(String absolutePath, Map<String, IndexPlate> map) {
private void findAllDir(String absolutePath, Map<String, IndexPlate> map, LevelType levelType) {
File sourceFile = new File(absolutePath);
File[] files = sourceFile.listFiles();
for (File o : files) {
if (o.isDirectory()) {
findAllDir(o.getAbsolutePath(), map);
findAllDir(o.getAbsolutePath(), map,levelType);
}
if (o.isFile()) {
@ -501,6 +501,12 @@ public class SuoyinService {
//盘
.getParentFile();
if(levelType==LevelType.THREE){
parentFile = o.getParentFile()
//卷
.getParentFile();
}
if (map.get(parentFile.getAbsolutePath()) == null) {
IndexPlate indexPlate = new IndexPlate(parentFile.getAbsolutePath(), parentFile.getName(), parentFile.getParentFile().getName());
map.put(parentFile.getAbsolutePath(), indexPlate);

Loading…
Cancel
Save