| | |
| | | import cc.mrbird.febs.mall.service.IApiMallMemberWalletService; |
| | | import cc.mrbird.febs.mall.service.ICommonService; |
| | | import cc.mrbird.febs.mall.vo.*; |
| | | import cn.hutool.core.bean.BeanUtil; |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.util.IdUtil; |
| | | import cn.hutool.core.util.ObjectUtil; |
| | |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.http.HttpStatus; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | |
| | | private final IApiMallMemberWalletService walletService; |
| | | private final MallMemberPaymentMapper mallMemberPaymentMapper; |
| | | private final DataDictionaryCustomMapper dataDictionaryCustomMapper; |
| | | private final MallShopApplyMapper mallShopApplyMapper; |
| | | private final MallRegisterAppealMapper mallRegisterAppealMapper; |
| | | |
| | | |
| | | @Value("${spring.profiles.active}") |
| | |
| | | MallMember mallMember = this.baseMapper.selectInfoByAccount(registerDto.getAccount()); |
| | | if (mallMember != null) { |
| | | throw new FebsException("该账号已被占用"); |
| | | } |
| | | |
| | | List<MallMember> mallMembers = this.baseMapper.selectMemberByName(registerDto.getName()); |
| | | if (CollUtil.isNotEmpty(mallMembers)) { |
| | | MallRegisterAppeal registerAppeal = mallRegisterAppealMapper.selectByPhoneAndName(registerDto.getName(), registerDto.getAccount()); |
| | | if (registerAppeal == null || registerAppeal.getStatus() != 1) { |
| | | return new FebsResponse().code(HttpStatus.ACCEPTED).message("用户名已存在"); |
| | | } |
| | | } |
| | | |
| | | String account = registerDto.getAccount(); |
| | |
| | | mallMember.setReferrerId(registerDto.getInviteId()); |
| | | |
| | | } |
| | | mallMember.setName(registerDto.getAccount()); |
| | | mallMember.setName(registerDto.getName()); |
| | | mallMember.setAccountStatus(MallMember.ACCOUNT_STATUS_ENABLE); |
| | | mallMember.setAccountType(MallMember.ACCOUNT_TYPE_NORMAL); |
| | | mallMember.setLevel(AgentLevelEnum.ZERO_LEVEL.name()); |
| | | mallMember.setLevel(AgentLevelEnum.FIRST_LEVEL.name()); |
| | | mallMember.setSex("男"); |
| | | mallMember.setBindPhone(registerDto.getAccount()); |
| | | |
| | | this.baseMapper.insert(mallMember); |
| | | |
| | |
| | | MallMember mallMember = this.baseMapper.selectById(memberId); |
| | | |
| | | List<TeamListVo> list = this.baseMapper.selectTeamListByInviteId(mallMember.getInviteId()); |
| | | BigDecimal ownAmount = this.baseMapper.selectOwnOrderAmountByInviteId(mallMember.getInviteId()); |
| | | |
| | | TeamListVo own = new TeamListVo(); |
| | | own.setCreatedTime(mallMember.getCreatedTime()); |
| | | own.setAmount(ownAmount); |
| | | own.setName(mallMember.getName()); |
| | | own.setPhone(mallMember.getPhone()); |
| | | own.setInviteId(mallMember.getInviteId()); |
| | | own.setIsCurrent(1); |
| | | own.setCnt(this.baseMapper.selectOwnCntByInviteId(mallMember.getInviteId())); |
| | | own.setOrderCnt(this.baseMapper.selectOwnOrderCntByInviteId(mallMember.getInviteId())); |
| | | own.setId(mallMember.getId()); |
| | | // list.add(0, own); |
| | | // BigDecimal ownAmount = this.baseMapper.selectOwnOrderAmountByInviteId(mallMember.getInviteId()); |
| | | // TeamListVo own = new TeamListVo(); |
| | | // own.setCreatedTime(mallMember.getCreatedTime()); |
| | | // own.setAmount(ownAmount); |
| | | // own.setName(mallMember.getName()); |
| | | // own.setPhone(mallMember.getPhone()); |
| | | // own.setInviteId(mallMember.getInviteId()); |
| | | // own.setIsCurrent(1); |
| | | // own.setCnt(this.baseMapper.selectOwnCntByInviteId(mallMember.getInviteId())); |
| | | // own.setOrderCnt(this.baseMapper.selectOwnOrderCntByInviteId(mallMember.getInviteId())); |
| | | // own.setId(mallMember.getId()); |
| | | |
| | | MyTeamVo myTeamVo = new MyTeamVo(); |
| | | myTeamVo.setTeam(list); |
| | | myTeamVo.setMyAchieve(BigDecimal.valueOf(100)); |
| | | myTeamVo.setMyTeamAchieve(BigDecimal.valueOf(100)); |
| | | myTeamVo.setMyTeamCnt(100); |
| | | myTeamVo.setMyAchieve(this.baseMapper.selectAchieveByMemberId(mallMember.getInviteId(), 1)); |
| | | myTeamVo.setMyTeamAchieve(this.baseMapper.selectAchieveByMemberId(mallMember.getInviteId(), 2)); |
| | | myTeamVo.setMyTeamCnt(list.size()); |
| | | return new FebsResponse().success().data(myTeamVo); |
| | | } |
| | | |
| | |
| | | commissionVo.setWaitCommission(BigDecimal.ZERO); |
| | | return commissionVo; |
| | | } |
| | | |
| | | @Override |
| | | public void shopApply(ShopApplyDto shopApplyDto) { |
| | | MallMember member = LoginUserUtil.getLoginUser(); |
| | | |
| | | MallShopApply hasApply = mallShopApplyMapper.selectNewestApplyByMemberId(member.getId()); |
| | | if (hasApply != null) { |
| | | if (!hasApply.getStatus().equals(MallShopApply.APPLY_DISAGREE)) { |
| | | throw new FebsException("审核中或审核已通过"); |
| | | } |
| | | } |
| | | |
| | | MallShopApply mallShopApply = new MallShopApply(); |
| | | BeanUtil.copyProperties(shopApplyDto, mallShopApply); |
| | | |
| | | mallShopApply.setStatus(MallShopApply.APPLY_ING); |
| | | mallShopApply.setMemberId(member.getId()); |
| | | mallShopApplyMapper.insert(mallShopApply); |
| | | } |
| | | |
| | | @Override |
| | | public MallShopApply findNewestApply() { |
| | | MallMember member = LoginUserUtil.getLoginUser(); |
| | | |
| | | return mallShopApplyMapper.selectNewestApplyByMemberId(member.getId()); |
| | | } |
| | | |
| | | @Override |
| | | public void addRegisterAppeal(RegisterAppealDto registerAppeal) { |
| | | MallRegisterAppeal isExist = mallRegisterAppealMapper.selectByPhoneAndName(registerAppeal.getName(), registerAppeal.getPhone()); |
| | | if (isExist != null) { |
| | | throw new FebsException("申诉已存在"); |
| | | } |
| | | |
| | | isExist = new MallRegisterAppeal(); |
| | | isExist.setName(registerAppeal.getName()); |
| | | isExist.setPhone(registerAppeal.getPhone()); |
| | | isExist.setStatus(2); |
| | | |
| | | mallRegisterAppealMapper.insert(isExist); |
| | | } |
| | | } |