fix(系统设置): 优化用户编辑时填写已存在邮箱的报错信息
This commit is contained in:
parent
4923456b6d
commit
55a6ecae3b
|
@ -204,10 +204,12 @@ public class UserService {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
public UserEditRequest updateUser(UserEditRequest userEditRequest, String operator) {
|
||||
//检查用户组合法性
|
||||
globalUserRoleService.checkRoleIsGlobalAndHaveMember(userEditRequest.getUserRoleIdList(), true);
|
||||
//检查用户邮箱的合法性
|
||||
this.checkUserEmail(userEditRequest.getId(), userEditRequest.getEmail());
|
||||
|
||||
User user = new User();
|
||||
BeanUtils.copyBean(user, userEditRequest);
|
||||
user.setUpdateUser(operator);
|
||||
|
|
|
@ -402,6 +402,7 @@ public class UserControllerTests extends BaseTest {
|
|||
@Test
|
||||
@Order(5)
|
||||
public void testUserUpdateError() throws Exception {
|
||||
this.checkUserList();
|
||||
// 4xx 验证
|
||||
UserCreateInfo user = new UserCreateInfo();
|
||||
UserEditRequest userMaintainRequest;
|
||||
|
@ -432,7 +433,9 @@ public class UserControllerTests extends BaseTest {
|
|||
BeanUtils.copyBean(user, USER_LIST.get(0));
|
||||
user.setEmail(USER_LIST.get(USER_LIST.size() - 1).getEmail());
|
||||
userMaintainRequest = UserParamUtils.getUserUpdateDTO(user, USER_ROLE_LIST);
|
||||
this.requestPost(UserRequestUtils.URL_USER_UPDATE, userMaintainRequest, ERROR_REQUEST_MATCHER);
|
||||
MvcResult mvcResult = this.requestPost(UserRequestUtils.URL_USER_UPDATE, userMaintainRequest, ERROR_REQUEST_MATCHER).andReturn();
|
||||
ResultHolder resultHolder = JSON.parseObject(mvcResult.getResponse().getContentAsString(StandardCharsets.UTF_8), ResultHolder.class);
|
||||
Assertions.assertEquals(resultHolder.getMessage(), "用户邮箱已存在");
|
||||
//用户组不包含系统成员
|
||||
BeanUtils.copyBean(user, USER_LIST.get(0));
|
||||
userMaintainRequest = UserParamUtils.getUserUpdateDTO(user,
|
||||
|
|
Loading…
Reference in New Issue