From 38179780b2f728abe6dd0e5aaa284c6ee6aa8380 Mon Sep 17 00:00:00 2001 From: Helius <wangdoubleone@gmail.com> Date: Wed, 09 Mar 2022 14:19:56 +0800 Subject: [PATCH] init otc --- src/main/java/com/xcong/excoin/modules/member/service/impl/MemberServiceImpl.java | 106 ++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 100 insertions(+), 6 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 a6addc9..bdb2171 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 @@ -17,14 +17,18 @@ 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.*; import com.xcong.excoin.modules.member.parameter.vo.*; import com.xcong.excoin.modules.member.service.MemberService; +import com.xcong.excoin.modules.member.vo.DefaultWayVo; import com.xcong.excoin.modules.platform.dao.PlatformFeeSettingDao; import com.xcong.excoin.modules.platform.dao.PlatformSymbolsCoinDao; import com.xcong.excoin.modules.platform.entity.PlatformFeeSettingEntity; @@ -39,6 +43,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; @@ -59,6 +64,9 @@ @Resource private MemberDao memberDao; + + @Resource + private ZhiYaRecordDao zhiYaRecordDao; @Resource private MemberWalletAgentDao memberWalletAgentDao; @@ -594,6 +602,29 @@ } @Override + public Result setDefaultPaymethod(Long id) { + MemberEntity member = LoginUserUtils.getAppLoginUser(); + MemberPaymentMethodEntity defualtMethod = this.memberPaymentMethodDao.selectDefualtMethod(member.getId(), null, "1"); + + if (defualtMethod != null) { + if (id.equals(defualtMethod.getId())) { + return Result.fail("不能关闭默认收款方式"); + } + } + + MemberPaymentMethodEntity paymentMethodEntity = new MemberPaymentMethodEntity(); + paymentMethodEntity.setId(id); + paymentMethodEntity.setIsDefualt("1"); + this.memberPaymentMethodDao.updateById(paymentMethodEntity); + + if (defualtMethod != null) { + defualtMethod.setIsDefualt("2"); + this.memberPaymentMethodDao.updateById(defualtMethod); + } + return Result.ok("操作成功"); + } + + @Override @Transactional public Result memberBindPhone(@Valid MemberBindPhoneDto memberBindPhoneDto) { //获取用户ID @@ -1031,12 +1062,75 @@ //获取用户ID Long memberId = LoginUserUtils.getAppLoginUser().getId(); MemberEntity member = memberDao.selectById(memberId); - Page<MemberTeamVo> page = new Page<>(memberTeamRecordsPageDto.getPageNum(), memberTeamRecordsPageDto.getPageSize()); - MemberEntity memberEntity = new MemberEntity(); - memberEntity.setId(memberId); - memberEntity.setInviteId(member.getInviteId()); - IPage<MemberTeamVo> lists = memberDao.selectAllTeamByInviteIdInPage(page, memberEntity); - return Result.ok(lists); + 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 findDefaultWay() { + //获取用户ID + Long memberId = LoginUserUtils.getAppLoginUser().getId(); + + DefaultWayVo defaultWayVo = new DefaultWayVo(); + MemberPaymentMethodEntity defualtMethod = this.memberPaymentMethodDao.selectDefualtMethod(memberId, null, "1"); + if(ObjectUtil.isNotEmpty(defualtMethod)){ + String paymentType = defualtMethod.getPaymentType(); + defaultWayVo.setPaymentType(paymentType); + } + return Result.ok(defaultWayVo); } } -- Gitblit v1.9.1