From 0ea6cd6f2be2fc9196ef29a0c9fd8db18c69811b Mon Sep 17 00:00:00 2001
From: xiaoyong931011 <15274802129@163.com>
Date: Mon, 22 Mar 2021 11:48:15 +0800
Subject: [PATCH] 20210318 活动信息注册时,初始化

---
 src/main/java/com/xcong/excoin/modules/contract/service/impl/RabbitOrderServiceImpl.java |    4 ++++
 1 files changed, 4 insertions(+), 0 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 d8cd8ba..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.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