package com.docus.sw.souyin; import com.alibaba.excel.util.FileUtils; import com.docus.sw.fenpan.FileTypeEnum; import com.docus.sw.fenpan.Pieces; import com.docus.sw.fenpan.Plate; import java.io.File; import java.util.ArrayList; import java.util.List; public class SuoyinService { //读取分盘后的结果。 //宗,盘,卷,件 //输出目录文件 //生成片头,片尾 //统计出需要使用的 胶片量 public static void main(String[] args) { } public void test(){ ArrayList indexPlates = new ArrayList<>(); findAllDir("",indexPlates); //计算出宗 //计算出每个盘的目录。 //读取片头 //读取片尾 //生成excel //生成图片 // } private void findAllDir(String absolutePath, List allDirectory) { File sourceFile = new File(absolutePath); File[] files = sourceFile.listFiles(); for (File o : files) { if (o.isDirectory()) { findAllDir(o.getAbsolutePath(), allDirectory); } if (o.isFile()) { //判断是word,pdf,pic if (o.getName().endsWith(".pdf")) { // new Plate() } else if (o.getName().endsWith(".docx") || o.getName().endsWith(".doc")) { } else if (o.getName().endsWith(".jpg") || o.getName().endsWith(".png") || o.getName().endsWith(".jpeg") || o.getName().endsWith(".tif") || o.getName().endsWith(".tiff")) { //件 File parentFile = o.getParentFile() //卷 .getParentFile() //盘 .getParentFile(); IndexPlate indexPlate = new IndexPlate(parentFile.getAbsolutePath(), parentFile.getName()); allDirectory.add(indexPlate); } else { FileUtils.delete(new File(o.getAbsolutePath())); System.out.println("请删除无效的文件:" + o.getAbsolutePath()); throw new RuntimeException("请删除无效的文件:" + o.getAbsolutePath()); } break; } } } }