From 06c9e8289a5705487f9b9210f1abe08533f2f186 Mon Sep 17 00:00:00 2001
From: Helius <wangdoubleone@gmail.com>
Date: Wed, 05 Aug 2020 18:07:46 +0800
Subject: [PATCH] modify
---
src/main/java/com/xcong/excoin/modules/documentary/service/impl/DocumentaryServiceImpl.java | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 56 insertions(+), 1 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 189ff0c..f1bde06 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
@@ -35,6 +35,8 @@
import com.xcong.excoin.modules.documentary.dto.HistoryOrderRecordsDto;
import com.xcong.excoin.modules.documentary.dto.MyFollowOrderDto;
import com.xcong.excoin.modules.documentary.dto.MyFollowTraderInfoDto;
+import com.xcong.excoin.modules.documentary.dto.OutFollowInfoDto;
+import com.xcong.excoin.modules.documentary.dto.TradeFollowInfoDto;
import com.xcong.excoin.modules.documentary.dto.TradeOrderInfoDto;
import com.xcong.excoin.modules.documentary.dto.UpdateDocumentaryOrderSetDto;
import com.xcong.excoin.modules.documentary.dto.UpdateTradeSetInfoDto;
@@ -53,6 +55,7 @@
import com.xcong.excoin.modules.documentary.vo.MemberIsTradeVo;
import com.xcong.excoin.modules.documentary.vo.MyFollowOrderVo;
import com.xcong.excoin.modules.documentary.vo.MyFollowTraderInfoVo;
+import com.xcong.excoin.modules.documentary.vo.TradeFollowInfoVo;
import com.xcong.excoin.modules.documentary.vo.TradeHistoryOrderInfoVo;
import com.xcong.excoin.modules.documentary.vo.TradeOrderInfoVo;
import com.xcong.excoin.modules.documentary.vo.TradeProfitInfoVo;
@@ -366,7 +369,7 @@
// 回报率
BigDecimal returnRate = rewardRatio.divide(contractHoldOrderEntity.getBondAmount().subtract(contractHoldOrderEntity.getOpeningFeeAmount()), 8, BigDecimal.ROUND_DOWN);
- myFollowOrderVo.setRewardRatio(returnRate.setScale(2, BigDecimal.ROUND_DOWN));
+ myFollowOrderVo.setRewardRatio(returnRate.setScale(4, BigDecimal.ROUND_DOWN));
myFollowOrderVos.add(myFollowOrderVo);
}
@@ -852,6 +855,58 @@
}
return Result.ok(myFollowOrderVos);
}
+
+ @Override
+ public Result getTradeFollowInfo(@Valid TradeFollowInfoDto tradeFollowInfoDto) {
+ //获取用户ID
+ Long memberId = LoginUserUtils.getAppLoginUser().getId();
+ List<TradeFollowInfoVo> myFollowOrderVos = new ArrayList<>();
+
+ Page<FollowFollowerProfitEntity> page = new Page<>(tradeFollowInfoDto.getPageNum(), tradeFollowInfoDto.getPageSize());
+ IPage<FollowFollowerProfitEntity> followFollowerProfitEntitys = followFollowerProfitDao.selectTradeFollowerProfitEntitys(page, memberId);
+ List<FollowFollowerProfitEntity> records = followFollowerProfitEntitys.getRecords();
+ if(CollUtil.isNotEmpty(records)) {
+ for(FollowFollowerProfitEntity followFollowerProfitEntity : records) {
+ TradeFollowInfoVo myFollowTraderInfoVo = new TradeFollowInfoVo();
+
+ Long followMemberId = followFollowerProfitEntity.getMemberId();
+ MemberEntity memberEntity = memberDao.selectById(followMemberId);
+ if(ObjectUtil.isNotEmpty(memberEntity)) {
+ String phone = memberEntity.getPhone();
+ String email = memberEntity.getEmail();
+ if(StrUtil.isNotEmpty(phone)) {
+ myFollowTraderInfoVo.setNickName(phone);
+ }else {
+ myFollowTraderInfoVo.setNickName(email);
+ }
+ }
+
+ Long id = followFollowerProfitEntity.getId();
+ myFollowTraderInfoVo.setId(id);
+ BigDecimal totalPrincipal = followFollowerProfitEntity.getTotalPrincipal();
+ myFollowTraderInfoVo.setTotalPrincipal(totalPrincipal);
+ BigDecimal totalProfit = followFollowerProfitEntity.getTotalProfit();
+ myFollowTraderInfoVo.setTotalProfit(totalProfit.setScale(2, BigDecimal.ROUND_DOWN));
+
+ myFollowOrderVos.add(myFollowTraderInfoVo);
+ }
+ }
+ return Result.ok(myFollowOrderVos);
+ }
+
+ @Override
+ @Transactional
+ public Result getOutFollowInfo(@Valid OutFollowInfoDto outFollowInfoDto) {
+ //获取用户ID
+ Long memberId = LoginUserUtils.getAppLoginUser().getId();
+ long id = outFollowInfoDto.getId();
+ //获取【跟随者收益】
+ FollowFollowerProfitEntity followFollowerProfitEntity = followFollowerProfitDao.selectById(id);
+ followFollowerProfitEntity.setIsFollow(FollowFollowerProfitEntity.IS_FOLLOW_N);
+ followFollowerProfitDao.updateById(followFollowerProfitEntity);
+
+ return Result.ok(MessageSourceUtils.getString("member_service_0026"));
+ }
--
Gitblit v1.9.1