NotifyController.java 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. package cc.iotkit.manager.controller;
  2. import cc.iotkit.common.api.PageRequest;
  3. import cc.iotkit.common.api.Paging;
  4. import cc.iotkit.common.api.Request;
  5. import cc.iotkit.common.validate.EditGroup;
  6. import cc.iotkit.common.validate.QueryGroup;
  7. import cc.iotkit.manager.dto.bo.channel.ChannelConfigBo;
  8. import cc.iotkit.manager.dto.bo.channel.ChannelTemplateBo;
  9. import cc.iotkit.manager.dto.vo.channel.ChannelConfigVo;
  10. import cc.iotkit.manager.dto.vo.channel.ChannelTemplateVo;
  11. import cc.iotkit.manager.service.NotifyService;
  12. import cc.iotkit.model.notify.Channel;
  13. import cc.iotkit.model.notify.ChannelConfig;
  14. import cc.iotkit.model.notify.ChannelTemplate;
  15. import io.swagger.annotations.Api;
  16. import io.swagger.annotations.ApiOperation;
  17. import lombok.extern.slf4j.Slf4j;
  18. import org.springframework.validation.annotation.Validated;
  19. import org.springframework.web.bind.annotation.PostMapping;
  20. import org.springframework.web.bind.annotation.RequestBody;
  21. import org.springframework.web.bind.annotation.RequestMapping;
  22. import org.springframework.web.bind.annotation.RestController;
  23. import javax.annotation.Resource;
  24. import java.util.List;
  25. /**
  26. * author: 石恒
  27. * date: 2023-05-11 15:17
  28. * description:
  29. **/
  30. @Api(tags = {"消息通知"})
  31. @Slf4j
  32. @RestController
  33. @RequestMapping("/notify")
  34. public class NotifyController {
  35. @Resource
  36. private NotifyService notifyService;
  37. @ApiOperation("获取通道类型列表")
  38. @PostMapping("/channel/getList")
  39. public List<Channel> getChannelList() {
  40. return notifyService.getChannelList();
  41. }
  42. @ApiOperation("获取通道配置分页列表")
  43. @PostMapping("/channel/config/getList")
  44. public Paging<ChannelConfigVo> getChannelConfigList(@RequestBody @Validated(QueryGroup.class) PageRequest<ChannelConfigBo> request) {
  45. return notifyService.getChannelConfigList(request);
  46. }
  47. @ApiOperation("获取通道配置列表")
  48. @PostMapping("/channel/config/getAll")
  49. public List<ChannelConfigVo> getChannelConfigAll() {
  50. return notifyService.getChannelConfigAll();
  51. }
  52. @ApiOperation("新增通道配置")
  53. @PostMapping("/channel/config/add")
  54. public ChannelConfig addChannelConfig(@RequestBody @Validated(EditGroup.class) Request<ChannelConfig> request) {
  55. return notifyService.addChannelConfig(request.getData());
  56. }
  57. @ApiOperation("根据ID获取通道配置")
  58. @PostMapping("/channel/config/getById")
  59. public ChannelConfig getChannelConfigById(@RequestBody @Validated(QueryGroup.class) Request<Long> request) {
  60. return notifyService.getChannelConfigById(request.getData());
  61. }
  62. @ApiOperation("修改通道配置")
  63. @PostMapping("/channel/config/updateById")
  64. public ChannelConfig updateChannelConfigById(@RequestBody @Validated Request<ChannelConfig> request) {
  65. return notifyService.updateChannelConfigById(request.getData());
  66. }
  67. @ApiOperation("删除通道配置")
  68. @PostMapping("/channel/config/delById")
  69. public Boolean delChannelConfigById(@RequestBody @Validated Request<Long> request) {
  70. return notifyService.delChannelConfigById(request.getData());
  71. }
  72. @ApiOperation("获取通道模板列表")
  73. @PostMapping("/channel/template/getList")
  74. public Paging<ChannelTemplateVo> getChannelTemplateList(@RequestBody @Validated(QueryGroup.class) PageRequest<ChannelTemplateBo> request) {
  75. return notifyService.getChannelTemplateList(request);
  76. }
  77. @ApiOperation("新增通道模板")
  78. @PostMapping("/channel/template/add")
  79. public ChannelTemplate addChannelTemplate(@RequestBody @Validated(EditGroup.class) Request<ChannelTemplateBo> request) {
  80. return notifyService.addChannelTemplate(request.getData());
  81. }
  82. @ApiOperation("根据ID获取通道模板")
  83. @PostMapping("/channel/template/getById")
  84. public ChannelTemplate getChannelTemplateById(@RequestBody @Validated Request<Long> request) {
  85. return notifyService.getChannelTemplateById(request.getData());
  86. }
  87. @ApiOperation("修改通道模板")
  88. @PostMapping("/channel/template/updateById")
  89. public ChannelTemplate updateChannelTemplateById(@RequestBody @Validated Request<ChannelTemplate> request) {
  90. return notifyService.updateChannelTemplateById(request.getData());
  91. }
  92. @ApiOperation("删除通道模板")
  93. @PostMapping("/channel/template/delById")
  94. public Boolean delChannelTemplateById(@RequestBody @Validated(EditGroup.class) Request<Long> request) {
  95. return notifyService.delChannelTemplateById(request.getData());
  96. }
  97. }