BarCodeController.java 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. package jnpf.controller;
  2. import io.swagger.v3.oas.annotations.Operation;
  3. import io.swagger.v3.oas.annotations.tags.Tag;
  4. import jnpf.util.DownUtil;
  5. import jnpf.util.ServletUtil;
  6. import jnpf.util.ZxingCodeUtil;
  7. import org.springframework.web.bind.annotation.GetMapping;
  8. import org.springframework.web.bind.annotation.RequestMapping;
  9. import org.springframework.web.bind.annotation.RestController;
  10. import java.awt.image.BufferedImage;
  11. /**
  12. * 生成条码
  13. *
  14. * @author JNPF开发平台组
  15. * @version V3.1.0
  16. * @copyright 引迈信息技术有限公司(https://www.jnpfsoft.com)
  17. * @date 2019年9月26日 上午9:18
  18. */
  19. @RestController
  20. @Tag(name = "(待定)生成条码", description = "BarCode")
  21. @RequestMapping("/api/extend/BarCode")
  22. public class BarCodeController {
  23. /**
  24. * 生成二维码
  25. *
  26. * @return
  27. */
  28. @Operation(summary = "生成二维码")
  29. @GetMapping("/BuildQRCode")
  30. public void buildQrCode() {
  31. BufferedImage image = ZxingCodeUtil.createCode(ServletUtil.getHeader("F_QRCodeContent"), 400, 400);
  32. DownUtil.write(image);
  33. }
  34. /**
  35. * 生成条形码
  36. *
  37. * @return
  38. */
  39. @Operation(summary = "生成条形码")
  40. @GetMapping("/BuildBarCode")
  41. public void buildBarCode() {
  42. BufferedImage image = ZxingCodeUtil.getBarcode(ServletUtil.getHeader("F_BarCodeContent"), 265, 50);
  43. DownUtil.write(image);
  44. }
  45. }