Helius
2020-06-05 6d5d631a9e25e145ec39dabc0d92555d13d85d74
src/main/java/com/xcong/excoin/modules/contract/service/impl/OrderWebsocketServiceImpl.java
@@ -182,7 +182,7 @@
                            }
                        }
                        //回报率
                        BigDecimal returnRate = profitLossPrice.divide((order.getPrePaymentAmount().subtract(contractOrderEntity.getOpeningFeeAmount())), 8, BigDecimal.ROUND_DOWN);
                        BigDecimal returnRate = profitLossPrice.divide((order.getBondAmount().subtract(contractOrderEntity.getOpeningFeeAmount())), 8, BigDecimal.ROUND_DOWN);
                        contractOrderEntity.setRewardAmount(profitLossPrice);
                        contractOrderEntity.setRewardRatio(returnRate);
                        contractOrderEntity.setClosingFeeAmount(order.getOpeningFeeAmount());
@@ -270,7 +270,7 @@
                            }
                        }
                        //回报率
                        BigDecimal returnRate = profitLossPrice.divide((order.getPrePaymentAmount().subtract(contractOrderEntity.getOpeningFeeAmount())), 8, BigDecimal.ROUND_DOWN);
                        BigDecimal returnRate = profitLossPrice.divide((order.getBondAmount().subtract(contractOrderEntity.getOpeningFeeAmount())), 8, BigDecimal.ROUND_DOWN);
                        contractOrderEntity.setRewardAmount(profitLossPrice);
                        contractOrderEntity.setRewardRatio(returnRate);
                        contractOrderEntity.setClosingFeeAmount(order.getOpeningFeeAmount());
@@ -361,7 +361,7 @@
                            }
                        }
                        //回报率
                        BigDecimal returnRate = profitLossPrice.divide((order.getPrePaymentAmount().subtract(contractOrderEntity.getOpeningFeeAmount())), 8, BigDecimal.ROUND_DOWN);
                        BigDecimal returnRate = profitLossPrice.divide((order.getBondAmount().subtract(contractOrderEntity.getOpeningFeeAmount())), 8, BigDecimal.ROUND_DOWN);
                        contractOrderEntity.setRewardAmount(profitLossPrice);
                        contractOrderEntity.setRewardRatio(returnRate);
                        contractOrderEntity.setClosingFeeAmount(order.getOpeningFeeAmount());
@@ -448,7 +448,7 @@
                            }
                        }
                        //回报率
                        BigDecimal returnRate = profitLossPrice.divide((order.getPrePaymentAmount().subtract(contractOrderEntity.getClosingFeeAmount())), 8, BigDecimal.ROUND_DOWN);
                        BigDecimal returnRate = profitLossPrice.divide((order.getBondAmount().subtract(contractOrderEntity.getOpeningFeeAmount())), 8, BigDecimal.ROUND_DOWN);
                        contractOrderEntity.setRewardAmount(profitLossPrice);
                        contractOrderEntity.setRewardRatio(returnRate);
                        contractOrderEntity.setClosingFeeAmount(order.getOpeningFeeAmount());
@@ -563,7 +563,7 @@
                // 扣除手续费
                BigDecimal totalBalance = openFeePrice.negate();
                contractEntrustOrderService.removeById(coinsCoinsOrder.getId());
                memberWalletContractService.increaseWalletContractBalanceById(null, totalBalance, null, wallet.getId());
                memberWalletContractService.increaseWalletContractBalanceById(null, totalBalance, coinsCoinsOrder.getBondAmount().negate(), wallet.getId());
                //返佣
                ThreadPoolUtils.calReturnMoney(memberEntity.getId(), openFeePrice, contractOrderEntity, AgentReturnEntity.ORDER_TYPE_OPEN);
@@ -617,10 +617,10 @@
                    //更新主表订单状态位为“已平仓”
                    contractOrderEntity.setId(null);
                    contractOrderEntity.setClosingPrice(BigDecimal.ZERO);
                    contractOrderEntity.setClosingPrice(nowPrice);
                    contractOrderEntity.setClosingTime(new Date());
                    contractOrderEntity.setRewardAmount(coinsOrder.getPrePaymentAmount().negate());
                    contractOrderEntity.setClosingFeeAmount(coinsOrder.getOpeningFeeAmount());
                    contractOrderEntity.setRewardAmount(coinsOrder.getBondAmount().subtract(contractOrderEntity.getOpeningFeeAmount()).negate());
                    contractOrderService.save(contractOrderEntity);
                    //更新用户钱包数据
@@ -628,7 +628,7 @@
                    // 减去的时候用负数
                    BigDecimal totalPrice = coinsOrder.getBondAmount().negate();
                    memberWalletContractService.increaseWalletContractBalanceById(null, totalPrice, totalPrice, usdt.getId());
                    memberWalletContractService.increaseWalletContractBalanceById(null, totalPrice, null, usdt.getId());
                    // 流水记录 TODO
                    MemberAccountFlowEntity record = new MemberAccountFlowEntity();
                    record.setCreateTime(new Date());