补充完整的索引

master
zhanghai 2 years ago
parent 20c19cd6a6
commit 401dd0cad9

@ -21,6 +21,9 @@ public class Document {
private Integer dpi; private Integer dpi;
private String name;
//写一个方法判断是 A3 还是 A4 //写一个方法判断是 A3 还是 A4
public Boolean isA3() { public Boolean isA3() {

@ -295,7 +295,7 @@ public class FenpanService {
BufferedImage image = ImageIO.read(file); BufferedImage image = ImageIO.read(file);
int height = image.getHeight(); int height = image.getHeight();
int width = image.getWidth(); int width = image.getWidth();
Document document = new Document(width, height, 300); Document document = new Document(width, height, 300,file.getName());
documentList.add(document); documentList.add(document);
} catch (IOException e) { } catch (IOException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
@ -307,7 +307,7 @@ public class FenpanService {
int height = imageInfo.getHeight(); int height = imageInfo.getHeight();
int width = imageInfo.getWidth(); int width = imageInfo.getWidth();
int physicalHeightDpi = imageInfo.getPhysicalHeightDpi(); int physicalHeightDpi = imageInfo.getPhysicalHeightDpi();
Document document = new Document(width, height, physicalHeightDpi); Document document = new Document(width, height, physicalHeightDpi,file.getName());
documentList.add(document); documentList.add(document);
} catch (IOException e) { } catch (IOException e) {
FileUtils.delete(file); FileUtils.delete(file);
@ -335,7 +335,7 @@ public class FenpanService {
BufferedImage image = ImageIO.read(file); BufferedImage image = ImageIO.read(file);
int height = image.getHeight(); int height = image.getHeight();
int width = image.getWidth(); int width = image.getWidth();
Document document = new Document(width, height, 300); Document document = new Document(width, height, 300,file.getName());
return document; return document;
} catch (IOException e) { } catch (IOException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
@ -347,7 +347,7 @@ public class FenpanService {
int height = imageInfo.getHeight(); int height = imageInfo.getHeight();
int width = imageInfo.getWidth(); int width = imageInfo.getWidth();
int physicalHeightDpi = imageInfo.getPhysicalHeightDpi(); int physicalHeightDpi = imageInfo.getPhysicalHeightDpi();
Document document = new Document(width, height, physicalHeightDpi); Document document = new Document(width, height, physicalHeightDpi,file.getName());
return document; return document;
} catch (IOException e) { } catch (IOException e) {
FileUtils.delete(file); FileUtils.delete(file);

@ -0,0 +1,33 @@
package com.docus.sw.souyin;
import com.alibaba.excel.annotation.ExcelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
@AllArgsConstructor
@Data
public class FullIndexPageRow {
@ExcelProperty("全宗名")
private String zongName;
@ExcelProperty("盘号")
private String phNum;
@ExcelProperty("卷号")
private String rollName;
@ExcelProperty("件名")
private String piecesName;
@ExcelProperty("文件名")
private String documentName;
@ExcelProperty("画幅幅面")
private String sizeStr;
@ExcelProperty("缩微id码")
private Integer start;
}

@ -140,7 +140,6 @@ public class SuoyinService {
} }
} }
indexPlate.putAll(rollList); indexPlate.putAll(rollList);
@ -201,7 +200,6 @@ public class SuoyinService {
Integer page = PdfUtil.getPage(indexPlate.getAbsolutePath() + "/" + indexPlate.getName() + ".pdf"); Integer page = PdfUtil.getPage(indexPlate.getAbsolutePath() + "/" + indexPlate.getName() + ".pdf");
indexPageRows = indexGen(indexPlate, rollList, page, totalSize); indexPageRows = indexGen(indexPlate, rollList, page, totalSize);
//修正数据 //修正数据
System.out.println(new Gson().toJson(indexPageRows)); System.out.println(new Gson().toJson(indexPageRows));
@ -235,6 +233,22 @@ public class SuoyinService {
File file2 = new File(xlsParentFile.getAbsolutePath() + "/" + indexPlate.getName() + ".xls"); File file2 = new File(xlsParentFile.getAbsolutePath() + "/" + indexPlate.getName() + ".xls");
Files.move(xls.toPath(), file2.toPath()); Files.move(xls.toPath(), file2.toPath());
//计算完整索引
List<FullIndexPageRow> fullIndexPageRows = new ArrayList<>();
int i = 1;
for (Roll roll : rollList) {
List<Pieces> piecesList = roll.getPiecesList();
for (Pieces pieces : piecesList) {
List<Document> documentList = pieces.getDocumentList();
for (Document document : documentList) {
FullIndexPageRow fullIndexPageRow = new FullIndexPageRow(indexPlate.getZongName(), indexPlate.getName(), roll.getName(), pieces.getName(), document.getName(), document.isA3() ? "A3" : "A4", i);
fullIndexPageRows.add(fullIndexPageRow);
}
}
}
EasyExcel.write(indexPlate.getAbsolutePath() + "/full-index-" + indexPlate.getName() + ".xls", MesEasyExcel.class).sheet("test").doWrite(fullIndexPageRows);
} }
//读取片头 //读取片头
@ -262,7 +276,7 @@ public class SuoyinService {
BufferedImage image = ImageIO.read(docfile); BufferedImage image = ImageIO.read(docfile);
int height = image.getHeight(); int height = image.getHeight();
int width = image.getWidth(); int width = image.getWidth();
Document document = new Document(width, height, 300); Document document = new Document(width, height, 300, docfile.getName());
documentList.add(document); documentList.add(document);
} catch (IOException e) { } catch (IOException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
@ -274,7 +288,7 @@ public class SuoyinService {
int height = imageInfo.getHeight(); int height = imageInfo.getHeight();
int width = imageInfo.getWidth(); int width = imageInfo.getWidth();
int physicalHeightDpi = imageInfo.getPhysicalHeightDpi(); int physicalHeightDpi = imageInfo.getPhysicalHeightDpi();
Document document = new Document(width, height, physicalHeightDpi); Document document = new Document(width, height, physicalHeightDpi, docfile.getName());
documentList.add(document); documentList.add(document);
} catch (IOException e) { } catch (IOException e) {
throw new RuntimeException("非图片格式", e); throw new RuntimeException("非图片格式", e);
@ -289,7 +303,6 @@ public class SuoyinService {
} }
} }
private List<IndexPageRow> indexGen(IndexPlate indexPlate, List<Roll> rollList, Integer pianPageNum, Integer totalSize) { private List<IndexPageRow> indexGen(IndexPlate indexPlate, List<Roll> rollList, Integer pianPageNum, Integer totalSize) {

Loading…
Cancel
Save