Browse Source

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

修改关系树
Yangzw 10 months ago
parent
commit
759fbe4cfe

+ 1 - 1
feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/controller/admin/sharepath/vo/SharePathTreeReqVO.java

@@ -11,7 +11,7 @@ import javax.validation.constraints.NotNull;
 @ToString(callSuper = true)
 public class SharePathTreeReqVO {
     @Schema(description = "名称")
-    private String name;
+    private String nickName;
 
     @Schema(description = "电话")
     private String mobile;

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

@@ -100,7 +100,7 @@ public class DuserServiceImpl implements DuserService {
     @Override
     public List<DuserDO> getDuserByName(String name) {
         return duserMapper.selectList(new LambdaQueryWrapperX<DuserDO>()
-                .eq(DuserDO::getName, name)
+                .eq(DuserDO::getNickName, name)
         );
     }
 

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

@@ -172,7 +172,10 @@ public class SharePathServiceImpl implements SharePathService {
         if (maxDepth > 1) {
             List<Long> descs = sharePathDOS.stream().filter(k -> k.getDepth() > 1).map(SharePathDO::getDescendant).collect(Collectors.toList());
             // 获取大于1层级的数据
-            List<SharePathDO> descList = sharePathMapper.selectList(new LambdaQueryWrapperX<SharePathDO>().ne(SharePathDO::getAncestor, 1).in(SharePathDO::getDescendant, descs));
+            List<SharePathDO> descList = sharePathMapper.selectList(new LambdaQueryWrapperX<SharePathDO>()
+                    .inIfPresent(SharePathDO::getDescendant, descs)
+                    .ne(SharePathDO::getAncestor, 1)
+            );
             List<TreeNode> treeNodes1 = sharePathDO2TreeNode(descList);
             deep = deep.stream().filter(k -> k.getDeep() == 1).collect(Collectors.toList());
             deep.addAll(treeNodes1);
@@ -191,16 +194,16 @@ public class SharePathServiceImpl implements SharePathService {
     @Override
     public TreeNode getTreeByNameOrMobile(SharePathTreeReqVO sharePathTreeReqVO) {
         //拿到当前用户ID
-        Long userId = getUserIdByNameOrMobile(sharePathTreeReqVO.getName(), sharePathTreeReqVO.getMobile());
+        Long userId = getUserIdByNameOrMobile(sharePathTreeReqVO.getNickName(), sharePathTreeReqVO.getMobile());
 
         //拿到推荐人ID
         Long ancestor = sharePathMapper.selectAncestorByDescendant(userId);
         return getTree(ancestor, sharePathTreeReqVO.getMaxDepth());
     }
 
-    private Long getUserIdByNameOrMobile(String name, String mobile) {
-        if(!StringUtils.isEmpty(name)){
-            List<DuserDO> duserDOS = duserService.getDuserByName(name);
+    private Long getUserIdByNameOrMobile(String nickName, String mobile) {
+        if (!StringUtils.isEmpty(nickName)) {
+            List<DuserDO> duserDOS = duserService.getDuserByName(nickName);
             if (duserDOS.isEmpty()) {
                 throw exception(DUSER_NAME_NOT_EXISTS);
             } else if (duserDOS.size() > 1) {
@@ -208,7 +211,7 @@ public class SharePathServiceImpl implements SharePathService {
             }
 
             return duserDOS.get(0).getUserId();
-        }else{
+        } else {
             DuserDO duserDO = duserService.getDuserByMobile(mobile);
             if (duserDO == null) {
                 throw exception(DUSER_MOBILE_NOT_EXISTS);