|
|
@@ -0,0 +1,34 @@
|
|
|
+package com.fdkankan.scene.controller;
|
|
|
+
|
|
|
+import cn.hutool.core.io.FileUtil;
|
|
|
+import cn.hutool.core.lang.UUID;
|
|
|
+import com.fdkankan.common.util.DateExtUtil;
|
|
|
+import com.fdkankan.fyun.face.FYunFileServiceInterface;
|
|
|
+import com.fdkankan.model.constants.UploadFilePath;
|
|
|
+import com.fdkankan.scene.ObjectStoragePath;
|
|
|
+import com.fdkankan.scene.annotation.CheckPermit;
|
|
|
+import com.fdkankan.web.response.ResultData;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+
|
|
|
+import javax.annotation.Resource;
|
|
|
+import java.io.File;
|
|
|
+import java.net.URL;
|
|
|
+import java.util.Date;
|
|
|
+
|
|
|
+@RestController
|
|
|
+@RequestMapping("/service/scene/fileStorage")
|
|
|
+public class FileStorageContoller {
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private FYunFileServiceInterface fYunFileService;
|
|
|
+
|
|
|
+ @CheckPermit
|
|
|
+ @GetMapping("getPresignedUrl")
|
|
|
+ public ResultData getPresignedUrl(@RequestParam String num, String fileName){
|
|
|
+ String extName = FileUtil.extName(fileName);
|
|
|
+ String key = ObjectStoragePath.TEMP_PATH + DateExtUtil.format(new Date(), DateExtUtil.dateStyle6) + File.separator + UUID.randomUUID() + "." + extName;
|
|
|
+ URL presignedUrl = fYunFileService.getPresignedUrl(key);
|
|
|
+ return ResultData.ok(presignedUrl.toExternalForm());
|
|
|
+ }
|
|
|
+
|
|
|
+}
|