|
@@ -70,11 +70,20 @@ public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements
|
|
|
@Override
|
|
|
public void saveUser(LoginUser loginUser, UserSaveReq req) {
|
|
|
if (StringUtils.isBlank(req.getLoginName())) {
|
|
|
- throw new StatusException("登录名不能为空");
|
|
|
+ throw new StatusException("账号不能为空");
|
|
|
+ }
|
|
|
+ if (StringUtils.length(req.getLoginName()) > 50) {
|
|
|
+ throw new StatusException("账号限制50字以内");
|
|
|
}
|
|
|
if (StringUtils.isBlank(req.getName())) {
|
|
|
throw new StatusException("用户名不能为空");
|
|
|
}
|
|
|
+ if (StringUtils.length(req.getName()) > 50) {
|
|
|
+ throw new StatusException("用户名限制50字以内");
|
|
|
+ }
|
|
|
+ if (StringUtils.length(req.getMobile()) > 20) {
|
|
|
+ throw new StatusException("联系方式限制20字以内");
|
|
|
+ }
|
|
|
if (req.getRoleCode() == null) {
|
|
|
throw new StatusException("请选择角色");
|
|
|
}
|
|
@@ -88,6 +97,16 @@ public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements
|
|
|
log.warn("当前用户不存在!userId:{}", req.getId());
|
|
|
throw new StatusException("当前用户不存在");
|
|
|
}
|
|
|
+
|
|
|
+ if (!req.getLoginName().equals(existUser.getLoginName())) {
|
|
|
+ UserEntity uu = this.findUserByLoginName(loginUser.getOrgId(), req.getLoginName());
|
|
|
+ if (uu != null) {
|
|
|
+ throw new StatusException("登录账号已存在");
|
|
|
+ }
|
|
|
+
|
|
|
+ existUser.setLoginName(req.getLoginName());
|
|
|
+ }
|
|
|
+
|
|
|
existUser.setRole(req.getRoleCode());
|
|
|
existUser.setName(req.getName());
|
|
|
existUser.setMobile(req.getMobile());
|