From 6a615efb2051fee8aa119ffc9e6fa0c991c7758c Mon Sep 17 00:00:00 2001 From: xiaoyong931011 <15274802129@163.com> Date: Fri, 22 Jan 2021 17:25:59 +0800 Subject: [PATCH] 20210122 --- src/main/java/com/xcong/excoin/modules/coin/service/impl/CoinServiceImpl.java | 119 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 119 insertions(+), 0 deletions(-) diff --git a/src/main/java/com/xcong/excoin/modules/coin/service/impl/CoinServiceImpl.java b/src/main/java/com/xcong/excoin/modules/coin/service/impl/CoinServiceImpl.java index c4cc3dc..7e308a9 100644 --- a/src/main/java/com/xcong/excoin/modules/coin/service/impl/CoinServiceImpl.java +++ b/src/main/java/com/xcong/excoin/modules/coin/service/impl/CoinServiceImpl.java @@ -7,6 +7,7 @@ import java.util.Map; import javax.annotation.Resource; +import javax.validation.Valid; import com.xcong.excoin.modules.platform.entity.PlatformCnyUsdtExchangeEntity; import org.springframework.stereotype.Service; @@ -23,8 +24,10 @@ import com.xcong.excoin.modules.coin.entity.MemberAccountMoneyChange; import com.xcong.excoin.modules.coin.entity.OrderCoinsDealEntity; import com.xcong.excoin.modules.coin.mapper.MemberAccountMoneyChangeMapper; +import com.xcong.excoin.modules.coin.parameter.dto.CoinInListDto; import com.xcong.excoin.modules.coin.parameter.dto.RecordsPageDto; import com.xcong.excoin.modules.coin.parameter.vo.AllWalletCoinVo; +import com.xcong.excoin.modules.coin.parameter.vo.CoinInListVo; import com.xcong.excoin.modules.coin.parameter.vo.ContractSymbolListVo; import com.xcong.excoin.modules.coin.parameter.vo.MemberAccountMoneyChangeInfoVo; import com.xcong.excoin.modules.coin.parameter.vo.MemberWalletAgentInfoVo; @@ -32,14 +35,19 @@ import com.xcong.excoin.modules.coin.parameter.vo.MemberWalletCoinVo; import com.xcong.excoin.modules.coin.parameter.vo.MemberWalletContractInfoVo; import com.xcong.excoin.modules.coin.service.CoinService; +import com.xcong.excoin.modules.member.dao.MemberCoinChargeDao; +import com.xcong.excoin.modules.member.dao.MemberCoinWithdrawDao; import com.xcong.excoin.modules.member.dao.MemberDao; import com.xcong.excoin.modules.member.dao.MemberWalletAgentDao; import com.xcong.excoin.modules.member.dao.MemberWalletCoinDao; import com.xcong.excoin.modules.member.dao.MemberWalletContractDao; +import com.xcong.excoin.modules.member.entity.MemberCoinChargeEntity; +import com.xcong.excoin.modules.member.entity.MemberCoinWithdrawEntity; import com.xcong.excoin.modules.member.entity.MemberEntity; import com.xcong.excoin.modules.member.entity.MemberWalletAgentEntity; import com.xcong.excoin.modules.member.entity.MemberWalletCoinEntity; import com.xcong.excoin.modules.member.entity.MemberWalletContractEntity; +import com.xcong.excoin.modules.member.vo.MemberCoinChargeVo; import com.xcong.excoin.modules.platform.dao.PlatformCnyUsdtExchangeDao; import com.xcong.excoin.utils.CoinTypeConvert; import com.xcong.excoin.utils.MessageSourceUtils; @@ -67,6 +75,10 @@ MemberWalletAgentDao memberWalletAgentDao; @Resource MemberDao memberDao; + @Resource + MemberCoinChargeDao memberCoinChargeDao; + @Resource + MemberCoinWithdrawDao memberCoinWithdrawDao; @Resource RedisUtils redisUtils; @@ -886,6 +898,113 @@ return Result.ok(MessageSourceUtils.getString("member_service_0006")); } + + @Override + public Result coinInList(@Valid CoinInListDto coinInListDto) { + //获取用户ID + Long memberId = LoginUserUtils.getAppLoginUser().getId(); + int type = coinInListDto.getType(); + //充币记录 + if(type == 1) { + Page<MemberCoinChargeEntity> page = new Page<>(coinInListDto.getPageNum(), coinInListDto.getPageSize()); + MemberCoinChargeEntity memberCoinChargeEntity = new MemberCoinChargeEntity(); + memberCoinChargeEntity.setMemberId(memberId); + IPage<MemberCoinChargeEntity> memberCoinCharge = memberCoinChargeDao.findMemberCoinChargeInPage(page, memberCoinChargeEntity); + List<MemberCoinChargeEntity> records = memberCoinCharge.getRecords(); + + Page<CoinInListVo> responsePage = new Page<>(coinInListDto.getPageNum(), coinInListDto.getPageSize()); + if(CollUtil.isNotEmpty(records)) { + ArrayList<CoinInListVo> arrayList = new ArrayList<>(); + for(MemberCoinChargeEntity memberCoinChargeEntitys : records) { + CoinInListVo coinInListVo = new CoinInListVo(); + coinInListVo.setSymbol(memberCoinChargeEntitys.getSymbol()); + coinInListVo.setAmount(memberCoinChargeEntitys.getAmount()); + coinInListVo.setContent("充币"); + coinInListVo.setStatus(memberCoinChargeEntitys.getStatus()); + coinInListVo.setUpdateTime(memberCoinChargeEntitys.getUpdateTime()); + arrayList.add(coinInListVo); + } + responsePage.setRecords(arrayList); + } + return Result.ok(responsePage); + } + //提币记录 + if(type == 2) { + Page<MemberCoinWithdrawEntity> page = new Page<>(coinInListDto.getPageNum(), coinInListDto.getPageSize()); + MemberCoinWithdrawEntity memberCoinWithdrawEntity = new MemberCoinWithdrawEntity(); + memberCoinWithdrawEntity.setMemberId(memberId); + IPage<MemberCoinWithdrawEntity> memberCoinWithdraw = memberCoinWithdrawDao.findMemberCoinWithdrawInPage(page, memberCoinWithdrawEntity); + List<MemberCoinWithdrawEntity> records = memberCoinWithdraw.getRecords(); + + Page<CoinInListVo> responsePage = new Page<>(coinInListDto.getPageNum(), coinInListDto.getPageSize()); + if(CollUtil.isNotEmpty(records)) { + ArrayList<CoinInListVo> arrayList = new ArrayList<>(); + for(MemberCoinWithdrawEntity memberCoinWithdrawEntitys : records) { + CoinInListVo coinInListVo = new CoinInListVo(); + coinInListVo.setSymbol(memberCoinWithdrawEntitys.getSymbol()); + coinInListVo.setAmount(memberCoinWithdrawEntitys.getAmount()); + coinInListVo.setContent("提币"); + coinInListVo.setStatus(memberCoinWithdrawEntitys.getStatus()); + coinInListVo.setUpdateTime(memberCoinWithdrawEntitys.getUpdateTime()); + coinInListVo.setIsInside(memberCoinWithdrawEntitys.getIsInside()); + arrayList.add(coinInListVo); + } + responsePage.setRecords(arrayList); + } + return Result.ok(responsePage); + } + //划转记录 + if(type == 3) { + Page<MemberAccountMoneyChange> page = new Page<>(coinInListDto.getPageNum(), coinInListDto.getPageSize()); + MemberAccountMoneyChange memberAccountMoneyChange = new MemberAccountMoneyChange(); + memberAccountMoneyChange.setMemberId(memberId); + IPage<MemberAccountMoneyChange> list = memberAccountMoneyChangeDao.coinInList(page, memberAccountMoneyChange); + List<MemberAccountMoneyChange> records = list.getRecords(); + + Page<CoinInListVo> responsePage = new Page<>(coinInListDto.getPageNum(), coinInListDto.getPageSize()); + if(CollUtil.isNotEmpty(records)) { + ArrayList<CoinInListVo> arrayList = new ArrayList<>(); + for(MemberAccountMoneyChange memberAccountMoneyChanges : records) { + CoinInListVo coinInListVo = new CoinInListVo(); + coinInListVo.setSymbol(memberAccountMoneyChanges.getSymbol()); + coinInListVo.setAmount(memberAccountMoneyChanges.getAmount()); + coinInListVo.setContent(memberAccountMoneyChanges.getContent()); + coinInListVo.setStatus(memberAccountMoneyChanges.getStatus()); + coinInListVo.setUpdateTime(memberAccountMoneyChanges.getUpdateTime()); + arrayList.add(coinInListVo); + } + responsePage.setRecords(arrayList); + } + return Result.ok(responsePage); + } + //其他记录 + if(type == 4) { + Page<OrderCoinsDealEntity> page = new Page<>(coinInListDto.getPageNum(), coinInListDto.getPageSize()); + MemberAccountMoneyChange memberAccountMoneyChange = new MemberAccountMoneyChange(); + memberAccountMoneyChange.setMemberId(memberId); + IPage<MemberAccountMoneyChange> list = memberAccountMoneyChangeDao.selectWalletAgentIntoRecordsByMemIdTypeSymbol(page, memberAccountMoneyChange); + List<MemberAccountMoneyChange> records = list.getRecords(); + + Page<CoinInListVo> responsePage = new Page<>(coinInListDto.getPageNum(), coinInListDto.getPageSize()); + if(CollUtil.isNotEmpty(records)) { + ArrayList<CoinInListVo> arrayList = new ArrayList<>(); + for(MemberAccountMoneyChange memberAccountMoneyChanges : records) { + CoinInListVo coinInListVo = new CoinInListVo(); + coinInListVo.setSymbol(memberAccountMoneyChanges.getSymbol()); + coinInListVo.setAmount(memberAccountMoneyChanges.getAmount()); + coinInListVo.setContent(memberAccountMoneyChanges.getContent()); + coinInListVo.setStatus(memberAccountMoneyChanges.getStatus()); + coinInListVo.setUpdateTime(memberAccountMoneyChanges.getUpdateTime()); + arrayList.add(coinInListVo); + } + responsePage.setRecords(arrayList); + } + return Result.ok(responsePage); + } + + return Result.fail(MessageSourceUtils.getString("member_controller_0005")); + + } -- Gitblit v1.9.1