update 查询用户时邮箱和手机号按规则脱敏
This commit is contained in:
+14
-2
@@ -1,5 +1,6 @@
|
||||
package com.jero.modules.system.service.impl;
|
||||
|
||||
import cn.hutool.core.util.DesensitizedUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.aliyun.oss.ServiceException;
|
||||
@@ -546,7 +547,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
||||
} catch (Exception e) {
|
||||
email = user.getEmail();
|
||||
}
|
||||
user.setEmail(email);
|
||||
user.setEmail(DesensitizedEmail(email));
|
||||
}
|
||||
|
||||
if (StrUtil.isNotEmpty(phone)){
|
||||
@@ -556,10 +557,21 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
||||
} catch (Exception e) {
|
||||
phone = user.getPhone();
|
||||
}
|
||||
user.setPhone(phone);
|
||||
user.setPhone(DesensitizedUtil.mobilePhone(phone));
|
||||
}
|
||||
}
|
||||
|
||||
private String DesensitizedEmail(String email) {
|
||||
if (StrUtil.isBlank(email)) {
|
||||
return StrUtil.EMPTY;
|
||||
}
|
||||
int index = StrUtil.indexOf(email, '@');
|
||||
if (index <= 4) {
|
||||
return StrUtil.hide(email, 0, index);
|
||||
}
|
||||
return StrUtil.hide(email, index - 4, index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String proceedEmailDecrypt(String email) {
|
||||
if (StrUtil.isNotEmpty(email)){
|
||||
|
||||
Reference in New Issue
Block a user