소스 검색

返回oss链接改为/oss开头

dengsixing 2 년 전
부모
커밋
c594ff5a0c

+ 4 - 16
src/main/java/com/fdkankan/scene/service/impl/SceneEditInfoServiceImpl.java

@@ -1187,10 +1187,7 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
                 throw new BusinessException(ErrorCode.FAILURE_CODE_5063);
             }
             fYunFileService.uploadFile(bucket, localFilePath, ossFilePath);
-            url = ossFilePath;
-            if(!FYunTypeEnum.LOCAL.code().equals(this.fyunType)){
-                url = ossUrlPrefix + url;
-            }
+            url = ossUrlPrefix + ossFilePath;
             downloadName = fileName;
         }else{
             if(!cn.hutool.core.io.FileUtil.exist(localImagesPath)
@@ -1207,10 +1204,7 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
             log.info("打包耗时:" + (end1 - start));
             //上传压缩包
             fYunFileService.uploadFileByCommand(bucket, zipPath, String.format(cacheFormat, num) + downloadName);
-            url = String.format(cacheFormat, num) + downloadName;
-            if(!FYunTypeEnum.LOCAL.code().equals(this.fyunType)){
-                url = ossUrlPrefix + url;
-            }
+            url = ossUrlPrefix + String.format(cacheFormat, num) + downloadName;
             long end2 = Calendar.getInstance().getTimeInMillis();
             log.info("上传耗时:" + (end2 - end1));
             //删除本地压缩包
@@ -1356,10 +1350,7 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
     @Override
     public DownloadVO downloadBallScreenVideo(BallScreenVideoParamVO param) {
         String videoPath = String.format(UploadFilePath.VIDEOS_VIEW_PATH, param.getNum()) + param.getFileName();
-        String url = videoPath + "?t=" + System.currentTimeMillis();
-        if(!FYunTypeEnum.LOCAL.code().equals(this.fyunType)){
-            url = ossUrlPrefix + url;
-        }
+        String url = ossUrlPrefix + videoPath + "?t=" + System.currentTimeMillis();
         return DownloadVO.builder()
             .fileName(param.getFileName())
             .url(url)
@@ -1607,10 +1598,7 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
 
             SceneDataDownload sceneDataDownload = sceneDataDownloadService.findBySceneNum(num);
             if(sceneDataDownload == null){
-                String downloadPath = "data_download/" + num + ".zip";
-                if(!FYunTypeEnum.LOCAL.code().equals(this.fyunType)){
-                    downloadPath = ossUrlPrefix + downloadPath;
-                }
+                String downloadPath = ossUrlPrefix + "data_download/" + num + ".zip";
                 sceneDataDownload = new SceneDataDownload();
                 sceneDataDownload.setSceneNum(num);
                 sceneDataDownload.setDownloadPath(downloadPath);

+ 1 - 1
src/main/java/com/fdkankan/scene/service/impl/ScenePlusServiceImpl.java

@@ -221,7 +221,7 @@ public class ScenePlusServiceImpl extends ServiceImpl<IScenePlusMapper, ScenePlu
         String outPathZh = ConstantFilePath.BASE_PATH + File.separator + "sceneQRcode/"+num+".png";
         String outPathEn = ConstantFilePath.BASE_PATH + File.separator + "sceneQRcode/"+num+"_en.png";
 
-        String webSize = mainUrl + "/" + sceneProNewUrl + num;
+        String webSize = "/" + sceneProNewUrl + num;
         QrCodeUtil.generate(webSize, QrConfig.create().setImg(logoPath), FileUtil.file(outPathZh));
         QrCodeUtil.generate(webSize + "&lang=en", QrConfig.create().setImg(logoPath), FileUtil.file(outPathEn));
         //上传logo图片

+ 6 - 21
src/main/java/com/fdkankan/scene/service/impl/SceneProServiceImpl.java

@@ -122,11 +122,8 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
         }
         ScenePlusExt scenePlusExt = scenePlusExtService.getScenePlusExtByPlusId(scenePlus.getId());
 
-        String thumbUrl = String.format(UploadFilePath.USER_EDIT_PATH, param.getNum()) + param.getFileName();
+        String thumbUrl = this.ossUrlPrefix + String.format(UploadFilePath.USER_EDIT_PATH, param.getNum()) + param.getFileName();
         //更新缩略图url
-        if(!FYunTypeEnum.LOCAL.code().equals(fyunType)){
-            thumbUrl = this.ossUrlPrefix + thumbUrl;
-        }
         scenePlusExt.setThumb(thumbUrl);
         scenePlusExtService.updateById(scenePlusExt);
 
@@ -895,10 +892,7 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
             ZipUtil.zip(newData, zipPath);
             //上传压缩包
             fYunFileService.uploadFile(bucket, zipPath, "downloads/extras/" + zipName);
-            String url = "downloads/extras/" + zipName + "?t=" + Calendar.getInstance().getTimeInMillis();
-            if(!FYunTypeEnum.LOCAL.code().equals(fyunType)){
-                url = ossUrlPrefix + url;
-            }
+            String url = ossUrlPrefix + "downloads/extras/" + zipName + "?t=" + Calendar.getInstance().getTimeInMillis();
             return ResultData.ok(url);
         }
 
@@ -943,11 +937,8 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
                 ZipUtil.zip(meshPath, zipPath);
                 //上传压缩包
                 fYunFileService.uploadFile(bucket, zipPath, "downloads/extras/" + zipName);
-                String url = "downloads/extras/" + zipName + "?t=" + Calendar.getInstance().getTimeInMillis();
-                if(!FYunTypeEnum.LOCAL.code().equals(fyunType)){
-                    url = ossUrlPrefix + url;
-                }
-//                FileUtil.del(zipPath);
+                String url = ossUrlPrefix + "downloads/extras/" + zipName + "?t=" + Calendar.getInstance().getTimeInMillis();
+                FileUtil.del(zipPath);
                 return ResultData.ok(url);
             }
         }
@@ -971,10 +962,7 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
             ZipUtil.zip(editData, zipPath);
             //上传压缩包
             fYunFileService.uploadFile(bucket, zipPath, "downloads/extras/" + zipName);
-            String url = "downloads/extras/" + zipName + "?t=" + Calendar.getInstance().getTimeInMillis();
-            if(!FYunTypeEnum.LOCAL.code().equals(fyunType)){
-                url = ossUrlPrefix + url;
-            }
+            String url = ossUrlPrefix + "downloads/extras/" + zipName + "?t=" + Calendar.getInstance().getTimeInMillis();
             return ResultData.ok(url);
         }
 
@@ -998,10 +986,7 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
         ZipUtil.zip(dataPath, zipPath);
         //上传压缩包
         fYunFileService.uploadFile(bucket, zipPath, "downloads/extras/" + zipName);
-        String url = "downloads/extras/" + zipName + "?t=" + Calendar.getInstance().getTimeInMillis();
-        if(!FYunTypeEnum.LOCAL.code().equals(fyunType)){
-            url = ossUrlPrefix + url;
-        }
+        String url = ossUrlPrefix + "downloads/extras/" + zipName + "?t=" + Calendar.getInstance().getTimeInMillis();
         return ResultData.ok(url);
     }
 

+ 2 - 2
src/main/java/com/fdkankan/scene/service/impl/SceneUploadServiceImpl.java

@@ -226,9 +226,9 @@ public class SceneUploadServiceImpl extends ServiceImpl<ISceneUploadMapper, Scen
         cn.hutool.core.io.FileUtil.writeString(param.getContent(), tempFile, StandardCharsets.UTF_8);
         fYunFileService.uploadFile(param.getBucket(), tempFile.getPath(), param.getOssPath());
         tempFile.deleteOnExit();
-        String url = param.getOssPath();
+        String url = "/" + param.getOssPath();
         if(!FYunTypeEnum.LOCAL.code().equals(fyunType)){
-            url = this.ossUrlPrefix + url;
+            url = this.ossUrlPrefix + param.getOssPath();
         }
         return url;
     }