From a7d5859d7f95d27ed1be29c437911a083ab9703a Mon Sep 17 00:00:00 2001
From: xiaoyong931011 <15274802129@163.com>
Date: Thu, 06 Aug 2020 11:05:42 +0800
Subject: [PATCH] 20200806  代码提交

---
 src/main/java/com/xcong/excoin/modules/documentary/service/impl/FollowOrderOperationServiceImpl.java |   19 ++++++++++++++++---
 1 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/src/main/java/com/xcong/excoin/modules/documentary/service/impl/FollowOrderOperationServiceImpl.java b/src/main/java/com/xcong/excoin/modules/documentary/service/impl/FollowOrderOperationServiceImpl.java
index a07be6c..0173007 100644
--- a/src/main/java/com/xcong/excoin/modules/documentary/service/impl/FollowOrderOperationServiceImpl.java
+++ b/src/main/java/com/xcong/excoin/modules/documentary/service/impl/FollowOrderOperationServiceImpl.java
@@ -13,6 +13,7 @@
 import com.xcong.excoin.modules.contract.entity.ContractHoldOrderEntity;
 import com.xcong.excoin.modules.contract.entity.ContractOrderEntity;
 import com.xcong.excoin.modules.contract.mapper.ContractHoldOrderEntityMapper;
+import com.xcong.excoin.modules.contract.service.RabbitOrderService;
 import com.xcong.excoin.modules.documentary.common.NoticeConstant;
 import com.xcong.excoin.modules.documentary.dao.FollowFollowerOrderRelationDao;
 import com.xcong.excoin.modules.documentary.dao.FollowFollowerProfitDao;
@@ -41,6 +42,7 @@
 import javax.annotation.Resource;
 import java.math.BigDecimal;
 import java.math.RoundingMode;
+import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
 
@@ -71,6 +73,9 @@
     private OrderProducer producer;
     @Resource
     private FollowTraderInfoDao followTraderInfoDao;
+
+    @Resource
+    private RabbitOrderService rabbitOrderService;
 
 
     @Override
@@ -178,7 +183,7 @@
                     relationEntity.setOrderType(FollowFollowerOrderRelationEntity.ORDER_TYPE_HOLD);
                     relationEntity.setTradeId(followTraderInfoEntity.getId());
                     relationEntity.setTradeMemberId(followTraderInfoEntity.getMemberId());
-                    relationEntity.setTradeOrderId(id);
+                    relationEntity.setTradeOrderNo(holdOrderEntity.getOrderNo());
                     followFollowerOrderRelationDao.insert(relationEntity);
 
                     // 发送爆仓消息
@@ -212,8 +217,16 @@
         producer.sendPriceOperate(JSONObject.toJSONString(model));
     }
 
-    @Override
-    public void closingFollowOrders(Long id) {
 
+    @Override
+    public void closingFollowOrders(String orderNo) {
+        List<FollowFollowerOrderRelationEntity> orderRelations = followFollowerOrderRelationDao.selectFollowHoldOrderByTradeOrderNo(orderNo);
+        if (CollUtil.isNotEmpty(orderRelations)) {
+            for (FollowFollowerOrderRelationEntity orderRelation : orderRelations) {
+                List<Long> ids= new ArrayList<>();
+                ids.add(orderRelation.getOrderId());
+                rabbitOrderService.cancelHoldOrder(ids);
+            }
+        }
     }
 }

--
Gitblit v1.9.1