From dd48d2c05e7ba09b11a3f7ccffd43c1b65ab1a9a Mon Sep 17 00:00:00 2001
From: xiaoyong931011 <15274802129@163.com>
Date: Mon, 18 Jan 2021 17:19:28 +0800
Subject: [PATCH] 20210118

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

diff --git a/src/main/java/com/xcong/excoin/modules/contract/service/impl/ContractHoldOrderServiceImpl.java b/src/main/java/com/xcong/excoin/modules/contract/service/impl/ContractHoldOrderServiceImpl.java
index 35217b3..c0f0234 100644
--- a/src/main/java/com/xcong/excoin/modules/contract/service/impl/ContractHoldOrderServiceImpl.java
+++ b/src/main/java/com/xcong/excoin/modules/contract/service/impl/ContractHoldOrderServiceImpl.java
@@ -24,8 +24,10 @@
 import com.xcong.excoin.modules.contract.parameter.vo.*;
 import com.xcong.excoin.modules.contract.service.ContractHoldOrderService;
 import com.xcong.excoin.modules.documentary.dao.FollowFollowerOrderRelationDao;
+import com.xcong.excoin.modules.documentary.dao.FollowFollowerProfitDao;
 import com.xcong.excoin.modules.documentary.dao.FollowTraderInfoDao;
 import com.xcong.excoin.modules.documentary.entity.FollowFollowerOrderRelationEntity;
+import com.xcong.excoin.modules.documentary.entity.FollowFollowerProfitEntity;
 import com.xcong.excoin.modules.documentary.entity.FollowTraderInfoEntity;
 import com.xcong.excoin.modules.member.dao.MemberDao;
 import com.xcong.excoin.modules.member.dao.MemberLevelRateDao;
@@ -86,8 +88,12 @@
 
     @Resource
     private MemberDao memberDao;
+    
     @Resource
     private MemberSettingDao memberSettingDao;
+
+    @Resource
+    private FollowFollowerProfitDao followFollowerProfitDao;
 
     @Resource
     private FollowTraderInfoDao followTraderInfoDao;
@@ -474,12 +480,13 @@
 //                    canAddMaxBond = BigDecimal.ZERO;
 //                }
                 BigDecimal canReduceMaxBond = holdOrderEntity.getBondAmount().subtract(holdOrderEntity.getPrePaymentAmount());
-                if (canReduceMaxBond.compareTo(BigDecimal.ZERO) < 0) {
-                    canReduceMaxBond = BigDecimal.ZERO;
-                }
 
                 if (rewardRatio.compareTo(BigDecimal.ZERO) < 0) {
                     canReduceMaxBond = canReduceMaxBond.add(rewardRatio);
+                }
+
+                if (canReduceMaxBond.compareTo(BigDecimal.ZERO) < 0) {
+                    canReduceMaxBond = BigDecimal.ZERO;
                 }
 
                 holdOrderListVo.setCanReduceMaxBond(canReduceMaxBond);
@@ -969,6 +976,15 @@
         if (CollUtil.isNotEmpty(list) || CollUtil.isNotEmpty(entrustList)) {
             return Result.fail("存在持仓/委托, 无法更改");
         }
+        
+        /**
+         * 验证用户是否存在跟随交易员
+         * 是:不允许切换成全仓模式
+         */
+        List<FollowFollowerProfitEntity> followFollowerProfitEntitys = followFollowerProfitDao.selectByMemberIdandIsFollow(member.getId(),FollowFollowerProfitEntity.IS_FOLLOW_Y);
+        if(CollUtil.isNotEmpty(followFollowerProfitEntitys)) {
+        	return Result.fail(MessageSourceUtils.getString("documentary_service_0018"));
+        }
 
         Integer positionType = member.getContractPositionType() == ContractEntrustOrderEntity.POSITION_TYPE_ADD ? ContractEntrustOrderEntity.POSITION_TYPE_ALL : ContractEntrustOrderEntity.POSITION_TYPE_ADD;
         MemberEntity updateEntity = new MemberEntity();

--
Gitblit v1.9.1