|
|
|
@ -17,7 +17,6 @@ import org.springframework.web.bind.annotation.RequestBody;
|
|
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
import com.ruoyi.common.core.constant.UserConstants;
|
|
|
|
|
import com.ruoyi.common.core.domain.R;
|
|
|
|
|
import com.ruoyi.common.core.utils.StringUtils;
|
|
|
|
|
import com.ruoyi.common.core.utils.poi.ExcelUtil;
|
|
|
|
@ -143,7 +142,7 @@ public class SysUserController extends BaseController
|
|
|
|
|
{
|
|
|
|
|
return R.fail("当前系统没有开启注册功能!");
|
|
|
|
|
}
|
|
|
|
|
if (UserConstants.NOT_UNIQUE.equals(userService.checkUserNameUnique(sysUser)))
|
|
|
|
|
if (!userService.checkUserNameUnique(sysUser))
|
|
|
|
|
{
|
|
|
|
|
return R.fail("保存用户'" + username + "'失败,注册账号已存在");
|
|
|
|
|
}
|
|
|
|
@ -200,17 +199,15 @@ public class SysUserController extends BaseController
|
|
|
|
|
@PostMapping
|
|
|
|
|
public AjaxResult add(@Validated @RequestBody SysUser user)
|
|
|
|
|
{
|
|
|
|
|
if (UserConstants.NOT_UNIQUE.equals(userService.checkUserNameUnique(user)))
|
|
|
|
|
if (!userService.checkUserNameUnique(user))
|
|
|
|
|
{
|
|
|
|
|
return error("新增用户'" + user.getUserName() + "'失败,登录账号已存在");
|
|
|
|
|
}
|
|
|
|
|
else if (StringUtils.isNotEmpty(user.getPhonenumber())
|
|
|
|
|
&& UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user)))
|
|
|
|
|
else if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user))
|
|
|
|
|
{
|
|
|
|
|
return error("新增用户'" + user.getUserName() + "'失败,手机号码已存在");
|
|
|
|
|
}
|
|
|
|
|
else if (StringUtils.isNotEmpty(user.getEmail())
|
|
|
|
|
&& UserConstants.NOT_UNIQUE.equals(userService.checkEmailUnique(user)))
|
|
|
|
|
else if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user))
|
|
|
|
|
{
|
|
|
|
|
return error("新增用户'" + user.getUserName() + "'失败,邮箱账号已存在");
|
|
|
|
|
}
|
|
|
|
@ -229,17 +226,15 @@ public class SysUserController extends BaseController
|
|
|
|
|
{
|
|
|
|
|
userService.checkUserAllowed(user);
|
|
|
|
|
userService.checkUserDataScope(user.getUserId());
|
|
|
|
|
if (UserConstants.NOT_UNIQUE.equals(userService.checkUserNameUnique(user)))
|
|
|
|
|
if (!userService.checkUserNameUnique(user))
|
|
|
|
|
{
|
|
|
|
|
return error("修改用户'" + user.getUserName() + "'失败,登录账号已存在");
|
|
|
|
|
}
|
|
|
|
|
else if (StringUtils.isNotEmpty(user.getPhonenumber())
|
|
|
|
|
&& UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user)))
|
|
|
|
|
else if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user))
|
|
|
|
|
{
|
|
|
|
|
return error("修改用户'" + user.getUserName() + "'失败,手机号码已存在");
|
|
|
|
|
}
|
|
|
|
|
else if (StringUtils.isNotEmpty(user.getEmail())
|
|
|
|
|
&& UserConstants.NOT_UNIQUE.equals(userService.checkEmailUnique(user)))
|
|
|
|
|
else if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user))
|
|
|
|
|
{
|
|
|
|
|
return error("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在");
|
|
|
|
|
}
|
|
|
|
|