Browse Source

全景看看下载支持sit,pro

wuweihao 3 years ago
parent
commit
d1020071b6

+ 1 - 1
gis_service/src/main/java/com/gis/service/AliOssService.java

@@ -12,5 +12,5 @@ import java.util.List;
 public interface AliOssService {
 
 
-    Result batchDownload(List<String> code, String bucket);
+    Result batchDownload(List<String> code, String bucket, String workId);
 }

+ 9 - 2
gis_service/src/main/java/com/gis/service/impl/AliOssServiceImpl.java

@@ -1,5 +1,6 @@
 package com.gis.service.impl;
 
+import cn.hutool.core.util.StrUtil;
 import com.gis.common.constant.CmdConstant;
 import com.gis.common.constant.ConfigConstant;
 import com.gis.common.constant.PathConstant;
@@ -27,9 +28,15 @@ public class AliOssServiceImpl implements AliOssService {
 
 
     @Override
-    public Result batchDownload(List<String> code, String bucket) {
+    public Result batchDownload(List<String> code, String bucket, String workId) {
         log.info("输入场景码数量: {}", code.size());
-        String outPath = configConstant.serverBasePath + "720yun_" + StrUtils.getTimeStr();
+        String dir ;
+        if (StrUtil.isBlank(workId)){
+            dir = "720yun_" + StrUtils.getTimeStr();
+        } else {
+            dir = "720yun_" + workId + "_" + StrUtils.getTimeStr();
+        }
+        String outPath = configConstant.serverBasePath + dir;
         log.info("下载目录: {}", outPath);
         int i = 1;
         for (String sceneCode : code) {

+ 4 - 3
gis_web/src/main/java/com/gis/web/controller/AliOssController.java

@@ -27,9 +27,10 @@ public class AliOssController {
     AliOssService aliOssService;
 
     @PostMapping("download/{bucket}")
-    @ApiOperation(value = "720yun-批量下载场景数据", notes = "批量下载, 场景码以逗号分隔, bucket: oss-xiaoan:全景看看sit, 4dkankan:全景看看pro")
-    public Result batchDownload(@RequestBody List<String> code, @PathVariable String bucket){
-        return aliOssService.batchDownload(code, bucket);
+    @ApiOperation(value = "720yun-批量下载场景数据", notes = "批量下载, 场景码以逗号分隔, " +
+            "bucket: oss-xiaoan:全景看看sit, 4dkankan:全景看看pro;  workId:作品id, 用来做目录(允许为空)")
+    public Result batchDownload(@RequestBody List<String> code, @PathVariable String bucket, String workId){
+        return aliOssService.batchDownload(code, bucket, workId);
     }