Browse Source

修改下载目录1

wuweihao 3 years ago
parent
commit
a619da1e35

+ 7 - 4
gis_service/src/main/java/com/gis/service/impl/AliOssServiceImpl.java

@@ -1,6 +1,7 @@
 package com.gis.service.impl;
 
 import cn.hutool.core.io.FileUtil;
+import cn.hutool.core.util.StrUtil;
 import cn.hutool.http.HttpUtil;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
@@ -164,12 +165,14 @@ public class AliOssServiceImpl implements AliOssService {
      * @param workId
      */
     private void downloadGuideThumb(Map<String, String> iconMap, String workId){
-        String savePath = configConstant.serverBasePath + "/download/" + workId + "/images";
+        String savePath = configConstant.serverBasePath + "/download/" + workId + "/images/";
         for (Map.Entry<String, String> m : iconMap.entrySet()) {
             String sceneCode = m.getKey();
             String ossUrl = m.getValue();
-            HttpUtil.downloadFile(ossUrl, savePath);
-            log.info("场景:{} 保存路径: {} 完成", sceneCode, savePath);
+            String fileName = StrUtil.subAfter(ossUrl, "/", true);
+            String filePath = savePath + fileName;
+            HttpUtil.downloadFile(ossUrl, filePath);
+            log.info("场景:{} 保存路径: {} 完成", sceneCode, filePath);
         }
         log.info("下载导览图片完成: {}", savePath);
     }
@@ -195,7 +198,7 @@ public class AliOssServiceImpl implements AliOssService {
     private void downloadOss(String sceneCode,  String bucket, String workId){
         String cmd = CmdConstant.OSSUTIL_DOWNLOAD_DIR;
         String inPath = PathConstant.OSS_720YUN_MANAGE + File.separator + sceneCode;
-        String outPath = configConstant.serverBasePath + "/" + workId;
+        String outPath = configConstant.serverBasePath + "/download/" + workId;
         cmd = cmd.replaceAll("@inPath", inPath);
         cmd = cmd.replaceAll("@outPath", outPath);
         cmd = cmd.replaceAll("@bucket", bucket);