司机APP注册是默认用户角色
This commit is contained in:
+4
-1
@@ -107,11 +107,14 @@ public class TokenLoginApplicationService {
|
||||
//租户一级组织ID
|
||||
SysTenantsPo sysTenantsPo = JSON.parseObject(JSON.toJSONString(topOrganizationIdR.get("data")), SysTenantsPo.class);
|
||||
Long topOrganizationId = sysTenantsPo.getOrganizationId();
|
||||
// 获取用户选择的组织ID,未选则使用一级组织ID
|
||||
Long selectedOrgId = loginDTO.getOrganizationId();
|
||||
Long organizationId = (selectedOrgId != null) ? selectedOrgId : topOrganizationId;
|
||||
//获取用户信息,组装dto
|
||||
UserDTO userDTO = new UserDTO();
|
||||
userDTO.setUserPhone(userPhone);
|
||||
userDTO.setTopOrganizationId(topOrganizationId);
|
||||
userDTO.setOrganizationId(topOrganizationId);
|
||||
userDTO.setOrganizationId(organizationId);
|
||||
// 查询用户信息,查询组织下用户是否存在
|
||||
R<LoginUser> userResult = userServiceFeign.getUserByTopOrganizationUserPhone(userDTO, SecurityConstants.INNER);
|
||||
if (R.FAIL == userResult.getCode()) {
|
||||
|
||||
@@ -34,4 +34,7 @@ public class LoginDTO {
|
||||
@ApiModelProperty(name = "APP包名")
|
||||
private String appMark;
|
||||
|
||||
@ApiModelProperty(name = "组织ID(司机选择组织,不传默认一级组织)")
|
||||
private Long organizationId;
|
||||
|
||||
}
|
||||
|
||||
+22
@@ -1864,6 +1864,12 @@ public class UserApplicationService {
|
||||
wlhyDomainService.addOrEditPlatformUser1(userEntity);
|
||||
//同步商城用户
|
||||
userMallDomainService.syncDriverUserInfo(userEntity);
|
||||
//同步YMS平台员工信息
|
||||
try {
|
||||
ymsDomainService.addOrEditYmsUser(userEntity);
|
||||
} catch (Exception e) {
|
||||
log.warn("同步YMS平台员工信息失败,但不影响用户保存: {}", e.getMessage());
|
||||
}
|
||||
//给用户分配默认普通角色权限
|
||||
RoleDo roleDo = new RoleDo();
|
||||
roleDo.setRoleCode(RoleEnum.DRIVER.getCode());
|
||||
@@ -1881,6 +1887,22 @@ public class UserApplicationService {
|
||||
userRoleDomainService.addUserRole(userRoleDo);
|
||||
}
|
||||
}
|
||||
//给用户分配默认普通用户角色(must)
|
||||
RoleDo mustRoleDo = new RoleDo();
|
||||
mustRoleDo.setRoleCode(RoleEnum.MUST.getCode());
|
||||
mustRoleDo.setOrganizationId(userEntity.getOrganizationId());
|
||||
RoleEntity mustRoleEntity = roleDomainService.selectByOrganizationIdAndRoleCode(mustRoleDo);
|
||||
if (null != mustRoleEntity) {
|
||||
UserRoleDo mustUserRoleDo = new UserRoleDo();
|
||||
mustUserRoleDo.setUserId(userEntity.getUserId());
|
||||
mustUserRoleDo.setRoleId(mustRoleEntity.getRoleId());
|
||||
LoginUser loginUser2 = SecurityUtils.getLoginUser();
|
||||
if (ObjectUtil.isNull(loginUser2)) {
|
||||
userRoleDomainService.addUserRole(mustUserRoleDo, userEntity);
|
||||
} else {
|
||||
userRoleDomainService.addUserRole(mustUserRoleDo);
|
||||
}
|
||||
}
|
||||
//2024年3月27日16:40:15 处理用户验证码注册,首次登录redis用户数据不更新问题
|
||||
//此处根据id重新查询
|
||||
return userDomainService.selectByUserId(userEntity.getUserId());
|
||||
|
||||
Reference in New Issue
Block a user