From 58686a85bdfa549ac87f4dfd34a472ddc22a5667 Mon Sep 17 00:00:00 2001
From: xiaoyong931011 <15274802129@163.com>
Date: Wed, 05 Aug 2020 15:08:53 +0800
Subject: [PATCH] 20200805 代码提交
---
src/main/resources/mapper/documentary/FollowFollowerProfitDao.xml | 10 +++++
src/main/java/com/xcong/excoin/modules/documentary/controller/TraderController.java | 12 ++++++
src/main/java/com/xcong/excoin/modules/documentary/dto/TradeFollowInfoDto.java | 20 ++++++++++
src/main/java/com/xcong/excoin/modules/documentary/service/DocumentaryService.java | 3 +
src/main/java/com/xcong/excoin/modules/documentary/service/impl/DocumentaryServiceImpl.java | 40 ++++++++++++++++++++
src/main/java/com/xcong/excoin/modules/documentary/vo/TradeFollowInfoVo.java | 25 ++++++++++++
src/main/java/com/xcong/excoin/modules/documentary/dao/FollowFollowerProfitDao.java | 3 +
7 files changed, 113 insertions(+), 0 deletions(-)
diff --git a/src/main/java/com/xcong/excoin/modules/documentary/controller/TraderController.java b/src/main/java/com/xcong/excoin/modules/documentary/controller/TraderController.java
index ba1a8f4..cd02124 100644
--- a/src/main/java/com/xcong/excoin/modules/documentary/controller/TraderController.java
+++ b/src/main/java/com/xcong/excoin/modules/documentary/controller/TraderController.java
@@ -10,9 +10,11 @@
import org.springframework.web.bind.annotation.RestController;
import com.xcong.excoin.common.response.Result;
+import com.xcong.excoin.modules.documentary.dto.TradeFollowInfoDto;
import com.xcong.excoin.modules.documentary.dto.TradeOrderInfoDto;
import com.xcong.excoin.modules.documentary.dto.UpdateTradeSetInfoDto;
import com.xcong.excoin.modules.documentary.service.DocumentaryService;
+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;
@@ -75,6 +77,16 @@
}
/**
+ * 交易员设置--我的跟随者
+ */
+ @ApiOperation(value="交易员设置--我的跟随者", notes="交易员设置--我的跟随者")
+ @ApiResponses({@ApiResponse( code = 200, message = "success", response = TradeFollowInfoVo.class)})
+ @GetMapping(value = "/getTradeFollowInfo")
+ public Result getTradeFollowInfo(@RequestBody @Valid TradeFollowInfoDto tradeFollowInfoDto) {
+ return documentaryService.getTradeFollowInfo(tradeFollowInfoDto);
+ }
+
+ /**
* 成为交易员---立即入驻
*/
@ApiOperation(value="成为交易员---立即入驻", notes="成为交易员---立即入驻")
diff --git a/src/main/java/com/xcong/excoin/modules/documentary/dao/FollowFollowerProfitDao.java b/src/main/java/com/xcong/excoin/modules/documentary/dao/FollowFollowerProfitDao.java
index 79a96df..188da7f 100644
--- a/src/main/java/com/xcong/excoin/modules/documentary/dao/FollowFollowerProfitDao.java
+++ b/src/main/java/com/xcong/excoin/modules/documentary/dao/FollowFollowerProfitDao.java
@@ -32,5 +32,8 @@
@Param("memberId")Long memberId);
FollowFollowerProfitEntity selectDocumentaryOrderSetInfoBymemberIdAndTradeId(@Param("memberId")Long memberId, @Param("traderId")Long traderId);
+
+ IPage<FollowFollowerProfitEntity> selectTradeFollowerProfitEntitys(Page<FollowFollowerProfitEntity> page,
+ @Param("memberId")Long memberId);
}
diff --git a/src/main/java/com/xcong/excoin/modules/documentary/dto/TradeFollowInfoDto.java b/src/main/java/com/xcong/excoin/modules/documentary/dto/TradeFollowInfoDto.java
new file mode 100644
index 0000000..264f975
--- /dev/null
+++ b/src/main/java/com/xcong/excoin/modules/documentary/dto/TradeFollowInfoDto.java
@@ -0,0 +1,20 @@
+package com.xcong.excoin.modules.documentary.dto;
+
+import javax.validation.constraints.Min;
+import javax.validation.constraints.NotNull;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+@Data
+@ApiModel(value = "TradeFollowInfoDto", description = "参数接受类")
+public class TradeFollowInfoDto {
+ @NotNull
+ @Min(1)
+ @ApiModelProperty(value = "第几页", example = "1")
+ private int pageNum;
+
+ @NotNull
+ @ApiModelProperty(value = "每页数量", example = "10")
+ private int pageSize;
+}
diff --git a/src/main/java/com/xcong/excoin/modules/documentary/service/DocumentaryService.java b/src/main/java/com/xcong/excoin/modules/documentary/service/DocumentaryService.java
index 659ba24..08f9820 100644
--- a/src/main/java/com/xcong/excoin/modules/documentary/service/DocumentaryService.java
+++ b/src/main/java/com/xcong/excoin/modules/documentary/service/DocumentaryService.java
@@ -11,6 +11,7 @@
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.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;
@@ -60,4 +61,6 @@
public Result getTradeHistoryOrderInfo(@Valid TradeOrderInfoDto tradeOrderInfoDto);
+ public Result getTradeFollowInfo(@Valid TradeFollowInfoDto tradeFollowInfoDto);
+
}
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..afd020e 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,7 @@
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.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 +54,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;
@@ -852,6 +854,44 @@
}
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.setAccount(phone);
+ }else {
+ myFollowTraderInfoVo.setAccount(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);
+ }
diff --git a/src/main/java/com/xcong/excoin/modules/documentary/vo/TradeFollowInfoVo.java b/src/main/java/com/xcong/excoin/modules/documentary/vo/TradeFollowInfoVo.java
new file mode 100644
index 0000000..77291d0
--- /dev/null
+++ b/src/main/java/com/xcong/excoin/modules/documentary/vo/TradeFollowInfoVo.java
@@ -0,0 +1,25 @@
+package com.xcong.excoin.modules.documentary.vo;
+
+import java.math.BigDecimal;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+@Data
+@ApiModel(value = "TradeFollowInfoVo", description = "返回类")
+public class TradeFollowInfoVo {
+
+ @ApiModelProperty(value = "ID")
+ private Long id;
+
+ @ApiModelProperty("名称")
+ private String account;
+
+ @ApiModelProperty(value = "累计跟随本金")
+ private BigDecimal totalPrincipal;
+
+ @ApiModelProperty(value = "累计收益")
+ private BigDecimal totalProfit;
+
+}
diff --git a/src/main/resources/mapper/documentary/FollowFollowerProfitDao.xml b/src/main/resources/mapper/documentary/FollowFollowerProfitDao.xml
index d016055..4ad0d24 100644
--- a/src/main/resources/mapper/documentary/FollowFollowerProfitDao.xml
+++ b/src/main/resources/mapper/documentary/FollowFollowerProfitDao.xml
@@ -29,6 +29,16 @@
and is_follow = 1
order by create_time desc
</select>
+ <select id="selectTradeFollowerProfitEntitys" resultType="com.xcong.excoin.modules.documentary.entity.FollowFollowerProfitEntity">
+ SELECT
+ *
+ FROM
+ follow_follower_profit
+ WHERE
+ trade_member_id = #{memberId}
+ and is_follow = 1
+ order by create_time desc
+ </select>
<select id="getMyFollowOrderHistoryRecords" resultType="com.xcong.excoin.modules.contract.entity.ContractOrderEntity">
SELECT
--
Gitblit v1.9.1