xiaoyong931011
2021-02-05 44bac492a887015e83c0a89f2398eb04a14353cb
20210205
1 files modified
3 files added
74 ■■■■■ changed files
src/main/java/com/xcong/excoin/modules/documentary/entity/FollowFollowerProfitEntity.java 44 ●●●●● patch | view | raw | blame | history
src/main/java/com/xcong/excoin/modules/documentary/mapper/FollowFollowerProfitMapper.java 8 ●●●●● patch | view | raw | blame | history
src/main/java/com/xcong/excoin/modules/documentary/service/impl/DocumentaryServiceImpl.java 17 ●●●●● patch | view | raw | blame | history
src/main/resources/mapper/modules/FollowFollowerProfitMapper.xml 5 ●●●●● patch | view | raw | blame | history
src/main/java/com/xcong/excoin/modules/documentary/entity/FollowFollowerProfitEntity.java
New file
@@ -0,0 +1,44 @@
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_follower_profit")
public class FollowFollowerProfitEntity 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
     */
    private Long memberId;
    /**
     * 交易员ID
     */
    private Long tradeId;
    /**
     * 交易员会员ID
     */
    private Long tradeMemberId;
    /**
     * 累计跟随本金
     */
    private BigDecimal totalPrincipal;
    /**
     * 累计收益
     */
    private BigDecimal totalProfit;
    /**
     * 是否跟随 1-是 2-否
     */
    private Integer isFollow;
}
src/main/java/com/xcong/excoin/modules/documentary/mapper/FollowFollowerProfitMapper.java
New file
@@ -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.FollowFollowerProfitEntity;
public interface FollowFollowerProfitMapper extends BaseMapper<FollowFollowerProfitEntity> {
}
src/main/java/com/xcong/excoin/modules/documentary/service/impl/DocumentaryServiceImpl.java
@@ -20,9 +20,11 @@
import com.xcong.excoin.common.entity.FebsResponse;
import com.xcong.excoin.common.entity.QueryRequest;
import com.xcong.excoin.modules.documentary.dto.FollowTraderInfoDto;
import com.xcong.excoin.modules.documentary.entity.FollowFollowerProfitEntity;
import com.xcong.excoin.modules.documentary.entity.FollowTraderInfoEntity;
import com.xcong.excoin.modules.documentary.entity.FollowTraderLabelEntity;
import com.xcong.excoin.modules.documentary.entity.FollowTraderProfitInfoEntity;
import com.xcong.excoin.modules.documentary.mapper.FollowFollowerProfitMapper;
import com.xcong.excoin.modules.documentary.mapper.FollowTraderInfoMapper;
import com.xcong.excoin.modules.documentary.mapper.FollowTraderLabelMapper;
import com.xcong.excoin.modules.documentary.mapper.FollowTraderProfitInfoMapper;
@@ -43,6 +45,8 @@
public class DocumentaryServiceImpl extends ServiceImpl<FollowTraderInfoMapper, FollowTraderInfoEntity> implements DocumentaryService {
    
    private final FollowTraderInfoMapper followTraderInfoMapper;
    private final FollowFollowerProfitMapper followFollowerProfitMapper;
    
    private final FollowTraderLabelMapper followTraderLabelMapper;
    
@@ -163,12 +167,25 @@
    }
    @Override
    @Transactional
    public FebsResponse traderGetOut(@NotNull(message = "{required}") Long id) {
        FollowTraderInfoEntity followTraderInfoEntity = followTraderInfoMapper.selectById(id);
        if(ObjectUtil.isEmpty(followTraderInfoEntity)) {
            return new FebsResponse().fail().message("交易员信息不存在");
        }
        Long memberId = followTraderInfoEntity.getMemberId();
        Map<String, Object> columnMap = new HashMap<>();
        columnMap.put("trade_member_id", memberId);
        List<FollowFollowerProfitEntity> selectByMap = followFollowerProfitMapper.selectByMap(columnMap);
        if(CollUtil.isNotEmpty(selectByMap)) {
            for(FollowFollowerProfitEntity FollowFollowerProfitEntity : selectByMap ) {
                FollowFollowerProfitEntity.setIsFollow(FollowFollowerProfitEntity.IS_FOLLOW_N);
                followFollowerProfitMapper.updateById(FollowFollowerProfitEntity);
            }
        }
        followTraderInfoEntity.setVerifyStatus(FollowTraderInfoEntity.VERIFYSTATUS_N);
        followTraderInfoMapper.updateById(followTraderInfoEntity);
        MemberEntity memberEntity = memberMapper.selectById(memberId);
        memberEntity.setIsTrader(2);
        memberMapper.updateById(memberEntity);
src/main/resources/mapper/modules/FollowFollowerProfitMapper.xml
New file
@@ -0,0 +1,5 @@
<?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.FollowFollowerProfitMapper">
</mapper>