Jelajahi Sumber

卷库查询下载pdf名称修改

wangliang 2 tahun lalu
induk
melakukan
131f872f1a

+ 4 - 0
teachcloud-common/src/main/java/com/qmth/teachcloud/common/service/impl/TeachcloudCommonServiceImpl.java

@@ -631,6 +631,10 @@ public class TeachcloudCommonServiceImpl implements TeachcloudCommonService {
             if (!file.exists()) {
             if (!file.exists()) {
                 throw ExceptionResultEnum.ERROR.exception("本地文件不存在");
                 throw ExceptionResultEnum.ERROR.exception("本地文件不存在");
             }
             }
+            if (!localPath.exists()) {
+                localPath.getParentFile().mkdirs(); //目标文件目录不存在的话需要创建目录
+                localPath.createNewFile();
+            }
             IOUtils.copy(new FileInputStream(filePath), new FileOutputStream(localPath));
             IOUtils.copy(new FileInputStream(filePath), new FileOutputStream(localPath));
             return file;
             return file;
         }
         }