From 809b41916cbf53219aca69d94e45effae5ac160b Mon Sep 17 00:00:00 2001
From: xiaoyong931011 <15274802129@163.com>
Date: Thu, 27 May 2021 10:16:51 +0800
Subject: [PATCH] 20210527 不显示合伙人
---
src/main/java/com/xcong/excoin/modules/yunding/service/Impl/YunDingServiceImpl.java | 80 ++++++++++++++++++++++++++++++++-------
1 files changed, 65 insertions(+), 15 deletions(-)
diff --git a/src/main/java/com/xcong/excoin/modules/yunding/service/Impl/YunDingServiceImpl.java b/src/main/java/com/xcong/excoin/modules/yunding/service/Impl/YunDingServiceImpl.java
index 616cdaa..ab06c0e 100644
--- a/src/main/java/com/xcong/excoin/modules/yunding/service/Impl/YunDingServiceImpl.java
+++ b/src/main/java/com/xcong/excoin/modules/yunding/service/Impl/YunDingServiceImpl.java
@@ -1,7 +1,6 @@
package com.xcong.excoin.modules.yunding.service.Impl;
import cn.hutool.core.collection.CollUtil;
-import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
@@ -42,7 +41,6 @@
import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.util.Date;
-import java.util.HashMap;
import java.util.List;
@Slf4j
@@ -109,7 +107,7 @@
for(YdProductVo ydProductVo : records){
ydProductVo.setProfitT(prifitT);
- if(ydProductVo.getTotalT().compareTo(BigDecimal.ZERO) < 1) {
+ if(ydProductVo.getSurplusT().compareTo(BigDecimal.ZERO) < 1) {
ydProductVo.setStatus(2);
}
}
@@ -148,10 +146,8 @@
Date endTime = DateUtil.offsetDay(workTime, proCycle);
ydProductVo.setEndTime(endTime);
- if (ydProductVo.getTotalT().compareTo(BigDecimal.ZERO) < 1) {
+ if (ydProductVo.getSurplusT().compareTo(BigDecimal.ZERO) < 1) {
ydProductVo.setStatus(2);
- } else {
- ydProductVo.setStatus(1);
}
return Result.ok(ydProductVo);
}
@@ -231,12 +227,14 @@
quantityOwn = quantityOwn + ydOrderEntity.getQuantity();
}
}
- if(quantityOwn >= limitedNum){
+ int quantityInt = quantity.intValue();
+ if(quantityOwn + quantityInt > limitedNum){
return Result.fail("产品限购"+limitedNum);
}
- if (quantity.compareTo(BigDecimal.valueOf(ydProductEntity.getLimitedNum())) < 1) {
- return Result.fail("产品限购" + ydProductEntity.getLimitedNum());
- }
+
+// if (quantity.compareTo(BigDecimal.valueOf(ydProductEntity.getLimitedNum())) < 1) {
+// return Result.fail("产品限购" + ydProductEntity.getLimitedNum());
+// }
BigDecimal salePrice = ydProductEntity.getSalePrice();
//剩余产品数量
BigDecimal surplusT = ydProductEntity.getSurplusT();
@@ -280,7 +278,6 @@
"USDT", 1, 3, ydOrderEntity.getId());
yunDingProducter.sendYunDingUsdtProfit(ydOrderEntity.getId());
- yunDingProducter.sendYunDingAutoAgent(ydOrderEntity.getMemberId());
return Result.ok("支付成功");
}
@@ -454,13 +451,13 @@
MemberWalletCoinEntity xch = memberWalletCoinDao.selectWalletCoinBymIdAndCode(memberId, "XCH");
BigDecimal totalBalance = xch.getTotalBalance();
BigDecimal subtractTotalBalance = totalBalance.subtract(xchNum);
- if(BigDecimal.ZERO.compareTo(subtractTotalBalance) >= 0){
+ if(BigDecimal.ZERO.compareTo(subtractTotalBalance) > 0){
return Result.fail("XCH数量不足");
}
BigDecimal availableBalance = xch.getAvailableBalance();
BigDecimal subtractAvailableBalance = availableBalance.subtract(xchNum);
- if(BigDecimal.ZERO.compareTo(subtractAvailableBalance) >= 0){
+ if(BigDecimal.ZERO.compareTo(subtractAvailableBalance) > 0){
return Result.fail("XCH数量不足");
}
//xch减少
@@ -585,7 +582,6 @@
memberEntity.setAgentLevel(id.intValue());
LoginUserUtils.resetAppLoginUser(memberEntity);
- yunDingProducter.sendYunDingAutoAgent(memberId);
yunDingProducter.sendYunDingUsdtProfit(orderEntity.getId());
return Result.ok("购买成功");
}
@@ -593,8 +589,62 @@
@Override
public Result getXchPrice() {
log.info("获取XCH当前价");
+ BigDecimal xchNewPrices = BigDecimal.ZERO;
String xchNewPrice = redisUtils.getString("XCH_NEW_PRICE");
- return Result.ok(Long.parseLong(xchNewPrice));
+ if(StrUtil.isNotEmpty(xchNewPrice)){
+ xchNewPrices = new BigDecimal(xchNewPrice);
+ }
+ return Result.ok(xchNewPrices);
+ }
+
+ @Override
+ public Result getTeamList(TeamInfoDto teamInfoDto) {
+ log.info("获取团队信息");
+ MemberEntity memberEntity = LoginUserUtils.getAppLoginUser();
+ Long memberId = memberEntity.getId();
+// Long memberId = 444L;
+// MemberEntity memberEntity = memberDao.selectById(memberId);
+ /**
+ * 获取团队总人数,总购买数
+ * 详细列表
+ *
+ */
+ TeamVo teamVo = new TeamVo();
+ //团队总人数
+ int memberNum = 0;
+ String inviteId = memberEntity.getInviteId();
+ List<MemberEntity> memberEntityList = ydOrderDao.selectMemberByInviteId(inviteId);
+ if(CollUtil.isNotEmpty(memberEntityList)){
+ memberNum = memberEntityList.size();
+ }
+ teamVo.setMemberNum(memberNum);
+ //购买总算力
+ int allPower = ydOrderDao.selectAllPowerByMemberIdAndElse(inviteId);
+ teamVo.setAllPower(allPower);
+ //详细列表
+ Page<TeamInfoVo> page = new Page<>(teamInfoDto.getPageNum(), teamInfoDto.getPageSize());
+ IPage<TeamInfoVo> teamInfoVos = ydOrderDao.getTeamInfoList(page, memberEntity);
+ List<TeamInfoVo> records = teamInfoVos.getRecords();
+ if(CollUtil.isNotEmpty(records)){
+ for(TeamInfoVo teamInfoVo : records){
+ String phone = teamInfoVo.getInvitephone();
+ if(StrUtil.isNotEmpty(phone)){
+ teamInfoVo.setInvitephone(StrUtil.subSufByLength(phone,4));
+ }
+ //下属团队人数
+ int memberNumInvite = 0;
+ List<MemberEntity> memberEntityInviteList = ydOrderDao.selectMemberByInviteId(phone);
+ if(CollUtil.isNotEmpty(memberEntityInviteList)){
+ memberNumInvite = memberEntityInviteList.size();
+ }
+ teamInfoVo.setMemberNum(memberNumInvite);
+ //下属团队总算力
+ int powerNum = ydOrderDao.selectAllPowerByMemberIdAndElse(phone);
+ teamInfoVo.setPowerNum(powerNum);
+ }
+ }
+ teamVo.setTeamInfoVos(records);
+ return Result.ok(teamVo);
}
--
Gitblit v1.9.1