|
@@ -316,7 +316,7 @@ public class SysUserServiceImpl implements ISysUserService {
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public int insertUser(SysUserBo user) {
|
|
public int insertUser(SysUserBo user) {
|
|
|
SysUser sysUser = MapstructUtils.convert(user, SysUser.class);
|
|
SysUser sysUser = MapstructUtils.convert(user, SysUser.class);
|
|
|
- // 1. 校验当前是否为总控平台(main),否则不能指定 platformCode
|
|
|
|
|
|
|
+ // 1. 校验当前是否为总控平台(main),否则不能指定 platformCode
|
|
|
String currentPlatform = PlatformContext.getPlatform();
|
|
String currentPlatform = PlatformContext.getPlatform();
|
|
|
String targetPlatform = currentPlatform;
|
|
String targetPlatform = currentPlatform;
|
|
|
// 如果传入了 platformCode,优先使用传入的值
|
|
// 如果传入了 platformCode,优先使用传入的值
|
|
@@ -336,8 +336,8 @@ public class SysUserServiceImpl implements ISysUserService {
|
|
|
// 后续操作(岗位、角色)是否也需要在 "main" 平台下执行?
|
|
// 后续操作(岗位、角色)是否也需要在 "main" 平台下执行?
|
|
|
// 如果这些表也受 platform_code 控制,则同样需要包裹!
|
|
// 如果这些表也受 platform_code 控制,则同样需要包裹!
|
|
|
|
|
|
|
|
- insertUserPost(user, false);
|
|
|
|
|
- insertUserRole(user, false,targetPlatform);
|
|
|
|
|
|
|
+ insertUserPost(user, false);
|
|
|
|
|
+ insertUserRole(user, false, targetPlatform);
|
|
|
|
|
|
|
|
return rows;
|
|
return rows;
|
|
|
}
|
|
}
|
|
@@ -375,7 +375,7 @@ public class SysUserServiceImpl implements ISysUserService {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 新增用户与角色管理
|
|
// 新增用户与角色管理
|
|
|
- insertUserRole(user, true,targetPlatform);
|
|
|
|
|
|
|
+ insertUserRole(user, true, targetPlatform);
|
|
|
// 新增用户与岗位管理
|
|
// 新增用户与岗位管理
|
|
|
insertUserPost(user, true);
|
|
insertUserPost(user, true);
|
|
|
SysUser sysUser = MapstructUtils.convert(user, SysUser.class);
|
|
SysUser sysUser = MapstructUtils.convert(user, SysUser.class);
|
|
@@ -399,8 +399,8 @@ public class SysUserServiceImpl implements ISysUserService {
|
|
|
*/
|
|
*/
|
|
|
@Override
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
- public void insertUserAuth(Long userId, Long[] roleIds,String platformCode) {
|
|
|
|
|
- insertUserRole(userId, roleIds, true,platformCode);
|
|
|
|
|
|
|
+ public void insertUserAuth(Long userId, Long[] roleIds, String platformCode) {
|
|
|
|
|
+ insertUserRole(userId, roleIds, true, platformCode);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -466,14 +466,28 @@ public class SysUserServiceImpl implements ISysUserService {
|
|
|
.eq(SysUser::getUserId, userId));
|
|
.eq(SysUser::getUserId, userId));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 更换用户手机号
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param userId 用户ID
|
|
|
|
|
+ * @return 结果
|
|
|
|
|
+ */
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public int resetUserPhonenumber(Long userId, String phonenumber) {
|
|
|
|
|
+ return baseMapper.update(null,
|
|
|
|
|
+ new LambdaUpdateWrapper<SysUser>()
|
|
|
|
|
+ .set(SysUser::getPhonenumber, phonenumber)
|
|
|
|
|
+ .eq(SysUser::getUserId, userId));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 新增用户角色信息
|
|
* 新增用户角色信息
|
|
|
*
|
|
*
|
|
|
* @param user 用户对象
|
|
* @param user 用户对象
|
|
|
* @param clear 清除已存在的关联数据
|
|
* @param clear 清除已存在的关联数据
|
|
|
*/
|
|
*/
|
|
|
- private void insertUserRole(SysUserBo user, boolean clear,String platformCode) {
|
|
|
|
|
- this.insertUserRole(user.getUserId(), user.getRoleIds(), clear,platformCode);
|
|
|
|
|
|
|
+ private void insertUserRole(SysUserBo user, boolean clear, String platformCode) {
|
|
|
|
|
+ this.insertUserRole(user.getUserId(), user.getRoleIds(), clear, platformCode);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -507,7 +521,7 @@ public class SysUserServiceImpl implements ISysUserService {
|
|
|
* @param roleIds 角色组
|
|
* @param roleIds 角色组
|
|
|
* @param clear 清除已存在的关联数据
|
|
* @param clear 清除已存在的关联数据
|
|
|
*/
|
|
*/
|
|
|
- private void insertUserRole(Long userId, Long[] roleIds, boolean clear,String platformCode) {
|
|
|
|
|
|
|
+ private void insertUserRole(Long userId, Long[] roleIds, boolean clear, String platformCode) {
|
|
|
if (ArrayUtil.isNotEmpty(roleIds)) {
|
|
if (ArrayUtil.isNotEmpty(roleIds)) {
|
|
|
List<Long> roleList = new ArrayList<>(List.of(roleIds));
|
|
List<Long> roleList = new ArrayList<>(List.of(roleIds));
|
|
|
if (!LoginHelper.isSuperAdmin(userId)) {
|
|
if (!LoginHelper.isSuperAdmin(userId)) {
|