UploadFileController.java 856 B

12345678910111213141516171819202122
  1. package com.nosum.deliver.file.controller;
  2. import com.nosum.common.base.domain.Result;
  3. import com.nosum.deliver.file.factory.UploadFileFactory;
  4. import org.springframework.web.bind.annotation.PostMapping;
  5. import org.springframework.web.bind.annotation.RequestMapping;
  6. import org.springframework.web.bind.annotation.RequestParam;
  7. import org.springframework.web.bind.annotation.RestController;
  8. import org.springframework.web.multipart.MultipartFile;
  9. @RestController
  10. @RequestMapping("/file")
  11. public class UploadFileController {
  12. @PostMapping("/file/v1/upload")
  13. public Result uploadFile(@RequestParam(value = "file") final MultipartFile file) {
  14. String storyType = "";
  15. final String store = UploadFileFactory.getUploadFileService(storyType).saveFileStore(file);
  16. return Result.createWithSuccessMessage().setExtra(store);
  17. }
  18. }