RemoteFileService.java 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. package com.xunmei.system.api;
  2. import com.xunmei.common.core.constant.ServiceNameConstants;
  3. import com.xunmei.common.core.domain.R;
  4. import com.xunmei.system.api.domain.SysFile;
  5. import com.xunmei.system.api.factory.RemoteFileFallbackFactory;
  6. import org.springframework.cloud.openfeign.FeignClient;
  7. import org.springframework.http.MediaType;
  8. import org.springframework.web.bind.annotation.GetMapping;
  9. import org.springframework.web.bind.annotation.PostMapping;
  10. import org.springframework.web.bind.annotation.RequestBody;
  11. import org.springframework.web.bind.annotation.RequestPart;
  12. import org.springframework.web.multipart.MultipartFile;
  13. import java.util.Map;
  14. /**
  15. * 文件服务
  16. *
  17. * @author xunmei
  18. */
  19. @FeignClient(contextId = "remoteFileService", value = ServiceNameConstants.FILE_SERVICE, fallbackFactory = RemoteFileFallbackFactory.class)
  20. public interface RemoteFileService {
  21. /**
  22. * 上传文件
  23. *
  24. * @param file 文件信息
  25. * @return 结果
  26. */
  27. @PostMapping(value = "/upload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
  28. public R<SysFile> upload(@RequestPart(value = "file") MultipartFile file);
  29. /**
  30. * 生成教育培训登记簿
  31. *
  32. * @param data 文件信息
  33. * @param cacheDir 缓存目录
  34. * @return 结果
  35. */
  36. @PostMapping(value = "/file/generateEduTrainingPdf")
  37. R<String> generateEduTrainingPdf(@RequestBody Map<String, Object> data);
  38. /**
  39. * 获取本地存储路径前缀
  40. *
  41. * @return 结果
  42. */
  43. @GetMapping(value = "/file/getLocalPathPrefix")
  44. String getLocalPathPrefix();
  45. /**
  46. * 获取nginx静态目录前缀
  47. *
  48. * @return 结果
  49. */
  50. @GetMapping(value = "/file/getStaticPathPrefix")
  51. String getStaticPathPrefix();
  52. }