Browse Source

全景图下载耗时日志打印

dengsixing 3 years ago
parent
commit
f0aace9b22

+ 6 - 1
4dkankan-center-scene/src/main/java/com/fdkankan/scene/service/impl/SceneEditInfoServiceImpl.java

@@ -987,6 +987,7 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
         String downloadName = null;
         //删除本地文件
         FileUtils.deleteDirectory(localImagesPath);
+        long start = Calendar.getInstance().getTimeInMillis();
         //如果入参文件名不为空,则是单个文件下载,不需要打包
         boolean single = true;
         if(StrUtil.isNotEmpty(fileName)){
@@ -1002,13 +1003,15 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
             //先下载到本地
             List<String> keyList = uploadToOssUtil.listKeys(imgCachePath);
             if (!StorageType.LOCAL.code().equals(this.type)) {// TODO: 2022/2/15 这里有可能有问题,可能还需要考虑本地部署的情况
-                keyList.stream().forEach(key->{
+                keyList.parallelStream().forEach(key->{
                     String file = key.substring(key.lastIndexOf("/") + 1);
                     String imageUrl = ossUrlPrefix + imgCachePath + file + "?t=" + System.currentTimeMillis();
                     FileUtils.downLoadFromUrl(imageUrl, file, localImagesPath);
                 });
             }
         }
+        long downloadEnd = Calendar.getInstance().getTimeInMillis();
+        log.info("全景图下载耗时,num:{}, time:{}", num, downloadEnd - start);
 
         if(!single){
             downloadName = num + "_images.zip";
@@ -1023,6 +1026,8 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
             //删除本地目录
             FileUtils.deleteDirectory(localImagesPath);
         }
+        long end = Calendar.getInstance().getTimeInMillis();
+        log.info("全景图压缩包上传耗时,num:{}, time:{}", num, end - downloadEnd);
 
         Map<String, Object> map = new HashMap<>();
         map.put("fileUrl", url + "?t=" + System.currentTimeMillis());