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.enums.BusinessType; import com.zhongzheng.common.utils.ServletUtils; import com.zhongzheng.framework.web.service.TokenService; import com.zhongzheng.framework.web.service.WxTokenService; import com.zhongzheng.modules.distribution.bo.DistributionLinkAddBo; import com.zhongzheng.modules.distribution.service.IDistributionLinkService; import com.zhongzheng.modules.user.entity.ClientLoginUser; 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.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; /** * 分销链路Controller * * @author ruoyi * @date 2023-03-23 */ @Api(value = "分销链路控制器", tags = {"分销链路管理"}) @RequiredArgsConstructor(onConstructor_ = @Autowired) @RestController @RequestMapping("/system/link") public class DistributionLinkController extends BaseController { private final IDistributionLinkService iDistributionLinkService; private final TokenService tokenService; /** * 新增分销链路 */ @ApiOperation("绑定分销链路") @PreAuthorize("@ss.hasPermi('system:link:add')") @Log(title = "分销链路", businessType = BusinessType.INSERT) @PostMapping() public AjaxResult add(@RequestBody DistributionLinkAddBo bo) { LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest()); bo.setSellerId(loginUser.getUser().getSellerId()); return toAjax(iDistributionLinkService.bindLink(bo) ? 1 : 0); } }