xiaoyong931011
2021-03-04 af051d7a0fa660f874e0f2aacff6c10219e62c91
20210304   申请交易员,信息初始化,由前端传入
1 files added
3 files modified
75 ■■■■ changed files
src/main/java/com/xcong/excoin/modules/documentary/controller/TraderController.java 7 ●●●●● patch | view | raw | blame | history
src/main/java/com/xcong/excoin/modules/documentary/dto/BeTraderDto.java 26 ●●●●● 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 37 ●●●● patch | view | raw | blame | history
src/main/java/com/xcong/excoin/modules/documentary/controller/TraderController.java
@@ -10,6 +10,7 @@
import org.springframework.web.bind.annotation.RestController;
import com.xcong.excoin.common.response.Result;
import com.xcong.excoin.modules.documentary.dto.BeTraderDto;
import com.xcong.excoin.modules.documentary.dto.OutFollowInfoDto;
import com.xcong.excoin.modules.documentary.dto.TradeFollowInfoDto;
import com.xcong.excoin.modules.documentary.dto.TradeOrderInfoDto;
@@ -114,9 +115,9 @@
     *  成为交易员---立即入驻
     */
    @ApiOperation(value="成为交易员---立即入驻", notes="成为交易员---立即入驻")
    @GetMapping(value = "/beTrader")
    public Result  beTrader() {
        return documentaryService.beTrader();
    @PostMapping(value = "/beTrader")
    public Result  beTrader(@RequestBody @Valid BeTraderDto beTraderDto) {
        return documentaryService.beTrader(beTraderDto);
    }
    
    /**
src/main/java/com/xcong/excoin/modules/documentary/dto/BeTraderDto.java
New file
@@ -0,0 +1,26 @@
package com.xcong.excoin.modules.documentary.dto;
import javax.validation.constraints.NotNull;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel(value = "BeTraderDto", description = "参数接受类")
public class BeTraderDto {
    @ApiModelProperty("头像")
    private String avatar;
    @NotNull(message = "名称不能为空")
    @ApiModelProperty("名称")
    private String nickname;
    @ApiModelProperty("宣言")
    private String declaration;
    @NotNull(message = "标签不能为空")
    @ApiModelProperty("标签")
    private String labels;
}
src/main/java/com/xcong/excoin/modules/documentary/service/DocumentaryService.java
@@ -2,9 +2,12 @@
import javax.validation.Valid;
import org.springframework.web.bind.annotation.RequestBody;
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.BeTraderDto;
import com.xcong.excoin.modules.documentary.dto.CancelDocumentaryOrderSetDto;
import com.xcong.excoin.modules.documentary.dto.DocumentaryOrderSetDto;
import com.xcong.excoin.modules.documentary.dto.FollowFollowerNoticeDto;
@@ -50,7 +53,7 @@
    public Result getFollowTraderProfit(long traderId);
    public Result beTrader();
    public Result beTrader(@Valid BeTraderDto beTraderDto);
    public Result beTraderStatus();
src/main/java/com/xcong/excoin/modules/documentary/service/impl/DocumentaryServiceImpl.java
@@ -16,6 +16,7 @@
import com.xcong.excoin.utils.*;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestBody;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
@@ -39,6 +40,7 @@
import com.xcong.excoin.modules.documentary.dao.FollowTraderLabelDao;
import com.xcong.excoin.modules.documentary.dao.FollowTraderProfitDetailDao;
import com.xcong.excoin.modules.documentary.dao.FollowTraderProfitInfoDao;
import com.xcong.excoin.modules.documentary.dto.BeTraderDto;
import com.xcong.excoin.modules.documentary.dto.CancelDocumentaryOrderSetDto;
import com.xcong.excoin.modules.documentary.dto.DocumentaryOrderSetDto;
import com.xcong.excoin.modules.documentary.dto.FollowFollowerNoticeDto;
@@ -718,7 +720,15 @@
    @Override
    @Transactional
    public Result beTrader() {
    public Result beTrader(@Valid BeTraderDto beTraderDto) {
        //头像
        String avatar = beTraderDto.getAvatar();
        //昵称
        String nickname = beTraderDto.getNickname();
        //宣言
        String declaration = beTraderDto.getDeclaration();
        //标签
        String labels = beTraderDto.getLabels();
        //获取用户ID
        Long memberId = LoginUserUtils.getAppLoginUser().getId();
        MemberEntity memberEntity = memberDao.selectById(memberId);
@@ -756,15 +766,24 @@
        followTraderInfoEntity.setMemberId(memberId);
        followTraderInfoEntity.setProfitRatio(BigDecimal.valueOf(0.1));
//        followTraderInfoEntity.setAvatar(FollowTraderInfoEntity.AVATAR_DEFAULT);
        String phone = memberEntity.getPhone();
        String email = memberEntity.getEmail();
        if(StrUtil.isNotEmpty(phone)) {
            followTraderInfoEntity.setNickname(phone.replaceAll("(\\d{3})\\d{4}(\\d{4})", "$1****$2"));
        }else {
            followTraderInfoEntity.setNickname(email.replaceAll("(\\w?)(\\w+)(\\w)(@\\w+\\.[a-z]+(\\.[a-z]+)?)","$1****$3$4"));
//        String phone = memberEntity.getPhone();
//        String email = memberEntity.getEmail();
//        if(StrUtil.isNotEmpty(phone)) {
//            followTraderInfoEntity.setNickname(phone.replaceAll("(\\d{3})\\d{4}(\\d{4})", "$1****$2"));
//        }else {
//            followTraderInfoEntity.setNickname(email.replaceAll("(\\w?)(\\w+)(\\w)(@\\w+\\.[a-z]+(\\.[a-z]+)?)","$1****$3$4"));
//        }
        if(StrUtil.isNotEmpty(avatar)) {
            followTraderInfoEntity.setAvatar(avatar);
        }
        followTraderInfoEntity.setNicknameState(FollowTraderInfoEntity.STATE_N);
        followTraderInfoEntity.setDeclaration(FollowTraderInfoEntity.DECLARATION_DEFAULT);
        followTraderInfoEntity.setNickname(nickname);
        followTraderInfoEntity.setNicknameState(FollowTraderInfoEntity.STATE_Y);
        if(StrUtil.isEmpty(declaration)) {
            followTraderInfoEntity.setDeclaration(FollowTraderInfoEntity.DECLARATION_DEFAULT);
        }else {
            followTraderInfoEntity.setDeclaration(declaration);
        }
        followTraderInfoEntity.setLabels(labels);
        followTraderInfoEntity.setIsAll(FollowTraderInfoEntity.IS_ALL_N);
        followTraderInfoEntity.setProfitRatio(BigDecimal.ZERO);
        followTraderInfoEntity.setVerifyStatus(FollowTraderInfoEntity.VERIFYSTATUS_ING);