|  |  | 
 |  |  | import javax.annotation.Resource;
 | 
 |  |  | import javax.validation.Valid;
 | 
 |  |  | 
 | 
 |  |  | import com.xcong.excoin.modules.contract.dao.ContractHoldOrderDao;
 | 
 |  |  | import com.xcong.excoin.modules.contract.entity.ContractEntrustOrderEntity;
 | 
 |  |  | import com.xcong.excoin.modules.contract.entity.ContractHoldOrderEntity;
 | 
 |  |  | import com.xcong.excoin.modules.contract.entity.ContractOrderEntity;
 | 
 |  |  | import com.xcong.excoin.modules.platform.entity.PlatformCnyUsdtExchangeEntity;
 | 
 |  |  | import com.xcong.excoin.modules.platform.entity.PlatformTradeSettingEntity;
 | 
 |  |  | import com.xcong.excoin.utils.*;
 | 
 |  |  | import org.springframework.stereotype.Service;
 | 
 |  |  | import org.springframework.transaction.annotation.Transactional;
 | 
 |  |  | 
 | 
 |  |  | 
 |  |  | 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;
 | 
 |  |  | import com.xcong.excoin.utils.RedisUtils;
 | 
 |  |  | import com.xcong.excoin.utils.ThreadPoolUtils;
 | 
 |  |  | 
 | 
 |  |  | 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 {
 | 
 |  |  | 
 |  |  |     MemberCoinWithdrawDao memberCoinWithdrawDao;
 | 
 |  |  |     @Resource
 | 
 |  |  |     RedisUtils redisUtils;
 | 
 |  |  |     @Resource
 | 
 |  |  |     CacheSettingUtils cacheSettingUtils;
 | 
 |  |  |     @Resource
 | 
 |  |  |     ContractHoldOrderDao contractHoldOrderDao;
 | 
 |  |  | 
 | 
 |  |  | 
 | 
 |  |  |     @Override
 | 
 |  |  |     public Result getWalletCoin() {
 | 
 |  |  |         //获取用户ID
 | 
 |  |  |         Long memberId = LoginUserUtils.getAppLoginUser().getId();
 | 
 |  |  | //        Long memberId = 444L;
 | 
 |  |  |         PlatformCnyUsdtExchangeEntity cnyUsdtExchange = cnyUsdtExchangeDao.getCNYAndUSDTOne();
 | 
 |  |  |         BigDecimal cnyUsdt = cnyUsdtExchange.getValue();
 | 
 |  |  | 
 | 
 |  |  | 
 |  |  | 
 | 
 |  |  |             if (CollUtil.isNotEmpty(memberWalletCoinlist)) {
 | 
 |  |  |                 for (MemberWalletCoinEntity memberWalletCoinEntity : memberWalletCoinlist) {
 | 
 |  |  |                     MemberWalletCoinInfoVo memberWalletCoinInfoVo = new MemberWalletCoinInfoVo();
 | 
 |  |  |                     memberWalletCoinInfoVo.setAvailableBalance(memberWalletCoinEntity.getAvailableBalance().setScale(4, BigDecimal.ROUND_DOWN));
 | 
 |  |  |                     memberWalletCoinInfoVo.setFrozenBalance(memberWalletCoinEntity.getFrozenBalance().setScale(4, BigDecimal.ROUND_DOWN));
 | 
 |  |  |                     memberWalletCoinInfoVo.setMemberId(memberWalletCoinEntity.getMemberId());
 | 
 |  |  |                     memberWalletCoinInfoVo.setTotalBalance(memberWalletCoinEntity.getTotalBalance().setScale(4, BigDecimal.ROUND_DOWN));
 | 
 |  |  |                     memberWalletCoinInfoVo.setWalletCode(memberWalletCoinEntity.getWalletCode());
 | 
 |  |  |                     memberWalletCoinInfoVolist.add(memberWalletCoinInfoVo);
 | 
 |  |  |                     if ("USDT".equals(memberWalletCoinEntity.getWalletCode()) || "XCH".equals(memberWalletCoinEntity.getWalletCode())) {
 | 
 |  |  |                         MemberWalletCoinInfoVo memberWalletCoinInfoVo = new MemberWalletCoinInfoVo();
 | 
 |  |  |                         memberWalletCoinInfoVo.setAvailableBalance(memberWalletCoinEntity.getAvailableBalance().setScale(8, BigDecimal.ROUND_DOWN));
 | 
 |  |  |                         memberWalletCoinInfoVo.setFrozenBalance(memberWalletCoinEntity.getFrozenBalance().setScale(8, BigDecimal.ROUND_DOWN));
 | 
 |  |  |                         memberWalletCoinInfoVo.setMemberId(memberWalletCoinEntity.getMemberId());
 | 
 |  |  |                         memberWalletCoinInfoVo.setTotalBalance(memberWalletCoinEntity.getTotalBalance().setScale(8, BigDecimal.ROUND_DOWN));
 | 
 |  |  |                         memberWalletCoinInfoVo.setWalletCode(memberWalletCoinEntity.getWalletCode());
 | 
 |  |  |                         memberWalletCoinInfoVolist.add(memberWalletCoinInfoVo);
 | 
 |  |  |                     }
 | 
 |  |  |                 }
 | 
 |  |  |             }
 | 
 |  |  | 
 | 
 |  |  | 
 |  |  |                         totalUsdts = totalUsdts.add(totalUsdt);
 | 
 |  |  |                         BigDecimal totalCny = totalUsdt.multiply(cnyUsdt);
 | 
 |  |  |                         walletCoin.setTotalBalance(totalCny);
 | 
 |  |  |                     } else {
 | 
 |  |  |                     }
 | 
 |  |  | 
 | 
 |  |  |                     if ("XCH".equals(walletCoin.getWalletCode())) {
 | 
 |  |  | //                        BigDecimal xch = walletCoin.getAvailableBalance().add(walletCoin.getFrozenBalance());
 | 
 |  |  | //                        String xchNewPrice = redisUtils.getString("XCH_NEW_PRICE");
 | 
 |  |  | //                        BigDecimal totalUsdt = xch.add(new BigDecimal(xchNewPrice));
 | 
 |  |  | //                        BigDecimal totalCny = totalUsdt.multiply(cnyUsdt);
 | 
 |  |  | //                        walletCoin.setTotalBalance(totalCny);
 | 
 |  |  | 
 | 
 |  |  |                         BigDecimal amount = walletCoin.getAvailableBalance().add(walletCoin.getFrozenBalance());
 | 
 |  |  |                         // 获取最新价
 | 
 |  |  |                         BigDecimal closePrice = new BigDecimal(redisUtils.getString(CoinTypeConvert.convertToKey(walletCoin.getWalletCode()+"/USDT")));
 | 
 |  |  |                         BigDecimal closePrice = new BigDecimal(redisUtils.getString("XCH_NEW_PRICE"));
 | 
 |  |  |                         BigDecimal totalUsdt = BigDecimal.ZERO;
 | 
 |  |  |                         //Double closePrice = symbolsService.getCloseSymbolsBySymbolsName(walletCoin.getWalletCode()+"/USDT");
 | 
 |  |  |                         totalUsdt = totalUsdt.add(amount.multiply(closePrice));
 | 
 |  |  |                         totalUsdts = totalUsdts.add(totalUsdt);
 | 
 |  |  |                         walletCoin.setTotalBalance(totalUsdt.multiply(cnyUsdt));
 | 
 |  |  |                     }
 | 
 |  |  | //                    else {
 | 
 |  |  | //                        BigDecimal amount = walletCoin.getAvailableBalance().add(walletCoin.getFrozenBalance());
 | 
 |  |  | //                        // 获取最新价
 | 
 |  |  | //                        BigDecimal closePrice = new BigDecimal(redisUtils.getString(CoinTypeConvert.convertToKey(walletCoin.getWalletCode()+"/USDT")));
 | 
 |  |  | //                        BigDecimal totalUsdt = BigDecimal.ZERO;
 | 
 |  |  | //                        //Double closePrice = symbolsService.getCloseSymbolsBySymbolsName(walletCoin.getWalletCode()+"/USDT");
 | 
 |  |  | //                        totalUsdt = totalUsdt.add(amount.multiply(closePrice));
 | 
 |  |  | //                        totalUsdts = totalUsdts.add(totalUsdt);
 | 
 |  |  | //                        walletCoin.setTotalBalance(totalUsdt.multiply(cnyUsdt));
 | 
 |  |  | //                    }
 | 
 |  |  |                 }
 | 
 |  |  |             }
 | 
 |  |  |             MemberWalletCoinVo memberWalletCoinVo = new MemberWalletCoinVo();
 | 
 |  |  | 
 |  |  |             //更新合约全仓模式下的订单权益
 | 
 |  |  |             MemberEntity memberEntity = memberDao.selectById(memberId);
 | 
 |  |  |             String symbols = symbol+"/USDT";
 | 
 |  |  |             ThreadPoolUtils.sendWholeForceClosingPrice(symbols, memberEntity);
 | 
 |  |  |             //ThreadPoolUtils.sendWholeForceClosingPrice(symbols, memberEntity);
 | 
 |  |  |             // 全仓爆仓
 | 
 |  |  |             ThreadPoolUtils.sendWholePrice(memberEntity.getId());
 | 
 |  |  |             
 | 
 |  |  |             //添加币币资金划转历史记录
 | 
 |  |  |             MemberAccountMoneyChange memberAccountRecord = new MemberAccountMoneyChange();
 | 
 |  |  | 
 |  |  |     @Override
 | 
 |  |  |     @Transactional(rollbackFor = Exception.class)
 | 
 |  |  |     public Result contractTransferToWalletCoins(BigDecimal balance, String symbol) {
 | 
 |  |  |        if (balance.compareTo(BigDecimal.ZERO) <= 0) {
 | 
 |  |  |         //获取用户ID
 | 
 |  |  |         Long memberId = LoginUserUtils.getAppLoginUser().getId();
 | 
 |  |  |         MemberEntity memberEntity = memberDao.selectById(memberId);
 | 
 |  |  |         if (balance.compareTo(BigDecimal.ZERO) <= 0) {
 | 
 |  |  |           return Result.fail(MessageSourceUtils.getString("member_service_0004"));
 | 
 |  |  |        }
 | 
 |  |  |        //获取用户ID
 | 
 |  |  |        Long memberId = LoginUserUtils.getAppLoginUser().getId();
 | 
 |  |  |     	 | 
 |  |  |         //获取合约当前持仓类型
 | 
 |  |  |         Integer contractPositionType = memberEntity.getContractPositionType();
 | 
 |  |  |         // 总盈利
 | 
 |  |  |         BigDecimal totalProfitOrLess = BigDecimal.ZERO;
 | 
 |  |  |         if(contractPositionType == 2){
 | 
 |  |  |             //获取全仓模式下的所有持仓信息
 | 
 |  |  |             PlatformTradeSettingEntity tradeSetting = cacheSettingUtils.getTradeSetting();
 | 
 |  |  |             List<ContractHoldOrderEntity> holdOrderEntities = contractHoldOrderDao.selectHoldOrderListForWholeByMemberIdAndSymbol(memberEntity.getId(),"");
 | 
 |  |  |             if (CollUtil.isNotEmpty(holdOrderEntities)) {
 | 
 |  |  |                 for (ContractHoldOrderEntity holdOrderEntity : holdOrderEntities) {
 | 
 |  |  |                     // 获取最新价
 | 
 |  |  |                     BigDecimal newPrice = new BigDecimal(redisUtils.getString(CoinTypeConvert.convertToKey(holdOrderEntity.getSymbol())));
 | 
 |  |  |                     BigDecimal lotNumber = cacheSettingUtils.getSymbolSku(holdOrderEntity.getSymbol());
 | 
 |  |  |                     // 单个订单盈利
 | 
 |  |  |                     BigDecimal profitOrLess = BigDecimal.ZERO;
 | 
 |  |  |                     // 开多
 | 
 |  |  |                     if (ContractHoldOrderEntity.OPENING_TYPE_MORE == holdOrderEntity.getOpeningType()) {
 | 
 |  |  |                         profitOrLess = newPrice.subtract(holdOrderEntity.getOpeningPrice()).multiply(new BigDecimal(holdOrderEntity.getSymbolCntSale())).multiply(lotNumber);
 | 
 |  |  |                         // 开空
 | 
 |  |  |                     } else {
 | 
 |  |  |                         profitOrLess = holdOrderEntity.getOpeningPrice().subtract(newPrice).multiply(new BigDecimal(holdOrderEntity.getSymbolCntSale())).multiply(lotNumber);
 | 
 |  |  |                     }
 | 
 |  |  |                     if (MemberEntity.IS_PROFIT_Y == memberEntity.getIsProfit()) {
 | 
 |  |  |                         if (profitOrLess.compareTo(BigDecimal.ZERO) > 0) {
 | 
 |  |  |                             profitOrLess = profitOrLess.multiply(BigDecimal.ONE.subtract(tradeSetting.getForceParam()));
 | 
 |  |  |                         } else {
 | 
 |  |  |                             profitOrLess = profitOrLess.multiply(BigDecimal.ONE.add(tradeSetting.getForceParam()));
 | 
 |  |  |                         }
 | 
 |  |  |                     }
 | 
 |  |  |                     totalProfitOrLess = totalProfitOrLess.add(profitOrLess);
 | 
 |  |  |                 }
 | 
 |  |  |             }
 | 
 |  |  |         }
 | 
 |  |  | 
 | 
 |  |  |        String walletCode = MemberWalletCoinEnum.WALLETCOINCODE.getValue();
 | 
 |  |  |        MemberWalletContractEntity walletContract = memberWalletContractDao.findWalletContractByMemberIdAndSymbol(memberId, symbol);
 | 
 |  |  |        BigDecimal availableBalance = walletContract.getAvailableBalance();
 | 
 |  |  | 
 | 
 |  |  |        BigDecimal canReduce = availableBalance;
 | 
 |  |  |        //可用减去盈亏
 | 
 |  |  |        if(totalProfitOrLess.compareTo(BigDecimal.ZERO) < 0){
 | 
 |  |  |             canReduce = availableBalance.add(totalProfitOrLess);
 | 
 |  |  |         }
 | 
 |  |  |        // 扣币
 | 
 |  |  |        BigDecimal availableSubtract = availableBalance.subtract(balance);
 | 
 |  |  |        BigDecimal availableSubtract = canReduce.subtract(balance);
 | 
 |  |  |        if (availableSubtract.compareTo(BigDecimal.ZERO) < 0) {
 | 
 |  |  |           return Result.fail(MessageSourceUtils.getString("member_service_0007"));
 | 
 |  |  |        }
 | 
 |  |  |        BigDecimal totalBalance = walletContract.getTotalBalance();
 | 
 |  |  |        BigDecimal totalSubtract = totalBalance.subtract(balance);
 | 
 |  |  |        
 | 
 |  |  |        walletContract.setAvailableBalance(availableSubtract);
 | 
 |  |  |        walletContract.setAvailableBalance(availableBalance.subtract(balance));
 | 
 |  |  |        walletContract.setTotalBalance(totalSubtract);
 | 
 |  |  |        int updateWalletCoinById = memberWalletContractDao.updateById(walletContract);
 | 
 |  |  |        if (updateWalletCoinById < 1) {
 | 
 |  |  | 
 |  |  |        if (updateById < 1) {
 | 
 |  |  |           return Result.fail(MessageSourceUtils.getString("member_service_0096"));
 | 
 |  |  |        }
 | 
 |  |  |     	 | 
 |  |  |        //更新合约全仓模式下的订单权益
 | 
 |  |  |         MemberEntity memberEntity = memberDao.selectById(memberId);
 | 
 |  |  |         String symbols = symbol+"/USDT";
 | 
 |  |  |         ThreadPoolUtils.sendWholeForceClosingPrice(symbols, memberEntity);
 | 
 |  |  | 
 | 
 |  |  |         // 全仓爆仓
 | 
 |  |  |         ThreadPoolUtils.sendWholePrice(memberEntity.getId());
 | 
 |  |  |        
 | 
 |  |  |        //添加资金划转历史记录
 | 
 |  |  |        MemberAccountMoneyChange memberAccountRecord = new MemberAccountMoneyChange();
 | 
 |  |  | 
 |  |  |     public Result findWalletContractBySymbol(String symbol) {
 | 
 |  |  |         //获取用户ID
 | 
 |  |  |         Long memberId = LoginUserUtils.getAppLoginUser().getId();
 | 
 |  |  |         MemberEntity memberEntity = memberDao.selectById(memberId);
 | 
 |  |  |         //获取合约当前持仓类型
 | 
 |  |  |         Integer contractPositionType = memberEntity.getContractPositionType();
 | 
 |  |  |         // 总盈利
 | 
 |  |  |         BigDecimal totalProfitOrLess = BigDecimal.ZERO;
 | 
 |  |  |         if(contractPositionType == 2){
 | 
 |  |  |             //获取全仓模式下的所有持仓信息
 | 
 |  |  |             PlatformTradeSettingEntity tradeSetting = cacheSettingUtils.getTradeSetting();
 | 
 |  |  |             List<ContractHoldOrderEntity> holdOrderEntities = contractHoldOrderDao.selectHoldOrderListForWholeByMemberIdAndSymbol(memberEntity.getId(),"");
 | 
 |  |  |             if (CollUtil.isNotEmpty(holdOrderEntities)) {
 | 
 |  |  |                 for (ContractHoldOrderEntity holdOrderEntity : holdOrderEntities) {
 | 
 |  |  |                     // 获取最新价
 | 
 |  |  |                     BigDecimal newPrice = new BigDecimal(redisUtils.getString(CoinTypeConvert.convertToKey(holdOrderEntity.getSymbol())));
 | 
 |  |  |                     BigDecimal lotNumber = cacheSettingUtils.getSymbolSku(holdOrderEntity.getSymbol());
 | 
 |  |  |                     // 单个订单盈利
 | 
 |  |  |                     BigDecimal profitOrLess = BigDecimal.ZERO;
 | 
 |  |  |                     // 开多
 | 
 |  |  |                     if (ContractHoldOrderEntity.OPENING_TYPE_MORE == holdOrderEntity.getOpeningType()) {
 | 
 |  |  |                         profitOrLess = newPrice.subtract(holdOrderEntity.getOpeningPrice()).multiply(new BigDecimal(holdOrderEntity.getSymbolCntSale())).multiply(lotNumber);
 | 
 |  |  |                         // 开空
 | 
 |  |  |                     } else {
 | 
 |  |  |                         profitOrLess = holdOrderEntity.getOpeningPrice().subtract(newPrice).multiply(new BigDecimal(holdOrderEntity.getSymbolCntSale())).multiply(lotNumber);
 | 
 |  |  |                     }
 | 
 |  |  |                     if (MemberEntity.IS_PROFIT_Y == memberEntity.getIsProfit()) {
 | 
 |  |  |                         if (profitOrLess.compareTo(BigDecimal.ZERO) > 0) {
 | 
 |  |  |                             profitOrLess = profitOrLess.multiply(BigDecimal.ONE.subtract(tradeSetting.getForceParam()));
 | 
 |  |  |                         } else {
 | 
 |  |  |                             profitOrLess = profitOrLess.multiply(BigDecimal.ONE.add(tradeSetting.getForceParam()));
 | 
 |  |  |                         }
 | 
 |  |  |                     }
 | 
 |  |  |                     totalProfitOrLess = totalProfitOrLess.add(profitOrLess);
 | 
 |  |  |                 }
 | 
 |  |  |             }
 | 
 |  |  |         }
 | 
 |  |  | 
 | 
 |  |  |         MemberWalletContractEntity walletContract = memberWalletContractDao.findWalletContractByMemberIdAndSymbol(memberId, symbol);
 | 
 |  |  |         BigDecimal availableBalance = walletContract.getAvailableBalance().setScale(4, BigDecimal.ROUND_DOWN);
 | 
 |  |  |         BigDecimal availableBalance = walletContract.getAvailableBalance();
 | 
 |  |  |         //可用减去盈亏
 | 
 |  |  |         if(totalProfitOrLess.compareTo(BigDecimal.ZERO) < 0){
 | 
 |  |  |             availableBalance = availableBalance.add(totalProfitOrLess);
 | 
 |  |  |         }
 | 
 |  |  |         if(availableBalance.compareTo(BigDecimal.ZERO) > 0){
 | 
 |  |  |             availableBalance = availableBalance.setScale(4, BigDecimal.ROUND_DOWN);
 | 
 |  |  |         }else{
 | 
 |  |  |             availableBalance = BigDecimal.ZERO;
 | 
 |  |  |         }
 | 
 |  |  |         return Result.ok(availableBalance);
 | 
 |  |  |     }
 | 
 |  |  | 
 | 
 |  |  | 
 |  |  |           //更新合约全仓模式下的订单权益
 | 
 |  |  |             MemberEntity memberEntity = memberDao.selectById(memberId);
 | 
 |  |  |             String symbols = symbol+"/USDT";
 | 
 |  |  |             ThreadPoolUtils.sendWholeForceClosingPrice(symbols, memberEntity);
 | 
 |  |  |             //ThreadPoolUtils.sendWholeForceClosingPrice(symbols, memberEntity);
 | 
 |  |  |             // 全仓爆仓
 | 
 |  |  |             ThreadPoolUtils.sendWholePrice(memberEntity.getId());
 | 
 |  |  |           
 | 
 |  |  |           //添加资金划转历史记录
 | 
 |  |  |           memberAccountRecord.setMemberId(memberId);
 | 
 |  |  | 
 |  |  |    public Result getAllWalletCoin() {
 | 
 |  |  |       //获取【币币】
 | 
 |  |  |         Long memberId = LoginUserUtils.getAppLoginUser().getId();
 | 
 |  |  | //        Long memberId =446L;
 | 
 |  |  |         PlatformCnyUsdtExchangeEntity cnyUsdtExchange = cnyUsdtExchangeDao.getCNYAndUSDTOne();
 | 
 |  |  |         BigDecimal cnyUsdt = cnyUsdtExchange.getValue();
 | 
 |  |  |         AllWalletCoinVo allWalletCoinVo = new AllWalletCoinVo();
 | 
 |  |  | 
 |  |  |        //更新合约全仓模式下的订单权益
 | 
 |  |  |         MemberEntity memberEntity = memberDao.selectById(memberId);
 | 
 |  |  |         String symbols = symbolOut+"/USDT";
 | 
 |  |  |         ThreadPoolUtils.sendWholeForceClosingPrice(symbols, memberEntity);
 | 
 |  |  |         //ThreadPoolUtils.sendWholeForceClosingPrice(symbols, memberEntity);
 | 
 |  |  |         // 全仓爆仓
 | 
 |  |  |         ThreadPoolUtils.sendWholePrice(memberEntity.getId());
 | 
 |  |  |         
 | 
 |  |  |         // 加币
 | 
 |  |  |         // 查询合约账户
 | 
 |  |  | 
 |  |  |         
 | 
 |  |  |         //更新合约全仓模式下的订单权益
 | 
 |  |  |         String symbolIns = symbolIn+"/USDT";
 | 
 |  |  |         ThreadPoolUtils.sendWholeForceClosingPrice(symbolIns, memberEntity);
 | 
 |  |  |         //ThreadPoolUtils.sendWholeForceClosingPrice(symbolIns, memberEntity);
 | 
 |  |  |         // 全仓爆仓
 | 
 |  |  |         ThreadPoolUtils.sendWholePrice(memberEntity.getId());
 | 
 |  |  |         
 | 
 |  |  |         //添加币币资金划转历史记录
 | 
 |  |  |         MemberAccountMoneyChange memberAccountRecord = new MemberAccountMoneyChange();
 | 
 |  |  | 
 |  |  |              for(MemberCoinChargeEntity memberCoinChargeEntitys : records) {
 | 
 |  |  |                 CoinInListVo coinInListVo = new CoinInListVo();
 | 
 |  |  |                 coinInListVo.setSymbol(memberCoinChargeEntitys.getSymbol());
 | 
 |  |  |                 coinInListVo.setAmount(memberCoinChargeEntitys.getAmount());
 | 
 |  |  |                 coinInListVo.setAmount(memberCoinChargeEntitys.getAmount().toPlainString());
 | 
 |  |  |                 coinInListVo.setContent("充币");
 | 
 |  |  |                 coinInListVo.setStatus(memberCoinChargeEntitys.getStatus());
 | 
 |  |  |                 coinInListVo.setUpdateTime(memberCoinChargeEntitys.getUpdateTime());
 | 
 |  |  | 
 |  |  |              for(MemberCoinWithdrawEntity memberCoinWithdrawEntitys : records) {
 | 
 |  |  |                 CoinInListVo coinInListVo = new CoinInListVo();
 | 
 |  |  |                 coinInListVo.setSymbol(memberCoinWithdrawEntitys.getSymbol());
 | 
 |  |  |                 coinInListVo.setAmount(memberCoinWithdrawEntitys.getAmount());
 | 
 |  |  |                 coinInListVo.setAmount(memberCoinWithdrawEntitys.getAmount().toPlainString());
 | 
 |  |  |                 coinInListVo.setContent("提币");
 | 
 |  |  |                 coinInListVo.setStatus(memberCoinWithdrawEntitys.getStatus());
 | 
 |  |  |                 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);
 | 
 |  |  | 
 |  |  |              for(MemberAccountMoneyChange memberAccountMoneyChanges : records) {
 | 
 |  |  |                 CoinInListVo coinInListVo = new CoinInListVo();
 | 
 |  |  |                 coinInListVo.setSymbol(memberAccountMoneyChanges.getSymbol());
 | 
 |  |  |                 coinInListVo.setAmount(memberAccountMoneyChanges.getAmount());
 | 
 |  |  |                 coinInListVo.setAmount(memberAccountMoneyChanges.getAmount().toPlainString());
 | 
 |  |  |                 coinInListVo.setContent(memberAccountMoneyChanges.getContent());
 | 
 |  |  |                 coinInListVo.setStatus(memberAccountMoneyChanges.getStatus());
 | 
 |  |  |                 coinInListVo.setUpdateTime(memberAccountMoneyChanges.getUpdateTime());
 | 
 |  |  | 
 |  |  |              for(MemberAccountMoneyChange memberAccountMoneyChanges : records) {
 | 
 |  |  |                 CoinInListVo coinInListVo = new CoinInListVo();
 | 
 |  |  |                 coinInListVo.setSymbol(memberAccountMoneyChanges.getSymbol());
 | 
 |  |  |                 coinInListVo.setAmount(memberAccountMoneyChanges.getAmount());
 | 
 |  |  |                 coinInListVo.setAmount(memberAccountMoneyChanges.getAmount().toPlainString());
 | 
 |  |  |                 coinInListVo.setContent(memberAccountMoneyChanges.getContent());
 | 
 |  |  |                 coinInListVo.setStatus(memberAccountMoneyChanges.getStatus());
 | 
 |  |  |                 coinInListVo.setUpdateTime(memberAccountMoneyChanges.getUpdateTime());
 | 
 |  |  | 
 |  |  |         return Result.fail(MessageSourceUtils.getString("member_controller_0005"));
 | 
 |  |  |         
 | 
 |  |  |     }
 | 
 |  |  | 	 | 
 |  |  | 	 | 
 |  |  | 	 | 
 |  |  | 	 | 
 |  |  | 	 | 
 |  |  | 	 | 
 |  |  | 	 | 
 |  |  | 	 | 
 |  |  | 	 | 
 |  |  | 	 | 
 |  |  | 	 | 
 |  |  | 	 | 
 |  |  | 	 | 
 |  |  | 	 | 
 |  |  | 	 | 
 |  |  | 	 | 
 |  |  | 	 | 
 |  |  | 	 | 
 |  |  | 	 | 
 |  |  | 	 | 
 |  |  | 	 | 
 |  |  | 	 | 
 |  |  | 	 | 
 |  |  | 	 | 
 |  |  | 	 | 
 |  |  | 	 | 
 |  |  | 	 | 
 |  |  | 	 | 
 |  |  | 
 | 
 |  |  | 
 | 
 |  |  |     @Override
 | 
 |  |  |     public BigDecimal getAllWalletAmount(Long memberId) {
 | 
 |  |  |         List<MemberWalletCoinEntity> memberWalletCoinList = memberWalletCoinDao.selectMemberWalletCoinsByMemberId(memberId);
 | 
 |  |  |         BigDecimal total = BigDecimal.ZERO;
 | 
 |  |  |         if (CollUtil.isNotEmpty(memberWalletCoinList)) {
 | 
 |  |  |             for (MemberWalletCoinEntity memberWalletCoinEntity : memberWalletCoinList) {
 | 
 |  |  |                 if (memberWalletCoinEntity.getWalletCode().equals(CoinTypeEnum.USDT.name())) {
 | 
 |  |  |                     total = total.add(memberWalletCoinEntity.getTotalBalance());
 | 
 |  |  |                 } else {
 | 
 |  |  |                     BigDecimal newPrice = new BigDecimal(redisUtils.getString(CoinTypeConvert.convertToKey(memberWalletCoinEntity.getWalletCode() + "/USDT")));
 | 
 |  |  |                     total = total.add(memberWalletCoinEntity.getTotalBalance().multiply(newPrice));
 | 
 |  |  |                 }
 | 
 |  |  |             }
 | 
 |  |  |         }
 | 
 |  |  | 
 | 
 |  |  |         MemberWalletContractEntity contractWallet = memberWalletContractDao.findWalletContractByMemberIdAndSymbol(memberId, CoinTypeEnum.USDT.name());
 | 
 |  |  |         total = total.add(contractWallet.getTotalBalance());
 | 
 |  |  | 
 | 
 |  |  |         MemberWalletAgentEntity walletAgent = memberWalletAgentDao.selectWalletAgentBymIdAndCode(memberId, CoinTypeEnum.USDT.name());
 | 
 |  |  |         if (walletAgent != null) {
 | 
 |  |  |             total = total.add(walletAgent.getTotalBalance());
 | 
 |  |  |         }
 | 
 |  |  |         return total;
 | 
 |  |  |     }
 | 
 |  |  | }
 |