ProfileTpController.java 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. package com.zhongzheng.controller.base;
  2. import com.zhongzheng.common.core.controller.BaseController;
  3. import com.zhongzheng.common.core.domain.AjaxResult;
  4. import com.zhongzheng.common.core.page.TableDataInfo;
  5. import com.zhongzheng.common.utils.ServletUtils;
  6. import com.zhongzheng.framework.web.service.WxTokenService;
  7. import com.zhongzheng.modules.base.bo.*;
  8. import com.zhongzheng.modules.base.service.IProfileTpService;
  9. import com.zhongzheng.modules.base.service.IUserProfileService;
  10. import com.zhongzheng.modules.base.vo.ProfileTpVo;
  11. import com.zhongzheng.modules.user.entity.ClientLoginUser;
  12. import io.swagger.annotations.Api;
  13. import io.swagger.annotations.ApiOperation;
  14. import lombok.RequiredArgsConstructor;
  15. import org.springframework.beans.factory.annotation.Autowired;
  16. import org.springframework.web.bind.annotation.*;
  17. import java.util.List;
  18. /**
  19. * 资料模板Controller
  20. *
  21. * @author hjl
  22. * @date 2021-11-19
  23. */
  24. @Api(value = "资料模板控制器", tags = {"资料模板管理"})
  25. @RequiredArgsConstructor(onConstructor_ = @Autowired)
  26. @RestController
  27. @RequestMapping("/base/profile/tp")
  28. public class ProfileTpController extends BaseController {
  29. private final IProfileTpService iProfileTpService;
  30. private final WxTokenService wxTokenService;
  31. private final IUserProfileService iUserProfileService;
  32. /**
  33. * 查询资料模板列表
  34. */
  35. @ApiOperation("查询资料模板列表")
  36. @GetMapping("/list")
  37. public TableDataInfo<ProfileTpVo> list(ProfileTpQueryBo bo) {
  38. startPage();
  39. List<ProfileTpVo> list = iProfileTpService.selectList(bo);
  40. return getDataTable(list);
  41. }
  42. /**
  43. * 获取资料模板详细信息
  44. */
  45. @ApiOperation("获取资料模板详细信息")
  46. @GetMapping("/{goodsId}")
  47. public AjaxResult<ProfileTpVo> queryByGoodsId(@PathVariable("goodsId" ) Long goodsId) {
  48. return AjaxResult.success(iProfileTpService.queryByGoodsId(goodsId));
  49. }
  50. /**
  51. * 新增填写资料审核
  52. */
  53. @ApiOperation("新增填写资料审核")
  54. @PostMapping()
  55. public AjaxResult<Void> add(@RequestBody UserProfileAddBo bo) {
  56. ClientLoginUser loginUser = wxTokenService.getLoginUser(ServletUtils.getRequest());
  57. bo.setUserId(loginUser.getUser().getUserId());
  58. return toAjax(iUserProfileService.insertByAddBo(bo) ? 1 : 0);
  59. }
  60. @ApiOperation("新增填写资料审核")
  61. @PostMapping("/addWord")
  62. public AjaxResult<Void> addWord(@RequestBody UserProfileAddBo bo) {
  63. ClientLoginUser loginUser = wxTokenService.getLoginUser(ServletUtils.getRequest());
  64. bo.setUserId(loginUser.getUser().getUserId());
  65. String s = iUserProfileService.addWord(bo);
  66. return AjaxResult.success(s);
  67. }
  68. }