|
|
|
@ -189,7 +189,7 @@ public class SuoyinService {
|
|
|
|
|
|
|
|
|
|
EasyExcel.write(indexPlate.getAbsolutePath() + "/" + indexPlate.getName() + ".xls", MesEasyExcel.class).sheet("test").doWrite(mesEasyExcels);
|
|
|
|
|
|
|
|
|
|
ExcelUtil.toPdf(indexPlate.getAbsolutePath() + "/" + indexPlate.getName() + ".xls", indexPlate.getAbsolutePath() + "/" + indexPlate.getName() + ".pdf");
|
|
|
|
|
ExcelUtil.toPdf1(indexPlate.getAbsolutePath() + "/" + indexPlate.getName() + ".xls", indexPlate.getAbsolutePath() + "/" + indexPlate.getName() + ".pdf");
|
|
|
|
|
|
|
|
|
|
Integer page = PdfUtil.getPage(indexPlate.getAbsolutePath() + "/" + indexPlate.getName() + ".pdf");
|
|
|
|
|
|
|
|
|
@ -207,7 +207,7 @@ public class SuoyinService {
|
|
|
|
|
|
|
|
|
|
EasyExcel.write(indexPlate.getAbsolutePath() + "/" + indexPlate.getName() + ".xls", MesEasyExcel.class).sheet("test").doWrite(mesEasyExcels);
|
|
|
|
|
|
|
|
|
|
ExcelUtil.toPdf(indexPlate.getAbsolutePath() + "/" + indexPlate.getName() + ".xls", indexPlate.getAbsolutePath() + "/" + indexPlate.getName() + ".pdf");
|
|
|
|
|
ExcelUtil.toPdf1(indexPlate.getAbsolutePath() + "/" + indexPlate.getName() + ".xls", indexPlate.getAbsolutePath() + "/" + indexPlate.getName() + ".pdf");
|
|
|
|
|
|
|
|
|
|
//写入文件夹。
|
|
|
|
|
PdfToPic.toPic(indexPlate.getAbsolutePath() + "/" + indexPlate.getName() + ".pdf", indexPlate.getAbsolutePath() + "/片头", "01", "jpg");
|
|
|
|
@ -249,6 +249,88 @@ public class SuoyinService {
|
|
|
|
|
|
|
|
|
|
File file1 = new File(indexPlate.getAbsolutePath());
|
|
|
|
|
EasyExcel.write(file1.getParentFile().getAbsolutePath() + "/full-index-" + indexPlate.getName() + ".xls", FullIndexPageRow.class).sheet("test").doWrite(fullIndexPageRows);
|
|
|
|
|
ExcelUtil.toPdf2(file1.getParentFile().getAbsolutePath() + "/full-index-" + indexPlate.getName() + ".xls", file1.getParentFile().getAbsolutePath() + "/full-index-" + indexPlate.getName() + ".pdf");
|
|
|
|
|
// //写入文件夹。
|
|
|
|
|
PdfToPic.toPic(file1.getParentFile().getAbsolutePath() + "/full-index-" + indexPlate.getName() + ".pdf", indexPlate.getAbsolutePath() + "/片头", "01", "jpg");
|
|
|
|
|
|
|
|
|
|
PdfToPic.toPicDesc(file1.getParentFile().getAbsolutePath() + "/full-index-" + indexPlate.getName() + ".pdf", indexPlate.getAbsolutePath() + "/片尾", "00", "jpg");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<FullIndexPageRow> fullIndexPageRows2 = new ArrayList<>();
|
|
|
|
|
i = 1;
|
|
|
|
|
|
|
|
|
|
for (Roll roll : rollList) {
|
|
|
|
|
|
|
|
|
|
if (!roll.getName().equals("片头")) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
File file = new File(roll.getAbsolutePath());
|
|
|
|
|
List<Document> documentList = new ArrayList<>();
|
|
|
|
|
File[] files = file.listFiles();
|
|
|
|
|
for (File pdfImg : files) {
|
|
|
|
|
getDocumentList(documentList, pdfImg);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for(Document document:documentList){
|
|
|
|
|
FullIndexPageRow fullIndexPageRow = new FullIndexPageRow(indexPlate.getZongName(), indexPlate.getName(), roll.getName(), "", document.getName(), document.isA3() ? "A3" : "A4", i);
|
|
|
|
|
fullIndexPageRows2.add(fullIndexPageRow);
|
|
|
|
|
i++;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
for (Roll roll : rollList) {
|
|
|
|
|
|
|
|
|
|
if (roll.getName().equals("片头")) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
//跳过片尾
|
|
|
|
|
if (roll.getName().equals("片尾")) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
fullIndexPageRows2.add(fullIndexPageRow);
|
|
|
|
|
i++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (Roll roll : rollList) {
|
|
|
|
|
//跳过片尾
|
|
|
|
|
if (!roll.getName().equals("片尾")) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
File file = new File(roll.getAbsolutePath());
|
|
|
|
|
List<Document> documentList = new ArrayList<>();
|
|
|
|
|
File[] files = file.listFiles();
|
|
|
|
|
for (File pdfImg : files) {
|
|
|
|
|
getDocumentList(documentList, pdfImg);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for(Document document:documentList){
|
|
|
|
|
FullIndexPageRow fullIndexPageRow = new FullIndexPageRow(indexPlate.getZongName(), indexPlate.getName(), roll.getName(), "", document.getName(), document.isA3() ? "A3" : "A4", i);
|
|
|
|
|
fullIndexPageRows2.add(fullIndexPageRow);
|
|
|
|
|
i++;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
EasyExcel.write(file1.getParentFile().getAbsolutePath() + "/full-index-" + indexPlate.getName() + ".xls", FullIndexPageRow.class).sheet("test").doWrite(fullIndexPageRows2);
|
|
|
|
|
ExcelUtil.toPdf2(file1.getParentFile().getAbsolutePath() + "/full-index-" + indexPlate.getName() + ".xls", file1.getParentFile().getAbsolutePath() + "/full-index-" + indexPlate.getName() + ".pdf");
|
|
|
|
|
// //写入文件夹。
|
|
|
|
|
PdfToPic.toPic(file1.getParentFile().getAbsolutePath() + "/full-index-" + indexPlate.getName() + ".pdf", indexPlate.getAbsolutePath() + "/片头", "01", "jpg");
|
|
|
|
|
|
|
|
|
|
PdfToPic.toPicDesc(file1.getParentFile().getAbsolutePath() + "/full-index-" + indexPlate.getName() + ".pdf", indexPlate.getAbsolutePath() + "/片尾", "00", "jpg");
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -427,4 +509,44 @@ public class SuoyinService {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void getDocumentList(List<Document> documentList, File file) {
|
|
|
|
|
//非图片模式,跳过。
|
|
|
|
|
if (!(file.getName().endsWith(".jpg") || file.getName().endsWith(".png") || file.getName().endsWith(".jpeg") || file.getName().endsWith(".tif") || file.getName().endsWith(".tiff")) || file.getName().endsWith(".jp2") || file.getName().endsWith(".jpm") || file.getName().endsWith(".gif")) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (file.getName().endsWith(".jp2") || file.getName().endsWith(".jpm")) {
|
|
|
|
|
// 读取 JPEG 2000 图像文件
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
BufferedImage image = ImageIO.read(file);
|
|
|
|
|
int height = image.getHeight();
|
|
|
|
|
int width = image.getWidth();
|
|
|
|
|
Document document = new Document(width, height, 300,file.getName(),null);
|
|
|
|
|
documentList.add(document);
|
|
|
|
|
} catch (IOException e) {
|
|
|
|
|
throw new RuntimeException(e);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
try {
|
|
|
|
|
ImageInfo imageInfo = Imaging.getImageInfo(file);
|
|
|
|
|
int height = imageInfo.getHeight();
|
|
|
|
|
int width = imageInfo.getWidth();
|
|
|
|
|
int physicalHeightDpi = imageInfo.getPhysicalHeightDpi();
|
|
|
|
|
Document document = new Document(width, height, physicalHeightDpi,file.getName(),null);
|
|
|
|
|
documentList.add(document);
|
|
|
|
|
} catch (IOException e) {
|
|
|
|
|
FileUtils.delete(file);
|
|
|
|
|
throw new RuntimeException("非图片格式", e);
|
|
|
|
|
} catch (ImageReadException e) {
|
|
|
|
|
FileUtils.delete(file);
|
|
|
|
|
throw new RuntimeException(e);
|
|
|
|
|
} catch (IllegalArgumentException e) {
|
|
|
|
|
FileUtils.delete(file);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|