DistributionLinkController.java 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. package com.zhongzheng.controller.distribution;
  2. import com.zhongzheng.common.annotation.Log;
  3. import com.zhongzheng.common.core.controller.BaseController;
  4. import com.zhongzheng.common.core.domain.AjaxResult;
  5. import com.zhongzheng.common.core.domain.model.LoginUser;
  6. import com.zhongzheng.common.enums.BusinessType;
  7. import com.zhongzheng.common.utils.ServletUtils;
  8. import com.zhongzheng.framework.web.service.TokenService;
  9. import com.zhongzheng.framework.web.service.WxTokenService;
  10. import com.zhongzheng.modules.distribution.bo.DistributionLinkAddBo;
  11. import com.zhongzheng.modules.distribution.service.IDistributionLinkService;
  12. import com.zhongzheng.modules.user.entity.ClientLoginUser;
  13. import io.swagger.annotations.Api;
  14. import io.swagger.annotations.ApiOperation;
  15. import lombok.RequiredArgsConstructor;
  16. import org.springframework.beans.factory.annotation.Autowired;
  17. import org.springframework.security.access.prepost.PreAuthorize;
  18. import org.springframework.web.bind.annotation.PostMapping;
  19. import org.springframework.web.bind.annotation.RequestBody;
  20. import org.springframework.web.bind.annotation.RequestMapping;
  21. import org.springframework.web.bind.annotation.RestController;
  22. /**
  23. * 分销链路Controller
  24. *
  25. * @author ruoyi
  26. * @date 2023-03-23
  27. */
  28. @Api(value = "分销链路控制器", tags = {"分销链路管理"})
  29. @RequiredArgsConstructor(onConstructor_ = @Autowired)
  30. @RestController
  31. @RequestMapping("/system/link")
  32. public class DistributionLinkController extends BaseController {
  33. private final IDistributionLinkService iDistributionLinkService;
  34. private final TokenService tokenService;
  35. /**
  36. * 新增分销链路
  37. */
  38. @ApiOperation("绑定分销链路")
  39. @PreAuthorize("@ss.hasPermi('system:link:add')")
  40. @Log(title = "分销链路", businessType = BusinessType.INSERT)
  41. @PostMapping()
  42. public AjaxResult<Void> add(@RequestBody DistributionLinkAddBo bo) {
  43. LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
  44. bo.setSellerId(loginUser.getUser().getSellerId());
  45. return toAjax(iDistributionLinkService.bindLink(bo) ? 1 : 0);
  46. }
  47. }