123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182 |
- package com.fdkankan.scene.controller;
- import com.fasterxml.jackson.databind.ObjectMapper;
- import com.fdkankan.common.controller.BaseController;
- import com.fdkankan.common.response.ResultData;
- import com.fdkankan.redis.util.RedisLockUtil;
- import com.fdkankan.scene.service.*;
- import com.fdkankan.scene.vo.ResponseSceneFile;
- import lombok.extern.log4j.Log4j2;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.beans.factory.annotation.Value;
- import org.springframework.transaction.annotation.Transactional;
- 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.multipart.MultipartFile;
- /**
- * 场景文件上传模块
- */
- @Log4j2
- @RestController
- @RequestMapping("/api/scene/file")
- //@Transactional(rollbackFor = Exception.class)
- public class SceneFileController extends BaseController {
- @Value("${main.url}")
- private String mainUrl;
- @Value("${scene.url}")
- private String sceneUrl;
- @Value("${scene.pro.url}")
- private String sceneProUrl;
- @Value("${scene.pro.new.url}")
- private String sceneProNewUrl;
- @Value("${upload.type}")
- private String type;
- @Value("${oss.prefix.ali}")
- private String prefixAli;
- @Value("${ecs.type}")
- private String ecsType;
- @Value("${unCalculated.company.ids:#{null}}")
- private String[] unCalculatedCompanyIds;
- @Autowired
- private ISceneFileBuildService sceneFileBuildService;
- private String splice = "#";
- @Autowired
- RedisLockUtil redisLockUtil;
- /**
- * 场景文件上传之前先获取fileId
- * @param params
- * @return
- * @throws Exception
- */
- @PostMapping("preUpload")
- public ResponseSceneFile preUpload(String params) throws Exception {
- return sceneFileBuildService.preUpload(params);
- }
- /**
- * 获取文件上传的状态
- * @param params
- * @return
- * @throws Exception
- */
- @PostMapping("getProgress")
- public ResponseSceneFile getProgress(String params) throws Exception {
- return sceneFileBuildService.getProgress(params);
- }
- /**
- * 单个文件上传
- * @param file
- * @param params
- * @return
- */
- @PostMapping("upload")
- public ResultData upload(@RequestParam(value = "file",required = false) MultipartFile file,
- String params) throws Exception {
- return sceneFileBuildService.uploadFile(file, params);
- }
- /**
- * 上传大文件
- * @param file
- * @return
- * @throws
- */
- @PostMapping("uploadBigFile")
- public ResultData uploadBigFile(@RequestParam(value = "file",required = false) MultipartFile file,
- String params) throws Exception {
- return sceneFileBuildService.uploadFile(file, params);
- }
- /**
- * 更新fileid文件的上传状态 -- 作废
- *
- * @param params
- * @return
- */
- @PostMapping("uploadSuccess")
- public ResultData uploadSuccess(String params) throws Exception {
- return sceneFileBuildService.uploadSuccess(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);
- }
- /**
- * 获取亚马逊S3文件上传url
- *
- * @return
- */
- @PostMapping("getS3UploadUrl")
- public ResultData getS3UploadUrl(String params) throws Exception {
- return sceneFileBuildService.getS3UploadUrl(params);
- }
- /**
- * 计算双目场景 - 新双目相机上传 小红屋
- *
- * @return
- */
- // @ApiOperation("计算双目场景 - 新双目相机上传 小红屋")
- @PostMapping("buildLiteScene")
- // @ApiImplicitParams({
- // @ApiImplicitParam(name = "prefix", value = "文件下载前缀,结尾不加/", dataType = "String"),
- // @ApiImplicitParam(name = "dataFdage", value = "dataFdage", dataType = "String"),
- // @ApiImplicitParam(name = "zipName", value = "zip文件包名称", dataType = "String"),
- // @ApiImplicitParam(name = "password", value = "密码", dataType = "String"),
- // @ApiImplicitParam(name = "userName", value = "用户名", dataType = "String")})
- public ResultData buildLiteScene(String prefix, String dataFdage, String zipName, String userName, String password, String oldNum) throws Exception{
- return sceneFileBuildService.buildLiteScene(prefix, dataFdage, zipName, userName, password, oldNum);
- }
- /**
- * 获取亚马逊S3文件上传url
- * @return
- */
- @PostMapping("buildScene")
- // @ApiOperation("获取亚马逊S3文件上传url")
- // @ApiImplicitParams({
- // @ApiImplicitParam(name = "unicode", value = "unicode文件夹", dataType = "String"),
- // @ApiImplicitParam(name = "zip", value = "zip包的名称", dataType = "String"),
- // @ApiImplicitParam(name = "dataFdage", value = "dataFdage名称", dataType = "String")})
- public ResultData buildScene(String prefix, String unicode, String zip, String dataFdage) throws Exception{
- return sceneFileBuildService.buildScene(prefix, unicode, zip, dataFdage);
- }
- }
|