|
|
|
@ -1,11 +1,13 @@
|
|
|
|
|
package com.docus.sw.souyin;
|
|
|
|
|
|
|
|
|
|
import com.alibaba.excel.EasyExcel;
|
|
|
|
|
import com.alibaba.excel.util.FileUtils;
|
|
|
|
|
import com.docus.sw.Config;
|
|
|
|
|
import com.docus.sw.fenpan.Document;
|
|
|
|
|
import com.docus.sw.fenpan.FileTypeEnum;
|
|
|
|
|
import com.docus.sw.fenpan.Pieces;
|
|
|
|
|
import com.docus.sw.fenpan.Roll;
|
|
|
|
|
import com.drew.tools.FileUtil;
|
|
|
|
|
import com.google.gson.Gson;
|
|
|
|
|
import org.apache.commons.imaging.ImageInfo;
|
|
|
|
|
import org.apache.commons.imaging.ImageReadException;
|
|
|
|
@ -15,6 +17,9 @@ import javax.imageio.ImageIO;
|
|
|
|
|
import java.awt.image.BufferedImage;
|
|
|
|
|
import java.io.File;
|
|
|
|
|
import java.io.IOException;
|
|
|
|
|
import java.nio.file.CopyOption;
|
|
|
|
|
import java.nio.file.Files;
|
|
|
|
|
import java.nio.file.StandardCopyOption;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
import java.util.List;
|
|
|
|
@ -35,7 +40,7 @@ public class SuoyinService {
|
|
|
|
|
new SuoyinService().index(path);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void index(String path) {
|
|
|
|
|
public void index(String path) throws IOException {
|
|
|
|
|
Map<String,IndexPlate> map = new HashMap<>();
|
|
|
|
|
findAllDir(path, map);
|
|
|
|
|
|
|
|
|
@ -195,12 +200,22 @@ public class SuoyinService {
|
|
|
|
|
ExcelUtil.toPdf(indexPlate.getAbsolutePath()+"/"+indexPlate.getName()+".xls",indexPlate.getAbsolutePath()+"/"+indexPlate.getName()+".pdf");
|
|
|
|
|
|
|
|
|
|
//写入文件夹。
|
|
|
|
|
PdfToPic.toPic(indexPlate.getAbsolutePath()+"/"+indexPlate.getName()+".pdf",indexPlate.getAbsolutePath()+"/片头","0000","jpg");
|
|
|
|
|
PdfToPic.toPic(indexPlate.getAbsolutePath()+"/"+indexPlate.getName()+".pdf",indexPlate.getAbsolutePath()+"/片头","01","jpg");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PdfToPic.toPicDesc(indexPlate.getAbsolutePath()+"/"+indexPlate.getName()+".pdf",indexPlate.getAbsolutePath()+"/片尾","0010","jpg");
|
|
|
|
|
PdfToPic.toPicDesc(indexPlate.getAbsolutePath()+"/"+indexPlate.getName()+".pdf",indexPlate.getAbsolutePath()+"/片尾","00","jpg");
|
|
|
|
|
|
|
|
|
|
File pdf = new File(indexPlate.getAbsolutePath() + "/" + indexPlate.getName() + ".pdf");
|
|
|
|
|
//再重算一次索引,以及将文件进行替换。
|
|
|
|
|
File parentFile = pdf.getParentFile().getParentFile();
|
|
|
|
|
File file = new File(parentFile.getAbsolutePath() + "/" + indexPlate.getName() + ".pdf");
|
|
|
|
|
Files.move(pdf.toPath(),file.toPath(), StandardCopyOption.ATOMIC_MOVE);
|
|
|
|
|
|
|
|
|
|
File xls = new File(indexPlate.getAbsolutePath() + "/" + indexPlate.getName() + ".xls");
|
|
|
|
|
//再重算一次索引,以及将文件进行替换。
|
|
|
|
|
File xlsParentFile = xls.getParentFile().getParentFile();
|
|
|
|
|
File file2 = new File(xlsParentFile.getAbsolutePath() + "/" + indexPlate.getName() + ".xls");
|
|
|
|
|
Files.move(xls.toPath(),file2.toPath());
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|