123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152 |
- package com.zhongzheng.controller.distribution;
- import com.zhongzheng.common.annotation.Log;
- import com.zhongzheng.common.core.controller.BaseController;
- import com.zhongzheng.common.core.domain.AjaxResult;
- import com.zhongzheng.common.core.domain.model.LoginUser;
- import com.zhongzheng.common.core.page.TableDataInfo;
- import com.zhongzheng.common.enums.BusinessType;
- import com.zhongzheng.common.utils.ServletUtils;
- import com.zhongzheng.framework.web.service.SellerTokenService;
- import com.zhongzheng.framework.web.service.TokenService;
- import com.zhongzheng.framework.web.service.WxLoginService;
- import com.zhongzheng.modules.distribution.bo.DistributionSellerAddBo;
- import com.zhongzheng.modules.distribution.bo.DistributionSellerEditBo;
- import com.zhongzheng.modules.distribution.bo.DistributionSellerQueryBo;
- import com.zhongzheng.modules.distribution.service.IDistributionSellerService;
- import com.zhongzheng.modules.distribution.vo.DistributionSellerVo;
- import com.zhongzheng.modules.user.bo.UserVisitLogAddBo;
- import com.zhongzheng.modules.user.entity.ClientLoginSeller;
- import com.zhongzheng.modules.wx.bo.WxLoginBody;
- import io.swagger.annotations.Api;
- import io.swagger.annotations.ApiOperation;
- import lombok.RequiredArgsConstructor;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.security.access.prepost.PreAuthorize;
- import org.springframework.web.bind.annotation.*;
- import java.util.List;
- /**
- * 分销业务员Controller
- *
- * @author hjl
- * @date 2023-03-13
- */
- @Api(value = "分销业务员控制器", tags = {"分销业务员管理"})
- @RequiredArgsConstructor(onConstructor_ = @Autowired)
- @RestController
- @RequestMapping("/distribution/seller")
- public class DistributionSellerController extends BaseController {
- private final IDistributionSellerService iDistributionSellerService;
- private final TokenService tokenService;
- private final WxLoginService wxLoginService;
- /**
- * 查询分销业务员列表
- */
- @ApiOperation("查询分销业务员列表")
- @PreAuthorize("@ss.hasPermi('system:seller:list')")
- @GetMapping("/list")
- public TableDataInfo<DistributionSellerVo> list(DistributionSellerQueryBo bo) {
- startPage();
- List<DistributionSellerVo> list = iDistributionSellerService.findList(bo);
- return getDataTable(list);
- }
- /**
- * 获取分销业务员详细信息
- */
- @ApiOperation("获取分销业务员详细信息")
- @PreAuthorize("@ss.hasPermi('system:seller:query')")
- @GetMapping("/{salerId}")
- public AjaxResult<DistributionSellerVo> getInfo(@PathVariable("salerId" ) Long salerId) {
- return AjaxResult.success(iDistributionSellerService.queryById(salerId));
- }
- /**
- * 新增分销业务员
- */
- @ApiOperation("新增分销业务员")
- @PreAuthorize("@ss.hasPermi('system:seller:add')")
- @Log(title = "分销业务员", businessType = BusinessType.INSERT)
- @PostMapping()
- public AjaxResult<Void> add(@RequestBody DistributionSellerAddBo bo) {
- return toAjax(iDistributionSellerService.insertByAddBo(bo) ? 1 : 0);
- }
- /**
- * 修改分销业务员
- */
- @ApiOperation("修改分销业务员")
- @PreAuthorize("@ss.hasPermi('system:seller:edit')")
- @Log(title = "分销业务员", businessType = BusinessType.UPDATE)
- @PostMapping("/edit")
- public AjaxResult<Void> edit(@RequestBody DistributionSellerEditBo bo) {
- LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
- bo.setSellerId(loginUser.getUser().getSellerId());
- return toAjax(iDistributionSellerService.updateByEditBo(bo) ? 1 : 0);
- }
- /**
- * 管理员修改分销业务员
- */
- @ApiOperation("管理员修改分销业务员")
- @PreAuthorize("@ss.hasPermi('system:seller:edit')")
- @Log(title = "分销业务员", businessType = BusinessType.UPDATE)
- @PostMapping("/sysEdit")
- public AjaxResult<Void> sysEdit(@RequestBody DistributionSellerEditBo bo) {
- return toAjax(iDistributionSellerService.updateByEditBo(bo) ? 1 : 0);
- }
- /**
- * 新增分销业务员
- */
- @ApiOperation("批量新增关联分销业务员")
- @PreAuthorize("@ss.hasPermi('system:seller:add')")
- @Log(title = "分销业务员", businessType = BusinessType.INSERT)
- @PostMapping("/batchAdd")
- public AjaxResult<Void> batchAdd(@RequestBody DistributionSellerAddBo bo) {
- return toAjax(iDistributionSellerService.insertBatchByAddBo(bo) ? 1 : 0);
- }
- /**
- * 获取用户信息
- *
- * @return 用户信息
- */
- @ApiOperation("登录业务员用户信息")
- @GetMapping("getInfo")
- public AjaxResult<DistributionSellerVo> getInfo()
- {
- LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
- DistributionSellerVo vo = iDistributionSellerService.findDetail(loginUser.getUser().getSellerId());
- vo.setSelfNull();
- return AjaxResult.success(vo);
- }
- @ApiOperation("业务员检查是否绑定公众号")
- @GetMapping("/checkBindGzh")
- public AjaxResult<String> checkBindGzh()
- {
- LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
- DistributionSellerVo vo = iDistributionSellerService.queryById(loginUser.getUser().getSellerId());
- return AjaxResult.success("成功",vo.getGzhOpenId());
- }
- @ApiOperation("提现前绑定公众号openid")
- @PostMapping("/gzh_bind")
- public AjaxResult gzh_bind(@RequestBody WxLoginBody loginBody)
- {
- LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
- loginBody.setSellerId(loginUser.getUser().getSellerId());
- wxLoginService.bindWxGzhUnionIdSeller(loginBody);
- return AjaxResult.success();
- }
- }
|