| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114 |
- package com.fdkankan.scene.controller;
- import com.fdkankan.common.controller.BaseController;
- import com.fdkankan.common.response.ResultData;
- import com.fdkankan.redis.util.RedisLockUtil;
- import com.fdkankan.scene.service.ISceneFileBuildService;
- 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.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("/service/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);
- }
- /**
- * 获取亚马逊S3文件上传url
- *
- * @return
- */
- @PostMapping("getS3UploadUrl")
- public ResultData getS3UploadUrl(String params) throws Exception {
- return sceneFileBuildService.getS3UploadUrl(params);
- }
- }
|