fix: 修改个人信息报错

This commit is contained in:
fit2cloud-chenyw 2022-05-29 09:41:09 +08:00
parent 319df86b5b
commit 960040be9a
2 changed files with 4 additions and 1 deletions

View File

@ -26,6 +26,7 @@ import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.apache.shiro.authz.annotation.RequiresRoles;
import org.springframework.web.bind.annotation.*;
@ -148,7 +149,7 @@ public class SysUserController {
DataEaseException.throwException(Translator.get("i18n_wrong_content"));
}
// 再次验证匹配格式
if (!request.getPhone().isEmpty() && !request.getPhone().matches("^1[3|4|5|7|8][0-9]{9}$")) {
if (StringUtils.isNotBlank(request.getPhone()) && !request.getPhone().matches("^1[3|4|5|7|8][0-9]{9}$")) {
DataEaseException.throwException(Translator.get("i18n_wrong_tel"));
}
if (!request.getEmail().matches("^[a-zA-Z0-9_._-]+@[a-zA-Z0-9_-]+(\\.[a-zA-Z0-9_-]+)+$")) {

View File

@ -219,6 +219,8 @@ public class SysUserService {
@CacheEvict(value = AuthConstants.USER_CACHE_NAME, key = "'user' + #request.userId")
@Transactional
public int updatePersonBasicInfo(SysUserCreateRequest request) {
checkEmail(request);
checkNickName(request);
SysUser user = new SysUser();
long now = System.currentTimeMillis();
user.setUserId(request.getUserId());