From 1ff9db0d954efc5d0f8eb9e930af030c37fe36cd Mon Sep 17 00:00:00 2001
From: xiaoyong931011 <15274802129@163.com>
Date: Tue, 02 Mar 2021 18:15:34 +0800
Subject: [PATCH] Merge branch 'whole_new' of http://120.27.238.55:7000/r/exchange into whole_new

---
 src/main/java/com/xcong/excoin/modules/documentary/service/impl/DocumentaryServiceImpl.java |  146 +++++++++++++++++++++++++++++++++++++-----------
 1 files changed, 111 insertions(+), 35 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 cb4d891..2609225 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,8 +16,10 @@
 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;
@@ -32,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;
@@ -51,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;
@@ -68,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;
@@ -80,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
@@ -116,6 +122,8 @@
     private FollowFollowerOrderRelationDao followFollowerOrderRelationDao;
     @Resource
     private FollowFollowerNoticeDao followFollowerNoticeDao;
+    @Resource
+    private FollowTraderLabelDao followTraderLabelDao;
     
 	
 	@Override
@@ -165,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
@@ -185,7 +221,8 @@
         		historyOrderRecordsVo.setClosingPrice(closingPrice);
         		BigDecimal openingPrice = historyOrderRecordsVo.getOpeningPrice().setScale(2, BigDecimal.ROUND_DOWN);
         		historyOrderRecordsVo.setOpeningPrice(openingPrice);
-        	}
+				historyOrderRecordsVo.setClosingTimeStamp(historyOrderRecordsVo.getClosingTime().getTime());
+			}
         }
 		return Result.ok(historyOrderRecordsVoList);
 	}
@@ -272,38 +309,41 @@
         			MyFollowOrderVo myFollowOrderVo = new MyFollowOrderVo();
         			//获取交易员信息
 					Long orderId = contractOrderEntity.getId();
-					myFollowOrderVo.setOrderId(orderId);
 					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();
-        			myFollowOrderVo.setOrderType(orderType);
-        			int leverRatio = contractOrderEntity.getLeverRatio();
-        			myFollowOrderVo.setLeverRatio(leverRatio);
-        			BigDecimal rewardAmount = contractOrderEntity.getRewardAmount().setScale(2, BigDecimal.ROUND_DOWN);
-        			myFollowOrderVo.setRewardAmount(rewardAmount);
-        			BigDecimal rewardRatio = contractOrderEntity.getRewardRatio().setScale(4, BigDecimal.ROUND_DOWN);
-        			myFollowOrderVo.setRewardRatio(rewardRatio);
-        			int symbolCnt = contractOrderEntity.getSymbolCnt();
-        			myFollowOrderVo.setSymbolCnt(symbolCnt);
-        			BigDecimal bondAmount = contractOrderEntity.getBondAmount().setScale(2, BigDecimal.ROUND_DOWN);
-        			myFollowOrderVo.setBondAmount(bondAmount);
-        			BigDecimal openingPrice = contractOrderEntity.getOpeningPrice().setScale(2, BigDecimal.ROUND_DOWN);
-        			myFollowOrderVo.setOpeningPrice(openingPrice);
-        			BigDecimal closingPrice = contractOrderEntity.getClosingPrice().setScale(2, BigDecimal.ROUND_DOWN);
-        			myFollowOrderVo.setClosingPrice(closingPrice);
-        			Date openingTime = contractOrderEntity.getOpeningTime();
-        			myFollowOrderVo.setOpeningTime(openingTime);
-        			Date closingTime = contractOrderEntity.getClosingTime();
-        			myFollowOrderVo.setClosingTime(closingTime);
-        			String orderNo = contractOrderEntity.getOrderNo();
-        			myFollowOrderVo.setOrderNo(orderNo);
-        			myFollowOrderVos.add(myFollowOrderVo);
+					if(ObjectUtil.isNotEmpty(FollowFollowerOrderRelation)) {
+						myFollowOrderVo.setOrderId(orderId);
+						Long tradeId = FollowFollowerOrderRelation.getTradeId();
+						FollowTraderInfoEntity followTraderInfoEntity = followTraderInfoDao.selectById(tradeId);
+						if(ObjectUtil.isNotEmpty(followTraderInfoEntity)) {
+							String nickname = followTraderInfoEntity.getNickname();
+							myFollowOrderVo.setNickname(nickname);
+						}
+						String symbol = contractOrderEntity.getSymbol();
+						myFollowOrderVo.setSymbol(symbol);
+						int orderType = contractOrderEntity.getOrderType();
+						myFollowOrderVo.setOrderType(orderType);
+						int leverRatio = contractOrderEntity.getLeverRatio();
+						myFollowOrderVo.setLeverRatio(leverRatio);
+						BigDecimal rewardAmount = contractOrderEntity.getRewardAmount().setScale(2, BigDecimal.ROUND_DOWN);
+						myFollowOrderVo.setRewardAmount(rewardAmount);
+						BigDecimal rewardRatio = contractOrderEntity.getRewardRatio().setScale(4, BigDecimal.ROUND_DOWN);
+						myFollowOrderVo.setRewardRatio(rewardRatio);
+						int symbolCnt = contractOrderEntity.getSymbolCnt();
+						myFollowOrderVo.setSymbolCnt(symbolCnt);
+						BigDecimal bondAmount = contractOrderEntity.getBondAmount().setScale(2, BigDecimal.ROUND_DOWN);
+						myFollowOrderVo.setBondAmount(bondAmount);
+						BigDecimal openingPrice = contractOrderEntity.getOpeningPrice().setScale(2, BigDecimal.ROUND_DOWN);
+						myFollowOrderVo.setOpeningPrice(openingPrice);
+						BigDecimal closingPrice = contractOrderEntity.getClosingPrice().setScale(2, BigDecimal.ROUND_DOWN);
+						myFollowOrderVo.setClosingPrice(closingPrice);
+						Date openingTime = contractOrderEntity.getOpeningTime();
+						myFollowOrderVo.setOpeningTime(openingTime);
+						Date closingTime = contractOrderEntity.getClosingTime();
+						myFollowOrderVo.setClosingTime(closingTime);
+						String orderNo = contractOrderEntity.getOrderNo();
+						myFollowOrderVo.setOrderNo(orderNo);
+						myFollowOrderVos.add(myFollowOrderVo);
+					}
         		}
         	}
 		return Result.ok(myFollowOrderVos);
@@ -690,9 +730,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);
@@ -744,6 +784,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);
 	}
 
@@ -760,6 +813,8 @@
         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);
@@ -767,7 +822,7 @@
         followTraderInfoDao.updateById(followTraderInfoEntity);
 		return Result.ok(MessageSourceUtils.getString("member_service_0024"));
 	}
-
+	
 	@Override
 	public Result getTradeProfitInfo() {
 		//获取用户ID
@@ -1053,6 +1108,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