DistributionSellerController.java 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. package com.zhongzheng.controller.distribution;
  2. import java.util.List;
  3. import java.util.Arrays;
  4. import cn.hutool.core.lang.Validator;
  5. import com.zhongzheng.common.utils.ServletUtils;
  6. import com.zhongzheng.framework.web.service.SellerTokenService;
  7. import com.zhongzheng.modules.distribution.bo.DistributionSellerAddBo;
  8. import com.zhongzheng.modules.distribution.bo.DistributionSellerEditBo;
  9. import com.zhongzheng.modules.distribution.bo.DistributionSellerQueryBo;
  10. import com.zhongzheng.modules.distribution.service.IDistributionSellerService;
  11. import com.zhongzheng.modules.distribution.vo.DistributionSellerVo;
  12. import com.zhongzheng.modules.user.bo.UserVisitLogAddBo;
  13. import com.zhongzheng.modules.user.domain.UserWxFollow;
  14. import com.zhongzheng.modules.user.entity.ClientLoginSeller;
  15. import com.zhongzheng.modules.user.entity.ClientLoginUser;
  16. import com.zhongzheng.modules.user.vo.UserVo;
  17. import lombok.RequiredArgsConstructor;
  18. import org.springframework.security.access.prepost.PreAuthorize;
  19. import org.springframework.beans.factory.annotation.Autowired;
  20. import org.springframework.web.bind.annotation.GetMapping;
  21. import org.springframework.web.bind.annotation.PostMapping;
  22. import org.springframework.web.bind.annotation.PutMapping;
  23. import org.springframework.web.bind.annotation.DeleteMapping;
  24. import org.springframework.web.bind.annotation.PathVariable;
  25. import org.springframework.web.bind.annotation.RequestBody;
  26. import org.springframework.web.bind.annotation.RequestMapping;
  27. import org.springframework.web.bind.annotation.RestController;
  28. import com.zhongzheng.common.annotation.Log;
  29. import com.zhongzheng.common.core.controller.BaseController;
  30. import com.zhongzheng.common.core.domain.AjaxResult;
  31. import com.zhongzheng.common.enums.BusinessType;
  32. import com.zhongzheng.common.utils.poi.ExcelUtil;
  33. import com.zhongzheng.common.core.page.TableDataInfo;
  34. import io.swagger.annotations.Api;
  35. import io.swagger.annotations.ApiOperation;
  36. /**
  37. * 分销业务员Controller
  38. *
  39. * @author hjl
  40. * @date 2023-03-13
  41. */
  42. @Api(value = "分销业务员控制器", tags = {"分销业务员管理"})
  43. @RequiredArgsConstructor(onConstructor_ = @Autowired)
  44. @RestController
  45. @RequestMapping("/distribution/seller")
  46. public class DistributionSellerController extends BaseController {
  47. private final IDistributionSellerService iDistributionSellerService;
  48. private final SellerTokenService sellerTokenService;
  49. /**
  50. * 查询分销业务员列表
  51. */
  52. @ApiOperation("查询分销业务员列表")
  53. @PreAuthorize("@ss.hasPermi('system:seller:list')")
  54. @GetMapping("/list")
  55. public TableDataInfo<DistributionSellerVo> list(DistributionSellerQueryBo bo) {
  56. startPage();
  57. List<DistributionSellerVo> list = iDistributionSellerService.queryList(bo);
  58. return getDataTable(list);
  59. }
  60. /**
  61. * 获取分销业务员详细信息
  62. */
  63. @ApiOperation("获取分销业务员详细信息")
  64. @PreAuthorize("@ss.hasPermi('system:seller:query')")
  65. @GetMapping("/{salerId}")
  66. public AjaxResult<DistributionSellerVo> getInfo(@PathVariable("salerId" ) Long salerId) {
  67. return AjaxResult.success(iDistributionSellerService.queryById(salerId));
  68. }
  69. /**
  70. * 新增分销业务员
  71. */
  72. /* @ApiOperation("新增分销业务员")
  73. @PreAuthorize("@ss.hasPermi('system:seller:add')")
  74. @Log(title = "分销业务员", businessType = BusinessType.INSERT)
  75. @PostMapping()
  76. public AjaxResult<Void> add(@RequestBody DistributionSellerAddBo bo) {
  77. return toAjax(iDistributionSellerService.insertByAddBo(bo) ? 1 : 0);
  78. }*/
  79. /**
  80. * 修改分销业务员
  81. */
  82. @ApiOperation("修改分销业务员")
  83. @PreAuthorize("@ss.hasPermi('system:seller:edit')")
  84. @Log(title = "分销业务员", businessType = BusinessType.UPDATE)
  85. @PostMapping("/edit")
  86. public AjaxResult<Void> edit(@RequestBody DistributionSellerEditBo bo) {
  87. ClientLoginSeller loginUser = sellerTokenService.getLoginUser(ServletUtils.getRequest());
  88. bo.setSellerId(loginUser.getSeller().getSellerId());
  89. return toAjax(iDistributionSellerService.updateByEditBo(bo) ? 1 : 0);
  90. }
  91. /**
  92. * 获取用户信息
  93. *
  94. * @return 用户信息
  95. */
  96. @ApiOperation("登录业务员用户信息")
  97. @GetMapping("getInfo")
  98. public AjaxResult<DistributionSellerVo> getInfo()
  99. {
  100. ClientLoginSeller loginUser = sellerTokenService.getLoginUser(ServletUtils.getRequest());
  101. DistributionSellerVo vo = iDistributionSellerService.queryById(loginUser.getSeller().getSellerId());
  102. vo.setNull();
  103. return AjaxResult.success(vo);
  104. }
  105. }