From 9219e18a9b2fb06b95b5c881b057d3fde7270ca3 Mon Sep 17 00:00:00 2001 From: zainali5120 <512061637@qq.com> Date: Thu, 25 Feb 2021 10:28:54 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/whole_new' into whole_new --- src/main/java/com/xcong/excoin/modules/coin/service/impl/CoinServiceImpl.java | 136 ++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 134 insertions(+), 2 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 f94fad9..a3e53bb 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,10 +35,14 @@ 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; @@ -49,6 +56,7 @@ import cn.hutool.core.collection.CollUtil; import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; +import jnr.ffi.Struct.int16_t; @Service public class CoinServiceImpl extends ServiceImpl<MemberWalletCoinDao, MemberWalletCoinEntity> implements CoinService { @@ -67,6 +75,10 @@ MemberWalletAgentDao memberWalletAgentDao; @Resource MemberDao memberDao; + @Resource + MemberCoinChargeDao memberCoinChargeDao; + @Resource + MemberCoinWithdrawDao memberCoinWithdrawDao; @Resource RedisUtils redisUtils; @@ -196,8 +208,8 @@ for(MemberWalletContractEntity memberWalletContractEntity : selectByMap) { memberWalletContractInfoVo.setFrozenBalance(memberWalletContractEntity.getFrozenBalance().setScale(4, BigDecimal.ROUND_DOWN)); memberWalletContractInfoVo.setAvailableBalance(memberWalletContractEntity.getAvailableBalance().setScale(4, BigDecimal.ROUND_DOWN)); - memberWalletContractInfoVo.setTotalBalance(memberWalletContractEntity.getTotalBalance().setScale(4, BigDecimal.ROUND_DOWN)); - memberWalletContractInfoVo.setTotalRMBBalance(memberWalletContractEntity.getTotalBalance().multiply(cnyUsdt).setScale(4, BigDecimal.ROUND_DOWN)); + memberWalletContractInfoVo.setTotalCoin(memberWalletContractEntity.getTotalBalance().setScale(4, BigDecimal.ROUND_DOWN)); + memberWalletContractInfoVo.setAvailableCoin(memberWalletContractEntity.getTotalBalance().multiply(cnyUsdt).setScale(4, BigDecimal.ROUND_DOWN)); memberWalletContractInfoVo.setWalletCode(memberWalletContractEntity.getWalletCode()+"/USDT"); } } @@ -870,6 +882,8 @@ String symbolIns = symbolIn+"/USDT"; ThreadPoolUtils.sendWholeForceClosingPrice(symbolIns, memberEntity); + ThreadPoolUtils.sendWholePrice(memberId); + //添加币币资金划转历史记录 MemberAccountMoneyChange memberAccountRecord = new MemberAccountMoneyChange(); memberAccountRecord.setContent("转出至合约"+symbolIn+"账户"); @@ -886,6 +900,124 @@ 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("提币"); + int status = memberCoinWithdrawEntitys.getStatus(); + int statusOut = 0; + if(status == 1) { + statusOut = 0; + } + if(status == 2) { + statusOut = 1; + } + if(status == 3) { + statusOut = 2; + } + coinInListVo.setStatus(statusOut); + 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