From ea6dfba6e2550f75437398c790559b1eb98ba49d Mon Sep 17 00:00:00 2001 From: Helius <wangdoubleone@gmail.com> Date: Thu, 04 Mar 2021 17:29:49 +0800 Subject: [PATCH] Merge branch 'whole_new' of http://120.27.238.55:7000/r/exchange into whole_new --- src/main/resources/i18n/messages_zh_CN.properties | 1 src/main/java/com/xcong/excoin/modules/documentary/vo/TradeSetInfoVo.java | 3 + src/main/java/com/xcong/excoin/modules/documentary/controller/TraderController.java | 7 +- src/main/java/com/xcong/excoin/modules/documentary/dao/FollowFollowerSettingDao.java | 2 src/main/resources/mapper/documentary/FollowFollowerSettingDao.xml | 8 ++ src/main/java/com/xcong/excoin/modules/documentary/dto/BeTraderDto.java | 26 ++++++++ src/main/java/com/xcong/excoin/modules/documentary/entity/FollowTraderInfoEntity.java | 10 +++ src/main/java/com/xcong/excoin/modules/documentary/service/DocumentaryService.java | 5 + src/main/java/com/xcong/excoin/modules/documentary/service/impl/DocumentaryServiceImpl.java | 63 ++++++++++++++++++--- src/main/resources/i18n/messages_en_US.properties | 1 10 files changed, 113 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/dao/FollowFollowerSettingDao.java b/src/main/java/com/xcong/excoin/modules/documentary/dao/FollowFollowerSettingDao.java index ffb1b68..48f8626 100644 --- a/src/main/java/com/xcong/excoin/modules/documentary/dao/FollowFollowerSettingDao.java +++ b/src/main/java/com/xcong/excoin/modules/documentary/dao/FollowFollowerSettingDao.java @@ -17,4 +17,6 @@ FollowFollowerSettingEntity selectOneBymemberIdAndTradeId(@Param("memberId")Long memberId, @Param("traderId")Long traderId); List<FollowFollowerSettingEntity> selectAllFollowerSettingByTradeMemberId(@Param("memberId") Long memberId); + + List<FollowFollowerSettingEntity> selectDocumentaryOrderSetInfosBymemberId(@Param("memberId")Long memberId); } 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/entity/FollowTraderInfoEntity.java b/src/main/java/com/xcong/excoin/modules/documentary/entity/FollowTraderInfoEntity.java index 92ca020..696b321 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 @@ -34,6 +34,12 @@ */ private String nickname; /** + * 名称是否已修改 + */ + private Integer nicknameState; + public static final Integer STATE_Y = 1; + public static final Integer STATE_N = 0; + /** * 宣言 */ private String declaration; @@ -70,6 +76,10 @@ private Integer isOpen; public static final Integer ISOPEN_Y = 1; public static final Integer ISOPEN_N = 2; + /** + * 最大跟随人数 + */ + private Integer followNum; } 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 0f9356c..2f93ebe 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; @@ -630,8 +632,23 @@ public Result getDocumentaryOrderSetInfo(String tradeId) { //获取用户ID Long memberId = LoginUserUtils.getAppLoginUser().getId(); + log.info("跟单---点击跟单或者编辑---"+memberId+"参数"+tradeId); DocumentaryOrderSetInfoVo documentaryOrderSetInfoVo = new DocumentaryOrderSetInfoVo(); long parseLong = Long.parseLong(tradeId); + + //只能跟随一个人 + Map<String, Object> columnMaps = new HashMap<>(); + columnMaps.put("member_id", memberId); + List<FollowFollowerSettingEntity> followFollowerSettingEntityAllows = followFollowerSettingDao.selectByMap(columnMaps); + if(CollUtil.isNotEmpty(followFollowerSettingEntityAllows)) { + for(FollowFollowerSettingEntity followFollowerSettingEntityAllow : followFollowerSettingEntityAllows) { + Long tradeIdAllow = followFollowerSettingEntityAllow.getTraderId(); + if(parseLong != tradeIdAllow) { + return Result.fail(MessageSourceUtils.getString("documentary_service_0015")); + } + } + } + //获取【跟随者设置】数据 FollowFollowerSettingEntity followFollowerSettingEntity = followFollowerSettingDao.selectOneBymemberIdAndTradeId(memberId,parseLong); @@ -661,7 +678,7 @@ if(maxFollowCnt > 0){ documentaryOrderSetInfoVo.setMaxFollowCnt(maxFollowCnt.toString()); } - documentaryOrderSetInfoVo.setMaxFollowCnt(null); + documentaryOrderSetInfoVo.setMaxFollowCnt(""); log.info(memberId + "-最大持仓张数-"+maxFollowCnt.toString()); return Result.ok(documentaryOrderSetInfoVo); } @@ -739,7 +756,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); @@ -777,14 +802,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.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); @@ -830,6 +865,8 @@ tradeSetInfoVo.setAvatar(avatar); String nickname = followTraderInfoEntity.getNickname(); tradeSetInfoVo.setNickname(nickname); + Integer nicknameState = followTraderInfoEntity.getNicknameState(); + tradeSetInfoVo.setNicknameState(nicknameState); String declaration = followTraderInfoEntity.getDeclaration(); tradeSetInfoVo.setDeclaration(declaration); Integer isOpen = followTraderInfoEntity.getIsOpen(); @@ -864,6 +901,14 @@ String declaration = updateTradeSetInfoDto.getDeclaration(); int isOpen = updateTradeSetInfoDto.getIsOpen(); String labels = updateTradeSetInfoDto.getLabels(); + Integer nicknameState = followTraderInfoEntity.getNicknameState(); + if(FollowTraderInfoEntity.STATE_Y == nicknameState && !nickname.equals(followTraderInfoEntity.getNickname())) { + return Result.ok(MessageSourceUtils.getString("member_service_0099")); + } + if(!nickname.equals(followTraderInfoEntity.getNickname())) { + followTraderInfoEntity.setNickname(nickname); + followTraderInfoEntity.setNicknameState(FollowTraderInfoEntity.STATE_Y); + } followTraderInfoEntity.setLabels(labels); followTraderInfoEntity.setAvatar(avatar); followTraderInfoEntity.setNickname(nickname); diff --git a/src/main/java/com/xcong/excoin/modules/documentary/vo/TradeSetInfoVo.java b/src/main/java/com/xcong/excoin/modules/documentary/vo/TradeSetInfoVo.java index 59ef975..555f00e 100644 --- a/src/main/java/com/xcong/excoin/modules/documentary/vo/TradeSetInfoVo.java +++ b/src/main/java/com/xcong/excoin/modules/documentary/vo/TradeSetInfoVo.java @@ -18,6 +18,9 @@ @ApiModelProperty("名称") private String nickname; + + @ApiModelProperty("名称状态:0:未修改 1:已修改") + private int nicknameState; @ApiModelProperty("是否开启带单 1是2否") private int isOpen; diff --git a/src/main/resources/i18n/messages_en_US.properties b/src/main/resources/i18n/messages_en_US.properties index 825a36e..1b5f99a 100644 --- a/src/main/resources/i18n/messages_en_US.properties +++ b/src/main/resources/i18n/messages_en_US.properties @@ -140,6 +140,7 @@ member_service_0096=Transfer fail member_service_0097=Payment method already exists member_service_0098=Please select another account +member_service_0099=The nickname can only be modified once order_service_0001=Wrong parameter value order_service_0002=Not logged in diff --git a/src/main/resources/i18n/messages_zh_CN.properties b/src/main/resources/i18n/messages_zh_CN.properties index 6d7272b..fa50004 100644 --- a/src/main/resources/i18n/messages_zh_CN.properties +++ b/src/main/resources/i18n/messages_zh_CN.properties @@ -140,6 +140,7 @@ member_service_0096=划转失败 member_service_0097=支付方式已存在 member_service_0098=请选择其他账户 +member_service_0099=昵称只允许修改一次 order_service_0001=参值有误 order_service_0002=未登录 diff --git a/src/main/resources/mapper/documentary/FollowFollowerSettingDao.xml b/src/main/resources/mapper/documentary/FollowFollowerSettingDao.xml index 941cd8a..e7a0151 100644 --- a/src/main/resources/mapper/documentary/FollowFollowerSettingDao.xml +++ b/src/main/resources/mapper/documentary/FollowFollowerSettingDao.xml @@ -25,5 +25,13 @@ from follow_follower_setting a, follow_follower_profit b where a.member_id=b.member_id and a.trader_member_id=b.trade_member_id and a.trader_member_id=#{memberId} and b.is_follow=1 </select> + <select id="selectDocumentaryOrderSetInfosBymemberId" resultType="com.xcong.excoin.modules.documentary.entity.FollowFollowerSettingEntity"> + SELECT + * + FROM + follow_follower_setting + WHERE + member_id = #{memberId} + </select> </mapper> \ No newline at end of file -- Gitblit v1.9.1