From 69fd409bbd0cdce5b376be46e7ca5828568607c9 Mon Sep 17 00:00:00 2001
From: xiaoyong931011 <15274802129@163.com>
Date: Wed, 29 Jul 2020 12:25:52 +0800
Subject: [PATCH] 20200729  代码提交

---
 src/main/java/com/xcong/excoin/modules/documentary/dao/FollowTraderInfoDao.java               |   12 ++
 src/main/java/com/xcong/excoin/modules/documentary/dao/FollowTraderProfitInfoDao.java         |    8 +
 src/main/java/com/xcong/excoin/modules/documentary/vo/FollowTraderProfitInfoListVo.java       |   17 +++
 src/main/resources/mapper/documentary/FollowTraderProfitInfoDao.xml                           |   11 ++
 src/main/java/com/xcong/excoin/modules/documentary/controller/DocumentaryController.java      |   23 ++++
 src/main/java/com/xcong/excoin/modules/documentary/dao/FollowTraderProfitDetailDao.java       |    8 +
 src/main/java/com/xcong/excoin/modules/documentary/entity/FollowTraderInfoEntity.java         |   63 ++++++++++++
 src/main/java/com/xcong/excoin/modules/documentary/service/DocumentaryService.java            |    5 +
 src/main/java/com/xcong/excoin/modules/documentary/service/impl/DocumentaryServiceImpl.java   |   48 +++++++++
 src/main/resources/mapper/documentary/FollowTraderInfoDao.xml                                 |    9 +
 src/main/java/com/xcong/excoin/modules/documentary/vo/FollowTraderProfitInfoVo.java           |   72 ++++++++++++++
 src/main/java/com/xcong/excoin/modules/documentary/entity/FollowTraderProfitDetailEntity.java |   20 ++++
 12 files changed, 296 insertions(+), 0 deletions(-)

diff --git a/src/main/java/com/xcong/excoin/modules/documentary/controller/DocumentaryController.java b/src/main/java/com/xcong/excoin/modules/documentary/controller/DocumentaryController.java
index 28ec4f5..d81709b 100644
--- a/src/main/java/com/xcong/excoin/modules/documentary/controller/DocumentaryController.java
+++ b/src/main/java/com/xcong/excoin/modules/documentary/controller/DocumentaryController.java
@@ -1,12 +1,16 @@
 package com.xcong.excoin.modules.documentary.controller;
 
+import javax.validation.Valid;
+
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
 import com.xcong.excoin.common.response.Result;
+import com.xcong.excoin.modules.coin.parameter.dto.RecordsPageDto;
 import com.xcong.excoin.modules.documentary.service.DocumentaryService;
 import com.xcong.excoin.modules.documentary.vo.MemberIsTradeVo;
 import com.xcong.excoin.modules.member.parameter.vo.AppVersionListVo;
@@ -35,5 +39,24 @@
 	public Result  getMemberIsTradeInfo() {
 		return documentaryService.getMemberIsTradeInfo();
 	}
+	
+	/**
+	 *  交易员收益信息列表
+	 */
+	@ApiOperation(value="getFollowTraderProfitInfo", notes="交易员收益信息列表")
+	@ApiResponses({@ApiResponse( code = 200, message = "success", response = MemberIsTradeVo.class)})
+	@GetMapping(value = "/getFollowTraderProfitInfo")
+	public Result  getFollowTraderProfitInfo(@RequestBody @Valid RecordsPageDto recordsPageDto) {
+		return documentaryService.getFollowTraderProfitInfo(recordsPageDto);
+	}
+	
+	
+	
+	
+	
+	
+	
+	
+	
 
 }
diff --git a/src/main/java/com/xcong/excoin/modules/documentary/dao/FollowTraderInfoDao.java b/src/main/java/com/xcong/excoin/modules/documentary/dao/FollowTraderInfoDao.java
new file mode 100644
index 0000000..2e452cd
--- /dev/null
+++ b/src/main/java/com/xcong/excoin/modules/documentary/dao/FollowTraderInfoDao.java
@@ -0,0 +1,12 @@
+package com.xcong.excoin.modules.documentary.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.xcong.excoin.modules.documentary.entity.FollowTraderInfoEntity;
+
+import io.lettuce.core.dynamic.annotation.Param;
+
+public interface FollowTraderInfoDao extends BaseMapper<FollowTraderInfoEntity> {
+
+	FollowTraderInfoEntity selectFollowTraderInfoEntityBytreaderId(@Param("traderId")Long traderId);
+
+}
diff --git a/src/main/java/com/xcong/excoin/modules/documentary/dao/FollowTraderProfitDetailDao.java b/src/main/java/com/xcong/excoin/modules/documentary/dao/FollowTraderProfitDetailDao.java
new file mode 100644
index 0000000..ab01a2a
--- /dev/null
+++ b/src/main/java/com/xcong/excoin/modules/documentary/dao/FollowTraderProfitDetailDao.java
@@ -0,0 +1,8 @@
+package com.xcong.excoin.modules.documentary.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.xcong.excoin.modules.documentary.entity.FollowTraderProfitDetailEntity;
+
+public interface FollowTraderProfitDetailDao extends BaseMapper<FollowTraderProfitDetailEntity> {
+
+}
diff --git a/src/main/java/com/xcong/excoin/modules/documentary/dao/FollowTraderProfitInfoDao.java b/src/main/java/com/xcong/excoin/modules/documentary/dao/FollowTraderProfitInfoDao.java
index d6c72c5..814aff9 100644
--- a/src/main/java/com/xcong/excoin/modules/documentary/dao/FollowTraderProfitInfoDao.java
+++ b/src/main/java/com/xcong/excoin/modules/documentary/dao/FollowTraderProfitInfoDao.java
@@ -1,8 +1,16 @@
 package com.xcong.excoin.modules.documentary.dao;
 
+import org.apache.ibatis.annotations.Param;
+
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.xcong.excoin.modules.documentary.entity.FollowTraderProfitInfoEntity;
+import com.xcong.excoin.modules.documentary.vo.FollowTraderProfitInfoVo;
 
 public interface FollowTraderProfitInfoDao extends BaseMapper<FollowTraderProfitInfoEntity> {
+	
+	IPage<FollowTraderProfitInfoVo> selectFollowTraderProfitInfoEntity(Page<FollowTraderProfitInfoVo> page,
+			@Param("record")FollowTraderProfitInfoEntity memberAccountMoneyChange);
 
 }
diff --git a/src/main/java/com/xcong/excoin/modules/documentary/entity/FollowTraderInfoEntity.java b/src/main/java/com/xcong/excoin/modules/documentary/entity/FollowTraderInfoEntity.java
new file mode 100644
index 0000000..65fc9ba
--- /dev/null
+++ b/src/main/java/com/xcong/excoin/modules/documentary/entity/FollowTraderInfoEntity.java
@@ -0,0 +1,63 @@
+package com.xcong.excoin.modules.documentary.entity;
+
+import java.math.BigDecimal;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.xcong.excoin.common.system.base.BaseEntity;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * 交易员信息表
+ */
+@EqualsAndHashCode(callSuper = true)
+@Data
+@TableName("follow_trader_info")
+public class FollowTraderInfoEntity extends BaseEntity{
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = 1L;
+	 /**
+     * 会员ID
+     */
+    private Long memberId;
+    /**
+     * 头像
+     */
+    private String avatar;
+    /**
+     * 名称
+     */
+    private String nickname;
+    /**
+     * 宣言
+     */
+    private String declaration;
+    /**
+     * 是否满员 1-是2-否
+     */
+    private Integer isAll;
+    public static final Integer IS_ALL_Y = 1;
+    public static final Integer IS_ALL_N = 2;
+    /**
+     * 利润
+     */
+    private BigDecimal profitRatio;
+    /**
+     * 审核状态 1通过2不通过3待审核
+     */
+    private Integer verifyStatus;
+    public static final Integer VERIFYSTATUS_Y = 1;
+    public static final Integer VERIFYSTATUS_ING = 2;
+    public static final Integer VERIFYSTATUS_N = 3;
+    /**
+     * 是否开启带单 1是2否
+     */
+    private Integer isOpen;
+    public static final Integer ISOPEN_Y = 1;
+    public static final Integer ISOPEN_N = 2;
+    
+
+}
diff --git a/src/main/java/com/xcong/excoin/modules/documentary/entity/FollowTraderProfitDetailEntity.java b/src/main/java/com/xcong/excoin/modules/documentary/entity/FollowTraderProfitDetailEntity.java
new file mode 100644
index 0000000..a949057
--- /dev/null
+++ b/src/main/java/com/xcong/excoin/modules/documentary/entity/FollowTraderProfitDetailEntity.java
@@ -0,0 +1,20 @@
+package com.xcong.excoin.modules.documentary.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.xcong.excoin.common.system.base.BaseEntity;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * 交易员收益返利明细
+ */
+@EqualsAndHashCode(callSuper = true)
+@Data
+@TableName("follow_trader_profit_detail")
+public class FollowTraderProfitDetailEntity extends BaseEntity{/**
+	 * 
+	 */
+	private static final long serialVersionUID = 1L;
+
+}
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 d66d8ef..ac019f8 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
@@ -1,11 +1,16 @@
 package com.xcong.excoin.modules.documentary.service;
 
+import javax.validation.Valid;
+
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.xcong.excoin.common.response.Result;
+import com.xcong.excoin.modules.coin.parameter.dto.RecordsPageDto;
 import com.xcong.excoin.modules.documentary.entity.FollowTraderProfitInfoEntity;
 
 public interface DocumentaryService extends IService<FollowTraderProfitInfoEntity> {
 
 	public Result getMemberIsTradeInfo();
 
+	public Result getFollowTraderProfitInfo(@Valid RecordsPageDto recordsPageDto);
+
 }
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 16bf169..c3b99c4 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
@@ -1,19 +1,34 @@
 package com.xcong.excoin.modules.documentary.service.impl;
 
+import java.util.List;
+
 import javax.annotation.Resource;
+import javax.validation.Valid;
 
 import org.springframework.stereotype.Service;
 
+import com.baomidou.mybatisplus.core.conditions.Wrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.xcong.excoin.common.LoginUserUtils;
 import com.xcong.excoin.common.response.Result;
+import com.xcong.excoin.modules.coin.entity.MemberAccountMoneyChange;
+import com.xcong.excoin.modules.coin.entity.OrderCoinsDealEntity;
+import com.xcong.excoin.modules.coin.parameter.dto.RecordsPageDto;
+import com.xcong.excoin.modules.documentary.dao.FollowTraderInfoDao;
+import com.xcong.excoin.modules.documentary.dao.FollowTraderProfitDetailDao;
 import com.xcong.excoin.modules.documentary.dao.FollowTraderProfitInfoDao;
+import com.xcong.excoin.modules.documentary.entity.FollowTraderInfoEntity;
 import com.xcong.excoin.modules.documentary.entity.FollowTraderProfitInfoEntity;
 import com.xcong.excoin.modules.documentary.service.DocumentaryService;
+import com.xcong.excoin.modules.documentary.vo.FollowTraderProfitInfoVo;
 import com.xcong.excoin.modules.documentary.vo.MemberIsTradeVo;
 import com.xcong.excoin.modules.member.dao.MemberDao;
 import com.xcong.excoin.modules.member.entity.MemberEntity;
 
+import cn.hutool.core.collection.CollUtil;
 import lombok.extern.slf4j.Slf4j;
 
 @Slf4j
@@ -22,6 +37,12 @@
 
 	@Resource
     private MemberDao memberDao;
+	@Resource
+	private FollowTraderInfoDao followTraderInfoDao;
+	@Resource
+	private FollowTraderProfitDetailDao followTraderProfitDetailDao;
+	@Resource
+	private FollowTraderProfitInfoDao followTraderProfitInfoDao;
 	
 	@Override
 	public Result getMemberIsTradeInfo() {
@@ -39,4 +60,31 @@
         return Result.ok(memberIsTradeVo);
 	}
 
+	@Override
+	public Result getFollowTraderProfitInfo(@Valid RecordsPageDto recordsPageDto) {
+        
+        Page<FollowTraderProfitInfoVo> page = new Page<>(recordsPageDto.getPageNum(), recordsPageDto.getPageSize());
+        FollowTraderProfitInfoEntity memberAccountMoneyChange = new FollowTraderProfitInfoEntity();
+        IPage<FollowTraderProfitInfoVo> FollowTraderProfitInfoList = followTraderProfitInfoDao.selectFollowTraderProfitInfoEntity(page, memberAccountMoneyChange);
+        
+        List<FollowTraderProfitInfoVo> FollowTraderProfitInfoVoList = FollowTraderProfitInfoList.getRecords();
+        if(CollUtil.isNotEmpty(FollowTraderProfitInfoVoList)) {
+        	for(FollowTraderProfitInfoVo FollowTraderProfitInfoVo : FollowTraderProfitInfoVoList) {
+        		Long traderId = FollowTraderProfitInfoVo.getTraderId();
+        		FollowTraderInfoEntity followTraderInfoEntity = followTraderInfoDao.selectFollowTraderInfoEntityBytreaderId(traderId);
+        		String avatar = followTraderInfoEntity.getAvatar();
+        		FollowTraderProfitInfoVo.setAvatar(avatar);
+        		String nickname = followTraderInfoEntity.getNickname();
+        		FollowTraderProfitInfoVo.setNickname(nickname);
+        		String declaration = followTraderInfoEntity.getDeclaration();
+        		FollowTraderProfitInfoVo.setDeclaration(declaration);
+        		Integer isAll = followTraderInfoEntity.getIsAll();
+        		FollowTraderProfitInfoVo.setIsAll(isAll);
+        		Integer isOpen = followTraderInfoEntity.getIsOpen();
+        		FollowTraderProfitInfoVo.setIsOpen(isOpen);
+        	}
+        }
+		return Result.ok(FollowTraderProfitInfoVoList);
+	}
+
 }
diff --git a/src/main/java/com/xcong/excoin/modules/documentary/vo/FollowTraderProfitInfoListVo.java b/src/main/java/com/xcong/excoin/modules/documentary/vo/FollowTraderProfitInfoListVo.java
new file mode 100644
index 0000000..d93cfa4
--- /dev/null
+++ b/src/main/java/com/xcong/excoin/modules/documentary/vo/FollowTraderProfitInfoListVo.java
@@ -0,0 +1,17 @@
+package com.xcong.excoin.modules.documentary.vo;
+
+import java.util.List;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+@Data
+@ApiModel(value = "FollowTraderProfitInfoListVo", description = "交易员列表")
+public class FollowTraderProfitInfoListVo {
+	
+	@ApiModelProperty(value = "交易员信息")
+	private List<FollowTraderProfitInfoVo> followTraderProfitInfoVo;
+
+
+}
diff --git a/src/main/java/com/xcong/excoin/modules/documentary/vo/FollowTraderProfitInfoVo.java b/src/main/java/com/xcong/excoin/modules/documentary/vo/FollowTraderProfitInfoVo.java
new file mode 100644
index 0000000..44116be
--- /dev/null
+++ b/src/main/java/com/xcong/excoin/modules/documentary/vo/FollowTraderProfitInfoVo.java
@@ -0,0 +1,72 @@
+package com.xcong.excoin.modules.documentary.vo;
+
+import java.math.BigDecimal;
+
+import com.xcong.excoin.common.system.base.BaseEntity;
+
+import io.swagger.annotations.ApiModel;
+import lombok.Data;
+
+@Data
+@ApiModel(value = "FollowTraderProfitInfoVo", description = "交易员信息")
+public class FollowTraderProfitInfoVo extends BaseEntity{
+	
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = 1L;
+	/**
+     * 交易员ID
+     */
+    private Long traderId;
+    /**
+     * 会员ID
+     */
+    private Long memberId;
+    /**
+     * 累计收益率
+     */
+    private BigDecimal totalProfitRatio;
+    /**
+     * 带单总收益
+     */
+    private BigDecimal totalProfit;
+    /**
+     * 跟随者总收益
+     */
+    private BigDecimal followerTotalProfit;
+    /**
+     * 胜率
+     */
+    private BigDecimal winRate;
+    /**
+     * 累计跟随人数
+     */
+    private BigDecimal totalFollowerCnt;
+    /**
+     * 交易笔数
+     */
+    private BigDecimal totalOrderCnt;
+    
+    /**
+     * 头像
+     */
+    private String avatar;
+    /**
+     * 名称
+     */
+    private String nickname;
+    /**
+     * 宣言
+     */
+    private String declaration;
+    /**
+     * 是否满员 1-是2-否
+     */
+    private Integer isAll;
+    /**
+     * 是否开启带单 1是2否
+     */
+    private Integer isOpen;
+
+}
diff --git a/src/main/resources/mapper/documentary/FollowTraderInfoDao.xml b/src/main/resources/mapper/documentary/FollowTraderInfoDao.xml
new file mode 100644
index 0000000..268e65b
--- /dev/null
+++ b/src/main/resources/mapper/documentary/FollowTraderInfoDao.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.xcong.excoin.modules.documentary.dao.FollowTraderInfoDao">
+	
+	<select id="selectFollowTraderInfoEntityBytreaderId" resultType="com.xcong.excoin.modules.documentary.entity.FollowTraderInfoEntity">
+		select * from follow_trader_info where id = #{traderId}
+    </select>
+    
+</mapper>
\ No newline at end of file
diff --git a/src/main/resources/mapper/documentary/FollowTraderProfitInfoDao.xml b/src/main/resources/mapper/documentary/FollowTraderProfitInfoDao.xml
new file mode 100644
index 0000000..449a3c1
--- /dev/null
+++ b/src/main/resources/mapper/documentary/FollowTraderProfitInfoDao.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.xcong.excoin.modules.documentary.dao.FollowTraderProfitInfoDao">
+	
+	<select id="selectFollowTraderProfitInfoEntity" resultType="com.xcong.excoin.modules.documentary.entity.FollowTraderProfitInfoEntity">
+		select * from follow_trader_profit_info 
+		
+        order by id desc
+    </select>
+    
+</mapper>
\ No newline at end of file

--
Gitblit v1.9.1