From b34be29401abfe68c05e7e47af2888f0a54ba12f Mon Sep 17 00:00:00 2001 From: xiaoyong931011 <15274802129@163.com> Date: Fri, 31 Jul 2020 15:34:12 +0800 Subject: [PATCH] 20200731 代码提交 --- src/main/java/com/xcong/excoin/modules/documentary/dao/FollowFollowerOrderRelationDao.java | 4 ++ src/main/java/com/xcong/excoin/modules/documentary/controller/TraderController.java | 10 +--- src/main/java/com/xcong/excoin/modules/documentary/vo/MyFollowOrderVo.java | 10 ++++- src/main/java/com/xcong/excoin/modules/documentary/entity/FollowTraderInfoEntity.java | 7 ++- src/main/java/com/xcong/excoin/modules/documentary/service/DocumentaryService.java | 2 + src/main/java/com/xcong/excoin/modules/documentary/service/impl/DocumentaryServiceImpl.java | 44 ++++++++++++++++++++++ src/main/resources/mapper/documentary/FollowFollowerOrderRelationDao.xml | 12 +++++ 7 files changed, 77 insertions(+), 12 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 945ef3b..9508ed3 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 @@ -8,12 +8,9 @@ import com.xcong.excoin.common.response.Result; import com.xcong.excoin.modules.documentary.service.DocumentaryService; -import com.xcong.excoin.modules.documentary.vo.MemberIsTradeVo; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; import lombok.extern.slf4j.Slf4j; @RestController @@ -29,10 +26,9 @@ * 成为交易员---立即入驻 */ @ApiOperation(value="成为交易员---立即入驻", notes="成为交易员---立即入驻") - @ApiResponses({@ApiResponse( code = 200, message = "success", response = MemberIsTradeVo.class)}) - @GetMapping(value = "/getTraderInfo") - public Result getMemberIsTradeInfo() { - return documentaryService.getMemberIsTradeInfo(); + @GetMapping(value = "/beTrader") + public Result beTrader() { + return documentaryService.beTrader(); } } diff --git a/src/main/java/com/xcong/excoin/modules/documentary/dao/FollowFollowerOrderRelationDao.java b/src/main/java/com/xcong/excoin/modules/documentary/dao/FollowFollowerOrderRelationDao.java index dff3af5..af23003 100644 --- a/src/main/java/com/xcong/excoin/modules/documentary/dao/FollowFollowerOrderRelationDao.java +++ b/src/main/java/com/xcong/excoin/modules/documentary/dao/FollowFollowerOrderRelationDao.java @@ -3,8 +3,12 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.xcong.excoin.modules.documentary.entity.FollowFollowerOrderRelationEntity; +import io.lettuce.core.dynamic.annotation.Param; + /** * @author helius */ public interface FollowFollowerOrderRelationDao extends BaseMapper<FollowFollowerOrderRelationEntity> { + + FollowFollowerOrderRelationEntity selectOneByorderIdandMemberId(@Param("orderId")Long orderId,@Param("memberId") Long memberId); } 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 65fc9ba..87aec59 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 @@ -19,6 +19,9 @@ * */ private static final long serialVersionUID = 1L; + + public static final String AVATAR_DEFAULT = "测试图片地址"; + public static final String DECLARATION_DEFAULT = "正忙着赚钱,什么也没写"; /** * 会员ID */ @@ -50,8 +53,8 @@ */ private Integer verifyStatus; public static final Integer VERIFYSTATUS_Y = 1; - public static final Integer VERIFYSTATUS_ING = 2; - public static final Integer VERIFYSTATUS_N = 3; + public static final Integer VERIFYSTATUS_N = 2; + public static final Integer VERIFYSTATUS_ING = 3; /** * 是否开启带单 1是2否 */ 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 e146231..75e8a3f 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 @@ -44,4 +44,6 @@ public Result getFollowTraderProfit(long traderId); + public Result beTrader(); + } 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 8d0cc27..e583568 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 @@ -23,6 +23,7 @@ import com.xcong.excoin.modules.contract.dao.ContractHoldOrderDao; import com.xcong.excoin.modules.contract.entity.ContractHoldOrderEntity; import com.xcong.excoin.modules.contract.entity.ContractOrderEntity; +import com.xcong.excoin.modules.documentary.dao.FollowFollowerOrderRelationDao; import com.xcong.excoin.modules.documentary.dao.FollowFollowerProfitDao; import com.xcong.excoin.modules.documentary.dao.FollowFollowerSettingDao; import com.xcong.excoin.modules.documentary.dao.FollowTraderInfoDao; @@ -35,6 +36,7 @@ import com.xcong.excoin.modules.documentary.dto.MyFollowOrderDto; import com.xcong.excoin.modules.documentary.dto.MyFollowTraderInfoDto; import com.xcong.excoin.modules.documentary.dto.UpdateDocumentaryOrderSetDto; +import com.xcong.excoin.modules.documentary.entity.FollowFollowerOrderRelationEntity; import com.xcong.excoin.modules.documentary.entity.FollowFollowerProfitEntity; import com.xcong.excoin.modules.documentary.entity.FollowFollowerSettingEntity; import com.xcong.excoin.modules.documentary.entity.FollowTraderInfoEntity; @@ -94,6 +96,8 @@ private MemberWalletContractDao memberWalletContractDao; @Resource private FollowFollowerSettingDao followFollowerSettingDao; + @Resource + private FollowFollowerOrderRelationDao followFollowerOrderRelationDao; @Override @@ -295,6 +299,14 @@ if(CollUtil.isNotEmpty(records)) { for(ContractHoldOrderEntity contractHoldOrderEntity : records) { MyFollowOrderVo myFollowOrderVo = new MyFollowOrderVo(); + //获取交易员信息 + Long orderId = contractHoldOrderEntity.getId(); + FollowFollowerOrderRelationEntity FollowFollowerOrderRelation = followFollowerOrderRelationDao.selectOneByorderIdandMemberId(orderId,memberId); + Long tradeId = FollowFollowerOrderRelation.getTradeId(); + FollowTraderInfoEntity followTraderInfoEntity = followTraderInfoDao.selectById(tradeId); + String nickname = followTraderInfoEntity.getNickname(); + myFollowOrderVo.setNickname(nickname); + String symbol = contractHoldOrderEntity.getSymbol(); myFollowOrderVo.setSymbol(symbol); int orderType = contractHoldOrderEntity.getOpeningType(); @@ -314,6 +326,8 @@ // 获取最新价 BigDecimal newPrice = new BigDecimal(redisUtils.getString(CoinTypeConvert.convertToKey(contractHoldOrderEntity.getSymbol()))); + myFollowOrderVo.setNewPrice(newPrice); + BigDecimal lotNumber = cacheSettingUtils.getSymbolSku(contractHoldOrderEntity.getSymbol()); // 盈亏 BigDecimal rewardRatio = BigDecimal.ZERO; @@ -528,6 +542,36 @@ followTraderProfitInfoVo.setIsAll(isAll); return Result.ok(followTraderProfitInfoVo); } + + @Override + @Transactional + public Result beTrader() { + //获取用户ID + Long memberId = LoginUserUtils.getAppLoginUser().getId(); + MemberEntity memberEntity = memberDao.selectById(memberId); + Integer certifyStatus = memberEntity.getCertifyStatus(); + if(MemberEntity.CERTIFY_STATUS_Y != certifyStatus) { + return Result.ok(MessageSourceUtils.getString("member_controller_0009")); + } + //新增【交易员信息表】数据 + FollowTraderInfoEntity followTraderInfoEntity = new FollowTraderInfoEntity(); + followTraderInfoEntity.setMemberId(memberId); + followTraderInfoEntity.setAvatar(FollowTraderInfoEntity.AVATAR_DEFAULT); + String phone = memberEntity.getPhone(); + String email = memberEntity.getEmail(); + if(StrUtil.isNotEmpty(phone)) { + followTraderInfoEntity.setNickname(phone); + }else { + followTraderInfoEntity.setNickname(email); + } + followTraderInfoEntity.setDeclaration(FollowTraderInfoEntity.DECLARATION_DEFAULT); + followTraderInfoEntity.setIsAll(FollowTraderInfoEntity.IS_ALL_N); + followTraderInfoEntity.setProfitRatio(BigDecimal.ZERO); + followTraderInfoEntity.setVerifyStatus(FollowTraderInfoEntity.VERIFYSTATUS_ING); + followTraderInfoEntity.setIsOpen(FollowTraderInfoEntity.ISOPEN_Y); + followTraderInfoDao.insert(followTraderInfoEntity); + return Result.ok(MessageSourceUtils.getString("member_service_0024")); + } diff --git a/src/main/java/com/xcong/excoin/modules/documentary/vo/MyFollowOrderVo.java b/src/main/java/com/xcong/excoin/modules/documentary/vo/MyFollowOrderVo.java index 782a43a..7a36b08 100644 --- a/src/main/java/com/xcong/excoin/modules/documentary/vo/MyFollowOrderVo.java +++ b/src/main/java/com/xcong/excoin/modules/documentary/vo/MyFollowOrderVo.java @@ -31,14 +31,17 @@ @ApiModelProperty("盈亏金额") private BigDecimal rewardAmount; - @ApiModelProperty("张数") + @ApiModelProperty("盈亏比例") private BigDecimal rewardRatio; - @ApiModelProperty("盈亏比例") + @ApiModelProperty("张数") private int symbolCnt; @ApiModelProperty("保证金") private BigDecimal bondAmount; + + @ApiModelProperty("当前价") + private BigDecimal newPrice; @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") @ApiModelProperty("开仓时间") @@ -51,4 +54,7 @@ @ApiModelProperty("订单编号") private String orderNo; + @ApiModelProperty("交易员") + private String nickname; + } diff --git a/src/main/resources/mapper/documentary/FollowFollowerOrderRelationDao.xml b/src/main/resources/mapper/documentary/FollowFollowerOrderRelationDao.xml index c546474..40a417e 100644 --- a/src/main/resources/mapper/documentary/FollowFollowerOrderRelationDao.xml +++ b/src/main/resources/mapper/documentary/FollowFollowerOrderRelationDao.xml @@ -1,5 +1,15 @@ <?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.dao.FollowFollowerOrderRelationDao"> - + + <select id="selectOneByorderIdandMemberId" resultType="com.xcong.excoin.modules.documentary.entity.FollowFollowerOrderRelationEntity"> + SELECT + * + FROM + follow_follower_order_relation + WHERE + member_id = #{memberId} + and order_id = #{orderId} + </select> + </mapper> \ No newline at end of file -- Gitblit v1.9.1