Forráskód Böngészése

Merge branch 'dev/2024/0418/update-admin' of Harper/feifan-backend-zx-admin into master

修改用户关系的展示数据
Yangzw 10 hónapja
szülő
commit
3b1e160b2a

+ 3 - 0
feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/controller/admin/duser/vo/DuserRespVO.java

@@ -56,6 +56,9 @@ public class DuserRespVO {
     @ExcelProperty("用户名称")
     private String nickName;
 
+    @Schema(description = "推荐人姓名", example = "张三")
+    private String ancNickName;
+
     @Schema(description = "直推人总数")
     private Long descendantCount;
 

+ 11 - 10
feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/service/duser/DuserServiceImpl.java

@@ -11,7 +11,6 @@ import cn.newfeifan.mall.module.distri.service.ptprofitlog.PtProfitLogService;
 import cn.newfeifan.mall.module.distri.service.sharepath.SharePathService;
 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.dal.mysql.user.MemberUserMapper;
 import cn.newfeifan.mall.module.member.service.user.MemberUserService;
 import org.springframework.stereotype.Service;
 
@@ -49,9 +48,6 @@ public class DuserServiceImpl implements DuserService {
     @Resource
     private SharePathMapper sharePathMapper;
 
-    @Resource
-    private MemberUserMapper memberUserMapper;
-
     @Resource
     private SharePathService sharePathService;
 
@@ -98,20 +94,20 @@ public class DuserServiceImpl implements DuserService {
 
     @Override
     public DuserDO getDuserByUser(Long id) {
-        return duserMapper.selectOne(new LambdaQueryWrapperX<DuserDO>().eq(DuserDO::getUserId,id));
+        return duserMapper.selectOne(new LambdaQueryWrapperX<DuserDO>().eq(DuserDO::getUserId, id));
     }
 
     @Override
     public List<DuserDO> getDuserByName(String name) {
         return duserMapper.selectList(new LambdaQueryWrapperX<DuserDO>()
-                .eq(DuserDO::getName,name)
+                .eq(DuserDO::getName, name)
         );
     }
 
     @Override
     public DuserDO getDuserByMobile(String mobile) {
         return duserMapper.selectOne(new LambdaQueryWrapperX<DuserDO>()
-                .eq(DuserDO::getMobile,mobile)
+                .eq(DuserDO::getMobile, mobile)
         );
     }
 
@@ -160,7 +156,7 @@ public class DuserServiceImpl implements DuserService {
 
         List<Long> sonsId = sharePathService.sonsId(userId);
         IntegralDO integral = integralService.getIntegral(userId);
-        if (integral == null){
+        if (integral == null) {
             throw exception(INTEGRAL_NOT_EXISTS);
         }
         DuserInfoVO.DuserInfoVOBuilder duserInfoVOBuilder = DuserInfoVO.builder()
@@ -215,12 +211,17 @@ public class DuserServiceImpl implements DuserService {
         for (DuserRespVO duserRespVO : list) {
             duserRespVO.setDescendantCount(sharePathMapper.selectCount(new LambdaQueryWrapperX<SharePathDO>()
                     .eq(SharePathDO::getAncestor, duserRespVO.getUserId())
-                    .eq(SharePathDO::getDepth,1)
+                    .eq(SharePathDO::getDepth, 1)
             ));
             duserRespVO.setChildrenCount(sharePathMapper.selectCount(new LambdaQueryWrapperX<SharePathDO>()
                     .eq(SharePathDO::getAncestor, duserRespVO.getUserId())
-                    .ne(SharePathDO::getDepth,1)
             ));
+
+            SharePathDO sharePathDO = sharePathMapper.selectOne(new LambdaQueryWrapperX<SharePathDO>()
+                    .eq(SharePathDO::getDescendant, duserRespVO.getUserId())
+                    .eq(SharePathDO::getDepth, 1)
+            );
+            duserRespVO.setAncNickName(sharePathDO != null ? sharePathDO.getAncNickName() : "");
         }
     }
 }