From cb6bf31330bd994e65879ccea31877d2e05c79ea Mon Sep 17 00:00:00 2001
From: zainali5120 <512061637@qq.com>
Date: Wed, 17 Mar 2021 19:30:22 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/whole_new' into whole_new

---
 src/main/java/com/xcong/excoin/modules/contract/service/impl/RabbitOrderServiceImpl.java |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/src/main/java/com/xcong/excoin/modules/contract/service/impl/RabbitOrderServiceImpl.java b/src/main/java/com/xcong/excoin/modules/contract/service/impl/RabbitOrderServiceImpl.java
index 4bdd613..86a9bbd 100644
--- a/src/main/java/com/xcong/excoin/modules/contract/service/impl/RabbitOrderServiceImpl.java
+++ b/src/main/java/com/xcong/excoin/modules/contract/service/impl/RabbitOrderServiceImpl.java
@@ -302,6 +302,7 @@
             }
             log.info("profitOrLoss:{}", profitOrLoss);
 
+            BigDecimal rewardRatio = profitOrLoss.divide(holdOrderEntity.getBondAmount().subtract(holdOrderEntity.getOpeningFeeAmount()), 4, BigDecimal.ROUND_DOWN);
             // 保证金
             BigDecimal bondAmount = CalculateUtil.getBondAmount(holdOrderEntity.getOpeningPrice(), lotNumber, closeCnt, holdOrderEntity.getLeverRatio());
 
@@ -323,6 +324,7 @@
             contractOrderEntity.setClosingType(closingType);
             contractOrderEntity.setSymbolCnt(closeCnt);
             contractOrderEntity.setRewardAmount(profitOrLoss);
+            contractOrderEntity.setRewardRatio(rewardRatio);
             contractOrderEntity.setBondAmount(bondAmount.add(fee));
             contractOrderEntity.setClosingFeeAmount(fee);
             contractOrderEntity.setClosingTime(new Date());
@@ -445,11 +447,13 @@
         contractOrderEntity.setEntrustOpeningPrice(newPrice);
         contractOrderEntity.setEntrustTime(new Date());
         contractOrderEntity.setClosingPrice(newPrice);
-        contractOrderEntity.setOrderType(orderType);
+        contractOrderEntity.setTradeType(ContractOrderEntity.TRADE_TYPE_LIMIT_PRICE);
+        contractOrderEntity.setOrderType(entrustOrder.getEntrustType());
         contractOrderEntity.setClosingType(closingType);
         contractOrderEntity.setSymbolCnt(closeCnt);
         contractOrderEntity.setRewardAmount(profitOrLoss);
         contractOrderEntity.setBondAmount(bondAmount);
+        contractOrderEntity.setClosingTime(new Date());
         contractOrderEntity.setClosingFeeAmount(fee);
         contractOrderDao.insert(contractOrderEntity);
 

--
Gitblit v1.9.1