From 05c74ca131add20dbcf23dc109e63c21b3e2be29 Mon Sep 17 00:00:00 2001
From: Helius <wangdoubleone@gmail.com>
Date: Wed, 24 Feb 2021 18:11:57 +0800
Subject: [PATCH] Merge branch 'whole_new_trc20' into whole_new
---
src/main/java/com/xcong/excoin/modules/documentary/service/impl/DocumentaryServiceImpl.java | 106 ++++++++++++++++++++++++++++++++++++++++++++++++++---
1 files changed, 100 insertions(+), 6 deletions(-)
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 5a23cb7..de44524 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,14 +16,17 @@
import org.springframework.transaction.annotation.Transactional;
import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.taobao.api.internal.toplink.embedded.websocket.util.StringUtil;
import com.xcong.excoin.common.LoginUserUtils;
import com.xcong.excoin.common.response.Result;
import com.xcong.excoin.modules.coin.dao.OrderCoinsDao;
import com.xcong.excoin.modules.coin.parameter.dto.RecordsPageDto;
import com.xcong.excoin.modules.contract.dao.ContractHoldOrderDao;
import com.xcong.excoin.modules.contract.dao.ContractOrderDao;
+import com.xcong.excoin.modules.contract.entity.ContractEntrustOrderEntity;
import com.xcong.excoin.modules.contract.entity.ContractHoldOrderEntity;
import com.xcong.excoin.modules.contract.entity.ContractOrderEntity;
import com.xcong.excoin.modules.documentary.dao.FollowFollowerNoticeDao;
@@ -31,6 +34,7 @@
import com.xcong.excoin.modules.documentary.dao.FollowFollowerProfitDao;
import com.xcong.excoin.modules.documentary.dao.FollowFollowerSettingDao;
import com.xcong.excoin.modules.documentary.dao.FollowTraderInfoDao;
+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.CancelDocumentaryOrderSetDto;
@@ -50,6 +54,7 @@
import com.xcong.excoin.modules.documentary.entity.FollowFollowerProfitEntity;
import com.xcong.excoin.modules.documentary.entity.FollowFollowerSettingEntity;
import com.xcong.excoin.modules.documentary.entity.FollowTraderInfoEntity;
+import com.xcong.excoin.modules.documentary.entity.FollowTraderLabelEntity;
import com.xcong.excoin.modules.documentary.entity.FollowTraderProfitInfoEntity;
import com.xcong.excoin.modules.documentary.service.DocumentaryService;
import com.xcong.excoin.modules.documentary.vo.DocumentaryOrderInfoVo;
@@ -67,6 +72,7 @@
import com.xcong.excoin.modules.documentary.vo.TradeOrderInfoVo;
import com.xcong.excoin.modules.documentary.vo.TradeProfitInfoVo;
import com.xcong.excoin.modules.documentary.vo.TradeSetInfoVo;
+import com.xcong.excoin.modules.documentary.vo.TradeSetLabelInfoVo;
import com.xcong.excoin.modules.documentary.vo.TraderStatusVo;
import com.xcong.excoin.modules.member.dao.MemberDao;
import com.xcong.excoin.modules.member.dao.MemberLevelRateDao;
@@ -79,6 +85,7 @@
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
+import jnr.ffi.Struct.int16_t;
import lombok.extern.slf4j.Slf4j;
@Slf4j
@@ -115,6 +122,8 @@
private FollowFollowerOrderRelationDao followFollowerOrderRelationDao;
@Resource
private FollowFollowerNoticeDao followFollowerNoticeDao;
+ @Resource
+ private FollowTraderLabelDao followTraderLabelDao;
@Override
@@ -164,9 +173,37 @@
FollowTraderProfitInfoVo.setDeclaration(declaration);
Integer isAll = followTraderInfoEntity.getIsAll();
FollowTraderProfitInfoVo.setIsAll(isAll);
+
+ String labels = followTraderInfoEntity.getLabels();
+ if(StrUtil.isNotEmpty(labels)) {
+ ArrayList<FollowTraderLabelEntity> arrayList = new ArrayList<>();
+ String[] split = labels.split(",");
+ int length = split.length;
+ for(int i = 0;i < length;i++) {
+ String string = split[i];
+ FollowTraderLabelEntity selectById = followTraderLabelDao.selectById(Long.parseLong(string));
+ arrayList.add(selectById);
+ }
+ FollowTraderProfitInfoVo.setLabels(arrayList);
+ }
+
}
}
return Result.ok(followTraderProfitInfoVoList);
+ }
+
+ public static void main(String[] args) {
+ String labels = "1,2,3";
+ if(StrUtil.isNotEmpty(labels)) {
+ String labelsName = "";
+ String[] split = labels.split(",");
+ int length = split.length;
+ for(int i = 0;i < length;i++) {
+ String string = split[i];
+ labelsName += (string + ",");
+ }
+ System.out.println(labelsName);
+ }
}
@Override
@@ -458,6 +495,20 @@
if (traderInfoEntity != null) {
return Result.fail(MessageSourceUtils.getString("documentary_service_0014"));
}
+
+ //判断当前用户是否是逐仓模式
+ MemberEntity selectById2 = memberDao.selectById(memberId);
+ Integer contractPositionType = selectById2.getContractPositionType();
+ if(ContractEntrustOrderEntity.POSITION_TYPE_ADD != contractPositionType) {
+ return Result.fail(MessageSourceUtils.getString("documentary_service_0017"));
+ }
+
+ //判断交易员是否开启了跟单
+ FollowTraderInfoEntity selectById = followTraderInfoDao.selectById(traderId);
+ Integer isOpen = selectById.getIsOpen();
+ if(FollowTraderInfoEntity.ISOPEN_Y != isOpen) {
+ return Result.fail(MessageSourceUtils.getString("documentary_service_0016"));
+ }
FollowFollowerSettingEntity isExistSetting = followFollowerSettingDao.selectOneBymemberIdAndTradeId(memberId, traderId);
if (isExistSetting == null) {
@@ -675,9 +726,9 @@
String phone = memberEntity.getPhone();
String email = memberEntity.getEmail();
if(StrUtil.isNotEmpty(phone)) {
- followTraderInfoEntity.setNickname(phone);
+ followTraderInfoEntity.setNickname(phone.replaceAll("(\\d{3})\\d{4}(\\d{4})", "$1****$2"));
}else {
- followTraderInfoEntity.setNickname(email);
+ followTraderInfoEntity.setNickname(email.replaceAll("(\\w?)(\\w+)(\\w)(@\\w+\\.[a-z]+(\\.[a-z]+)?)","$1****$3$4"));
}
followTraderInfoEntity.setDeclaration(FollowTraderInfoEntity.DECLARATION_DEFAULT);
followTraderInfoEntity.setIsAll(FollowTraderInfoEntity.IS_ALL_N);
@@ -719,6 +770,8 @@
FollowTraderInfoEntity followTraderInfoEntity = followTraderInfoDao.selectTraderInfoByMemberId(memberId);
TradeSetInfoVo tradeSetInfoVo = new TradeSetInfoVo();
+ Long id = followTraderInfoEntity.getId();
+ tradeSetInfoVo.setTradeId(id);
String avatar = followTraderInfoEntity.getAvatar();
tradeSetInfoVo.setAvatar(avatar);
String nickname = followTraderInfoEntity.getNickname();
@@ -727,6 +780,19 @@
tradeSetInfoVo.setDeclaration(declaration);
Integer isOpen = followTraderInfoEntity.getIsOpen();
tradeSetInfoVo.setIsOpen(isOpen);
+
+ String labels = followTraderInfoEntity.getLabels();
+ if(StrUtil.isNotEmpty(labels)) {
+ ArrayList<FollowTraderLabelEntity> arrayList = new ArrayList<>();
+ String[] split = labels.split(",");
+ int length = split.length;
+ for(int i = 0;i < length;i++) {
+ String string = split[i];
+ FollowTraderLabelEntity selectById = followTraderLabelDao.selectById(Long.parseLong(string));
+ arrayList.add(selectById);
+ }
+ tradeSetInfoVo.setFollowTraderLabelEntitys(arrayList);
+ }
return Result.ok(tradeSetInfoVo);
}
@@ -735,10 +801,16 @@
//获取用户ID
Long memberId = LoginUserUtils.getAppLoginUser().getId();
FollowTraderInfoEntity followTraderInfoEntity = followTraderInfoDao.selectTraderInfoByMemberId(memberId);
+ /**
+ * todo
+ * 当前交易员有合约多单,是否可以直接调整【是否带单】,是否需要在调整前【判断是否已经有带单的合约单】
+ */
String avatar = updateTradeSetInfoDto.getAvatar();
String nickname = updateTradeSetInfoDto.getNickname();
String declaration = updateTradeSetInfoDto.getDeclaration();
int isOpen = updateTradeSetInfoDto.getIsOpen();
+ String labels = updateTradeSetInfoDto.getLabels();
+ followTraderInfoEntity.setLabels(labels);
followTraderInfoEntity.setAvatar(avatar);
followTraderInfoEntity.setNickname(nickname);
followTraderInfoEntity.setDeclaration(declaration);
@@ -746,7 +818,7 @@
followTraderInfoDao.updateById(followTraderInfoEntity);
return Result.ok(MessageSourceUtils.getString("member_service_0024"));
}
-
+
@Override
public Result getTradeProfitInfo() {
//获取用户ID
@@ -874,8 +946,9 @@
BigDecimal allRewardRatio = BigDecimal.ZERO;
Long orderId = contractOrderEntity.getId();
+ String orderNo = contractOrderEntity.getOrderNo();
Map<String, Object> columnMapRelation = new HashMap<>();
- columnMapRelation.put("trade_order_no", orderId);
+ columnMapRelation.put("trade_order_no", orderNo);
columnMapRelation.put("trade_member_id", memberId);
columnMapRelation.put("order_type", 2);
columnMapRelation.put("is_show", 1);
@@ -927,7 +1000,7 @@
myFollowOrderVo.setOpeningTime(openingTime);
Date closingTime = contractOrderEntity.getClosingTime();
myFollowOrderVo.setClosingTime(closingTime);
- String orderNo = contractOrderEntity.getOrderNo();
+
myFollowOrderVo.setOrderNo(orderNo);
myFollowOrderVos.add(myFollowOrderVo);
}
@@ -1000,7 +1073,7 @@
FollowTraderInfoEntity traderInfoEntity = followTraderInfoDao.selectTraderInfoByMemberId(memberId);
if (traderInfoEntity != null) {
- LogRecordUtils.insertFollowerNotice(memberId, NoticeConstant.STOP_FOLLOW_TITLE, StrUtil.format(NoticeConstant.STOP_FOLLOW_CONTENT, traderInfoEntity.getNickname()));
+ LogRecordUtils.insertFollowerNotice(followMemberId, NoticeConstant.STOP_FOLLOW_TITLE, StrUtil.format(NoticeConstant.STOP_FOLLOW_CONTENT, traderInfoEntity.getNickname()));
}
return Result.ok(MessageSourceUtils.getString("member_service_0026"));
}
@@ -1031,6 +1104,27 @@
return Result.ok(arrayList);
}
+
+ @Override
+ public Result getTradeSetLabelInfo() {
+ //获取用户ID
+ Long memberId = LoginUserUtils.getAppLoginUser().getId();
+
+ Map<String, Object> columnMap = new HashMap<>();
+ List<FollowTraderLabelEntity> selectByMap = followTraderLabelDao.selectByMap(columnMap);
+ ArrayList<TradeSetLabelInfoVo> arrayList = new ArrayList<>();
+ if(CollUtil.isNotEmpty(selectByMap)) {
+ for(FollowTraderLabelEntity followTraderLabelEntity : selectByMap) {
+ TradeSetLabelInfoVo tradeSetLabelInfoVo = new TradeSetLabelInfoVo();
+ Long id = followTraderLabelEntity.getId();
+ String labels = followTraderLabelEntity.getLabels();
+ tradeSetLabelInfoVo.setId(id);
+ tradeSetLabelInfoVo.setLabels(labels);
+ arrayList.add(tradeSetLabelInfoVo);
+ }
+ }
+ return Result.ok(arrayList);
+ }
--
Gitblit v1.9.1