From 7572b8dbd4c41ca9b6437a032da2aa1a0fdd5444 Mon Sep 17 00:00:00 2001
From: xiaoyong931011 <15274802129@163.com>
Date: Mon, 17 May 2021 18:18:09 +0800
Subject: [PATCH] 20210517 云顶

---
 src/main/java/com/xcong/excoin/modules/member/service/impl/MemberServiceImpl.java |   88 ++++++++++++++++++++++++++++++++++----------
 1 files changed, 68 insertions(+), 20 deletions(-)

diff --git a/src/main/java/com/xcong/excoin/modules/member/service/impl/MemberServiceImpl.java b/src/main/java/com/xcong/excoin/modules/member/service/impl/MemberServiceImpl.java
index 9b7e2a7..6c74a62 100644
--- a/src/main/java/com/xcong/excoin/modules/member/service/impl/MemberServiceImpl.java
+++ b/src/main/java/com/xcong/excoin/modules/member/service/impl/MemberServiceImpl.java
@@ -13,8 +13,10 @@
 import com.xcong.excoin.common.configure.FebsConfigure;
 import com.xcong.excoin.common.entity.FebsResponse;
 import com.xcong.excoin.common.entity.QueryRequest;
+import com.xcong.excoin.common.exception.GlobalException;
 import com.xcong.excoin.modules.Sms106Send;
 import com.xcong.excoin.modules.member.dto.MemberDetailConfirmDto;
+import com.xcong.excoin.modules.member.entity.ActivityReceiveRecord;
 import com.xcong.excoin.modules.member.entity.AgentFriendRelationEntity;
 import com.xcong.excoin.modules.member.entity.MemberAccountMoneyChangeEntity;
 import com.xcong.excoin.modules.member.entity.MemberAuthenticationEntity;
@@ -34,6 +36,7 @@
 import com.xcong.excoin.modules.member.mapper.MemberQuickBuySaleMapper;
 import com.xcong.excoin.modules.member.mapper.MemberWalletCoinMapper;
 import com.xcong.excoin.modules.member.service.IMemberService;
+import com.xcong.excoin.modules.member.vo.MemberActivityReceiveVo;
 import com.xcong.excoin.modules.member.vo.MemberAuthenticationVo;
 import com.xcong.excoin.modules.member.vo.MemberCoinChargeVo;
 import com.xcong.excoin.modules.member.vo.MemberCoinWithdrawVo;
@@ -42,8 +45,11 @@
 import com.xcong.excoin.modules.member.vo.MemberQuickBuySaleVo;
 import com.xcong.excoin.modules.member.vo.MemberQuickSaleVo;
 
+import com.xcong.excoin.modules.yunding.entity.BasicLevelSettingEntity;
+import com.xcong.excoin.modules.yunding.mapper.BasicLevelSettingMapper;
 import lombok.RequiredArgsConstructor;
 import java.math.BigDecimal;
+import java.text.DecimalFormat;
 import java.text.SimpleDateFormat;
 import java.util.ArrayList;
 import java.util.Date;
@@ -86,6 +92,8 @@
 	private final MemberAuthenticationMapper memberAuthenticationMapper;
 	
 	private final AgentFriendRelationMapper agentFriendRelationMapper;
+
+	private final BasicLevelSettingMapper basicLevelSettingMapper;
 	
 	@Override
 	public IPage<AgentFriendRelationEntity> findAgentInfoListInPage(AgentFriendRelationEntity agentFriendRelationEntity,
@@ -202,6 +210,10 @@
         		String firstName = (memberEntitys.getFirstName() == null ? "" : memberEntitys.getFirstName());
         		String secondName = (memberEntitys.getSecondName() == null ? "" : memberEntitys.getSecondName());
         		memberEntitys.setRealName(firstName+secondName);
+				if (memberEntitys.getAgentLevel() != null) {
+					BasicLevelSettingEntity agent = basicLevelSettingMapper.selectById(memberEntitys.getAgentLevel().longValue());
+					memberEntitys.setAgentName(agent.getName());
+				}
         	}
         }
         return selectMemberListInPage;
@@ -496,7 +508,7 @@
 		String address = selectById.getAddress();
 		int status = selectById.getStatus();
 		if(status != 1) {
-			return new FebsResponse().fail().message("只有等待审核的状态才能确认!");
+			return new FebsResponse().message("只有等待审核的状态才能确认!");
 		}
 		
 		// 查询币币钱包
@@ -510,15 +522,33 @@
 		memberWalletCoinMapper.updateById(walletCoin);
 		
 		if ("Y".equals(selectById.getIsInside())) {
-			Map<String, Object> columnMap = new HashMap<>();
-			columnMap.put("symbol", symbol);
-			columnMap.put("address", address);
-			// 如果是内部转账 则需要将币加到内部地址
-			List<MemberCoinAddressEntity> selectByMap = memberCoinAddressMapper.selectByMap(columnMap);
-			if(selectByMap == null || selectByMap.isEmpty()) {
-				return new FebsResponse().fail().message("地址有误,请拒绝!");
+
+			Long aimMemberId = null;
+			if(symbol.equals("XCH")){
+				MemberEntity memberEntity = memberMapper.selectMemberByInviteId(address);
+				if (memberEntity == null) {
+					throw new GlobalException("地址有误或用户不存在,请拒绝!");
+				}
+				aimMemberId = memberEntity.getId();
+			}else{
+				Map<String, Object> columnMap = new HashMap<>();
+				columnMap.put("symbol", symbol);
+				columnMap.put("address", address);
+				// 如果是内部转账 则需要将币加到内部地址
+				List<MemberCoinAddressEntity> selectByMap = memberCoinAddressMapper.selectByMap(columnMap);
+				if(CollUtil.isEmpty(selectByMap)) {
+//				return new FebsResponse().message("地址有误,请拒绝!");
+//				throw new GlobalException("地址有误,请拒绝!");
+					MemberEntity memberEntity = memberMapper.selectMemberInfoByQueryKey(address);
+					if (memberEntity == null) {
+						throw new GlobalException("地址有误或用户不存在,请拒绝!");
+					}
+
+					aimMemberId = memberEntity.getId();
+				} else {
+					aimMemberId = selectByMap.get(0).getMemberId();
+				}
 			}
-			Long aimMemberId = selectByMap.get(0).getMemberId();
 			MemberWalletCoinEntity aimWalletCoin = memberWalletCoinMapper.findWalletCoinByMemberIdAndWalletCode(aimMemberId, symbol);
 			
 			BigDecimal addTotal = aimWalletCoin.getTotalBalance().add(selectById.getAmount());
@@ -561,7 +591,7 @@
 
 		log.info("---->{}", phone);
 		if(StrUtil.isNotBlank(phone)) {
-			Sms106Send.sendWithdrawalCoinMsg(phone, time);
+			Sms106Send.sendWithdrawalCoinMsg(phone, new Date(), selectById.getAmount().toString());
 		}
 		/**
 		//短信提醒
@@ -2264,7 +2294,7 @@
 				+(walletCoinNum == null ? 0 : Double.parseDouble(walletCoinNum))
 				+(agentNum == null ? 0 : Double.parseDouble(agentNum));
 		
-		double platformProfitAndLoss = 0 ;
+		double platformProfitAndLoss = 0.00 ;
 		platformProfitAndLoss = platformProfitAndLoss + (totalAmountUsdtB == null ? 0 : Double.parseDouble(totalAmountUsdtB));
 		platformProfitAndLoss = platformProfitAndLoss + (totalAmountUsdtCZ == null ? 0 : Double.parseDouble(totalAmountUsdtCZ));
 		platformProfitAndLoss = platformProfitAndLoss - (totalAmountUsdtS == null ? 0 : Double.parseDouble(totalAmountUsdtS));
@@ -2272,26 +2302,44 @@
 		
 		List<MemberDataInfoVo> records = selectMemberListInPage.getRecords();
 		for(MemberDataInfoVo memberDataInfoVo : records) {
+			DecimalFormat df = new DecimalFormat("0.00");
 			memberDataInfoVo.setChargeUsdt(totalAmountUsdtCZ == null ? 0 : Double.parseDouble(totalAmountUsdtCZ));
 			memberDataInfoVo.setAppealUsdt(totalAmountUsdtTX == null ? 0 : Double.parseDouble(totalAmountUsdtTX));
 			memberDataInfoVo.setChargeCoin(totalAmountUsdtB == null ? 0 : Double.parseDouble(totalAmountUsdtB));
 			memberDataInfoVo.setAppealCoin(totalAmountUsdtS == null ? 0 : Double.parseDouble(totalAmountUsdtS));
-			memberDataInfoVo.setClosingPrice(closingpriceByMid == null ? "0" : closingpriceByMid);
-			memberDataInfoVo.setSellClosingPrice(sellClosingpriceByMid == null ? "0" : sellClosingpriceByMid);
-			memberDataInfoVo.setFee(returnMoneyByMid == null ? "0" : returnMoneyByMid);
-			memberDataInfoVo.setYingkui(rewardratioByMid == null ? "0" : rewardratioByMid);
+			memberDataInfoVo.setClosingPrice(closingpriceByMid == "0" ? "0" : df.format(Double.parseDouble(closingpriceByMid)));
+			memberDataInfoVo.setSellClosingPrice(sellClosingpriceByMid == "0" ? "0" : df.format(Double.parseDouble(sellClosingpriceByMid)));
+			memberDataInfoVo.setFee(returnMoneyByMid == "0" ? "0" : df.format(Double.parseDouble(returnMoneyByMid)));
+			memberDataInfoVo.setYingkui(rewardratioByMid == null ? "0" : df.format(Double.parseDouble(rewardratioByMid)));
 			memberDataInfoVo.setNotNullNumber(notNullNumber == null ? "0" : notNullNumber);
 			memberDataInfoVo.setWalletNumber(walletNumber == null ? "0" : walletNumber);
 			memberDataInfoVo.setWalletCoinNumber(walletCoinNumber == null ? "0" : walletCoinNumber);
-			memberDataInfoVo.setPlatformProfitAndLoss(platformProfitAndLoss == 0 ? "0" : platformProfitAndLoss+"");
-			memberDataInfoVo.setDoingPrice(doingPrice == null ? "0" : doingPrice);
-			memberDataInfoVo.setWalletNum(walletNum == null ? "0" : walletNum);
-			memberDataInfoVo.setWalletCoinNum(walletCoinNum == null ? "0" : walletCoinNum);
-			memberDataInfoVo.setAgentNum(agentNum == null ? "0" : agentNum);
+			memberDataInfoVo.setPlatformProfitAndLoss(platformProfitAndLoss == 0.00 ? "0" : df.format(platformProfitAndLoss));
+			memberDataInfoVo.setDoingPrice(doingPrice == "0" ? "0" : df.format(Double.parseDouble(doingPrice)));
+			memberDataInfoVo.setWalletNum(walletNum == null ? "0" : df.format(Double.parseDouble(walletNum)));
+			memberDataInfoVo.setWalletCoinNum(walletCoinNum == null ? "0" : df.format(Double.parseDouble(walletCoinNum)));
+			memberDataInfoVo.setAgentNum(agentNum == null ? "0" : df.format(Double.parseDouble(agentNum)));
 			memberDataInfoVo.setAllCoin(allCoin);
 		}
 		selectMemberListInPage.setTotal(1);
 		return selectMemberListInPage;
 	}
 
+
+	@Override
+	public IPage<MemberActivityReceiveVo> memberActivityReceive(ActivityReceiveRecord activityReceiveRecord,
+			QueryRequest request) {
+
+		Page<ActivityReceiveRecord> page = new Page<>(request.getPageNum(), request.getPageSize());
+		return memberMapper.memberActivityReceive(page, activityReceiveRecord);
+	}
+
+
+	@Override
+	public IPage<ActivityReceiveRecord> seeReceiveInfo(QueryRequest request,
+			ActivityReceiveRecord activityReceiveRecord) {
+		Page<ActivityReceiveRecord> page = new Page<>(request.getPageNum(), request.getPageSize());
+		return memberMapper.seeReceiveInfo(page, activityReceiveRecord);
+	}
+
 }

--
Gitblit v1.9.1