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/DocumentaryServiceImpl.java |   56 ++++++++++++++++++++++++++++++++++++++++++++++++++------
 1 files changed, 50 insertions(+), 6 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 7361c74..48b666d 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
@@ -10,6 +10,8 @@
 import javax.annotation.Resource;
 import javax.validation.Valid;
 
+import com.xcong.excoin.modules.documentary.common.NoticeConstant;
+import com.xcong.excoin.utils.*;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
@@ -23,6 +25,7 @@
 import com.xcong.excoin.modules.contract.dao.ContractHoldOrderDao;
 import com.xcong.excoin.modules.contract.entity.ContractHoldOrderEntity;
 import com.xcong.excoin.modules.contract.entity.ContractOrderEntity;
+import com.xcong.excoin.modules.documentary.dao.FollowFollowerNoticeDao;
 import com.xcong.excoin.modules.documentary.dao.FollowFollowerOrderRelationDao;
 import com.xcong.excoin.modules.documentary.dao.FollowFollowerProfitDao;
 import com.xcong.excoin.modules.documentary.dao.FollowFollowerSettingDao;
@@ -40,6 +43,7 @@
 import com.xcong.excoin.modules.documentary.dto.TradeOrderInfoDto;
 import com.xcong.excoin.modules.documentary.dto.UpdateDocumentaryOrderSetDto;
 import com.xcong.excoin.modules.documentary.dto.UpdateTradeSetInfoDto;
+import com.xcong.excoin.modules.documentary.entity.FollowFollowerNoticeEntity;
 import com.xcong.excoin.modules.documentary.entity.FollowFollowerOrderRelationEntity;
 import com.xcong.excoin.modules.documentary.entity.FollowFollowerProfitEntity;
 import com.xcong.excoin.modules.documentary.entity.FollowFollowerSettingEntity;
@@ -48,6 +52,7 @@
 import com.xcong.excoin.modules.documentary.service.DocumentaryService;
 import com.xcong.excoin.modules.documentary.vo.DocumentaryOrderInfoVo;
 import com.xcong.excoin.modules.documentary.vo.DocumentaryOrderSetInfoVo;
+import com.xcong.excoin.modules.documentary.vo.FollowFollowerNoticeVo;
 import com.xcong.excoin.modules.documentary.vo.FollowInfoVo;
 import com.xcong.excoin.modules.documentary.vo.FollowRecordsVo;
 import com.xcong.excoin.modules.documentary.vo.FollowTraderProfitInfoVo;
@@ -68,10 +73,6 @@
 import com.xcong.excoin.modules.member.entity.MemberLevelRateEntity;
 import com.xcong.excoin.modules.member.entity.MemberWalletContractEntity;
 import com.xcong.excoin.modules.platform.entity.PlatformTradeSettingEntity;
-import com.xcong.excoin.utils.CacheSettingUtils;
-import com.xcong.excoin.utils.CoinTypeConvert;
-import com.xcong.excoin.utils.MessageSourceUtils;
-import com.xcong.excoin.utils.RedisUtils;
 
 import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.util.ObjectUtil;
@@ -108,6 +109,8 @@
     private FollowFollowerSettingDao followFollowerSettingDao;
     @Resource
     private FollowFollowerOrderRelationDao followFollowerOrderRelationDao;
+    
+    private FollowFollowerNoticeDao followFollowerNoticeDao;
     
 	
 	@Override
@@ -279,7 +282,7 @@
         			myFollowOrderVo.setLeverRatio(leverRatio);
         			BigDecimal rewardAmount = contractOrderEntity.getRewardAmount().setScale(2, BigDecimal.ROUND_DOWN);
         			myFollowOrderVo.setRewardAmount(rewardAmount);
-        			BigDecimal rewardRatio = contractOrderEntity.getRewardRatio().setScale(2, BigDecimal.ROUND_DOWN);
+        			BigDecimal rewardRatio = contractOrderEntity.getRewardRatio().setScale(4, BigDecimal.ROUND_DOWN);
         			myFollowOrderVo.setRewardRatio(rewardRatio);
         			int symbolCnt = contractOrderEntity.getSymbolCnt();
         			myFollowOrderVo.setSymbolCnt(symbolCnt);
@@ -927,9 +930,50 @@
         FollowFollowerProfitEntity followFollowerProfitEntity = followFollowerProfitDao.selectById(id);
         followFollowerProfitEntity.setIsFollow(FollowFollowerProfitEntity.IS_FOLLOW_N);
         followFollowerProfitDao.updateById(followFollowerProfitEntity);
-        
+
+        //删除【跟随者设置】
+        Map<String, Object> columnMap = new HashMap<>();
+        Long followMemberId = followFollowerProfitEntity.getMemberId();
+        Long tradeId = followFollowerProfitEntity.getTradeId();
+        columnMap.put("member_id", followMemberId);
+        columnMap.put("trader_id", tradeId);
+        List<FollowFollowerSettingEntity> selectByMap = followFollowerSettingDao.selectByMap(columnMap);
+        if(CollUtil.isNotEmpty(selectByMap)) {
+        	for(FollowFollowerSettingEntity followFollowerSettingEntity : selectByMap) {
+        		followFollowerSettingDao.deleteById(followFollowerSettingEntity.getId());
+        	}
+        }
+
+		FollowTraderInfoEntity traderInfoEntity = followTraderInfoDao.selectTraderInfoByMemberId(memberId);
+
+		if (traderInfoEntity != null) {
+			LogRecordUtils.insertFollowerNotice(memberId, NoticeConstant.STOP_FOLLOW_TITLE, StrUtil.format(NoticeConstant.STOP_FOLLOW_CONTENT, traderInfoEntity.getNickname()));
+		}
 		return Result.ok(MessageSourceUtils.getString("member_service_0026"));
 	}
+
+	@Override
+	public Result getFollowFollowerNoticeList() {
+		//获取用户ID
+        Long memberId = LoginUserUtils.getAppLoginUser().getId();
+        List<FollowFollowerNoticeVo> arrayList = new ArrayList<>();
+        
+        Map<String, Object> columnMap = new HashMap<>();
+        columnMap.put("member_id", memberId);
+		List<FollowFollowerNoticeEntity> selectByMap = followFollowerNoticeDao.selectByMap(columnMap );
+		if(CollUtil.isNotEmpty(selectByMap)) {
+			for(FollowFollowerNoticeEntity followFollowerNoticeEntity : selectByMap) {
+				FollowFollowerNoticeVo followFollowerNoticeVo = new FollowFollowerNoticeVo();
+				String title = followFollowerNoticeEntity.getTitle();
+				followFollowerNoticeVo.setTitle(title);
+				String content = followFollowerNoticeEntity.getContent();
+				followFollowerNoticeVo.setContent(content);
+				arrayList.add(followFollowerNoticeVo);
+			}
+		}
+        
+		return Result.ok(arrayList);
+	}
 	
 	
 	

--
Gitblit v1.9.1