| | |
| | | import com.xcong.excoin.modules.coin.dao.platform.CnyUsdtExchangeDao;
|
| | | import com.xcong.excoin.modules.coin.entity.CnyUsdtExchange;
|
| | | import com.xcong.excoin.modules.coin.entity.MemberAccountMoneyChange;
|
| | | import com.xcong.excoin.modules.coin.parameter.vo.MemberWalletCoinInfoVo;
|
| | | import com.xcong.excoin.modules.coin.parameter.vo.MemberWalletCoinVo;
|
| | | import com.xcong.excoin.modules.coin.service.CoinService;
|
| | | import com.xcong.excoin.modules.member.dao.MemberWalletAgentDao;
|
| | |
| | |
|
| | | if(!StrUtil.isEmpty(memberId.toString())) {
|
| | |
|
| | | List<MemberWalletCoinEntity> MemberWalletCoinlist = memberWalletCoinDao.selectMemberWalletCoinsByMemberId(memberId);
|
| | | List<MemberWalletCoinEntity> memberWalletCoinlist = memberWalletCoinDao.selectMemberWalletCoinsByMemberId(memberId);
|
| | |
|
| | | if(CollUtil.isNotEmpty(MemberWalletCoinlist)) {
|
| | | for(MemberWalletCoinEntity walletCoin : MemberWalletCoinlist) {
|
| | | List<MemberWalletCoinInfoVo> memberWalletCoinInfoVolist = new ArrayList<MemberWalletCoinInfoVo>();
|
| | | MemberWalletCoinInfoVo memberWalletCoinInfoVo = new MemberWalletCoinInfoVo();
|
| | | if(ObjectUtil.isNotEmpty(memberWalletCoinlist)) {
|
| | | for(MemberWalletCoinEntity memberWalletCoinEntity : memberWalletCoinlist) {
|
| | | memberWalletCoinInfoVo.setAvailableBalance(memberWalletCoinEntity.getAvailableBalance());
|
| | | memberWalletCoinInfoVo.setFrozenBalance(memberWalletCoinEntity.getFrozenBalance());
|
| | | memberWalletCoinInfoVo.setMemberId(memberWalletCoinEntity.getMemberId());
|
| | | memberWalletCoinInfoVo.setTotalBalance(memberWalletCoinEntity.getTotalBalance());
|
| | | memberWalletCoinInfoVolist.add(memberWalletCoinInfoVo);
|
| | | }
|
| | | }
|
| | | |
| | | |
| | | if(CollUtil.isNotEmpty(memberWalletCoinlist)) {
|
| | | for(MemberWalletCoinEntity walletCoin : memberWalletCoinlist) {
|
| | | if(MemberWalletCoinEnum.WALLETCOINCODE.getValue().equals(walletCoin.getWalletCode())) {
|
| | | totalUsdt = walletCoin.getAvailableBalance().add(walletCoin.getFrozenBalance());
|
| | | BigDecimal totalCny = totalUsdt.multiply(cnyUsdt);
|
| | |
| | | MemberWalletCoinVo memberWalletCoinVo = new MemberWalletCoinVo();
|
| | | memberWalletCoinVo.setTotalUsdt(totalUsdt.setScale(4, BigDecimal.ROUND_DOWN));
|
| | | memberWalletCoinVo.setTotalCny(totalUsdt.multiply(cnyUsdt).setScale(4, BigDecimal.ROUND_DOWN));
|
| | | memberWalletCoinVo.setWalletCoinEntities(MemberWalletCoinlist);
|
| | | memberWalletCoinVo.setMemberWalletCoinInfoVo(memberWalletCoinInfoVolist);
|
| | | return Result.ok(memberWalletCoinVo);
|
| | | }else {
|
| | | List<MemberWalletCoinEntity> MemberWalletCoinlist = new ArrayList<MemberWalletCoinEntity>();
|
| | | MemberWalletCoinEntity coin = new MemberWalletCoinEntity();
|
| | | List<MemberWalletCoinInfoVo> memberWalletCoinlist = new ArrayList<MemberWalletCoinInfoVo>();
|
| | | MemberWalletCoinInfoVo coin = new MemberWalletCoinInfoVo();
|
| | | coin.setAvailableBalance(BigDecimal.ZERO);
|
| | | coin.setTotalBalance(BigDecimal.ZERO);
|
| | | coin.setFrozenBalance(BigDecimal.ZERO);
|
| | | coin.setWalletCode(CoinTypeEnum.BTC.toString());
|
| | | MemberWalletCoinlist.add(coin);
|
| | | memberWalletCoinlist.add(coin);
|
| | | coin.setWalletCode(CoinTypeEnum.ETH.toString());
|
| | | MemberWalletCoinlist.add(coin);
|
| | | memberWalletCoinlist.add(coin);
|
| | | coin.setWalletCode(CoinTypeEnum.LTC.toString());
|
| | | MemberWalletCoinlist.add(coin);
|
| | | memberWalletCoinlist.add(coin);
|
| | | coin.setWalletCode(CoinTypeEnum.BCH.toString());
|
| | | MemberWalletCoinlist.add(coin);
|
| | | memberWalletCoinlist.add(coin);
|
| | | coin.setWalletCode(CoinTypeEnum.USDT.toString());
|
| | | MemberWalletCoinlist.add(coin);
|
| | | memberWalletCoinlist.add(coin);
|
| | | coin.setWalletCode(CoinTypeEnum.EOS.toString());
|
| | | MemberWalletCoinlist.add(coin);
|
| | | memberWalletCoinlist.add(coin);
|
| | | coin.setWalletCode(CoinTypeEnum.XRP.toString());
|
| | | MemberWalletCoinlist.add(coin);
|
| | | memberWalletCoinlist.add(coin);
|
| | | coin.setWalletCode(CoinTypeEnum.ETC.toString());
|
| | | MemberWalletCoinlist.add(coin);
|
| | | memberWalletCoinlist.add(coin);
|
| | | |
| | | MemberWalletCoinVo memberWalletCoinVo = new MemberWalletCoinVo();
|
| | | memberWalletCoinVo.setTotalUsdt(totalUsdt.setScale(4, BigDecimal.ROUND_DOWN));
|
| | | memberWalletCoinVo.setTotalCny(totalUsdt.multiply(cnyUsdt).setScale(4, BigDecimal.ROUND_DOWN));
|
| | | memberWalletCoinVo.setWalletCoinEntities(MemberWalletCoinlist);
|
| | | memberWalletCoinVo.setMemberWalletCoinInfoVo(memberWalletCoinlist);;
|
| | | return Result.ok(memberWalletCoinVo);
|
| | | }
|
| | | } catch (Exception e) {
|