| | |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.io.File; |
| | | import java.io.FilenameFilter; |
| | | import java.io.IOException; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | |
| | | String inFilePath = projectDir + File.separator + fileRelativePath; |
| | | String outFilePath = (projectDir + File.separator + fileRelativePath).replace("_approving",""); |
| | | WordUtil.fillValue(inFilePath,outFilePath,Arrays.asList(approving.getFzr(),approving.getBz(),approving.getZz(),approving.getPb())); |
| | | //删除之前预览产生的中间文件 |
| | | String filename = fileRelativePath.substring(fileRelativePath.lastIndexOf(File.separator)+1,fileRelativePath.lastIndexOf(".")); |
| | | File approvingDir = new File(projectDir + File.separator + "procedure_approving"); |
| | | FilenameFilter filenameFilter = new FilenameFilter() { |
| | | @Override |
| | | public boolean accept(File dir, String name) { |
| | | name = name.substring(0,name.lastIndexOf(".")); |
| | | if(name.contains(filename) && !name.equals(filename)){ |
| | | return true; |
| | | } |
| | | return false; |
| | | } |
| | | }; |
| | | File[] files = approvingDir.listFiles(filenameFilter); |
| | | for (File file : files) { |
| | | file.delete(); |
| | | } |
| | | |
| | | //流程文件数据转移 |
| | | ProcedureDoc procedureDoc = new ProcedureDoc(); |
| | | procedureDoc.setName(approving.getName()); |