This commit is contained in:
Vinjor 2024-11-11 10:03:13 +08:00
parent 8adf0e01f3
commit 29939dc277

View File

@ -41,9 +41,7 @@ import org.springframework.validation.annotation.Validated;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Set;
import static cn.iocoder.yudao.common.BaseConstants.*; import static cn.iocoder.yudao.common.BaseConstants.*;
import static cn.iocoder.yudao.common.DictBaseConstants.DICT_CUS_TYPE; import static cn.iocoder.yudao.common.DictBaseConstants.DICT_CUS_TYPE;
@ -120,7 +118,7 @@ public class CustomerMainServiceImpl extends ServiceImpl<CustomerMainMapper, Cus
AdminUserRespDTO userDTO = adminUserApi.getUserByUsername(saveReqVO.getPhoneNumber()); AdminUserRespDTO userDTO = adminUserApi.getUserByUsername(saveReqVO.getPhoneNumber());
user = BeanUtils.toBean(userDTO, UserDTO.class); user = BeanUtils.toBean(userDTO, UserDTO.class);
//存在两种情况一是该用户已经注册二是该用户未注册 //存在两种情况一是该用户已经注册二是该用户未注册
if (null == user){ if (null == userDTO){
user = new UserDTO(); user = new UserDTO();
//如果不存在创建用户 //如果不存在创建用户
user.setUsername(saveReqVO.getPhoneNumber()); user.setUsername(saveReqVO.getPhoneNumber());
@ -164,10 +162,10 @@ public class CustomerMainServiceImpl extends ServiceImpl<CustomerMainMapper, Cus
} }
//客户表绑定用户id //客户表绑定用户id
main.setUserId(userId); main.setUserId(userId);
//绑定角色 //绑定角色----客户不设置角色
Set<String> roleCodes = new HashSet<>(); // Set<String> roleCodes = new HashSet<>();
roleCodes.add(dict.getRemark()); // roleCodes.add(dict.getRemark());
permissionApi.assignUserRole(userId, roleCodes); // permissionApi.assignUserRole(userId, roleCodes);
} }
/*3、保存客户主表信息*/ /*3、保存客户主表信息*/
//暂时写死会员id TODO //暂时写死会员id TODO