diff --git a/ruoyi-vue-pro-master/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/user/MemberUserService.java b/ruoyi-vue-pro-master/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/user/MemberUserService.java index fb2e9cd..1cae4b8 100644 --- a/ruoyi-vue-pro-master/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/user/MemberUserService.java +++ b/ruoyi-vue-pro-master/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/user/MemberUserService.java @@ -186,5 +186,19 @@ public interface MemberUserService { * @return 更新结果 */ boolean updateUserPoint(Long userId, Integer point); + /** + * 注册帮扶人 + * + * @param userId 用户编号 + * @return 更新结果 + */ + boolean updateUserLevelId(Long userId); + /** + * 购买1188升级帮扶员 + * + * @param userId 用户编号 + * @return 更新结果 + */ + boolean updateUserUpgradesLevel(Long userId); } diff --git a/ruoyi-vue-pro-master/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/user/MemberUserServiceImpl.java b/ruoyi-vue-pro-master/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/user/MemberUserServiceImpl.java index f81e9a1..93c59f4 100644 --- a/ruoyi-vue-pro-master/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/user/MemberUserServiceImpl.java +++ b/ruoyi-vue-pro-master/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/user/MemberUserServiceImpl.java @@ -8,12 +8,16 @@ import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.util.object.BeanUtils; +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; import cn.iocoder.yudao.module.member.controller.admin.user.vo.MemberUserPageReqVO; import cn.iocoder.yudao.module.member.controller.admin.user.vo.MemberUserUpdateReqVO; import cn.iocoder.yudao.module.member.controller.app.user.vo.*; import cn.iocoder.yudao.module.member.convert.auth.AuthConvert; import cn.iocoder.yudao.module.member.convert.user.MemberUserConvert; +import cn.iocoder.yudao.module.member.dal.dataobject.level.MemberLevelDO; import cn.iocoder.yudao.module.member.dal.dataobject.user.MemberUserDO; +import cn.iocoder.yudao.module.member.dal.mysql.level.MemberLevelMapper; +import cn.iocoder.yudao.module.member.dal.mysql.level.MemberLevelRecordMapper; import cn.iocoder.yudao.module.member.dal.mysql.user.MemberUserMapper; import cn.iocoder.yudao.module.member.mq.producer.user.MemberUserProducer; import cn.iocoder.yudao.module.system.api.sms.SmsCodeApi; @@ -64,6 +68,12 @@ public class MemberUserServiceImpl implements MemberUserService { @Resource private MemberUserProducer memberUserProducer; + @Resource + private MemberLevelRecordMapper levelLogMapper; + + @Resource + private MemberLevelMapper memberLevelMapper; + @Override public MemberUserDO getUserByMobile(String mobile) { return memberUserMapper.selectByMobile(mobile); @@ -314,4 +324,43 @@ public class MemberUserServiceImpl implements MemberUserService { return true; } + @Override + public boolean updateUserLevelId(Long userId) { + //查询帮扶人等级id + MemberLevelDO memberLevelDO = memberLevelMapper.selectOne(new LambdaQueryWrapperX() + .eq(MemberLevelDO::getStatus, 0) + .eq(MemberLevelDO::getDeleted, 0) + .eq(MemberLevelDO::getLevel, 1) + .orderByAsc(MemberLevelDO::getLevel)); + int i = memberUserMapper.updateById(new MemberUserDO() + .setId(userId) + .setLevelId(memberLevelDO.getId()) + ); + if(i>0){ + return true; + } + return false; + } + @Override + public boolean updateUserUpgradesLevel(Long userId) { + //查询帮扶人等级id + List levelList = memberLevelMapper.selectList(new LambdaQueryWrapperX() + .eq(MemberLevelDO::getStatus, 0) + .eq(MemberLevelDO::getDeleted, 0) + .orderByAsc(MemberLevelDO::getLevel)); + //循环处理帮扶人等级 + for (MemberLevelDO vo:levelList) { + + } + //先会员本身升级为帮扶员 +// if(i>0){ +// return true; +// } + return false; + } + + private void recursionMemberLevel(List levelList,Long userId){ + + } + }