Răsfoiți Sursa

卷库查询下载pdf名称修改

wangliang 2 ani în urmă
părinte
comite
4be7b46c4e

+ 3 - 1
teachcloud-common/src/main/java/com/qmth/teachcloud/common/service/impl/TeachcloudCommonServiceImpl.java

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