|
@@ -1,21 +1,15 @@
|
|
|
package com.fdkankan.contro.controller;
|
|
|
|
|
|
import cn.hutool.core.util.ZipUtil;
|
|
|
-import com.alibaba.fastjson.JSON;
|
|
|
-import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.fdkankan.common.constant.ErrorCode;
|
|
|
import com.fdkankan.common.exception.BusinessException;
|
|
|
import com.fdkankan.common.util.FileUtils;
|
|
|
import com.fdkankan.common.util.SnowflakeIdGenerator;
|
|
|
import com.fdkankan.contro.constant.RedisConstants;
|
|
|
import com.fdkankan.contro.entity.SceneFileBuild;
|
|
|
-import com.fdkankan.contro.entity.ScenePro;
|
|
|
import com.fdkankan.contro.service.ISceneFileBuildService;
|
|
|
import com.fdkankan.contro.service.IScenePlusService;
|
|
|
-import com.fdkankan.contro.service.ISceneProService;
|
|
|
-import com.fdkankan.contro.vo.ResponseSceneFile;
|
|
|
import com.fdkankan.fyun.face.FYunFileServiceInterface;
|
|
|
import com.fdkankan.model.constants.ConstantFilePath;
|
|
|
import com.fdkankan.redis.util.RedisLockUtil;
|
|
@@ -23,13 +17,13 @@ import com.fdkankan.redis.util.RedisUtil;
|
|
|
import com.fdkankan.web.response.ResultData;
|
|
|
import lombok.extern.log4j.Log4j2;
|
|
|
import org.apache.commons.lang3.ObjectUtils;
|
|
|
-import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import java.io.File;
|
|
|
import java.io.IOException;
|
|
|
-import java.util.*;
|
|
|
+import java.util.Date;
|
|
|
+import java.util.Map;
|
|
|
|
|
|
/**
|
|
|
* 场景文件上传模块
|
|
@@ -54,41 +48,6 @@ public class SceneFileController{
|
|
|
@Autowired
|
|
|
private IScenePlusService scenePlusService;
|
|
|
|
|
|
- @Autowired
|
|
|
- private ISceneProService sceneProService;
|
|
|
-
|
|
|
- /**
|
|
|
- * 场景文件上传之前先获取fileId
|
|
|
- * @param params
|
|
|
- * @return
|
|
|
- * @throws Exception
|
|
|
- */
|
|
|
- @PostMapping("preUpload")
|
|
|
- public ResponseSceneFile preUpload(String params) throws Exception {
|
|
|
- return sceneFileBuildService.preUpload(params);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 更新fileid文件的上传状态 - 后端八目上传逻辑
|
|
|
- *
|
|
|
- * @param params
|
|
|
- * @return
|
|
|
- */
|
|
|
- @PostMapping("uploadSuccessBuild")
|
|
|
- public ResultData uploadSuccessBuild(String params) throws Exception {
|
|
|
- return sceneFileBuildService.uploadSuccessBuild(params);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- *
|
|
|
- *
|
|
|
- * @param params
|
|
|
- * @return
|
|
|
- */
|
|
|
- @PostMapping("turntableUploadSuccess")
|
|
|
- public ResultData turntableUploadSuccess(String params) throws Exception {
|
|
|
- return sceneFileBuildService.turntableUploadSuccess(params);
|
|
|
- }
|
|
|
|
|
|
@GetMapping("rebuildScene")
|
|
|
public ResultData rebuildScene(@RequestParam(value = "num") String num,@RequestParam(value = "force",defaultValue = "false") Boolean force ,@RequestParam(value = "deleteExtras",defaultValue = "true") Boolean deleteExtras) throws IOException {
|
|
@@ -96,46 +55,6 @@ public class SceneFileController{
|
|
|
}
|
|
|
|
|
|
|
|
|
- /**
|
|
|
- * 国际八目相机调用
|
|
|
- * @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;
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
@PostMapping("sendCallAlgorithm")
|
|
|
public ResultData sendCallAlgorithm(@RequestBody Map<String,String> params) throws Exception {
|
|
|
log.info("sendCallAlgorithm 参数为:{}",JSONObject.toJSONString(params));
|
|
@@ -198,18 +117,7 @@ public class SceneFileController{
|
|
|
throw new BusinessException(ErrorCode.FAILURE_CODE_5052);
|
|
|
}
|
|
|
|
|
|
- // 查找场景表
|
|
|
- LambdaQueryWrapper<ScenePro> proWrapper = new LambdaQueryWrapper<>();
|
|
|
- proWrapper.like(ScenePro::getDataSource, "/" + folderName).eq(ScenePro::getRecStatus, 'A');
|
|
|
- ScenePro pro = sceneProService.getOne(proWrapper);
|
|
|
-
|
|
|
- String dataSource = null;
|
|
|
-
|
|
|
- if (!org.springframework.util.ObjectUtils.isEmpty(pro)) {
|
|
|
- dataSource = pro.getDataSource();
|
|
|
- } else {
|
|
|
- dataSource = scenePlusService.getDataSourceLikeUnicode("/" + folderName);
|
|
|
- }
|
|
|
+ String dataSource = scenePlusService.getDataSourceLikeUnicode("/" + folderName);
|
|
|
|
|
|
if (!org.springframework.util.ObjectUtils.isEmpty(dataSource)) {
|
|
|
log.info("从数据库中查到与 fileId:{} 匹配的路径为:{}", fileId, dataSource);
|
|
@@ -235,10 +143,4 @@ public class SceneFileController{
|
|
|
redisUtil.set(String.format(RedisConstants.FILEID_FOLDER_BUILD, fileId), folderName, 2 * 24 * 60 * 60);
|
|
|
return fileId;
|
|
|
}
|
|
|
-
|
|
|
- @GetMapping("copyDataAndBuild")
|
|
|
- public ResultData copyDataAndBuild(@RequestParam(value = "dataSource") String dataSource,@RequestParam(value = "sceneVer") String sceneVer,
|
|
|
- @RequestParam(value = "sourceBucket",required = false) String sourceBucket) throws Exception {
|
|
|
- return sceneFileBuildService.copyDataAndBuild(sourceBucket,dataSource ,sceneVer);
|
|
|
- }
|
|
|
}
|