public static String convertTemplatePath(String path) {
// 如果是windows 则直接返回
// if (System.getProperties().getProperty("os.name").contains("Windows")) {
// return path;
// }
Resource resource = new ClassPathResource(path);
FileOutputStream fileOutputStream = null;
// 将模版文件写入到 tomcat临时目录
String folder = System.getProperty("catalina.home");
File tempFile = new File(folder + File.separator + path);
// System.out.println("文件路径:" + tempFile.getPath());
// 文件存在时 不再写入
if (tempFile.exists()) {
return tempFile.getPath();
}
File parentFile = tempFile.getParentFile();
// 判断父文件夹是否存在
if (!parentFile.exists()) {
parentFile.mkdirs();
}
try {
BufferedInputStream bufferedInputStream = new BufferedInputStream(resource.g
jeecg-boot 根据模板导出(找不到系统路径)
最新推荐文章于 2024-07-17 16:00:15 发布