From 829d77f7145514d67d957ad54dbef854440f77d3 Mon Sep 17 00:00:00 2001
From: Helius <wangdoubleone@gmail.com>
Date: Fri, 31 Jul 2020 17:05:08 +0800
Subject: [PATCH] fix conflect
---
src/main/java/com/xcong/excoin/modules/documentary/dao/FollowFollowerOrderRelationDao.java | 5 +
src/main/resources/mapper/documentary/FollowFollowerProfitDao.xml | 4
src/main/java/com/xcong/excoin/modules/documentary/controller/TraderController.java | 34 +++++++++++
src/main/java/com/xcong/excoin/modules/documentary/vo/MyFollowOrderVo.java | 10 ++
src/main/java/com/xcong/excoin/modules/documentary/controller/DocumentaryController.java | 2
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 | 65 +++++++++++++++++++--
src/main/resources/mapper/documentary/FollowFollowerOrderRelationDao.xml | 16 +++++
9 files changed, 130 insertions(+), 15 deletions(-)
diff --git a/src/main/java/com/xcong/excoin/modules/documentary/controller/DocumentaryController.java b/src/main/java/com/xcong/excoin/modules/documentary/controller/DocumentaryController.java
index 49ae7db..bcc76dd 100644
--- a/src/main/java/com/xcong/excoin/modules/documentary/controller/DocumentaryController.java
+++ b/src/main/java/com/xcong/excoin/modules/documentary/controller/DocumentaryController.java
@@ -40,7 +40,7 @@
@RestController
@Slf4j
@RequestMapping(value = "/api/documentary")
-@Api(value = "MemberQuickBuySaleController", tags = "跟单")
+@Api(value = "DocumentaryController", tags = "跟单---跟随者")
public class DocumentaryController {
@Resource
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
new file mode 100644
index 0000000..9508ed3
--- /dev/null
+++ b/src/main/java/com/xcong/excoin/modules/documentary/controller/TraderController.java
@@ -0,0 +1,34 @@
+package com.xcong.excoin.modules.documentary.controller;
+
+import javax.annotation.Resource;
+
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import com.xcong.excoin.common.response.Result;
+import com.xcong.excoin.modules.documentary.service.DocumentaryService;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+
+@RestController
+@Slf4j
+@RequestMapping(value = "/api/trader")
+@Api(value = "TraderController", tags = "跟单---交易员")
+public class TraderController {
+
+ @Resource
+ DocumentaryService documentaryService;
+
+ /**
+ * 成为交易员---立即入驻
+ */
+ @ApiOperation(value="成为交易员---立即入驻", notes="成为交易员---立即入驻")
+ @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 a6c1a0e..e7448a9 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
@@ -4,10 +4,15 @@
import com.xcong.excoin.modules.documentary.entity.FollowFollowerOrderRelationEntity;
import io.lettuce.core.dynamic.annotation.Param;
+import io.lettuce.core.dynamic.annotation.Param;
+
/**
* @author helius
*/
public interface FollowFollowerOrderRelationDao extends BaseMapper<FollowFollowerOrderRelationEntity> {
Integer selectFollowerHoldingSymbolCnt(@Param("tradeMemberId") Long tradeMemberId, @Param("memberId") Long memberId);
+ FollowFollowerOrderRelationEntity selectHistoryOneByorderId(@Param("orderId")Long orderId);
+
+ FollowFollowerOrderRelationEntity selectNowOneByorderId(@Param("orderId")Long orderId);
}
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 5f59d22..44a35ad 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
@@ -10,6 +10,7 @@
import javax.annotation.Resource;
import javax.validation.Valid;
+import org.apache.http.impl.NoConnectionReuseStrategy;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -23,6 +24,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 +37,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 +97,8 @@
private MemberWalletContractDao memberWalletContractDao;
@Resource
private FollowFollowerSettingDao followFollowerSettingDao;
+ @Resource
+ private FollowFollowerOrderRelationDao followFollowerOrderRelationDao;
@Override
@@ -241,8 +246,7 @@
public Result getHistoryMyFollowOrderRecords(@Valid MyFollowOrderDto myFollowOrderDto) {
//获取用户ID
Long memberId = LoginUserUtils.getAppLoginUser().getId();
- Page<MyFollowOrderVo> result = new Page<>();
- List<MyFollowOrderVo> myFollowOrderVos = result.getRecords();
+ List<MyFollowOrderVo> myFollowOrderVos = new ArrayList<>();
//历史跟单
Page<ContractOrderEntity> page = new Page<>(myFollowOrderDto.getPageNum(), myFollowOrderDto.getPageSize());
IPage<ContractOrderEntity> contractOrderEntitys = followFollowerProfitDao.getMyFollowOrderHistoryRecords(page, memberId);
@@ -251,6 +255,14 @@
if(CollUtil.isNotEmpty(records)) {
for(ContractOrderEntity contractOrderEntity : records) {
MyFollowOrderVo myFollowOrderVo = new MyFollowOrderVo();
+ //获取交易员信息
+ Long orderId = contractOrderEntity.getId();
+ FollowFollowerOrderRelationEntity FollowFollowerOrderRelation = followFollowerOrderRelationDao.selectHistoryOneByorderId(orderId);
+ Long tradeId = FollowFollowerOrderRelation.getTradeId();
+ FollowTraderInfoEntity followTraderInfoEntity = followTraderInfoDao.selectById(tradeId);
+ String nickname = followTraderInfoEntity.getNickname();
+ myFollowOrderVo.setNickname(nickname);
+
String symbol = contractOrderEntity.getSymbol();
myFollowOrderVo.setSymbol(symbol);
int orderType = contractOrderEntity.getOrderType();
@@ -287,8 +299,7 @@
Long memberId = LoginUserUtils.getAppLoginUser().getId();
MemberEntity member = memberDao.selectById(memberId);
- Page<MyFollowOrderVo> result = new Page<>();
- List<MyFollowOrderVo> myFollowOrderVos = result.getRecords();
+ List<MyFollowOrderVo> myFollowOrderVos = new ArrayList<>();
//当前跟单
Page<ContractHoldOrderEntity> page = new Page<>(myFollowOrderDto.getPageNum(), myFollowOrderDto.getPageSize());
IPage<ContractHoldOrderEntity> contractHoldOrderEntitys = followFollowerProfitDao.getMyFollowOrderNowRecords(page, memberId);
@@ -297,6 +308,14 @@
if(CollUtil.isNotEmpty(records)) {
for(ContractHoldOrderEntity contractHoldOrderEntity : records) {
MyFollowOrderVo myFollowOrderVo = new MyFollowOrderVo();
+ //获取交易员信息
+ Long orderId = contractHoldOrderEntity.getId();
+ FollowFollowerOrderRelationEntity FollowFollowerOrderRelation = followFollowerOrderRelationDao.selectNowOneByorderId(orderId);
+ 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();
@@ -316,6 +335,8 @@
// 获取最新价
BigDecimal newPrice = new BigDecimal(redisUtils.getString(CoinTypeConvert.convertToKey(contractHoldOrderEntity.getSymbol())));
+ myFollowOrderVo.setNewPrice(newPrice);
+
BigDecimal lotNumber = cacheSettingUtils.getSymbolSku(contractHoldOrderEntity.getSymbol());
// 盈亏
BigDecimal rewardRatio = BigDecimal.ZERO;
@@ -353,9 +374,7 @@
public Result getMyFollowTraderInfo(@Valid MyFollowTraderInfoDto myFollowTraderInfoDto) {
//获取用户ID
Long memberId = LoginUserUtils.getAppLoginUser().getId();
-
- Page<MyFollowTraderInfoVo> result = new Page<>();
- List<MyFollowTraderInfoVo> myFollowOrderVos = result.getRecords();
+ List<MyFollowTraderInfoVo> myFollowOrderVos = new ArrayList<>();
Page<FollowFollowerProfitEntity> page = new Page<>(myFollowTraderInfoDto.getPageNum(), myFollowTraderInfoDto.getPageSize());
IPage<FollowFollowerProfitEntity> followFollowerProfitEntitys = followFollowerProfitDao.selectFollowFollowerProfitEntitys(page, memberId);
@@ -377,7 +396,7 @@
myFollowOrderVos.add(myFollowTraderInfoVo);
}
}
- return Result.ok(result);
+ return Result.ok(myFollowOrderVos);
}
@Override
@@ -530,6 +549,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 f24dcfb..10e3018 100644
--- a/src/main/resources/mapper/documentary/FollowFollowerOrderRelationDao.xml
+++ b/src/main/resources/mapper/documentary/FollowFollowerOrderRelationDao.xml
@@ -10,4 +10,20 @@
where a.order_id=b.id and a.order_type=1 and a.trade_member_id=#{tradeMemberId}
and a.member_id=#{memberId}
</select>
+
+ <select id="selectHistoryOneByorderId" resultType="com.xcong.excoin.modules.documentary.entity.FollowFollowerOrderRelationEntity">
+ SELECT
+ *
+ FROM
+ follow_follower_order_relation
+ WHERE order_id = #{orderId} and order_type = 2
+ </select>
+ <select id="selectNowOneByorderId" resultType="com.xcong.excoin.modules.documentary.entity.FollowFollowerOrderRelationEntity">
+ SELECT
+ *
+ FROM
+ follow_follower_order_relation
+ WHERE order_id = #{orderId} and order_type = 1
+ </select>
+
</mapper>
\ No newline at end of file
diff --git a/src/main/resources/mapper/documentary/FollowFollowerProfitDao.xml b/src/main/resources/mapper/documentary/FollowFollowerProfitDao.xml
index 11172c4..d016055 100644
--- a/src/main/resources/mapper/documentary/FollowFollowerProfitDao.xml
+++ b/src/main/resources/mapper/documentary/FollowFollowerProfitDao.xml
@@ -40,7 +40,7 @@
and contract_type = 2
and order_type in (3,4)
and closing_type not in (4,5)
- order by opening_time desc
+ order by create_time desc
</select>
<select id="getMyFollowOrderNowRecords" resultType="com.xcong.excoin.modules.contract.entity.ContractHoldOrderEntity">
SELECT
@@ -50,7 +50,7 @@
WHERE
member_id = #{memberId}
and contract_type = 2
- order by opening_time desc
+ order by create_time desc
</select>
<select id="getFollowOrderNowRecords" resultType="com.xcong.excoin.modules.contract.entity.ContractHoldOrderEntity">
--
Gitblit v1.9.1