fix
Helius
2021-11-04 08533cfc3bcd964ba89b12abe55010619d6cfdbb
src/main/java/com/xcong/excoin/modules/coin/controller/GbzOrderController.java
@@ -48,14 +48,19 @@
    @PostMapping(value = "/add")
    @Transactional(rollbackFor = Exception.class)
    public Result add(@RequestBody GbzAddDto gbzAddDto) {
        String status = redisUtils.getString("bzz_order_status");
        String status = redisUtils.getString("bea_order_status");
        if ("1".equals(status)) {
            return Result.fail("无法购买");
        }
        String total = redisUtils.getString("bzz_coin_total");
        String start = redisUtils.getString("bea_start");
        if ("2".equals(start)) {
            return Result.fail("暂无法购买");
        }
        String total = redisUtils.getString("bea_coin_total");
        MemberEntity loginUser = LoginUserUtils.getAppLoginUser();
        BigDecimal price = new BigDecimal(redisUtils.getString("bzz_order_new_price"));
        BigDecimal price = new BigDecimal(redisUtils.getString("bea_order_new_price"));
        BigDecimal amount = BigDecimal.valueOf(gbzAddDto.getCount()).multiply(price);
        MemberWalletCoinEntity wallet = memberWalletCoinDao.selectWalletCoinBymIdAndCode(loginUser.getId(), CoinTypeEnum.USDT.name());
@@ -64,7 +69,7 @@
        }
        if (Integer.parseInt(total) < gbzAddDto.getCount()) {
            return Result.fail("BZZ数量不足");
            return Result.fail("BEA数量不足");
        }
        GbzOrderEntity gbzOrder = new GbzOrderEntity();
@@ -72,14 +77,14 @@
        gbzOrder.setAmount(amount);
        gbzOrder.setCnt(gbzAddDto.getCount());
        gbzOrder.setMemberId(loginUser.getId());
        gbzOrder.setSymbol(CoinTypeEnum.BZZ.name());
        gbzOrder.setSymbol(CoinTypeEnum.BEA.name());
        gbzOrder.setStatus(1);
        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);
        redisUtils.set("bea_coin_total", Integer.parseInt(total) - gbzAddDto.getCount());
        LogRecordUtils.insertMemberAccountMoneyChange(loginUser.getId(), "购买BEA", amount, "USDT", 1, 1);
        return Result.ok("购买成功");
    }
@@ -103,15 +108,15 @@
    @GetMapping(value = "/findPrice")
    public Result findPrice() {
        PriceVo priceVo = new PriceVo();
        String newPriceStr = redisUtils.getString("bzz_order_new_price");
        String newPriceStr = redisUtils.getString("bea_order_new_price");
        priceVo.setNewPrice(StrUtil.isNotBlank(newPriceStr) ? new BigDecimal(newPriceStr) : BigDecimal.valueOf(66));
        String status = redisUtils.getString("bzz_order_status");
        String status = redisUtils.getString("bea_order_status");
        priceVo.setStatus(StrUtil.isNotBlank(status) ? Integer.parseInt(status) : 2);
        String remain = redisUtils.getString("bzz_coin_total");
        priceVo.setRemainCnt(88888);
        String remain = redisUtils.getString("bea_coin_total");
        priceVo.setRemainCnt(Integer.parseInt(remain));
        BigDecimal totalAmount = gbzOrderDao.selectOrderTotalAmount(LoginUserUtils.getAppLoginUser().getId());
        priceVo.setTotalAmount(totalAmount);
@@ -121,7 +126,7 @@
    @ApiOperation(value = "提取到资产")
    @PostMapping(value = "/changeWallet")
    public Result changeWallet() {
        String status = redisUtils.getString("bzz_order_status");
        String status = redisUtils.getString("bea_order_status");
        if (!"1".equals(status)) {
            return Result.fail("暂无法划转");
        }
@@ -134,11 +139,11 @@
        }
        MemberWalletCoinEntity wallet = memberWalletCoinDao.selectWalletCoinBymIdAndCode(member.getId(), CoinTypeEnum
                .BZZ.name());
                .BEA.name());
        memberWalletCoinDao.updateBlockBalance(wallet.getId(), totalAmount, BigDecimal.ZERO, 0);
        gbzOrderDao.updateStatus(member.getId());
        LogRecordUtils.insertMemberAccountMoneyChange(member.getId(), "提取BZZ到资产", totalAmount, "BZZ", 1, 1);
        LogRecordUtils.insertMemberAccountMoneyChange(member.getId(), "提取BEA到资产", totalAmount, "BEA", 1, 1);
        return Result.ok("提取成功");
    }
}