Helius
2020-06-05 1fa764ab0ba279ef3a3bf7021b7528f10ea24a86
modify
2 files modified
14 ■■■■■ changed files
src/main/java/com/xcong/excoin/modules/contract/service/impl/OrderWebsocketServiceImpl.java 9 ●●●●● patch | view | raw | blame | history
src/main/java/com/xcong/excoin/modules/contract/service/impl/RabbitOrderServiceImpl.java 5 ●●●●● patch | view | raw | blame | history
src/main/java/com/xcong/excoin/modules/contract/service/impl/OrderWebsocketServiceImpl.java
@@ -198,6 +198,7 @@
                        totalReturn = needReturn.subtract(contractOrderEntity.getClosingFeeAmount());
                        // 总的是收益-平仓手续费
                        BigDecimal totalBalance = profitLossPrice.subtract(contractOrderEntity.getClosingFeeAmount());
                        memberWalletContractService.increaseWalletContractBalanceById(totalReturn, totalBalance, null, wallet.getId());
                        // 流水记录 TODO 531e
@@ -287,8 +288,8 @@
                        // 更新钱包
                        // 总的是收益-平仓手续费
                        BigDecimal totalBalance = profitLossPrice.subtract(contractOrderEntity.getClosingFeeAmount());
                        memberWalletContractService.increaseWalletContractBalanceById(totalReturn, totalBalance, null, wallet.getId());
                        memberWalletContractService.increaseWalletContractBalanceById(totalReturn, totalBalance, null, wallet.getId());
                        insertAccountFlow(order, wallet, profitLossPrice, "止盈平仓");
@@ -371,16 +372,14 @@
                        contractOrderService.save(contractOrderEntity);
                        contractHoldOrderService.removeById(order.getId());
                        log.info("保证金:{}", prePrice);
                        log.info("盈亏:{}", profitLossPrice);
                        // 将需要退回的减去手续费
                        BigDecimal needReturn = prePrice.add(profitLossPrice);
                        log.info("退回的钱:{}", needReturn);
                        //总退回金额=保证金+收益-手续费
                        totalReturn = needReturn.subtract(contractOrderEntity.getClosingFeeAmount());
                        // 更新钱包
                        // 总的是收益-平仓手续费
                        BigDecimal totalBalance = profitLossPrice.subtract(contractOrderEntity.getClosingFeeAmount());
                        memberWalletContractService.increaseWalletContractBalanceById(totalReturn, totalBalance, null, wallet.getId());
                        insertAccountFlow(order, wallet, profitLossPrice, "开多止损平仓");
@@ -425,7 +424,7 @@
                    String symbol = order.getSymbol();
                    Long memberId = order.getMemberId();
                    // 本次需要退回的预付款
                    BigDecimal prePrice = order.getPrePaymentAmount();
                    BigDecimal prePrice = order.getBondAmount();
                    MemberWalletContractEntity wallet = memberWalletContractService.findWalletContractByMemberIdAndSymbol(memberId, "USDT");
                    if (wallet != null) {
src/main/java/com/xcong/excoin/modules/contract/service/impl/RabbitOrderServiceImpl.java
@@ -133,8 +133,13 @@
            contractOrderEntity.setRewardRatio(rewardRatio);
            contractOrderDao.insert(contractOrderEntity);
            log.info("盈亏:{}", profitOrLoss);
            log.info("手续费:{}", holdOrderEntity.getOpeningFeeAmount());
            log.info("保证金:{}", holdOrderEntity.getBondAmount());
            // 计算盈利或亏损后可用金额和总金额应该增加或减少的
            BigDecimal addMoney = holdOrderEntity.getBondAmount().subtract(holdOrderEntity.getOpeningFeeAmount()).add(profitOrLoss);
            log.info("金额:{}", addMoney);
            log.info("----->:{}", contractOrderEntity.getOpeningFeeAmount());
            memberWalletContractDao.increaseWalletContractBalanceById(addMoney, profitOrLoss.subtract(contractOrderEntity.getOpeningFeeAmount()), null, walletContract.getId());
            // 计算佣金