FileFormatConversionController.java 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. package com.rongwei.controller;
  2. import com.rongwei.bscommon.sys.service.impl.FileFormatConversionServiceImpl;
  3. import org.slf4j.Logger;
  4. import org.slf4j.LoggerFactory;
  5. import org.springframework.beans.factory.annotation.Autowired;
  6. import org.springframework.web.bind.annotation.*;
  7. import javax.servlet.http.HttpServletResponse;
  8. /**
  9. * FileFormatConversionController class
  10. *
  11. * @author XH
  12. * @date 2025/08/01
  13. */
  14. @RestController
  15. @RequestMapping("/file")
  16. public class FileFormatConversionController {
  17. private static final Logger log = LoggerFactory.getLogger(FileFormatConversionController.class);
  18. @Autowired
  19. private FileFormatConversionServiceImpl fileFormatConversionService;
  20. /**
  21. * 文件转为pdf 预览
  22. *
  23. * @param id
  24. * @param response
  25. */
  26. @GetMapping("/format/conversion/{id}")
  27. public void fileFormatConversion(@PathVariable String id, HttpServletResponse response) {
  28. log.info("文件预览接口入参为:{}", id);
  29. fileFormatConversionService.fileFormatConversion(id, response,false);
  30. }
  31. /**
  32. * 文件转为pdf 预览带水印
  33. *
  34. * @param id
  35. * @param response
  36. */
  37. @GetMapping("/preview/waterMark/{id}")
  38. public void fileFormatConversionAndWaterMark(@PathVariable String id, HttpServletResponse response) {
  39. log.info("文件预览接口入参为:{}", id);
  40. fileFormatConversionService.fileFormatConversion(id, response,true);
  41. }
  42. }