EsbSocketController.java 964 B

12345678910111213141516171819202122232425262728293031
  1. package com.nokia.controller;
  2. import org.springframework.web.bind.annotation.PostMapping;
  3. import org.springframework.web.bind.annotation.RequestBody;
  4. import org.springframework.web.bind.annotation.RequestMapping;
  5. import org.springframework.web.bind.annotation.RestController;
  6. import com.nokia.common.http.R;
  7. import com.nokia.pojo.TousuSheet;
  8. import com.nokia.service.EsbNettyService;
  9. @RestController
  10. @RequestMapping("/esb/socket")
  11. public class EsbSocketController {
  12. private final EsbNettyService esbNettyService;
  13. public EsbSocketController(EsbNettyService esbNettyService) {
  14. this.esbNettyService = esbNettyService;
  15. }
  16. @PostMapping("/send/toususheet")
  17. public R sendTousuSheet(@RequestBody TousuSheet tousuSheet) {
  18. try {
  19. esbNettyService.send(tousuSheet);
  20. return R.ok().message("发送成功。");
  21. } catch (Exception e) {
  22. return R.error().message(e.getMessage());
  23. }
  24. }
  25. }