From af051d7a0fa660f874e0f2aacff6c10219e62c91 Mon Sep 17 00:00:00 2001 From: xiaoyong931011 <15274802129@163.com> Date: Thu, 04 Mar 2021 17:06:16 +0800 Subject: [PATCH] 20210304 申请交易员,信息初始化,由前端传入 --- src/main/java/com/xcong/excoin/modules/documentary/controller/TraderController.java | 7 ++- src/main/java/com/xcong/excoin/modules/documentary/dto/BeTraderDto.java | 26 +++++++++++++ src/main/java/com/xcong/excoin/modules/documentary/service/DocumentaryService.java | 5 ++ src/main/java/com/xcong/excoin/modules/documentary/service/impl/DocumentaryServiceImpl.java | 37 ++++++++++++++---- 4 files changed, 62 insertions(+), 13 deletions(-) diff --git a/src/main/java/com/xcong/excoin/modules/documentary/controller/TraderController.java b/src/main/java/com/xcong/excoin/modules/documentary/controller/TraderController.java index 733a709..1e7c417 100644 --- a/src/main/java/com/xcong/excoin/modules/documentary/controller/TraderController.java +++ b/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); } /** diff --git a/src/main/java/com/xcong/excoin/modules/documentary/dto/BeTraderDto.java b/src/main/java/com/xcong/excoin/modules/documentary/dto/BeTraderDto.java new file mode 100644 index 0000000..2b5e1b7 --- /dev/null +++ b/src/main/java/com/xcong/excoin/modules/documentary/dto/BeTraderDto.java @@ -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; + +} 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 9d4cb8d..94af144 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 @@ -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(); 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 92712d1..e25ce5f 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 @@ -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); -- Gitblit v1.9.1