分销员中心-实名认证
绑定邀请人 分销员:获取下级分销员分页列表 分销员:获取邀请人分页列表
This commit is contained in:
@@ -1,12 +1,16 @@
|
||||
package com.czg.controller.user;
|
||||
|
||||
import com.czg.market.dto.MkDistributionWithdrawFlowDTO;
|
||||
import com.czg.account.entity.UserInfo;
|
||||
import com.czg.market.dto.MkDistributionUserDTO;
|
||||
import com.czg.market.service.MkDistributionUserService;
|
||||
import com.czg.market.service.MkDistributionWithdrawFlowService;
|
||||
import com.czg.market.vo.DistributionCenterShopVO;
|
||||
import com.czg.market.vo.InviteUserVO;
|
||||
import com.czg.order.dto.MkDistributionPayDTO;
|
||||
import com.czg.resp.CzgResult;
|
||||
import com.czg.sa.StpKit;
|
||||
import com.czg.utils.AssertUtil;
|
||||
import com.czg.service.market.service.impl.AppWxServiceImpl;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
import jakarta.annotation.Resource;
|
||||
@@ -80,4 +84,50 @@ public class UDistributionController {
|
||||
return CzgResult.success(distributionUserService.withdraw(StpKit.USER.getLoginIdAsLong(), withdrawFlowDTO));
|
||||
}
|
||||
|
||||
/**
|
||||
* 分销员中心-实名认证
|
||||
*/
|
||||
@PostMapping("/realNameAuth")
|
||||
public CzgResult<Map<String, Object>> realNameAuth(@RequestBody UserInfo userInfo) {
|
||||
AssertUtil.isNull(userInfo.getId(), "用户Id不能为空");
|
||||
AssertUtil.isNull(userInfo.getRealName(), "用户实名不能为空");
|
||||
AssertUtil.isNull(userInfo.getIdCard(), "用户身份信息不能为空");
|
||||
distributionUserService.realNameAuth(userInfo);
|
||||
return CzgResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 分销员中心-绑定邀请人
|
||||
*/
|
||||
@PostMapping("/bindInviteUser")
|
||||
public CzgResult<Map<String, Object>> bindInviteUser(@RequestBody MkDistributionUserDTO param) {
|
||||
AssertUtil.isNull(param.getShopId(), "店铺ID不能为空");
|
||||
AssertUtil.isNull(param.getParentId(), "店铺用户ID不能为空");
|
||||
AssertUtil.isNull(param.getDistributionLevelId(), "分销等级ID不能为空");
|
||||
distributionUserService.bindInviteUser(param);
|
||||
return CzgResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 分销员:获取下级分销员分页列表
|
||||
*/
|
||||
@GetMapping("/childUser")
|
||||
public CzgResult<Page<MkDistributionUserDTO>> getDistributionUser(MkDistributionUserDTO param) {
|
||||
AssertUtil.isNull(param.getShopId(), "店铺ID不能为空");
|
||||
AssertUtil.isNull(param.getParentId(), "父级ID不能为空");
|
||||
return CzgResult.success(distributionUserService.getDistributionUser(param));
|
||||
}
|
||||
|
||||
/**
|
||||
* 分销员:获取邀请人分页列表
|
||||
*/
|
||||
@GetMapping("/inviteUser")
|
||||
public CzgResult<Page<InviteUserVO>> getInviteUser(
|
||||
@RequestParam Long id,
|
||||
@RequestParam(required = false, defaultValue = "1") Integer page,
|
||||
@RequestParam(required = false, defaultValue = "10") Integer size) {
|
||||
AssertUtil.isNull(id, "邀请人ID");
|
||||
return CzgResult.success(distributionUserService.getInviteUser(id, page, size));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -150,6 +150,12 @@ public class ShopUser implements Serializable {
|
||||
private LocalDateTime nextDeliverTime;
|
||||
// 分销员ID 邀请人id
|
||||
private Long distributionUserId;
|
||||
// 分销员ID 邀请人上级id
|
||||
private Long distributionUserParentId;
|
||||
//邀请人累计收益/一级分润
|
||||
private BigDecimal oneIncome;
|
||||
//邀请人上级累计收益/二级分润
|
||||
private BigDecimal twoIncome;
|
||||
|
||||
@Column(ignore = true)
|
||||
private String memberName;
|
||||
|
||||
@@ -106,6 +106,11 @@ public class MkDistributionUserDTO extends TimeQueryParam implements Serializabl
|
||||
*/
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
* 用户头像
|
||||
*/
|
||||
private String headImg;
|
||||
|
||||
/**
|
||||
* 用户名称
|
||||
*/
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
package com.czg.market.service;
|
||||
|
||||
import com.czg.account.entity.UserInfo;
|
||||
import com.czg.market.dto.MkDistributionUserDTO;
|
||||
import com.czg.market.dto.MkDistributionWithdrawFlowDTO;
|
||||
import com.czg.market.entity.MkDistributionUser;
|
||||
import com.czg.market.vo.DistributionCenterShopVO;
|
||||
import com.czg.market.vo.InviteUserVO;
|
||||
import com.czg.order.dto.MkDistributionPayDTO;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
import com.mybatisflex.core.service.IService;
|
||||
@@ -40,11 +42,26 @@ public interface MkDistributionUserService extends IService<MkDistributionUser>
|
||||
*/
|
||||
Map<String, Object> centerConfig(Long userId, Long shopId);
|
||||
|
||||
/**
|
||||
* 分销员中心-实名认证
|
||||
*/
|
||||
void realNameAuth(UserInfo userInfo);
|
||||
|
||||
/**
|
||||
* 分销员中心-绑定邀请人
|
||||
*/
|
||||
void bindInviteUser(MkDistributionUserDTO param);
|
||||
|
||||
/**
|
||||
* 获取分销员分页列表
|
||||
*/
|
||||
Page<MkDistributionUserDTO> getDistributionUser(MkDistributionUserDTO param);
|
||||
|
||||
/**
|
||||
* 获取分销员邀请人分页列表
|
||||
*/
|
||||
Page<InviteUserVO> getInviteUser(Long id, Integer page, Integer size);
|
||||
|
||||
/**
|
||||
* 添加分销员
|
||||
* shop_id 和 shop_user_id 必填 opening_method 必填
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.czg.market.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @author ww
|
||||
* @description
|
||||
*/
|
||||
@Data
|
||||
public class InviteUserVO {
|
||||
/**
|
||||
* 用户头像
|
||||
*/
|
||||
private String headImg;
|
||||
|
||||
/**
|
||||
* 用户名称
|
||||
*/
|
||||
private String shopUserName;
|
||||
/**
|
||||
* 手机号
|
||||
*/
|
||||
private String shopUserPhone;
|
||||
|
||||
/**
|
||||
* 一级收益
|
||||
*/
|
||||
private BigDecimal oneIncome;
|
||||
}
|
||||
@@ -3,8 +3,11 @@ package com.czg.service.market.service.impl;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.IdcardUtil;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.czg.account.entity.ShopInfo;
|
||||
import com.czg.account.entity.ShopUser;
|
||||
import com.czg.account.entity.UserInfo;
|
||||
import com.czg.account.service.ShopInfoService;
|
||||
import com.czg.account.service.ShopUserService;
|
||||
import com.czg.account.service.UserInfoService;
|
||||
@@ -24,6 +27,7 @@ import com.czg.market.vo.DistributionCenterShopVO;
|
||||
import com.czg.market.vo.DistributionCenterTopVO;
|
||||
import com.czg.market.entity.*;
|
||||
import com.czg.market.service.*;
|
||||
import com.czg.market.vo.InviteUserVO;
|
||||
import com.czg.market.vo.MkDistributionConfigVO;
|
||||
import com.czg.order.dto.MkDistributionPayDTO;
|
||||
import com.czg.order.entity.OrderPayment;
|
||||
@@ -142,7 +146,7 @@ public class MkDistributionUserServiceImpl extends ServiceImpl<MkDistributionUse
|
||||
result.put("shopName", shopInfo.getShopName());
|
||||
result.put("parentName", "");
|
||||
result.put("parentPhone", "");
|
||||
ShopUser shopUser = shopUserService.getShopUserInfo(userId, shopId);
|
||||
ShopUser shopUser = shopUserService.getShopUserInfo(shopId, userId);
|
||||
AssertUtil.isNull(shopUser, "店铺用户不存在");
|
||||
if (shopUser.getDistributionUserId() != null) {
|
||||
MkDistributionUser mkDistributionUser = this.getById(shopUser.getDistributionUserId());
|
||||
@@ -183,6 +187,30 @@ public class MkDistributionUserServiceImpl extends ServiceImpl<MkDistributionUse
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void realNameAuth(UserInfo userInfo) {
|
||||
AssertUtil.isTrue(IdcardUtil.isValidCard(userInfo.getIdCard()), "身份证号格式错误");
|
||||
UserInfo newUserInfo = new UserInfo();
|
||||
newUserInfo.setId(userInfo.getId());
|
||||
newUserInfo.setRealName(userInfo.getRealName());
|
||||
newUserInfo.setIdCard(userInfo.getIdCard());
|
||||
userInfoService.updateById(newUserInfo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bindInviteUser(MkDistributionUserDTO param) {
|
||||
ShopUser shopUser = shopUserService.getById(param.getShopUserId());
|
||||
AssertUtil.isNull(shopUser, "店铺用户不存在");
|
||||
AssertUtil.isNull(shopUser.getDistributionUserId(), "店铺用户已绑定分销员");
|
||||
MkDistributionUser mkDistributionUser = this.getById(param.getParentId());
|
||||
AssertUtil.isNull(mkDistributionUser, "上级分销员不存在");
|
||||
ShopUser newShopUser = new ShopUser();
|
||||
newShopUser.setId(shopUser.getId());
|
||||
newShopUser.setDistributionUserId(mkDistributionUser.getId());
|
||||
newShopUser.setDistributionUserParentId(mkDistributionUser.getParentId());
|
||||
shopUserService.updateById(newShopUser);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<MkDistributionUserDTO> getDistributionUser(MkDistributionUserDTO param) {
|
||||
QueryWrapper queryWrapper = new QueryWrapper();
|
||||
@@ -210,6 +238,7 @@ public class MkDistributionUserServiceImpl extends ServiceImpl<MkDistributionUse
|
||||
if (shopUser == null || shopUser.getId() == null) {
|
||||
continue;
|
||||
}
|
||||
record.setHeadImg(shopUser.getHeadImg());
|
||||
record.setShopUserName(shopUser.getNickName());
|
||||
record.setShopUserPhone(shopUser.getPhone());
|
||||
}
|
||||
@@ -217,6 +246,15 @@ public class MkDistributionUserServiceImpl extends ServiceImpl<MkDistributionUse
|
||||
return page;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<InviteUserVO> getInviteUser(Long id, Integer page, Integer size) {
|
||||
return pageAs(new Page<>(page, size), QueryWrapper.create()
|
||||
.select("head_img as headImg,nick_name as shopUserName,phone as shopUserPhone,one_income as oneIncome")
|
||||
.eq(MkDistributionUser::getShopId, id)
|
||||
.eq(MkDistributionUser::getParentId, id)
|
||||
.orderBy(MkDistributionUser::getCreateTime).desc(), InviteUserVO.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addDistributionUser(MkDistributionUser param) {
|
||||
AssertUtil.isNull(param.getShopId(), "店铺ID不能为空");
|
||||
|
||||
Reference in New Issue
Block a user