Browse Source

Merge branch 'dev/2024/0428/update-app' of Harper/feifan-backend-zx-app into master

修改用户查看团队的人员显示
Yangzw 6 months ago
parent
commit
29c3c57334

+ 2 - 0
feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/controller/app/sharepath/vo/SharePathRespVO.java

@@ -67,4 +67,6 @@ public class SharePathRespVO {
     @Schema(description = "身价等级名称")
     private String socialStatusLevelName;
 
+    @Schema(description = "后代人数")
+    private Long descendantsCount;
 }

+ 12 - 4
feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/service/sharepath/SharePathServiceImpl.java

@@ -12,6 +12,7 @@ import cn.newfeifan.mall.module.distri.service.duser.DuserService;
 import cn.newfeifan.mall.module.distri.service.socialstatus.SocialStatusService;
 import cn.newfeifan.mall.module.member.dal.dataobject.user.MemberUserDO;
 import cn.newfeifan.mall.module.member.service.user.MemberUserService;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import org.springframework.context.annotation.Lazy;
 import org.springframework.stereotype.Service;
 
@@ -135,8 +136,8 @@ public class SharePathServiceImpl implements SharePathService {
 
         //获取团队数
         LambdaQueryWrapperX<SharePathDO> wrapper = new LambdaQueryWrapperX<>();
-        wrapper.eq(SharePathDO::getAncestor, userId).or().eq(SharePathDO::getDescendant, userId);
-        //  +1为父级
+        wrapper.eq(SharePathDO::getAncestor, userId).eq(SharePathDO::getDepth, 1);
+        // +1 加自己
         Long teamCount = sharePathMapper.selectCount(wrapper) + 1;
 
         //获取推荐人
@@ -151,12 +152,19 @@ public class SharePathServiceImpl implements SharePathService {
 
         //获取团队成员
         PageResult<SharePathDO> descendants = sharePathMapper.selectPage(pageParam, new LambdaQueryWrapperX<SharePathDO>()
-                .eq(SharePathDO::getAncestor, userId)
-                .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()));
             getSocialStatus(item, item.getDescendant());
+
+            Long descendantsCount = sharePathMapper.selectCount(new LambdaQueryWrapper<SharePathDO>()
+                    .eq(SharePathDO::getAncestor, item.getDescendant())
+            );
+            item.setDescendantsCount(descendantsCount);
         });