|
@@ -3,14 +3,14 @@ package com.jeeplus.test.oss.controller;
|
|
|
import com.jeeplus.test.oss.domain.WorkAttachment;
|
|
|
import com.jeeplus.test.oss.service.OssService;
|
|
|
import com.jeeplus.test.oss.service.dto.FileDetailDTO;
|
|
|
-import com.jeeplus.test.oss.service.dto.OssServiceDto;
|
|
|
+import com.jeeplus.test.user.service.dto.FileUrlDto;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
-import io.swagger.annotations.ApiParam;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.http.ResponseEntity;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
+import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
@@ -97,4 +97,17 @@ public class OssFileController {
|
|
|
FileDetailDTO fileDetailDTO = ossService.getFileSizeByUrl(url);
|
|
|
return ResponseEntity.ok(fileDetailDTO);
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 上传文件
|
|
|
+ * @return
|
|
|
+ * @throws IOException
|
|
|
+ */
|
|
|
+ @ApiOperation("上传文件")
|
|
|
+ @PostMapping("webUpload/upload")
|
|
|
+ public ResponseEntity<FileUrlDto> webUpload(MultipartFile file) throws IOException {
|
|
|
+ String dir = "note";
|
|
|
+ FileUrlDto dto = ossService.webUpload(file,dir);
|
|
|
+ return ResponseEntity.ok(dto);
|
|
|
+ }
|
|
|
}
|