Helius
2021-06-15 2e3db6b70d8441f11fbbd60999ab8fe8cc167fa0
src/main/java/com/xcong/excoin/modules/coin/controller/GbzOrderController.java
@@ -52,6 +52,7 @@
        if ("1".equals(status)) {
            return Result.fail("无法购买");
        }
        String total = redisUtils.getString("bzz_coin_total");
        MemberEntity loginUser = LoginUserUtils.getAppLoginUser();
        BigDecimal price = new BigDecimal(66);
@@ -60,6 +61,10 @@
        MemberWalletCoinEntity wallet = memberWalletCoinDao.selectWalletCoinBymIdAndCode(loginUser.getId(), CoinTypeEnum.USDT.name());
        if (amount.compareTo(wallet.getAvailableBalance()) > 0) {
            return Result.fail("可用金额不足");
        }
        if (Integer.parseInt(total) < gbzAddDto.getCount()) {
            return Result.fail("BZZ数量不足");
        }
        GbzOrderEntity gbzOrder = new GbzOrderEntity();
@@ -73,7 +78,7 @@
        gbzOrderDao.insert(gbzOrder);
        memberWalletCoinDao.updateBlockBalance(wallet.getId(), amount.negate(), BigDecimal.ZERO, 0);
        redisUtils.set("bzz_coin_total", Integer.parseInt(total) - gbzAddDto.getCount());
        LogRecordUtils.insertMemberAccountMoneyChange(loginUser.getId(), "购买BZZ", amount, "USDT", 1, 1);
        return Result.ok("购买成功");
    }
@@ -101,6 +106,10 @@
        String status = redisUtils.getString("bzz_order_status");
        priceVo.setStatus(StrUtil.isNotBlank(status) ? Integer.parseInt(status) : 2);
        String remain = redisUtils.getString("bzz_coin_total");
        priceVo.setRemainCnt(Integer.parseInt(remain));
        BigDecimal totalAmount = gbzOrderDao.selectOrderTotalAmount(LoginUserUtils.getAppLoginUser().getId());
        priceVo.setTotalAmount(totalAmount);
        return Result.ok(priceVo);