更新了写真预约特殊产品处理
This commit is contained in:
parent
06bdf661d9
commit
add07d4931
src/main/java/com/cultural/heritage
|
@ -231,8 +231,14 @@ public class UserController {
|
|||
}
|
||||
User user = new User();
|
||||
BeanUtils.copyProperties(userUpdateRequest, user);
|
||||
String encryptPassword = DigestUtils.md5DigestAsHex((SALT + user.getUserPassword()).getBytes());
|
||||
user.setUserPassword(encryptPassword);
|
||||
|
||||
Long id = user.getId();
|
||||
User sourceUser = userService.getById(id);
|
||||
String userPassword = user.getUserPassword();
|
||||
if (!sourceUser.getUserPassword().equals(userPassword)) {
|
||||
String newPassword = DigestUtils.md5DigestAsHex((SALT + userPassword).getBytes());
|
||||
user.setUserPassword(newPassword);
|
||||
}
|
||||
userService.validUser(user, true);
|
||||
boolean result = userService.updateById(user);
|
||||
ThrowUtils.throwIf(!result, ErrorCode.OPERATION_ERROR);
|
||||
|
@ -240,6 +246,9 @@ public class UserController {
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 根据 id 获取用户
|
||||
* @param id
|
||||
|
|
|
@ -83,14 +83,14 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
|
|||
|
||||
@Override
|
||||
public void validUser(User user, boolean update) {
|
||||
String userPassword = user.getUserPassword();
|
||||
String userName = user.getUserName();
|
||||
String userPassword = user.getUserPassword();
|
||||
String userAvatar = user.getUserAvatar();
|
||||
String phone = user.getPhone();
|
||||
String userRole = user.getUserRole();
|
||||
Long id = user.getId();
|
||||
ThrowUtils.throwIf(update && id == null, ErrorCode.OPERATION_ERROR, "id字段为null");
|
||||
if (StringUtils.isAnyBlank(userPassword, userName, userAvatar, phone, userRole)) {
|
||||
if (StringUtils.isAnyBlank(userName, userAvatar, phone, userRole, userPassword)) {
|
||||
throw new BusinessException(ErrorCode.PARAMS_ERROR, "存在参数为空");
|
||||
}
|
||||
ThrowUtils.throwIf(RegexUtils.isPhoneInvalid(phone), ErrorCode.OPERATION_ERROR, "手机号格式错误");
|
||||
|
|
Loading…
Reference in New Issue
Block a user