From 829f629756e5402bcd3e9f6ef1f9c6dbffbabb11 Mon Sep 17 00:00:00 2001
From: KKSU <15274802129@163.com>
Date: Wed, 17 Apr 2024 14:46:29 +0800
Subject: [PATCH] 55测试环境

---
 src/main/java/com/xcong/excoin/modules/documentary/service/impl/DocumentaryServiceImpl.java |   48 +++++++++++++++++++++++++++++++++++++++---------
 1 files changed, 39 insertions(+), 9 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 18d649c..b0e0ba4 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
@@ -161,6 +161,7 @@
         FollowTraderProfitInfoEntity followTraderProfitInfoEntity = new FollowTraderProfitInfoEntity();
         if(FollowTraderInfoEntity.IS_SETFRIST_Y.equals(type)) {
         	followTraderProfitInfoEntity.setType(type);
+			followTraderProfitInfoEntity.setTotalProfitRatioSc(2);
         }else {
 	        String nicknameDto = recordsPageDto.getNickname();
 	        followTraderProfitInfoEntity.setNickname(nicknameDto);
@@ -216,6 +217,10 @@
         		FollowTraderProfitInfoVo.setDeclaration(declaration);
         		Integer isAll = followTraderInfoEntity.getIsAll();
         		FollowTraderProfitInfoVo.setIsAll(isAll);
+
+				Date entryTime = followTraderInfoEntity.getEntryTime();
+				int datePoor = getDatePoor(entryTime, new Date());
+				FollowTraderProfitInfoVo.setEntryDays(datePoor);
         		
         		String labels = followTraderInfoEntity.getLabels();
         		if(StrUtil.isNotEmpty(labels)) {
@@ -282,9 +287,19 @@
 		List<FollowRecordsVo> records = historyOrderRecordsVoList.getRecords();
 		if(CollUtil.isNotEmpty(records)) {
 			for(FollowRecordsVo followRecordsVo : records) {
-				
-				BigDecimal totalPrincipal = followRecordsVo.getTotalPrincipal().setScale(2, BigDecimal.ROUND_DOWN);
-				followRecordsVo.setTotalPrincipal(totalPrincipal);
+				Long memberIdFollow = followRecordsVo.getMemberId();
+				Long tradeId = followRecordsVo.getTradeId();
+				//获取当前跟随者最后一个历史跟单的保证金
+				BigDecimal bondAmount = BigDecimal.ZERO;
+				List<BigDecimal> bondamounts = followFollowerProfitDao.selectBondAmountByTradeIdAndMemberId(memberIdFollow,tradeId);
+				if(CollUtil.isNotEmpty(bondamounts)){
+					bondAmount = bondamounts.get(0).setScale(2, BigDecimal.ROUND_DOWN);
+
+				}
+				followRecordsVo.setTotalPrincipal(bondAmount);
+
+//				BigDecimal totalPrincipal = followRecordsVo.getTotalPrincipal().setScale(2, BigDecimal.ROUND_DOWN);
+//				followRecordsVo.setTotalPrincipal(totalPrincipal);
 				BigDecimal totalProfit = followRecordsVo.getTotalProfit().setScale(2, BigDecimal.ROUND_DOWN);
 				followRecordsVo.setTotalProfit(totalProfit);
 				
@@ -405,7 +420,7 @@
 						myFollowOrderVo.setLeverRatio(leverRatio);
 						BigDecimal rewardAmount = contractOrderEntity.getRewardAmount().setScale(2, BigDecimal.ROUND_DOWN);
 						myFollowOrderVo.setRewardAmount(rewardAmount);
-						BigDecimal rewardRatio = contractOrderEntity.getRewardRatio().setScale(4, BigDecimal.ROUND_DOWN);
+						BigDecimal rewardRatio = contractOrderEntity.getRewardRatio() == null ? BigDecimal.ZERO : contractOrderEntity.getRewardRatio().setScale(4, BigDecimal.ROUND_DOWN);
 						myFollowOrderVo.setRewardRatio(rewardRatio);
 						int symbolCnt = contractOrderEntity.getSymbolCnt();
 						myFollowOrderVo.setSymbolCnt(symbolCnt);
@@ -526,7 +541,7 @@
 				String nickname = followTraderInfoEntity.getNickname();
 				myFollowTraderInfoVo.setNickname(nickname);
 				BigDecimal totalPrincipal = FollowFollowerProfitEntity.getTotalPrincipal();
-				myFollowTraderInfoVo.setTotalPrincipal(totalPrincipal);
+				myFollowTraderInfoVo.setTotalPrincipal(totalPrincipal.setScale(2, BigDecimal.ROUND_DOWN));
 				BigDecimal totalProfit = FollowFollowerProfitEntity.getTotalProfit();
 	        	myFollowTraderInfoVo.setTotalProfit(totalProfit.setScale(2, BigDecimal.ROUND_DOWN));
 
@@ -1032,7 +1047,11 @@
         	tradeProfitInfoVo.setTotalFollowerCnt(totalFollowerCnt);
         	BigDecimal totalOrderCnt = followTraderProfitInfoVo.getTotalOrderCnt();
         	tradeProfitInfoVo.setTotalOrderCnt(totalOrderCnt);
-        }
+			BigDecimal thirtyProfitRatio = followTraderProfitInfoVo.getThirtyProfitRatio();
+			tradeProfitInfoVo.setThirtyProfitRatio(thirtyProfitRatio);
+			BigDecimal thirtyRatio = followTraderProfitInfoVo.getThirtyRatio();
+			tradeProfitInfoVo.setThirtyRatio(thirtyRatio);
+		}
 		return Result.ok(tradeProfitInfoVo);
 	}
 
@@ -1148,6 +1167,7 @@
         						BigDecimal rewardAmount = orderEntity.getRewardAmount();
         						allRewardAmount = allRewardAmount.add(rewardAmount);
         						BigDecimal rewardRatio = orderEntity.getRewardRatio();
+								rewardRatio = rewardRatio == null ? BigDecimal.ZERO : rewardRatio;
         						allRewardRatio = allRewardRatio.add(rewardRatio);
         					}
         				}
@@ -1170,7 +1190,7 @@
         			myFollowOrderVo.setLeverRatio(leverRatio);
         			BigDecimal rewardAmount = contractOrderEntity.getRewardAmount().setScale(2, BigDecimal.ROUND_DOWN);
         			myFollowOrderVo.setRewardAmount(rewardAmount);
-        			BigDecimal rewardRatio = contractOrderEntity.getRewardRatio().setScale(4, BigDecimal.ROUND_DOWN);
+        			BigDecimal rewardRatio = contractOrderEntity.getRewardRatio() == null ? BigDecimal.ZERO : contractOrderEntity.getRewardRatio().setScale(4, BigDecimal.ROUND_DOWN);
         			myFollowOrderVo.setRewardRatio(rewardRatio);
         			int symbolCnt = contractOrderEntity.getSymbolCnt();
         			myFollowOrderVo.setSymbolCnt(symbolCnt);
@@ -1219,8 +1239,18 @@
 				
 				Long id = followFollowerProfitEntity.getId();
 				myFollowTraderInfoVo.setId(id);
-				BigDecimal totalPrincipal = followFollowerProfitEntity.getTotalPrincipal();
-				myFollowTraderInfoVo.setTotalPrincipal(totalPrincipal);
+
+				Long tradeId = followFollowerProfitEntity.getTradeId();
+				//获取当前跟随者最后一个历史跟单的保证金
+				BigDecimal bondAmount = BigDecimal.ZERO;
+				List<BigDecimal> bondamounts = followFollowerProfitDao.selectBondAmountByTradeIdAndMemberId(followMemberId,tradeId);
+				if(CollUtil.isNotEmpty(bondamounts)){
+					bondAmount = bondamounts.get(0).setScale(2, BigDecimal.ROUND_DOWN);
+
+				}
+				myFollowTraderInfoVo.setTotalPrincipal(bondAmount);
+//				BigDecimal totalPrincipal = followFollowerProfitEntity.getTotalPrincipal();
+//				myFollowTraderInfoVo.setTotalPrincipal(totalPrincipal);
 				BigDecimal totalProfit = followFollowerProfitEntity.getTotalProfit();
 				myFollowTraderInfoVo.setTotalProfit(totalProfit.setScale(2, BigDecimal.ROUND_DOWN));
 				

--
Gitblit v1.9.1