From 07214840bab55342a8c4a220f7a5d190e0fc591b Mon Sep 17 00:00:00 2001 From: xiaoyong931011 <15274802129@163.com> Date: Tue, 04 Aug 2020 11:02:12 +0800 Subject: [PATCH] 20200804 --- src/main/java/com/xcong/excoin/modules/member/entity/MemberEntity.java | 5 + src/main/resources/mapper/modules/FollowTraderProfitInfoMapper.xml | 6 ++ src/main/java/com/xcong/excoin/modules/documentary/controller/DocumentaryController.java | 2 src/main/java/com/xcong/excoin/modules/documentary/entity/FollowTraderInfoEntity.java | 2 src/main/java/com/xcong/excoin/modules/documentary/service/impl/DocumentaryServiceImpl.java | 47 +++++++++++++++ src/main/resources/templates/febs/views/modules/documentary/traderDetail.html | 2 src/main/java/com/xcong/excoin/modules/documentary/entity/FollowTraderProfitInfoEntity.java | 52 +++++++++++++++++ src/main/java/com/xcong/excoin/modules/documentary/mapper/FollowTraderProfitInfoMapper.java | 8 ++ 8 files changed, 120 insertions(+), 4 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 5a8bc0d..6a407be 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 @@ -45,7 +45,7 @@ * @return */ @PostMapping("traderConfirm") - @ControllerEndpoint(operation = "实名认证---确认", exceptionMessage = "认证失败") + @ControllerEndpoint(operation = "交易员申请---确认", exceptionMessage = "认证失败") public FebsResponse traderConfirm(@Valid FollowTraderInfoEntity followTraderInfoEntity) { return documentaryService.traderConfirm(followTraderInfoEntity); } 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 index b415cc1..dafa9b5 100644 --- a/src/main/java/com/xcong/excoin/modules/documentary/entity/FollowTraderInfoEntity.java +++ b/src/main/java/com/xcong/excoin/modules/documentary/entity/FollowTraderInfoEntity.java @@ -79,6 +79,8 @@ private double walletCoinNum; @TableField(exist = false) private double agentNum; + @TableField(exist = false) + private String isok; } diff --git a/src/main/java/com/xcong/excoin/modules/documentary/entity/FollowTraderProfitInfoEntity.java b/src/main/java/com/xcong/excoin/modules/documentary/entity/FollowTraderProfitInfoEntity.java new file mode 100644 index 0000000..52c6d27 --- /dev/null +++ b/src/main/java/com/xcong/excoin/modules/documentary/entity/FollowTraderProfitInfoEntity.java @@ -0,0 +1,52 @@ +package com.xcong.excoin.modules.documentary.entity; + +import java.math.BigDecimal; +import com.baomidou.mybatisplus.annotation.TableName; +import com.xcong.excoin.common.entity.BaseEntity; + +import lombok.Data; + +@Data +@TableName("follow_trader_profit_info") +public class FollowTraderProfitInfoEntity 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; + + +} + diff --git a/src/main/java/com/xcong/excoin/modules/documentary/mapper/FollowTraderProfitInfoMapper.java b/src/main/java/com/xcong/excoin/modules/documentary/mapper/FollowTraderProfitInfoMapper.java new file mode 100644 index 0000000..31eea4f --- /dev/null +++ b/src/main/java/com/xcong/excoin/modules/documentary/mapper/FollowTraderProfitInfoMapper.java @@ -0,0 +1,8 @@ +package com.xcong.excoin.modules.documentary.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.xcong.excoin.modules.documentary.entity.FollowTraderProfitInfoEntity; + +public interface FollowTraderProfitInfoMapper extends BaseMapper<FollowTraderProfitInfoEntity> { + +} 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 7558ac8..6b9f140 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,5 +1,6 @@ package com.xcong.excoin.modules.documentary.service.impl; +import java.math.BigDecimal; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -7,6 +8,7 @@ import javax.validation.Valid; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; @@ -14,14 +16,19 @@ import com.xcong.excoin.common.entity.FebsResponse; import com.xcong.excoin.common.entity.QueryRequest; import com.xcong.excoin.modules.documentary.entity.FollowTraderInfoEntity; +import com.xcong.excoin.modules.documentary.entity.FollowTraderProfitInfoEntity; import com.xcong.excoin.modules.documentary.mapper.FollowTraderInfoMapper; +import com.xcong.excoin.modules.documentary.mapper.FollowTraderProfitInfoMapper; import com.xcong.excoin.modules.documentary.service.DocumentaryService; import com.xcong.excoin.modules.member.entity.MemberAuthenticationEntity; import com.xcong.excoin.modules.member.entity.MemberEntity; import com.xcong.excoin.modules.member.mapper.MemberAuthenticationMapper; import com.xcong.excoin.modules.member.mapper.MemberMapper; +import com.xcong.excoin.modules.member.vo.MemberAuthenticationVo; import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; @@ -35,6 +42,8 @@ private final MemberAuthenticationMapper memberAuthenticationMapper; private final MemberMapper memberMapper; + + private final FollowTraderProfitInfoMapper followTraderProfitInfoMapper; @Override public IPage<FollowTraderInfoEntity> findTraderListInPage(FollowTraderInfoEntity followTraderInfoEntity, @@ -98,9 +107,43 @@ } @Override + @Transactional public FebsResponse traderConfirm(@Valid FollowTraderInfoEntity followTraderInfoEntity) { - // TODO Auto-generated method stub - return null; + Long id = followTraderInfoEntity.getId(); + FollowTraderInfoEntity selectById = followTraderInfoMapper.selectById(id); + if(ObjectUtil.isEmpty(selectById)) { + return new FebsResponse().fail().message("交易员信息不存在"); + } + String isok = followTraderInfoEntity.getIsok(); + if("1".equals(isok)) { + //更新【会员信息表】数据 + Long memberId = selectById.getMemberId(); + MemberEntity memberEntity = memberMapper.selectById(memberId); + if(ObjectUtil.isEmpty(memberEntity)) { + return new FebsResponse().fail().message("会员信息不存在"); + } + memberEntity.setIsTrader(1); + memberMapper.updateById(memberEntity); + //更新【交易员信息表】数据 + selectById.setVerifyStatus(FollowTraderInfoEntity.VERIFYSTATUS_Y); + followTraderInfoMapper.updateById(selectById); + //新增【交易员收益信息 】数据 + FollowTraderProfitInfoEntity followTraderProfitInfoEntity = new FollowTraderProfitInfoEntity(); + followTraderProfitInfoEntity.setMemberId(memberId); + followTraderProfitInfoEntity.setTraderId(selectById.getId()); + followTraderProfitInfoEntity.setTotalProfitRatio(BigDecimal.ZERO); + followTraderProfitInfoEntity.setTotalProfit(BigDecimal.ZERO); + followTraderProfitInfoEntity.setFollowerTotalProfit(BigDecimal.ZERO); + followTraderProfitInfoEntity.setWinRate(BigDecimal.ZERO); + followTraderProfitInfoEntity.setTotalFollowerCnt(BigDecimal.ZERO); + followTraderProfitInfoEntity.setTotalOrderCnt(BigDecimal.ZERO); + followTraderProfitInfoMapper.updateById(followTraderProfitInfoEntity); + }else { + //更新【交易员信息表】数据 + selectById.setVerifyStatus(FollowTraderInfoEntity.VERIFYSTATUS_N); + followTraderInfoMapper.updateById(selectById); + } + return new FebsResponse().success(); } } diff --git a/src/main/java/com/xcong/excoin/modules/member/entity/MemberEntity.java b/src/main/java/com/xcong/excoin/modules/member/entity/MemberEntity.java index 8a8f337..7614c2e 100644 --- a/src/main/java/com/xcong/excoin/modules/member/entity/MemberEntity.java +++ b/src/main/java/com/xcong/excoin/modules/member/entity/MemberEntity.java @@ -139,6 +139,11 @@ * 是否设置盈亏难度系数 0-否1-是 */ private Integer isProfit; + + /** + * 是否是交易员1是2否 + */ + private Integer isTrader; /** * 是否设置预估强平价系数 0-否1-是 diff --git a/src/main/resources/mapper/modules/FollowTraderProfitInfoMapper.xml b/src/main/resources/mapper/modules/FollowTraderProfitInfoMapper.xml new file mode 100644 index 0000000..6047e9b --- /dev/null +++ b/src/main/resources/mapper/modules/FollowTraderProfitInfoMapper.xml @@ -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.mapper.FollowTraderProfitInfoMapper"> + + +</mapper> \ No newline at end of file diff --git a/src/main/resources/templates/febs/views/modules/documentary/traderDetail.html b/src/main/resources/templates/febs/views/modules/documentary/traderDetail.html index fc7b2b8..f1e7ded 100644 --- a/src/main/resources/templates/febs/views/modules/documentary/traderDetail.html +++ b/src/main/resources/templates/febs/views/modules/documentary/traderDetail.html @@ -121,7 +121,7 @@ } form.on('submit(user-update-form-submit)', function (data) { - febs.post(ctx + 'member/memberDetailConfirm', data.field, function () { + febs.post(ctx + 'documentary/traderConfirm', data.field, function () { layer.closeAll(); febs.alert.success('认证成功'); $('#febs-user').find('#query').click(); -- Gitblit v1.9.1