|
@@ -2,20 +2,20 @@ package cn.newfeifan.mall.module.distri.service.sharepath;
|
|
|
|
|
|
import cn.newfeifan.mall.framework.mybatis.core.query.LambdaQueryWrapperX;
|
|
|
import cn.newfeifan.mall.module.distri.service.duser.DuserService;
|
|
|
+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.stereotype.Service;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
-import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.util.*;
|
|
|
|
|
|
import cn.newfeifan.mall.module.distri.controller.admin.sharepath.vo.*;
|
|
|
import cn.newfeifan.mall.module.distri.dal.dataobject.sharepath.SharePathDO;
|
|
|
import cn.newfeifan.mall.framework.common.pojo.PageResult;
|
|
|
-import cn.newfeifan.mall.framework.common.pojo.PageParam;
|
|
|
import cn.newfeifan.mall.framework.common.util.object.BeanUtils;
|
|
|
|
|
|
import cn.newfeifan.mall.module.distri.dal.mysql.sharepath.SharePathMapper;
|
|
@@ -38,6 +38,9 @@ public class SharePathServiceImpl implements SharePathService {
|
|
|
@Resource
|
|
|
private DuserService duserService;
|
|
|
|
|
|
+ @Resource
|
|
|
+ private MemberUserService memberUserService;
|
|
|
+
|
|
|
|
|
|
@Override
|
|
|
public Long createSharePath(SharePathSaveReqVO createReqVO) {
|
|
@@ -61,6 +64,29 @@ public class SharePathServiceImpl implements SharePathService {
|
|
|
duserService.hasUserAndCreat(createReqVO);
|
|
|
// 存储他们之间的关系
|
|
|
sharePathMapper.addNode(createReqVO.getAncestor(), createReqVO.getDescendant());
|
|
|
+
|
|
|
+ //保存用户的基本信息
|
|
|
+ saveSharePathName(createReqVO.getDescendant());
|
|
|
+ }
|
|
|
+
|
|
|
+ private void saveSharePathName(Long descendant){
|
|
|
+ List<SharePathDO> sharePathDOS = sharePathMapper.selectList(new LambdaQueryWrapper<SharePathDO>()
|
|
|
+ .eq(SharePathDO::getDescendant, descendant)
|
|
|
+ );
|
|
|
+
|
|
|
+ for (SharePathDO sharePathDO : sharePathDOS) {
|
|
|
+ MemberUserDO ancestor = memberUserService.getUser(sharePathDO.getAncestor());
|
|
|
+ MemberUserDO descendantUser = memberUserService.getUser(sharePathDO.getDescendant());
|
|
|
+ if (ancestor != null && descendantUser != null) {
|
|
|
+ sharePathDO.setAncName(ancestor.getName());
|
|
|
+ sharePathDO.setAncNickName(ancestor.getNickname());
|
|
|
+ sharePathDO.setAncPhone(ancestor.getMobile());
|
|
|
+ sharePathDO.setDescName(descendantUser.getName());
|
|
|
+ sharePathDO.setDescNickName(descendantUser.getNickname());
|
|
|
+ sharePathDO.setDescPhone(descendantUser.getMobile());
|
|
|
+ sharePathMapper.updateById(sharePathDO);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
|