WxDataApi.java 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. package com.caimei.controller.wechat;
  2. import com.alibaba.fastjson.JSONObject;
  3. import com.caimei.model.ResponseJson;
  4. import com.caimei.model.vo.*;
  5. import com.caimei.service.auth.*;
  6. import com.caimei.service.data.FileService;
  7. import com.caimei.service.data.ImageService;
  8. import com.caimei.service.data.VideoService;
  9. import com.github.pagehelper.PageInfo;
  10. import io.swagger.annotations.Api;
  11. import io.swagger.annotations.ApiImplicitParam;
  12. import io.swagger.annotations.ApiImplicitParams;
  13. import io.swagger.annotations.ApiOperation;
  14. import lombok.RequiredArgsConstructor;
  15. import lombok.extern.slf4j.Slf4j;
  16. import org.springframework.web.bind.annotation.*;
  17. /**
  18. * @author Aslee
  19. */
  20. @Api(tags = "微信资料库API")
  21. @Slf4j
  22. @RestController
  23. @RequiredArgsConstructor
  24. @RequestMapping("/wx/data")
  25. public class WxDataApi {
  26. private final ArticleService articleService;
  27. private final ImageService imageService;
  28. private final VideoService videoService;
  29. private final FileService fileService;
  30. private final AuthClubService authClubService;
  31. @ApiOperation("资料库文章列表")
  32. @ApiImplicitParams({
  33. @ApiImplicitParam(name = "authUserId", required = true, value = "供应商用户id"),
  34. @ApiImplicitParam(name = "articleTitle", required = false, value = "文章名称"),
  35. @ApiImplicitParam(name = "pageNum", required = false, value = "第几页"),
  36. @ApiImplicitParam(name = "pageSize", required = false, value = "一页多少条")
  37. })
  38. @GetMapping("/article/list")
  39. public ResponseJson<PageInfo<WxArticleListVo>> getWxArticleList(Integer authUserId, String articleTitle,
  40. @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
  41. @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
  42. return articleService.getWxArticleList(authUserId, articleTitle, pageNum, pageSize);
  43. }
  44. @ApiOperation("资料库文章回显数据")
  45. @ApiImplicitParam(name = "articleId", value = "文章id", required = true)
  46. @GetMapping("/article/form/data")
  47. public ResponseJson<ArticleFormVo> getArticleFormData(Integer articleId) {
  48. return articleService.getArticleFormData(articleId);
  49. }
  50. @ApiOperation("资料库图片列表")
  51. @ApiImplicitParams({
  52. @ApiImplicitParam(name = "authUserId", required = true, value = "供应商用户id"),
  53. @ApiImplicitParam(name = "imageTitle", required = false, value = "文章名称"),
  54. @ApiImplicitParam(name = "pageNum", required = false, value = "第几页"),
  55. @ApiImplicitParam(name = "pageSize", required = false, value = "一页多少条")
  56. })
  57. @GetMapping("/image/list")
  58. public ResponseJson<PageInfo<WxImageListVo>> getWxImageList(Integer authUserId, String imageTitle,
  59. @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
  60. @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
  61. return imageService.getWxImageList(authUserId, imageTitle, pageNum, pageSize);
  62. }
  63. @ApiOperation("资料库视频列表")
  64. @ApiImplicitParams({
  65. @ApiImplicitParam(name = "authUserId", required = true, value = "供应商用户id"),
  66. @ApiImplicitParam(name = "videoTitle", required = false, value = "文章名称"),
  67. @ApiImplicitParam(name = "pageNum", required = false, value = "第几页"),
  68. @ApiImplicitParam(name = "pageSize", required = false, value = "一页多少条")
  69. })
  70. @GetMapping("/video/list")
  71. public ResponseJson<PageInfo<WxVideoListVo>> getWxVideoList(Integer authUserId, String videoTitle,
  72. @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
  73. @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
  74. return videoService.getWxVideoList(authUserId, videoTitle, pageNum, pageSize);
  75. }
  76. @ApiOperation("资料库文件列表")
  77. @ApiImplicitParams({
  78. @ApiImplicitParam(name = "authUserId", required = true, value = "供应商用户id"),
  79. @ApiImplicitParam(name = "fileTitle", required = false, value = "文章名称"),
  80. @ApiImplicitParam(name = "pageNum", required = false, value = "第几页"),
  81. @ApiImplicitParam(name = "pageSize", required = false, value = "一页多少条")
  82. })
  83. @GetMapping("/file/list")
  84. public ResponseJson<PageInfo<WxFileListVo>> getWxFileList(Integer authUserId, String fileTitle,
  85. @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
  86. @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
  87. return fileService.getWxFileList(authUserId, fileTitle, pageNum, pageSize);
  88. }
  89. @ApiOperation("提交意见反馈")
  90. @ApiImplicitParam(name = "params", required = true, value = "clubUserId:机构用户id;content:反馈内容")
  91. @PostMapping("/feedback/submit")
  92. public ResponseJson submitFeedback(@RequestBody String params) {
  93. JSONObject paramsMap = JSONObject.parseObject(params);
  94. Integer clubUserId = paramsMap.getInteger("clubUserId");
  95. String content = paramsMap.getString("content");
  96. return authClubService.submitFeedback(clubUserId, content);
  97. }
  98. }