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