|
@@ -20,6 +20,7 @@ import com.qmth.teachcloud.common.entity.*;
|
|
import com.qmth.teachcloud.common.enums.*;
|
|
import com.qmth.teachcloud.common.enums.*;
|
|
import com.qmth.teachcloud.common.service.*;
|
|
import com.qmth.teachcloud.common.service.*;
|
|
import com.qmth.teachcloud.common.util.*;
|
|
import com.qmth.teachcloud.common.util.*;
|
|
|
|
+import org.apache.commons.io.IOUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.LoggerFactory;
|
|
import org.slf4j.LoggerFactory;
|
|
@@ -616,8 +617,8 @@ public class TeachcloudCommonServiceImpl implements TeachcloudCommonService {
|
|
String type = object.getString(SystemConstant.TYPE);
|
|
String type = object.getString(SystemConstant.TYPE);
|
|
UploadFileEnum uploadType = Enum.valueOf(UploadFileEnum.class, (String) object.get(SystemConstant.UPLOAD_TYPE));
|
|
UploadFileEnum uploadType = Enum.valueOf(UploadFileEnum.class, (String) object.get(SystemConstant.UPLOAD_TYPE));
|
|
|
|
|
|
|
|
+ File localPath = new File(rootPath, fileName);
|
|
if (type.equals(SystemConstant.OSS)) {
|
|
if (type.equals(SystemConstant.OSS)) {
|
|
- File localPath = new File(rootPath, fileName);
|
|
|
|
try {
|
|
try {
|
|
// File file = ossUtil.ossDownload(filePath, localPath.getPath());
|
|
// File file = ossUtil.ossDownload(filePath, localPath.getPath());
|
|
File file = fileStoreUtil.ossDownload(filePath, localPath.getPath(), uploadType.getFssType());
|
|
File file = fileStoreUtil.ossDownload(filePath, localPath.getPath(), uploadType.getFssType());
|
|
@@ -630,6 +631,7 @@ public class TeachcloudCommonServiceImpl implements TeachcloudCommonService {
|
|
if (!file.exists()) {
|
|
if (!file.exists()) {
|
|
throw ExceptionResultEnum.ERROR.exception("本地文件不存在");
|
|
throw ExceptionResultEnum.ERROR.exception("本地文件不存在");
|
|
}
|
|
}
|
|
|
|
+ IOUtils.copy(new FileInputStream(filePath), new FileOutputStream(localPath));
|
|
return file;
|
|
return file;
|
|
}
|
|
}
|
|
}
|
|
}
|