From a4ea7a8d531f562c898c9fead98d14d6c85581db Mon Sep 17 00:00:00 2001
From: Helius <wangdoubleone@gmail.com>
Date: Wed, 20 Jan 2021 14:55:43 +0800
Subject: [PATCH] modify

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

diff --git a/src/main/java/com/xcong/excoin/modules/documentary/service/impl/DocumentaryServiceImpl.java b/src/main/java/com/xcong/excoin/modules/documentary/service/impl/DocumentaryServiceImpl.java
index 5a23cb7..cb4d891 100644
--- a/src/main/java/com/xcong/excoin/modules/documentary/service/impl/DocumentaryServiceImpl.java
+++ b/src/main/java/com/xcong/excoin/modules/documentary/service/impl/DocumentaryServiceImpl.java
@@ -24,6 +24,7 @@
 import com.xcong.excoin.modules.coin.parameter.dto.RecordsPageDto;
 import com.xcong.excoin.modules.contract.dao.ContractHoldOrderDao;
 import com.xcong.excoin.modules.contract.dao.ContractOrderDao;
+import com.xcong.excoin.modules.contract.entity.ContractEntrustOrderEntity;
 import com.xcong.excoin.modules.contract.entity.ContractHoldOrderEntity;
 import com.xcong.excoin.modules.contract.entity.ContractOrderEntity;
 import com.xcong.excoin.modules.documentary.dao.FollowFollowerNoticeDao;
@@ -458,6 +459,20 @@
 		if (traderInfoEntity != null) {
 			return Result.fail(MessageSourceUtils.getString("documentary_service_0014"));
 		}
+		
+		//判断当前用户是否是逐仓模式
+		MemberEntity selectById2 = memberDao.selectById(memberId);
+		Integer contractPositionType = selectById2.getContractPositionType();
+		if(ContractEntrustOrderEntity.POSITION_TYPE_ADD != contractPositionType) {
+			return Result.fail(MessageSourceUtils.getString("documentary_service_0017"));
+		}
+		
+		//判断交易员是否开启了跟单
+		FollowTraderInfoEntity selectById = followTraderInfoDao.selectById(traderId);
+		Integer isOpen = selectById.getIsOpen();
+		if(FollowTraderInfoEntity.ISOPEN_Y != isOpen) {
+			return Result.fail(MessageSourceUtils.getString("documentary_service_0016"));
+		}
 
 		FollowFollowerSettingEntity isExistSetting = followFollowerSettingDao.selectOneBymemberIdAndTradeId(memberId, traderId);
 		if (isExistSetting == null) {
@@ -719,6 +734,8 @@
         FollowTraderInfoEntity followTraderInfoEntity = followTraderInfoDao.selectTraderInfoByMemberId(memberId);
         
         TradeSetInfoVo tradeSetInfoVo = new TradeSetInfoVo();
+        Long id = followTraderInfoEntity.getId();
+        tradeSetInfoVo.setTradeId(id);
         String avatar = followTraderInfoEntity.getAvatar();
         tradeSetInfoVo.setAvatar(avatar);
         String nickname = followTraderInfoEntity.getNickname();
@@ -735,6 +752,10 @@
 		//获取用户ID
         Long memberId = LoginUserUtils.getAppLoginUser().getId();
         FollowTraderInfoEntity followTraderInfoEntity = followTraderInfoDao.selectTraderInfoByMemberId(memberId);
+        /**
+         * todo
+         * 当前交易员有合约多单,是否可以直接调整【是否带单】,是否需要在调整前【判断是否已经有带单的合约单】
+         */
         String avatar = updateTradeSetInfoDto.getAvatar();
         String nickname = updateTradeSetInfoDto.getNickname();
         String declaration = updateTradeSetInfoDto.getDeclaration();
@@ -874,8 +895,9 @@
         			BigDecimal allRewardRatio = BigDecimal.ZERO;
         			
         			Long orderId = contractOrderEntity.getId();
+        			String orderNo = contractOrderEntity.getOrderNo();
         			Map<String, Object> columnMapRelation = new HashMap<>();
-        			columnMapRelation.put("trade_order_no", orderId);
+        			columnMapRelation.put("trade_order_no", orderNo);
         			columnMapRelation.put("trade_member_id", memberId);
         			columnMapRelation.put("order_type", 2);
         			columnMapRelation.put("is_show", 1);
@@ -927,7 +949,7 @@
         			myFollowOrderVo.setOpeningTime(openingTime);
         			Date closingTime = contractOrderEntity.getClosingTime();
         			myFollowOrderVo.setClosingTime(closingTime);
-        			String orderNo = contractOrderEntity.getOrderNo();
+        			
         			myFollowOrderVo.setOrderNo(orderNo);
         			myFollowOrderVos.add(myFollowOrderVo);
         		}
@@ -1000,7 +1022,7 @@
 		FollowTraderInfoEntity traderInfoEntity = followTraderInfoDao.selectTraderInfoByMemberId(memberId);
 
 		if (traderInfoEntity != null) {
-			LogRecordUtils.insertFollowerNotice(memberId, NoticeConstant.STOP_FOLLOW_TITLE, StrUtil.format(NoticeConstant.STOP_FOLLOW_CONTENT, traderInfoEntity.getNickname()));
+			LogRecordUtils.insertFollowerNotice(followMemberId, NoticeConstant.STOP_FOLLOW_TITLE, StrUtil.format(NoticeConstant.STOP_FOLLOW_CONTENT, traderInfoEntity.getNickname()));
 		}
 		return Result.ok(MessageSourceUtils.getString("member_service_0026"));
 	}

--
Gitblit v1.9.1