xiaoyong931011
2020-07-29 07f76d11dc6304a362cdc5ff907047a6e9e45185
20200729  代码提交
4 files added
1 files deleted
11 files modified
331 ■■■■ changed files
src/main/java/com/xcong/excoin/modules/documentary/controller/DocumentaryController.java 25 ●●●●● patch | view | raw | blame | history
src/main/java/com/xcong/excoin/modules/documentary/dao/FollowFollowerNoticeDao.java 5 ●●●● patch | view | raw | blame | history
src/main/java/com/xcong/excoin/modules/documentary/dao/FollowFollowerOrderRelationDao.java 5 ●●●● patch | view | raw | blame | history
src/main/java/com/xcong/excoin/modules/documentary/dao/FollowFollowerProfitDao.java 13 ●●●●● patch | view | raw | blame | history
src/main/java/com/xcong/excoin/modules/documentary/dao/FollowFollowerSettingDao.java 5 ●●●● patch | view | raw | blame | history
src/main/java/com/xcong/excoin/modules/documentary/dao/FollowTraderProfitInfoDao.java 4 ●●●● patch | view | raw | blame | history
src/main/java/com/xcong/excoin/modules/documentary/dto/FollowRecordsDto.java 27 ●●●●● patch | view | raw | blame | history
src/main/java/com/xcong/excoin/modules/documentary/service/DocumentaryService.java 5 ●●●● patch | view | raw | blame | history
src/main/java/com/xcong/excoin/modules/documentary/service/impl/DocumentaryServiceImpl.java 66 ●●●● patch | view | raw | blame | history
src/main/java/com/xcong/excoin/modules/documentary/vo/FollowRecordsVo.java 56 ●●●●● patch | view | raw | blame | history
src/main/java/com/xcong/excoin/modules/documentary/vo/FollowTraderProfitInfoListVo.java 17 ●●●●● patch | view | raw | blame | history
src/main/java/com/xcong/excoin/modules/documentary/vo/FollowTraderProfitInfoVo.java 14 ●●●●● patch | view | raw | blame | history
src/main/java/com/xcong/excoin/modules/documentary/vo/HistoryOrderRecordsVo.java 45 ●●●●● patch | view | raw | blame | history
src/main/resources/mapper/documentary/FollowFollowerProfitDao.xml 16 ●●●●● patch | view | raw | blame | history
src/main/resources/mapper/documentary/FollowTraderProfitDetailDao.xml 6 ●●●●● patch | view | raw | blame | history
src/main/resources/mapper/documentary/FollowTraderProfitInfoDao.xml 22 ●●●●● patch | view | raw | blame | history
src/main/java/com/xcong/excoin/modules/documentary/controller/DocumentaryController.java
@@ -1,11 +1,9 @@
package com.xcong.excoin.modules.documentary.controller;
import javax.annotation.Resource;
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.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@@ -13,14 +11,13 @@
import com.xcong.excoin.common.response.Result;
import com.xcong.excoin.modules.coin.parameter.dto.RecordsPageDto;
import com.xcong.excoin.modules.coin.parameter.vo.MemberAgentIntoInfoVo;
import com.xcong.excoin.modules.documentary.dto.FollowRecordsDto;
import com.xcong.excoin.modules.documentary.dto.HistoryOrderRecordsDto;
import com.xcong.excoin.modules.documentary.service.DocumentaryService;
import com.xcong.excoin.modules.documentary.vo.FollowRecordsVo;
import com.xcong.excoin.modules.documentary.vo.MemberIsTradeVo;
import com.xcong.excoin.modules.member.parameter.vo.AppVersionListVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
@@ -32,7 +29,7 @@
@Api(value = "MemberQuickBuySaleController", tags = "跟单")
public class DocumentaryController {
    
    @Autowired
    @Resource
    DocumentaryService documentaryService;
    
    /**
@@ -63,9 +60,21 @@
    @ApiResponses({@ApiResponse( code = 200, message = "success", response = MemberAgentIntoInfoVo.class)})
    @GetMapping(value = "/getHistoryOrderRecords")
    public Result  getHistoryOrderRecords(@RequestBody @Valid HistoryOrderRecordsDto historyOrderRecordsDto) {
        return documentaryService.getWalletAgentIntoRecords(historyOrderRecordsDto);
        return documentaryService.getHistoryOrderRecords(historyOrderRecordsDto);
    }
    
    /**
     *  跟随者
     * @return
     */
    @ApiOperation(value="getFollowRecords", notes="跟随者")
    @ApiResponses({@ApiResponse( code = 200, message = "success", response = FollowRecordsVo.class)})
    @GetMapping(value = "/getFollowRecords")
    public Result  getFollowRecords(@RequestBody @Valid FollowRecordsDto followRecordsDto) {
        return documentaryService.getFollowRecords(followRecordsDto);
    }
    
    
    
src/main/java/com/xcong/excoin/modules/documentary/dao/FollowFollowerNoticeDao.java
@@ -1,7 +1,10 @@
package com.xcong.excoin.modules.documentary.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.xcong.excoin.modules.documentary.entity.FollowFollowerNoticeEntity;
/**
 * @author helius
 */
public interface FollowFollowerNoticeDao {
public interface FollowFollowerNoticeDao extends BaseMapper<FollowFollowerNoticeEntity> {
}
src/main/java/com/xcong/excoin/modules/documentary/dao/FollowFollowerOrderRelationDao.java
@@ -1,7 +1,10 @@
package com.xcong.excoin.modules.documentary.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.xcong.excoin.modules.documentary.entity.FollowFollowerOrderRelationEntity;
/**
 * @author helius
 */
public interface FollowFollowerOrderRelationDao {
public interface FollowFollowerOrderRelationDao extends BaseMapper<FollowFollowerOrderRelationEntity> {
}
src/main/java/com/xcong/excoin/modules/documentary/dao/FollowFollowerProfitDao.java
@@ -1,7 +1,18 @@
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.FollowFollowerProfitEntity;
import com.xcong.excoin.modules.documentary.vo.FollowRecordsVo;
/**
 * @author helius
 */
public interface FollowFollowerProfitDao {
public interface FollowFollowerProfitDao extends BaseMapper<FollowFollowerProfitEntity> {
    IPage<FollowRecordsVo> selectFollowRecords(Page<FollowRecordsVo> page, @Param("tradeMemberId")Long tradeMemberId);
}
src/main/java/com/xcong/excoin/modules/documentary/dao/FollowFollowerSettingDao.java
@@ -1,7 +1,10 @@
package com.xcong.excoin.modules.documentary.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.xcong.excoin.modules.documentary.entity.FollowFollowerSettingEntity;
/**
 * @author helius
 */
public interface FollowFollowerSettingDao {
public interface FollowFollowerSettingDao extends BaseMapper<FollowFollowerSettingEntity> {
}
src/main/java/com/xcong/excoin/modules/documentary/dao/FollowTraderProfitInfoDao.java
@@ -7,10 +7,14 @@
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.xcong.excoin.modules.documentary.entity.FollowTraderProfitInfoEntity;
import com.xcong.excoin.modules.documentary.vo.FollowTraderProfitInfoVo;
import com.xcong.excoin.modules.documentary.vo.HistoryOrderRecordsVo;
public interface FollowTraderProfitInfoDao extends BaseMapper<FollowTraderProfitInfoEntity> {
    
    IPage<FollowTraderProfitInfoVo> selectFollowTraderProfitInfoEntity(Page<FollowTraderProfitInfoVo> page,
            @Param("record")FollowTraderProfitInfoEntity memberAccountMoneyChange);
    IPage<HistoryOrderRecordsVo> selectHistoryOrderRecords(Page<HistoryOrderRecordsVo> page,
            @Param("memberId")Long memberId);
}
src/main/java/com/xcong/excoin/modules/documentary/dto/FollowRecordsDto.java
New file
@@ -0,0 +1,27 @@
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 = "FollowRecordsDto", description = "跟随者参数接受类")
public class FollowRecordsDto {
    @NotNull
    @Min(1)
    @ApiModelProperty(value = "第几页", example = "1")
    private int pageNum;
    @NotNull
    @ApiModelProperty(value = "每页数量", example = "10")
    private int pageSize;
    @NotNull
    @ApiModelProperty(value = "会员ID", example = "12543")
    private Long tradeMemberId;
}
src/main/java/com/xcong/excoin/modules/documentary/service/DocumentaryService.java
@@ -5,6 +5,7 @@
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.dto.FollowRecordsDto;
import com.xcong.excoin.modules.documentary.dto.HistoryOrderRecordsDto;
import com.xcong.excoin.modules.documentary.entity.FollowTraderProfitInfoEntity;
@@ -14,6 +15,8 @@
    public Result getFollowTraderProfitInfo(@Valid RecordsPageDto recordsPageDto);
    public Result getWalletAgentIntoRecords(@Valid HistoryOrderRecordsDto historyOrderRecordsDto);
    public Result getHistoryOrderRecords(@Valid HistoryOrderRecordsDto historyOrderRecordsDto);
    public Result getFollowRecords(@Valid FollowRecordsDto followRecordsDto);
}
src/main/java/com/xcong/excoin/modules/documentary/service/impl/DocumentaryServiceImpl.java
@@ -7,24 +7,25 @@
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.dao.OrderCoinsDao;
import com.xcong.excoin.modules.coin.parameter.dto.RecordsPageDto;
import com.xcong.excoin.modules.documentary.dao.FollowFollowerProfitDao;
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.dto.FollowRecordsDto;
import com.xcong.excoin.modules.documentary.dto.HistoryOrderRecordsDto;
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.FollowRecordsVo;
import com.xcong.excoin.modules.documentary.vo.FollowTraderProfitInfoVo;
import com.xcong.excoin.modules.documentary.vo.HistoryOrderRecordsVo;
import com.xcong.excoin.modules.documentary.vo.MemberIsTradeVo;
import com.xcong.excoin.modules.member.dao.MemberDao;
import com.xcong.excoin.modules.member.entity.MemberEntity;
@@ -44,6 +45,10 @@
    private FollowTraderProfitDetailDao followTraderProfitDetailDao;
    @Resource
    private FollowTraderProfitInfoDao followTraderProfitInfoDao;
    @Resource
    private FollowFollowerProfitDao followFollowerProfitDao;
    @Resource
    private OrderCoinsDao orderCoinsDao;
    
    @Override
    public Result getMemberIsTradeInfo() {
@@ -66,11 +71,11 @@
        
        Page<FollowTraderProfitInfoVo> page = new Page<>(recordsPageDto.getPageNum(), recordsPageDto.getPageSize());
        FollowTraderProfitInfoEntity memberAccountMoneyChange = new FollowTraderProfitInfoEntity();
        IPage<FollowTraderProfitInfoVo> FollowTraderProfitInfoList = followTraderProfitInfoDao.selectFollowTraderProfitInfoEntity(page, memberAccountMoneyChange);
        IPage<FollowTraderProfitInfoVo> followTraderProfitInfoList = followTraderProfitInfoDao.selectFollowTraderProfitInfoEntity(page, memberAccountMoneyChange);
        
        List<FollowTraderProfitInfoVo> FollowTraderProfitInfoVoList = FollowTraderProfitInfoList.getRecords();
        if(CollUtil.isNotEmpty(FollowTraderProfitInfoVoList)) {
            for(FollowTraderProfitInfoVo FollowTraderProfitInfoVo : FollowTraderProfitInfoVoList) {
        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();
@@ -85,13 +90,50 @@
                FollowTraderProfitInfoVo.setIsOpen(isOpen);
            }
        }
        return Result.ok(FollowTraderProfitInfoVoList);
        return Result.ok(followTraderProfitInfoVoList);
    }
    @Override
    public Result getWalletAgentIntoRecords(@Valid HistoryOrderRecordsDto historyOrderRecordsDto) {
        // TODO Auto-generated method stub
        return null;
    public Result getHistoryOrderRecords(@Valid HistoryOrderRecordsDto historyOrderRecordsDto) {
        Page<HistoryOrderRecordsVo> page = new Page<>(historyOrderRecordsDto.getPageNum(), historyOrderRecordsDto.getPageSize());
        IPage<HistoryOrderRecordsVo> historyOrderRecordsVoList = followTraderProfitInfoDao.selectHistoryOrderRecords(page, historyOrderRecordsDto.getMemberId());
        return Result.ok(historyOrderRecordsVoList);
    }
    @Override
    public Result getFollowRecords(@Valid FollowRecordsDto followRecordsDto) {
        Page<FollowRecordsVo> page = new Page<>(followRecordsDto.getPageNum(), followRecordsDto.getPageSize());
        IPage<FollowRecordsVo> historyOrderRecordsVoList = followFollowerProfitDao.selectFollowRecords(page, followRecordsDto.getTradeMemberId());
        return Result.ok(historyOrderRecordsVoList);
    }
}
src/main/java/com/xcong/excoin/modules/documentary/vo/FollowRecordsVo.java
New file
@@ -0,0 +1,56 @@
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 io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel(value = "FollowRecordsVo", description = "跟随者列表")
public class FollowRecordsVo extends BaseEntity{
    /**
     *
     */
    private static final long serialVersionUID = 1L;
    public static final Integer IS_FOLLOW_Y = 1;
    public static final Integer IS_FOLLOW_N = 2;
    /**
     * 主键ID
     */
    @ApiModelProperty(value = "主键ID")
    private Long id;
    /**
     * 跟随者ID
     */
    @ApiModelProperty(value = "跟随者ID")
    private Long memberId;
    /**
     * 交易员ID
     */
    @ApiModelProperty(value = "交易员ID")
    private Long tradeId;
    /**
     * 交易员会员ID
     */
    @ApiModelProperty(value = "交易员会员ID")
    private Long tradeMemberId;
    /**
     * 累计跟随本金
     */
    @ApiModelProperty(value = "累计跟随本金")
    private BigDecimal totalPrincipal;
    /**
     * 累计收益
     */
    @ApiModelProperty(value = "累计收益")
    private BigDecimal totalProfit;
    /**
     * 是否跟随 1-是 2-否
     */
    @ApiModelProperty(value = "是否跟随 1-是 2-否")
    private Integer isFollow;
}
src/main/java/com/xcong/excoin/modules/documentary/vo/FollowTraderProfitInfoListVo.java
File was deleted
src/main/java/com/xcong/excoin/modules/documentary/vo/FollowTraderProfitInfoVo.java
@@ -5,6 +5,7 @@
import com.xcong.excoin.common.system.base.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@@ -18,55 +19,68 @@
    /**
     * 交易员ID
     */
    @ApiModelProperty("交易员ID")
    private Long traderId;
    /**
     * 会员ID
     */
    @ApiModelProperty("会员ID")
    private Long memberId;
    /**
     * 累计收益率
     */
    @ApiModelProperty("累计收益率")
    private BigDecimal totalProfitRatio;
    /**
     * 带单总收益
     */
    @ApiModelProperty("带单总收益")
    private BigDecimal totalProfit;
    /**
     * 跟随者总收益
     */
    @ApiModelProperty("跟随者总收益")
    private BigDecimal followerTotalProfit;
    /**
     * 胜率
     */
    @ApiModelProperty("胜率")
    private BigDecimal winRate;
    /**
     * 累计跟随人数
     */
    @ApiModelProperty("累计跟随人数")
    private BigDecimal totalFollowerCnt;
    /**
     * 交易笔数
     */
    @ApiModelProperty("交易笔数")
    private BigDecimal totalOrderCnt;
    
    /**
     * 头像
     */
    @ApiModelProperty("头像")
    private String avatar;
    /**
     * 名称
     */
    @ApiModelProperty("名称")
    private String nickname;
    /**
     * 宣言
     */
    @ApiModelProperty("宣言")
    private String declaration;
    /**
     * 是否满员 1-是2-否
     */
    @ApiModelProperty("是否满员 1-是2-否")
    private Integer isAll;
    /**
     * 是否开启带单 1是2否
     */
    @ApiModelProperty("是否开启带单 1是2否")
    private Integer isOpen;
}
src/main/java/com/xcong/excoin/modules/documentary/vo/HistoryOrderRecordsVo.java
New file
@@ -0,0 +1,45 @@
package com.xcong.excoin.modules.documentary.vo;
import java.math.BigDecimal;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel(value = "HistoryOrderRecordsVo", description = "历史带单")
public class HistoryOrderRecordsVo {
    @ApiModelProperty("币种")
    private String symbol;
    @ApiModelProperty("订单类型 -1撤单,1开多,2开空,3平多,4平空")
    private int orderType;
    @ApiModelProperty("杠杆")
    private int leverRatio;
    @ApiModelProperty("开仓价")
    private BigDecimal openingPrice;
    @ApiModelProperty("平仓价")
    private BigDecimal closingPrice;
    @ApiModelProperty("盈亏比例")
    private BigDecimal rewardRatio;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @ApiModelProperty("开仓时间")
    private Date openingTime;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @ApiModelProperty("平仓时间")
    private Date closingTime;
    @ApiModelProperty("订单编号")
    private String orderNo;
}
src/main/resources/mapper/documentary/FollowFollowerProfitDao.xml
@@ -2,4 +2,20 @@
<!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.FollowFollowerProfitDao">
    <select id="selectFollowRecords" resultType="com.xcong.excoin.modules.documentary.vo.FollowRecordsVo">
        SELECT
            id,
            member_id memberId,
            trade_id tradeId,
            trade_member_id tradeMemberId,
            total_principal totalPrincipal,
            is_follow isFollow,
            total_profit totalProfit
        FROM
            follow_follower_profit
        WHERE
            trade_member_id = #{tradeMemberId}
        order by create_time desc
    </select>
</mapper>
src/main/resources/mapper/documentary/FollowTraderProfitDetailDao.xml
New file
@@ -0,0 +1,6 @@
<?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.FollowTraderProfitDetailDao">
</mapper>
src/main/resources/mapper/documentary/FollowTraderProfitInfoDao.xml
@@ -4,8 +4,28 @@
    
    <select id="selectFollowTraderProfitInfoEntity" resultType="com.xcong.excoin.modules.documentary.entity.FollowTraderProfitInfoEntity">
        select * from follow_trader_profit_info 
        order by id desc
    </select>
    
    <select id="selectHistoryOrderRecords" resultType="com.xcong.excoin.modules.documentary.vo.HistoryOrderRecordsVo">
        SELECT
            symbol,
            order_type orderType,
            lever_ratio leverRatio,
            opening_price openingPrice,
            closing_price closingPrice,
            reward_ratio rewardRatio,
            opening_time openingTime,
            closing_time closingTime,
            order_no orderNo
        FROM
            contract_order
        WHERE
            member_id = #{memberId}
            and contract_type = 2
            and order_type in (3,4)
            and closing_type not in (4,5)
        order by opening_time desc
    </select>
</mapper>