From b6c814cb99193bd203ed55aa3ebf4b2093bb6d78 Mon Sep 17 00:00:00 2001
From: xiaoyong931011 <15274802129@163.com>
Date: Fri, 05 Mar 2021 13:04:47 +0800
Subject: [PATCH] 20210304  跟单只允许跟一个交易员

---
 src/main/java/com/xcong/excoin/modules/documentary/service/impl/DocumentaryServiceImpl.java |   59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 59 insertions(+), 0 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 6db2a42..bbe01e9 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
@@ -65,6 +65,7 @@
 import com.xcong.excoin.modules.documentary.vo.BeTraderConditionVo;
 import com.xcong.excoin.modules.documentary.vo.DocumentaryOrderInfoVo;
 import com.xcong.excoin.modules.documentary.vo.DocumentaryOrderSetInfoVo;
+import com.xcong.excoin.modules.documentary.vo.DocumentaryOrderSetStateVo;
 import com.xcong.excoin.modules.documentary.vo.FollowFollowerNoticeVo;
 import com.xcong.excoin.modules.documentary.vo.FollowInfoVo;
 import com.xcong.excoin.modules.documentary.vo.FollowRecordsVo;
@@ -1265,6 +1266,64 @@
 		List<BeTraderConditionVo> beTraderConditionVos = followTraderInfoDao.selectBeTraderCondition(type);
 		return Result.ok(beTraderConditionVos);
 	}
+
+	@Override
+	public Result getDocumentaryOrderSetState(String tradeId) {
+		//获取用户ID
+        Long memberId = LoginUserUtils.getAppLoginUser().getId();
+        long parseLong = Long.parseLong(tradeId);
+		//交易员判断
+		Map<String, Object> columnMapTrader = new HashMap<>();
+		columnMapTrader.put("member_id", memberId);
+		List<FollowTraderInfoEntity> followTraderInfoEntitys = followTraderInfoDao.selectByMap(columnMapTrader);
+
+		//只能跟随一个人
+		Map<String, Object> columnMaps = new HashMap<>();
+		columnMaps.put("member_id", memberId);
+		List<FollowFollowerSettingEntity> followFollowerSettingEntityAllows = followFollowerSettingDao.selectByMap(columnMaps);
+
+		//没有交易员审核记录
+		if(CollUtil.isEmpty(followTraderInfoEntitys)) {
+			//没有跟随记录
+			if(CollUtil.isEmpty(followFollowerSettingEntityAllows)) {
+				return Result.ok("获取成功");
+			}else {
+				//有跟随记录
+				if(followFollowerSettingEntityAllows.size() == 1) {
+					Long tradeIdAllow = followFollowerSettingEntityAllows.get(0).getTraderId();
+					if(parseLong == tradeIdAllow) {
+						return Result.ok("获取成功");
+					}else{
+						return Result.fail("最多跟单一人");
+					}
+				}else{
+					return Result.fail("已经跟随多人,请修改");
+				}
+			}
+		}else{
+			Integer verifyStatus = followTraderInfoEntitys.get(0).getVerifyStatus();
+			if(FollowTraderInfoEntity.VERIFYSTATUS_N == verifyStatus) {
+				if(CollUtil.isEmpty(followFollowerSettingEntityAllows)) {
+					return Result.ok("获取成功");
+				}else {
+					if(followFollowerSettingEntityAllows.size() == 1) {
+						Long tradeIdAllow = followFollowerSettingEntityAllows.get(0).getTraderId();
+						if(parseLong == tradeIdAllow) {
+							return Result.ok("获取成功");
+						}else{
+							return Result.fail("最多跟单一人");
+						}
+					}else{
+						return Result.fail("已经跟随多人,请修改");
+					}
+				}
+			}else if(FollowTraderInfoEntity.VERIFYSTATUS_Y == verifyStatus){
+				return Result.fail("交易员不允许跟单");
+			}else {
+				return Result.fail("交易员审核中不允许跟单");
+			}
+		}
+	}
 	
 	
 	

--
Gitblit v1.9.1