|
@@ -160,7 +160,7 @@ public class SharePathServiceImpl implements SharePathService {
|
|
|
.eq(SharePathDO::getDescendant, userId)
|
|
|
.eq(SharePathDO::getDepth, 1));
|
|
|
SharePathRespVO ancestor = BeanUtils.toBean(sharePathDO, SharePathRespVO.class);
|
|
|
- if(ancestor != null) {
|
|
|
+ if (ancestor != null) {
|
|
|
ancestor.setAvatar(getAvatar(ancestor.getAncestor()));
|
|
|
getSocialStatus(ancestor, ancestor.getAncestor());
|
|
|
//获取最大可用额度
|
|
@@ -171,17 +171,18 @@ public class SharePathServiceImpl implements SharePathService {
|
|
|
.eq(SharePathDO::getAncestor, ancestor.getAncestor())
|
|
|
);
|
|
|
ancestor.setDescendantsCount(descendantsCount);
|
|
|
- ancestor.setResidueSocial(getResidueSocial(ancestor.getAncestor()));
|
|
|
+ //里面放的是本人的兄弟分区额度
|
|
|
+ ancestor.setResidueSocial(getBrotherSocial(userId));
|
|
|
//获取用户名
|
|
|
ancestor.setUsername(memberUserService.getUser(ancestor.getAncestor()).getUsername());
|
|
|
}
|
|
|
|
|
|
//获取团队成员
|
|
|
PageResult<SharePathDO> descendants = sharePathMapper.selectPage(pageParam, new LambdaQueryWrapperX<SharePathDO>()
|
|
|
- .eq(SharePathDO::getAncestor, userId)
|
|
|
- .eq(SharePathDO::getDepth, 1)
|
|
|
- .orderByAsc(SharePathDO::getDepth)
|
|
|
- );
|
|
|
+ .eq(SharePathDO::getAncestor, userId)
|
|
|
+ .eq(SharePathDO::getDepth, 1)
|
|
|
+ .orderByAsc(SharePathDO::getDepth)
|
|
|
+ );
|
|
|
PageResult<SharePathRespVO> result = BeanUtils.toBean(descendants, SharePathRespVO.class);
|
|
|
result.getList().forEach(item -> {
|
|
|
item.setAvatar(getAvatar(item.getDescendant()));
|
|
@@ -196,7 +197,7 @@ public class SharePathServiceImpl implements SharePathService {
|
|
|
// setHighQuota(item, item.getDescendant());
|
|
|
|
|
|
//获取剩余碰撞额度 + 待确权直推奖
|
|
|
- item.setResidueSocial(getResidueSocial(item.getDescendant()));
|
|
|
+ item.setResidueSocial(getSonSocial(item.getDescendant()));
|
|
|
//获取用户名
|
|
|
item.setUsername(memberUserService.getUser(item.getDescendant()).getUsername());
|
|
|
});
|
|
@@ -208,36 +209,58 @@ public class SharePathServiceImpl implements SharePathService {
|
|
|
.descendants(result).build();
|
|
|
}
|
|
|
|
|
|
- private Long getResidueSocial(Long userId){
|
|
|
-// if(!userId.equals(PT_ID)){
|
|
|
-// Long ancestorIncreaseIntegral = sharePathMapper.getAncestorIncreaseIntegralByUserId(userId);
|
|
|
-// if(ancestorIncreaseIntegral == null) ancestorIncreaseIntegral = 0L;
|
|
|
-// Long residueSocial = partitionCrashService.getResidueSocial(userId);
|
|
|
-// return ancestorIncreaseIntegral + residueSocial;
|
|
|
-// }
|
|
|
+ /**
|
|
|
+ * 获取本用户兄弟分区的剩余额度值
|
|
|
+ *
|
|
|
+ * @param userId 用户编号
|
|
|
+ * @return 剩余额度值
|
|
|
+ */
|
|
|
+ private Long getBrotherSocial(Long userId) {
|
|
|
+ return getYesterdayCrash(userId, 1).getBrotherPrice();
|
|
|
+ }
|
|
|
|
|
|
+ /**
|
|
|
+ * 获取昨日分区信息
|
|
|
+ *
|
|
|
+ * @param userId 用户编号
|
|
|
+ * @return 分区信息
|
|
|
+ */
|
|
|
+ private PartitionCrashDO getYesterdayCrash(Long userId, int today) {
|
|
|
LocalDateTime todayStart = LocalDateTime.of(LocalDate.now(), LocalTime.MIDNIGHT); // 今天的开始时间,即午夜12点
|
|
|
- LocalDateTime localDateTime = todayStart.minusDays(1);
|
|
|
+ LocalDateTime localDateTime = todayStart.minusDays(today);
|
|
|
String yesterdayNo = "CRASH:" + userId + ":" + localDateTime.toString();
|
|
|
- PartitionCrashDO yesterdayCrash = partitionCrashMapper.selectOne(new LambdaQueryWrapperX<PartitionCrashDO>().eqIfPresent(PartitionCrashDO::getPartNo, yesterdayNo));
|
|
|
+ PartitionCrashDO partitionCrashDO = partitionCrashMapper.selectOne(new LambdaQueryWrapperX<PartitionCrashDO>().eqIfPresent(PartitionCrashDO::getPartNo, yesterdayNo));
|
|
|
+ if(partitionCrashDO == null){
|
|
|
+ return getYesterdayCrash(userId, ++today);
|
|
|
+ }
|
|
|
+ return partitionCrashDO;
|
|
|
+ }
|
|
|
|
|
|
- return yesterdayCrash.getAfterHitQuota();
|
|
|
+ /**
|
|
|
+ * 获取直推人后代分区的剩余额度值
|
|
|
+ *
|
|
|
+ * @param userId 用户编号
|
|
|
+ * @return 剩余额度值
|
|
|
+ */
|
|
|
+ private Long getSonSocial(Long userId) {
|
|
|
+ return getYesterdayCrash(userId, 1).getSonPrice();
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获取最高可获取积分
|
|
|
+ *
|
|
|
* @param sharePath 对象
|
|
|
- * @param userId 用户编号
|
|
|
+ * @param userId 用户编号
|
|
|
*/
|
|
|
- private void setHighQuota(SharePathRespVO sharePath,Long userId){
|
|
|
+ private void setHighQuota(SharePathRespVO sharePath, Long userId) {
|
|
|
IntegralDO integralDO = integralService.selectByUser(userId);
|
|
|
- if(integralDO != null){
|
|
|
+ if (integralDO != null) {
|
|
|
sharePath.setHigh_quota(integralDO.getHighQuota());
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private void getSocialStatus(SharePathRespVO sharePathRespVO,Long userId){
|
|
|
- if(Objects.equals(userId, PT_ID)) return;
|
|
|
+ private void getSocialStatus(SharePathRespVO sharePathRespVO, Long userId) {
|
|
|
+ if (Objects.equals(userId, PT_ID)) return;
|
|
|
DuserDO duser = duserService.getDuserByUser(userId);
|
|
|
SocialStatusDO socialStatus = socialStatusService.getSocialStatus(duser.getSocialStatusId());
|
|
|
sharePathRespVO.setSocialStatusLevel(socialStatus.getLevel());
|