Browse Source

🐛 修复用户导入部门数据为null时保存报错的问题

test
smallchill 3 years ago
parent
commit
620539b87f
  1. 6
      blade-service/blade-user/src/main/java/org/springblade/system/user/service/impl/UserServiceImpl.java

6
blade-service/blade-user/src/main/java/org/springblade/system/user/service/impl/UserServiceImpl.java

@ -308,11 +308,11 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, User> implement
// 设置用户平台 // 设置用户平台
user.setUserType(Func.toInt(DictCache.getKey(DictEnum.USER_TYPE, userExcel.getUserTypeName()), 1)); user.setUserType(Func.toInt(DictCache.getKey(DictEnum.USER_TYPE, userExcel.getUserTypeName()), 1));
// 设置部门ID // 设置部门ID
user.setDeptId(SysCache.getDeptIds(userExcel.getTenantId(), userExcel.getDeptName())); user.setDeptId(Func.toStrWithEmpty(SysCache.getDeptIds(userExcel.getTenantId(), userExcel.getDeptName()), StringPool.EMPTY));
// 设置岗位ID // 设置岗位ID
user.setPostId(SysCache.getPostIds(userExcel.getTenantId(), userExcel.getPostName())); user.setPostId(Func.toStrWithEmpty(SysCache.getPostIds(userExcel.getTenantId(), userExcel.getPostName()), StringPool.EMPTY));
// 设置角色ID // 设置角色ID
user.setRoleId(SysCache.getRoleIds(userExcel.getTenantId(), userExcel.getRoleName())); user.setRoleId(Func.toStrWithEmpty(SysCache.getRoleIds(userExcel.getTenantId(), userExcel.getRoleName()), StringPool.EMPTY));
// 设置租户ID // 设置租户ID
if (!AuthUtil.isAdministrator() || StringUtil.isBlank(user.getTenantId())) { if (!AuthUtil.isAdministrator() || StringUtil.isBlank(user.getTenantId())) {
user.setTenantId(AuthUtil.getTenantId()); user.setTenantId(AuthUtil.getTenantId());

Loading…
Cancel
Save