|
@@ -1,17 +1,24 @@
|
|
package com.fdkankan.contro.controller;
|
|
package com.fdkankan.contro.controller;
|
|
|
|
|
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
|
+import com.alibaba.fastjson.JSONArray;
|
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
|
+import com.fdkankan.common.constant.ErrorCode;
|
|
|
|
+import com.fdkankan.common.exception.BusinessException;
|
|
import com.fdkankan.contro.service.ISceneFileBuildService;
|
|
import com.fdkankan.contro.service.ISceneFileBuildService;
|
|
import com.fdkankan.contro.vo.ResponseSceneFile;
|
|
import com.fdkankan.contro.vo.ResponseSceneFile;
|
|
|
|
+import com.fdkankan.fyun.face.FYunFileServiceInterface;
|
|
import com.fdkankan.web.response.ResultData;
|
|
import com.fdkankan.web.response.ResultData;
|
|
import lombok.extern.log4j.Log4j2;
|
|
import lombok.extern.log4j.Log4j2;
|
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
-import org.springframework.web.bind.annotation.GetMapping;
|
|
|
|
-import org.springframework.web.bind.annotation.PostMapping;
|
|
|
|
-import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
-import org.springframework.web.bind.annotation.RequestParam;
|
|
|
|
-import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import java.io.IOException;
|
|
import java.io.IOException;
|
|
|
|
+import java.util.ArrayList;
|
|
|
|
+import java.util.HashMap;
|
|
|
|
+import java.util.List;
|
|
|
|
+import java.util.Map;
|
|
|
|
|
|
/**
|
|
/**
|
|
* 场景文件上传模块
|
|
* 场景文件上传模块
|
|
@@ -24,6 +31,10 @@ public class SceneFileController{
|
|
@Autowired
|
|
@Autowired
|
|
private ISceneFileBuildService sceneFileBuildService;
|
|
private ISceneFileBuildService sceneFileBuildService;
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private FYunFileServiceInterface fYunFileService;
|
|
|
|
+
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 场景文件上传之前先获取fileId
|
|
* 场景文件上传之前先获取fileId
|
|
* @param params
|
|
* @param params
|
|
@@ -58,7 +69,48 @@ public class SceneFileController{
|
|
}
|
|
}
|
|
|
|
|
|
@GetMapping("rebuildScene")
|
|
@GetMapping("rebuildScene")
|
|
- public ResultData rebuildScene(@RequestParam(value = "num") String num,@RequestParam(value = "force",defaultValue = "true") Boolean force ,@RequestParam(value = "deleteExtras",defaultValue = "true") Boolean deleteExtras) throws IOException {
|
|
|
|
|
|
+ public ResultData rebuildScene(@RequestParam(value = "num") String num,@RequestParam(value = "force",defaultValue = "false") Boolean force ,@RequestParam(value = "deleteExtras",defaultValue = "true") Boolean deleteExtras) throws IOException {
|
|
return sceneFileBuildService.rebuildScene(num,force,deleteExtras);
|
|
return sceneFileBuildService.rebuildScene(num,force,deleteExtras);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 国际八目相机调用
|
|
|
|
+ * @param params
|
|
|
|
+ * @return
|
|
|
|
+ * @throws Exception
|
|
|
|
+ */
|
|
|
|
+ @PostMapping("getS3UploadUrl")
|
|
|
|
+ public ResultData getS3UploadUrl(String params) throws Exception {
|
|
|
|
+ log.info("getS3UploadUrl 参数:{}",params);
|
|
|
|
+ if (StringUtils.isEmpty(params)) {
|
|
|
|
+ throw new BusinessException(ErrorCode.PARAM_ERROR,"params为空。");
|
|
|
|
+ }
|
|
|
|
+ JSONObject jsonObject = JSON.parseObject(params);
|
|
|
|
+ if(jsonObject == null){
|
|
|
|
+ throw new BusinessException(ErrorCode.PARAM_ERROR,"params为空。");
|
|
|
|
+ }
|
|
|
|
+ JSONArray files = jsonObject.getJSONArray("Files");
|
|
|
|
+ if(files == null){
|
|
|
|
+ throw new BusinessException(ErrorCode.PARAM_ERROR,"params为空。");
|
|
|
|
+ }
|
|
|
|
+ List<String> urls = new ArrayList<>();
|
|
|
|
+ for(int i = 0, len = files.size(); i < len; i++){
|
|
|
|
+ urls.add(files.getJSONObject(i).getString("filename"));
|
|
|
|
+ }
|
|
|
|
+ Map<String, String> uploadS3Url = getUploadS3Url(urls);
|
|
|
|
+ return ResultData.ok(uploadS3Url);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private Map<String, String> getUploadS3Url(List<String> urls) {
|
|
|
|
+ if(urls == null || urls.size() <= 0){
|
|
|
|
+ return null;
|
|
|
|
+ }
|
|
|
|
+ Map<String, String> map = new HashMap();
|
|
|
|
+ for(String path : urls){
|
|
|
|
+ map.put(path, fYunFileService.getPresignedUrl(path).toString());
|
|
|
|
+ }
|
|
|
|
+ return map;
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|