| | |
| | | import com.xcong.excoin.modules.fish.dto.*; |
| | | import com.xcong.excoin.modules.fish.entity.*; |
| | | import com.xcong.excoin.modules.fish.service.MemberCannonService; |
| | | import com.xcong.excoin.modules.fish.vo.AccountAvaBanlaceVo; |
| | | import com.xcong.excoin.modules.fish.vo.CannonSettingVo; |
| | | import com.xcong.excoin.modules.fish.vo.GoldAccountVo; |
| | | import com.xcong.excoin.modules.fish.vo.OwnCannonVo; |
| | |
| | | //1:金币兑换1代币 2:1代币兑换金币 |
| | | if(type == 1){ |
| | | MemberAccountGold memberAccountGold = memberAccountGoldDao.selectAccountGoldByMemberId(memberId); |
| | | MemberWalletCoinEntity memberWalletCoinEntity = memberWalletCoinDao.selectWalletCoinBymIdAndCode(memberId, CoinTypeEnum.XCT.name()); |
| | | MemberWalletCoinEntity memberWalletCoinEntity = memberWalletCoinDao.selectWalletCoinBymIdAndCode(memberId, CoinTypeEnum.XCC.name()); |
| | | if(balance.compareTo(memberAccountGold.getAvailableBalance()) > 0){ |
| | | return Result.fail("金币不足"); |
| | | } |
| | |
| | | cannonAccountMoneyChangeDao.insert(cannonAccountMoneyChange); |
| | | }else if(type == 2){ |
| | | MemberAccountGold memberAccountGold = memberAccountGoldDao.selectAccountGoldByMemberId(memberId); |
| | | MemberWalletCoinEntity memberWalletCoinEntity = memberWalletCoinDao.selectWalletCoinBymIdAndCode(memberId, CoinTypeEnum.XCT.name()); |
| | | MemberWalletCoinEntity memberWalletCoinEntity = memberWalletCoinDao.selectWalletCoinBymIdAndCode(memberId, CoinTypeEnum.XCC.name()); |
| | | if(balance.compareTo(memberWalletCoinEntity.getAvailableBalance()) > 0){ |
| | | return Result.fail("代币不足"); |
| | | } |
| | |
| | | return Result.ok("success"); |
| | | } |
| | | |
| | | @Override |
| | | public Result getAccountAvaBanlace() { |
| | | Long memberId = LoginUserUtils.getAppLoginUser().getId(); |
| | | MemberAccountGold memberAccountGold = memberAccountGoldDao.selectAccountGoldByMemberId(memberId); |
| | | MemberWalletCoinEntity memberWalletCoinEntityXCC = memberWalletCoinDao.selectWalletCoinBymIdAndCode(memberId, CoinTypeEnum.XCC.name()); |
| | | MemberWalletCoinEntity memberWalletCoinEntityUSDT = memberWalletCoinDao.selectWalletCoinBymIdAndCode(memberId, CoinTypeEnum.USDT.name()); |
| | | AccountAvaBanlaceVo accountAvaBanlaceVo = new AccountAvaBanlaceVo(); |
| | | // accountAvaBanlaceVo.setMemberId(memberId); |
| | | accountAvaBanlaceVo.setGoldAvailableBalance(memberAccountGold.getAvailableBalance() == null?BigDecimal.ZERO:memberAccountGold.getAvailableBalance()); |
| | | accountAvaBanlaceVo.setCoinAvailableBalance(memberWalletCoinEntityXCC.getAvailableBalance() == null?BigDecimal.ZERO:memberWalletCoinEntityXCC.getAvailableBalance()); |
| | | accountAvaBanlaceVo.setUsdtAvailableBalance(memberWalletCoinEntityUSDT.getAvailableBalance() == null?BigDecimal.ZERO:memberWalletCoinEntityUSDT.getAvailableBalance()); |
| | | return Result.ok(accountAvaBanlaceVo); |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | System.out.println(UUID.randomUUID().toString()); |
| | | } |