From 2e2eeeb8291415706f4941e55270a0b23e76bf23 Mon Sep 17 00:00:00 2001 From: xiaoyong931011 <15274802129@163.com> Date: Fri, 04 Mar 2022 15:16:06 +0800 Subject: [PATCH] 20222223 --- src/main/java/com/xcong/excoin/modules/member/service/impl/MemberServiceImpl.java | 173 ++++++++++++++++++++++++++++++++++++++++++++++++++++----- 1 files changed, 158 insertions(+), 15 deletions(-) diff --git a/src/main/java/com/xcong/excoin/modules/member/service/impl/MemberServiceImpl.java b/src/main/java/com/xcong/excoin/modules/member/service/impl/MemberServiceImpl.java index 6b89fbe..4433b3a 100644 --- a/src/main/java/com/xcong/excoin/modules/member/service/impl/MemberServiceImpl.java +++ b/src/main/java/com/xcong/excoin/modules/member/service/impl/MemberServiceImpl.java @@ -5,6 +5,8 @@ import cn.hutool.core.util.StrUtil; import cn.hutool.crypto.SecureUtil; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.xcong.excoin.common.LoginUserUtils; import com.xcong.excoin.common.contants.AppContants; @@ -14,21 +16,16 @@ import com.xcong.excoin.common.system.dto.RegisterDto; import com.xcong.excoin.common.system.service.CommonService; import com.xcong.excoin.modules.coin.dao.MemberAccountMoneyChangeDao; +import com.xcong.excoin.modules.coin.dao.ZhiYaDao; +import com.xcong.excoin.modules.coin.dao.ZhiYaRecordDao; import com.xcong.excoin.modules.coin.entity.MemberAccountMoneyChange; +import com.xcong.excoin.modules.coin.entity.ZhiYaEntity; +import com.xcong.excoin.modules.coin.entity.ZhiYaRecordEntity; +import com.xcong.excoin.modules.coin.entity.ZhiYaTeam; +import com.xcong.excoin.modules.coin.parameter.vo.ZhiyaInfoVo; import com.xcong.excoin.modules.member.dao.*; import com.xcong.excoin.modules.member.entity.*; -import com.xcong.excoin.modules.member.parameter.dto.MemberAddCoinAddressDto; -import com.xcong.excoin.modules.member.parameter.dto.MemberAuthenticationDto; -import com.xcong.excoin.modules.member.parameter.dto.MemberBindEmailDto; -import com.xcong.excoin.modules.member.parameter.dto.MemberBindPhoneDto; -import com.xcong.excoin.modules.member.parameter.dto.MemberDelCoinAddressDto; -import com.xcong.excoin.modules.member.parameter.dto.MemberDelPaymethodDto; -import com.xcong.excoin.modules.member.parameter.dto.MemberForgetPwdDto; -import com.xcong.excoin.modules.member.parameter.dto.MemberPaymethodDto; -import com.xcong.excoin.modules.member.parameter.dto.MemberSubmitCoinApplyDto; -import com.xcong.excoin.modules.member.parameter.dto.MemberUpdatePwdDto; -import com.xcong.excoin.modules.member.parameter.dto.MemberUpdateTradePwdDto; -import com.xcong.excoin.modules.member.parameter.dto.MemberUpdateTradersPwdTimeDto; +import com.xcong.excoin.modules.member.parameter.dto.*; import com.xcong.excoin.modules.member.parameter.vo.*; import com.xcong.excoin.modules.member.service.MemberService; import com.xcong.excoin.modules.platform.dao.PlatformFeeSettingDao; @@ -45,6 +42,7 @@ import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import org.web3j.abi.datatypes.Int; import java.math.BigDecimal; import java.util.ArrayList; @@ -67,6 +65,9 @@ private MemberDao memberDao; @Resource + private ZhiYaRecordDao zhiYaRecordDao; + + @Resource private MemberWalletAgentDao memberWalletAgentDao; @Resource @@ -77,6 +78,12 @@ @Resource private MemberWalletCoinDao memberWalletCoinDao; + + @Resource + private MemberCoinAddressInDao memberCoinAddressInDao; + + @Resource + private ZhiYaDao zhiYaDao; @Resource private MemberLevelRateDao memberLevelRateDao; @@ -177,6 +184,9 @@ break; } parentId = parentMember.getRefererId(); + if(StringUtils.isBlank(parentId)){ + break; + } if (parentMember.getRefererId().equals(parentMember.getInviteId())) { flag = true; } @@ -215,6 +225,14 @@ walletCoin.setBorrowedFund(AppContants.INIT_MONEY); memberWalletCoinDao.insert(walletCoin); } + + //初始化质押 + ZhiYaEntity zhiYaEntity = new ZhiYaEntity(); + zhiYaEntity.setMemberId(member.getId()); + zhiYaEntity.setAvailableBalance(AppContants.INIT_MONEY); + zhiYaEntity.setFrozenBalance(AppContants.INIT_MONEY); + zhiYaEntity.setTotalBalance(AppContants.INIT_MONEY); + zhiYaDao.insert(zhiYaEntity); // 初始化代理佣金钱包 MemberWalletAgentEntity walletAgent = new MemberWalletAgentEntity(); @@ -380,6 +398,11 @@ if (count > 0) { return Result.fail(MessageSourceUtils.getString("member_service_0060")); } + // 同一个人只能认证一次 + int authenByMemberId = memberAuthenticationDao.findAuthenByMemberId(memberId); + if (authenByMemberId > 0) { + return Result.fail(MessageSourceUtils.getString("member_service_0055")); + } if (StrUtil.isBlank(memberAuthenticationDto.getIdCardFront()) || StrUtil.isBlank(memberAuthenticationDto.getIdCardReverse()) || StrUtil.isBlank(memberAuthenticationDto.getIdCardImage())) { @@ -461,7 +484,8 @@ @Transactional public Result memberTradersPwd(@Valid MemberForgetPwdDto memberForgetPwdDto) { //获取用户ID - MemberEntity memberEntity = LoginUserUtils.getAppLoginUser(); + Long memberId = LoginUserUtils.getAppLoginUser().getId(); + MemberEntity memberEntity = memberDao.selectById(memberId); String code = memberForgetPwdDto.getCode(); String password = memberForgetPwdDto.getPassword(); @@ -590,9 +614,13 @@ MemberEntity member = memberDao.selectById(memberId); if (ObjectUtil.isNotEmpty(member)) { - if (!commonservice.verifyCode(phone, code)) { + if (!commonservice.mutiVerifyCode(member.getEmail(), memberBindPhoneDto.getOtherCode(), phone, code)) { return Result.fail(MessageSourceUtils.getString("member_service_0013")); } + // 验证邮箱验证码 +// if (!commonservice.verifyCode(member.getEmail(), memberBindPhoneDto.getOtherCode())) { +// return Result.fail("邮箱"+MessageSourceUtils.getString("member_service_0013")); +// } Map<String, Object> columnMap = new HashMap<>(); columnMap.put("phone", phone); List<MemberEntity> selectByMap = memberDao.selectByMap(columnMap); @@ -618,7 +646,14 @@ String code = memberBindEmailDto.getCode(); MemberEntity member = memberDao.selectById(memberId); - boolean flag = commonservice.verifyCode(email, code); + boolean flag = commonservice.mutiVerifyCode(email, code, member.getPhone(), memberBindEmailDto.getOtherCode()); +// boolean flag2 = commonservice.verifyCode(member.getPhone(), memberBindEmailDto.getOtherCode()); + if(!flag){ + return Result.fail(MessageSourceUtils.getString("member_service_0013")); + } +// if(!flag2){ +// return Result.fail("手机"+MessageSourceUtils.getString("member_service_0013")); +// } if (ObjectUtil.isNotEmpty(member)) { if (flag) { Map<String, Object> columnMap = new HashMap<>(); @@ -875,6 +910,14 @@ //获取用户ID Long memberId = LoginUserUtils.getAppLoginUser().getId(); MemberEntity member = memberDao.selectById(memberId); + String golden_limit_transfer = redisUtils.getString("GOLDEN_LIMIT_TRANSFER"); + // 判断是否限制 + if(StringUtils.isNotBlank(member.getPhone()) &&StringUtils.isNotBlank(golden_limit_transfer) && golden_limit_transfer.contains(member.getPhone())){ + return Result.fail("此账号有财务问题,需联系客服"); + } + if(StringUtils.isNotBlank(member.getEmail()) &&StringUtils.isNotBlank(golden_limit_transfer) && golden_limit_transfer.contains(member.getEmail())){ + return Result.fail("此账号有财务问题,需联系客服"); + } if (member.getCertifyStatus() != MemberEntity.CERTIFY_STATUS_Y) { return Result.fail(MessageSourceUtils.getString("member_service_0077")); } @@ -992,6 +1035,106 @@ } return Result.ok(arrayList); } + + @Override + public Result memberTeam(MemberTeamRecordsPageDto memberTeamRecordsPageDto) { + //获取用户ID + Long memberId = LoginUserUtils.getAppLoginUser().getId(); + MemberEntity member = memberDao.selectById(memberId); + MemberTeamVo memberTeamVo = memberDao.selectAllTeamByInviteIdInPage(memberId,member.getInviteId()); + List<TeamVo> teamVos = new ArrayList<>(); + //直属会员 + List<MemberEntity> memberZhiShu = memberDao.selectMemberInfoByRefererId(member.getInviteId()); + if(ObjectUtil.isEmpty(memberTeamVo)){ + MemberTeamVo memberTeamVoNull = new MemberTeamVo(); + Integer teamCnt = memberDao.selectMemberCountByInvitedId(member.getInviteId()); + memberTeamVoNull.setTeamCnt(teamCnt); + memberTeamVoNull.setZhiyaCnt(BigDecimal.ZERO); + memberTeamVoNull.setRewardCnt(BigDecimal.ZERO); + //直属会员 + if(CollUtil.isNotEmpty(memberZhiShu)){ + for(MemberEntity zhishu : memberZhiShu){ + TeamVo teamVo = new TeamVo(); + String phone = zhishu.getPhone(); + if(StrUtil.isNotEmpty(phone)){ + String result = phone.substring(phone.length()-4,phone.length()); + teamVo.setAccount(result); + } + int memberCnt = memberDao.selectMemberCountByInvitedId(zhishu.getInviteId()); + teamVo.setTeamCnt(memberCnt); + teamVo.setZhiyaCnt(BigDecimal.ZERO); + teamVo.setRewardCnt(BigDecimal.ZERO); + teamVos.add(teamVo); + } + memberTeamVoNull.setTeamVo(teamVos); + } + return Result.ok(memberTeamVoNull); + } + if(CollUtil.isNotEmpty(memberZhiShu)){ + for(MemberEntity zhishu : memberZhiShu){ + Long zhiShuMemberId = zhishu.getId(); + ZhiYaTeam zhiYaTeam = memberDao.selectZhiYaTeamRecordByMemberId(zhiShuMemberId); + TeamVo teamVo = new TeamVo(); + String phone = zhishu.getPhone(); + if(StrUtil.isNotEmpty(phone)){ + String result = phone.substring(phone.length()-4,phone.length()); + teamVo.setAccount(result); + } + int memberCnt = memberDao.selectMemberCountByInvitedId(zhishu.getInviteId()); + teamVo.setTeamCnt(memberCnt); + + Long aLong = zhiYaRecordDao.selectSumZhiyaCntByMemberIdAndOrderStatus(zhiShuMemberId, 1); + Long rLong = zhiYaRecordDao.selectSumRewardCntByMemberId(zhiShuMemberId); + teamVo.setZhiyaCnt(new BigDecimal(aLong)); + teamVo.setRewardCnt(new BigDecimal(rLong)); + if(ObjectUtil.isNotEmpty(zhiYaTeam)){ + teamVo.setZhiyaCnt((zhiYaTeam.getZhiyaCnt() == null ? BigDecimal.ZERO : zhiYaTeam.getZhiyaCnt()).add(new BigDecimal(aLong))); + teamVo.setRewardCnt(zhiYaTeam.getRewardCnt() == null ?BigDecimal.ZERO : zhiYaTeam.getRewardCnt().add(new BigDecimal(rLong))); + } + teamVos.add(teamVo); + } + memberTeamVo.setTeamVo(teamVos); + } + return Result.ok(memberTeamVo); + } + + @Override + public Result memberCoinAddressInList() { + //获取用户ID + Long memberId = LoginUserUtils.getAppLoginUser().getId(); + + Map<String, Object> columnMap = new HashMap<>(); + columnMap.put("member_id", memberId); + List<MemberCoinAddressInEntity> selectByMap = memberCoinAddressInDao.selectByMap(columnMap ); + List<MemberCoinAddressInListVo> arrayList = new ArrayList<>(); + if (CollUtil.isNotEmpty(selectByMap)) { + for (MemberCoinAddressInEntity memberCoinAddressInEntity : selectByMap) { + MemberCoinAddressInListVo memberCoinAddressInListVo = new MemberCoinAddressInListVo(); + memberCoinAddressInListVo.setId(memberCoinAddressInEntity.getId()); + memberCoinAddressInListVo.setAccount(memberCoinAddressInEntity.getAccount()); + memberCoinAddressInListVo.setContent(memberCoinAddressInEntity.getContent()); + arrayList.add(memberCoinAddressInListVo); + } + } + return Result.ok(arrayList); + } + + @Override + @Transactional + public Result memberAddCoinAddressIn(MemberAddCoinAddressInDto memberAddCoinAddressDto) { + + //获取用户ID + Long memberId = LoginUserUtils.getAppLoginUser().getId(); + String address = memberAddCoinAddressDto.getAddress(); + String remark = memberAddCoinAddressDto.getRemark(); + + MemberCoinAddressInEntity memberCoinAddressInEntity = new MemberCoinAddressInEntity(); + memberCoinAddressInEntity.setAccount(address); + memberCoinAddressInEntity.setMemberId(memberId); + memberCoinAddressInEntity.setContent(remark); + memberCoinAddressInDao.insert(memberCoinAddressInEntity); + return Result.ok(MessageSourceUtils.getString("member_service_0024")); + } } -- Gitblit v1.9.1