|
|
|
@ -34,8 +34,7 @@ public class SuoyinService {
|
|
|
|
|
//统计出需要使用的 胶片量
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void index(String path) throws IOException {
|
|
|
|
|
public void index(String path, String indexType) throws IOException {
|
|
|
|
|
Map<String, IndexPlate> map = new HashMap<>();
|
|
|
|
|
findAllDir(path, map);
|
|
|
|
|
|
|
|
|
@ -176,76 +175,82 @@ public class SuoyinService {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (indexType.equals("简略索引")) {
|
|
|
|
|
List<IndexPageRow> indexPageRows = indexGen(indexPlate, rollList, pianPageNum, totalSize);
|
|
|
|
|
//修正数据
|
|
|
|
|
System.out.println(new Gson().toJson(indexPageRows));
|
|
|
|
|
|
|
|
|
|
List<IndexPageRow> indexPageRows = indexGen(indexPlate, rollList, pianPageNum, totalSize);
|
|
|
|
|
//修正数据
|
|
|
|
|
System.out.println(new Gson().toJson(indexPageRows));
|
|
|
|
|
|
|
|
|
|
//生成excel
|
|
|
|
|
List<MesEasyExcel> mesEasyExcels = new ArrayList<>();
|
|
|
|
|
for (IndexPageRow indexPageRowTemp : indexPageRows) {
|
|
|
|
|
mesEasyExcels.add(MesEasyExcel.create(indexPageRowTemp));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//生成excel
|
|
|
|
|
List<MesEasyExcel> mesEasyExcels = new ArrayList<>();
|
|
|
|
|
for (IndexPageRow indexPageRowTemp : indexPageRows) {
|
|
|
|
|
mesEasyExcels.add(MesEasyExcel.create(indexPageRowTemp));
|
|
|
|
|
}
|
|
|
|
|
EasyExcel.write(indexPlate.getAbsolutePath() + "/" + indexPlate.getName() + ".xls", MesEasyExcel.class).sheet("test").doWrite(mesEasyExcels);
|
|
|
|
|
|
|
|
|
|
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.toPdf(indexPlate.getAbsolutePath() + "/" + indexPlate.getName() + ".xls", indexPlate.getAbsolutePath() + "/" + indexPlate.getName() + ".pdf");
|
|
|
|
|
Integer page = PdfUtil.getPage(indexPlate.getAbsolutePath() + "/" + indexPlate.getName() + ".pdf");
|
|
|
|
|
|
|
|
|
|
Integer page = PdfUtil.getPage(indexPlate.getAbsolutePath() + "/" + indexPlate.getName() + ".pdf");
|
|
|
|
|
|
|
|
|
|
indexPageRows = indexGen(indexPlate, rollList, page, totalSize);
|
|
|
|
|
//修正数据
|
|
|
|
|
System.out.println(new Gson().toJson(indexPageRows));
|
|
|
|
|
|
|
|
|
|
indexPageRows = indexGen(indexPlate, rollList, page, totalSize);
|
|
|
|
|
//修正数据
|
|
|
|
|
System.out.println(new Gson().toJson(indexPageRows));
|
|
|
|
|
|
|
|
|
|
//生成excel
|
|
|
|
|
mesEasyExcels = new ArrayList<>();
|
|
|
|
|
for (IndexPageRow indexPageRowTemp : indexPageRows) {
|
|
|
|
|
mesEasyExcels.add(MesEasyExcel.create(indexPageRowTemp));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//生成excel
|
|
|
|
|
mesEasyExcels = new ArrayList<>();
|
|
|
|
|
for (IndexPageRow indexPageRowTemp : indexPageRows) {
|
|
|
|
|
mesEasyExcels.add(MesEasyExcel.create(indexPageRowTemp));
|
|
|
|
|
}
|
|
|
|
|
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");
|
|
|
|
|
|
|
|
|
|
EasyExcel.write(indexPlate.getAbsolutePath() + "/" + indexPlate.getName() + ".xls", MesEasyExcel.class).sheet("test").doWrite(mesEasyExcels);
|
|
|
|
|
//写入文件夹。
|
|
|
|
|
PdfToPic.toPic(indexPlate.getAbsolutePath() + "/" + indexPlate.getName() + ".pdf", indexPlate.getAbsolutePath() + "/片头", "01", "jpg");
|
|
|
|
|
|
|
|
|
|
ExcelUtil.toPdf(indexPlate.getAbsolutePath() + "/" + indexPlate.getName() + ".xls", indexPlate.getAbsolutePath() + "/" + indexPlate.getName() + ".pdf");
|
|
|
|
|
|
|
|
|
|
//写入文件夹。
|
|
|
|
|
PdfToPic.toPic(indexPlate.getAbsolutePath() + "/" + indexPlate.getName() + ".pdf", indexPlate.getAbsolutePath() + "/片头", "01", "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);
|
|
|
|
|
|
|
|
|
|
PdfToPic.toPicDesc(indexPlate.getAbsolutePath() + "/" + indexPlate.getName() + ".pdf", indexPlate.getAbsolutePath() + "/片尾", "00", "jpg");
|
|
|
|
|
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());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//计算完整索引
|
|
|
|
|
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);
|
|
|
|
|
i++;
|
|
|
|
|
if (indexType.equals("详细索引")) {
|
|
|
|
|
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);
|
|
|
|
|
i++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
File file1 = new File(indexPlate.getAbsolutePath());
|
|
|
|
|
EasyExcel.write(file1.getParentFile().getAbsolutePath() + "/full-index-" + indexPlate.getName() + ".xls", FullIndexPageRow.class).sheet("test").doWrite(fullIndexPageRows);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
File file1 = new File(indexPlate.getAbsolutePath());
|
|
|
|
|
EasyExcel.write(file1.getParentFile().getAbsolutePath() + "/full-index-" + indexPlate.getName() + ".xls", FullIndexPageRow.class).sheet("test").doWrite(fullIndexPageRows);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -274,7 +279,7 @@ public class SuoyinService {
|
|
|
|
|
BufferedImage image = ImageIO.read(docfile);
|
|
|
|
|
int height = image.getHeight();
|
|
|
|
|
int width = image.getWidth();
|
|
|
|
|
Document document = new Document(width, height, 300, docfile.getName(),null);
|
|
|
|
|
Document document = new Document(width, height, 300, docfile.getName(), null);
|
|
|
|
|
documentList.add(document);
|
|
|
|
|
} catch (IOException e) {
|
|
|
|
|
throw new RuntimeException(e);
|
|
|
|
@ -286,7 +291,7 @@ public class SuoyinService {
|
|
|
|
|
int height = imageInfo.getHeight();
|
|
|
|
|
int width = imageInfo.getWidth();
|
|
|
|
|
int physicalHeightDpi = imageInfo.getPhysicalHeightDpi();
|
|
|
|
|
Document document = new Document(width, height, physicalHeightDpi, docfile.getName(),null);
|
|
|
|
|
Document document = new Document(width, height, physicalHeightDpi, docfile.getName(), null);
|
|
|
|
|
documentList.add(document);
|
|
|
|
|
} catch (IOException e) {
|
|
|
|
|
throw new RuntimeException("非图片格式", e);
|
|
|
|
|