用户管理手机号脱敏
This commit is contained in:
parent
3d2266c427
commit
49571c2195
|
|
@ -45,6 +45,8 @@ public class SysUser extends BaseEntity
|
|||
@Excel(name = "手机号码", cellType = ColumnType.TEXT)
|
||||
private String phonenumber;
|
||||
|
||||
private String phonenumberDes;
|
||||
|
||||
/** 用户性别 */
|
||||
@Excel(name = "用户性别", readConverterExp = "0=男,1=女,2=未知")
|
||||
private String sex;
|
||||
|
|
@ -52,6 +54,14 @@ public class SysUser extends BaseEntity
|
|||
/** 用户头像 */
|
||||
private String avatar;
|
||||
|
||||
public String getPhonenumberDes() {
|
||||
return phonenumberDes;
|
||||
}
|
||||
|
||||
public void setPhonenumberDes(String phonenumberDes) {
|
||||
this.phonenumberDes = phonenumberDes;
|
||||
}
|
||||
|
||||
/** 密码 */
|
||||
private String password;
|
||||
|
||||
|
|
|
|||
|
|
@ -65,4 +65,12 @@ public class DesensitizedUtil {
|
|||
// 保留第1段和第4段,中间两段脱敏
|
||||
return parts[0] + ".*.*." + parts[3];
|
||||
}
|
||||
|
||||
// 手机号脱敏
|
||||
public static String maskPhone(String phone) {
|
||||
if (phone == null || phone.length() != 11) {
|
||||
return phone; // 非法手机号,原样返回或返回null
|
||||
}
|
||||
return phone.replaceAll("(\\d{3})\\d{4}(\\d{4})", "$1****$2");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,14 +6,14 @@ import com.bonus.common.core.domain.entity.SysDept;
|
|||
|
||||
/**
|
||||
* 部门管理 数据层
|
||||
*
|
||||
*
|
||||
* @author bonus
|
||||
*/
|
||||
public interface SysDeptMapper
|
||||
{
|
||||
/**
|
||||
* 查询部门管理数据
|
||||
*
|
||||
*
|
||||
* @param dept 部门信息
|
||||
* @return 部门信息集合
|
||||
*/
|
||||
|
|
@ -21,7 +21,7 @@ public interface SysDeptMapper
|
|||
|
||||
/**
|
||||
* 根据角色ID查询部门树信息
|
||||
*
|
||||
*
|
||||
* @param roleId 角色ID
|
||||
* @param deptCheckStrictly 部门树选择项是否关联显示
|
||||
* @return 选中部门列表
|
||||
|
|
@ -30,7 +30,7 @@ public interface SysDeptMapper
|
|||
|
||||
/**
|
||||
* 根据部门ID查询信息
|
||||
*
|
||||
*
|
||||
* @param deptId 部门ID
|
||||
* @return 部门信息
|
||||
*/
|
||||
|
|
@ -38,7 +38,7 @@ public interface SysDeptMapper
|
|||
|
||||
/**
|
||||
* 根据ID查询所有子部门
|
||||
*
|
||||
*
|
||||
* @param deptId 部门ID
|
||||
* @return 部门列表
|
||||
*/
|
||||
|
|
@ -46,7 +46,7 @@ public interface SysDeptMapper
|
|||
|
||||
/**
|
||||
* 根据ID查询所有子部门(正常状态)
|
||||
*
|
||||
*
|
||||
* @param deptId 部门ID
|
||||
* @return 子部门数
|
||||
*/
|
||||
|
|
@ -54,7 +54,7 @@ public interface SysDeptMapper
|
|||
|
||||
/**
|
||||
* 是否存在子节点
|
||||
*
|
||||
*
|
||||
* @param deptId 部门ID
|
||||
* @return 结果
|
||||
*/
|
||||
|
|
@ -62,7 +62,7 @@ public interface SysDeptMapper
|
|||
|
||||
/**
|
||||
* 查询部门是否存在用户
|
||||
*
|
||||
*
|
||||
* @param deptId 部门ID
|
||||
* @return 结果
|
||||
*/
|
||||
|
|
@ -70,7 +70,7 @@ public interface SysDeptMapper
|
|||
|
||||
/**
|
||||
* 校验部门名称是否唯一
|
||||
*
|
||||
*
|
||||
* @param deptName 部门名称
|
||||
* @param parentId 父部门ID
|
||||
* @return 结果
|
||||
|
|
@ -79,7 +79,7 @@ public interface SysDeptMapper
|
|||
|
||||
/**
|
||||
* 新增部门信息
|
||||
*
|
||||
*
|
||||
* @param dept 部门信息
|
||||
* @return 结果
|
||||
*/
|
||||
|
|
@ -87,7 +87,7 @@ public interface SysDeptMapper
|
|||
|
||||
/**
|
||||
* 修改部门信息
|
||||
*
|
||||
*
|
||||
* @param dept 部门信息
|
||||
* @return 结果
|
||||
*/
|
||||
|
|
@ -95,14 +95,14 @@ public interface SysDeptMapper
|
|||
|
||||
/**
|
||||
* 修改所在部门正常状态
|
||||
*
|
||||
*
|
||||
* @param deptIds 部门ID组
|
||||
*/
|
||||
public void updateDeptStatusNormal(Long[] deptIds);
|
||||
|
||||
/**
|
||||
* 修改子元素关系
|
||||
*
|
||||
*
|
||||
* @param depts 子元素
|
||||
* @return 结果
|
||||
*/
|
||||
|
|
@ -110,7 +110,7 @@ public interface SysDeptMapper
|
|||
|
||||
/**
|
||||
* 删除部门管理信息
|
||||
*
|
||||
*
|
||||
* @param deptId 部门ID
|
||||
* @return 结果
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -6,14 +6,14 @@ import com.bonus.common.core.domain.entity.SysDept;
|
|||
|
||||
/**
|
||||
* 部门管理 服务层
|
||||
*
|
||||
*
|
||||
* @author bonus
|
||||
*/
|
||||
public interface ISysDeptService
|
||||
{
|
||||
/**
|
||||
* 查询部门管理数据
|
||||
*
|
||||
*
|
||||
* @param dept 部门信息
|
||||
* @return 部门信息集合
|
||||
*/
|
||||
|
|
@ -21,7 +21,7 @@ public interface ISysDeptService
|
|||
|
||||
/**
|
||||
* 查询部门树结构信息
|
||||
*
|
||||
*
|
||||
* @param dept 部门信息
|
||||
* @return 部门树信息集合
|
||||
*/
|
||||
|
|
@ -29,7 +29,7 @@ public interface ISysDeptService
|
|||
|
||||
/**
|
||||
* 构建前端所需要树结构
|
||||
*
|
||||
*
|
||||
* @param depts 部门列表
|
||||
* @return 树结构列表
|
||||
*/
|
||||
|
|
@ -37,7 +37,7 @@ public interface ISysDeptService
|
|||
|
||||
/**
|
||||
* 构建前端所需要下拉树结构
|
||||
*
|
||||
*
|
||||
* @param depts 部门列表
|
||||
* @return 下拉树结构列表
|
||||
*/
|
||||
|
|
@ -45,7 +45,7 @@ public interface ISysDeptService
|
|||
|
||||
/**
|
||||
* 根据角色ID查询部门树信息
|
||||
*
|
||||
*
|
||||
* @param roleId 角色ID
|
||||
* @return 选中部门列表
|
||||
*/
|
||||
|
|
@ -53,7 +53,7 @@ public interface ISysDeptService
|
|||
|
||||
/**
|
||||
* 根据部门ID查询信息
|
||||
*
|
||||
*
|
||||
* @param deptId 部门ID
|
||||
* @return 部门信息
|
||||
*/
|
||||
|
|
@ -61,7 +61,7 @@ public interface ISysDeptService
|
|||
|
||||
/**
|
||||
* 根据ID查询所有子部门(正常状态)
|
||||
*
|
||||
*
|
||||
* @param deptId 部门ID
|
||||
* @return 子部门数
|
||||
*/
|
||||
|
|
@ -69,7 +69,7 @@ public interface ISysDeptService
|
|||
|
||||
/**
|
||||
* 是否存在部门子节点
|
||||
*
|
||||
*
|
||||
* @param deptId 部门ID
|
||||
* @return 结果
|
||||
*/
|
||||
|
|
@ -77,7 +77,7 @@ public interface ISysDeptService
|
|||
|
||||
/**
|
||||
* 查询部门是否存在用户
|
||||
*
|
||||
*
|
||||
* @param deptId 部门ID
|
||||
* @return 结果 true 存在 false 不存在
|
||||
*/
|
||||
|
|
@ -85,7 +85,7 @@ public interface ISysDeptService
|
|||
|
||||
/**
|
||||
* 校验部门名称是否唯一
|
||||
*
|
||||
*
|
||||
* @param dept 部门信息
|
||||
* @return 结果
|
||||
*/
|
||||
|
|
@ -93,14 +93,14 @@ public interface ISysDeptService
|
|||
|
||||
/**
|
||||
* 校验部门是否有数据权限
|
||||
*
|
||||
*
|
||||
* @param deptId 部门id
|
||||
*/
|
||||
public void checkDeptDataScope(Long deptId);
|
||||
|
||||
/**
|
||||
* 新增保存部门信息
|
||||
*
|
||||
*
|
||||
* @param dept 部门信息
|
||||
* @return 结果
|
||||
*/
|
||||
|
|
@ -108,7 +108,7 @@ public interface ISysDeptService
|
|||
|
||||
/**
|
||||
* 修改保存部门信息
|
||||
*
|
||||
*
|
||||
* @param dept 部门信息
|
||||
* @return 结果
|
||||
*/
|
||||
|
|
@ -116,7 +116,7 @@ public interface ISysDeptService
|
|||
|
||||
/**
|
||||
* 删除部门管理信息
|
||||
*
|
||||
*
|
||||
* @param deptId 部门ID
|
||||
* @return 结果
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import java.util.List;
|
|||
import java.util.stream.Collectors;
|
||||
import javax.validation.Validator;
|
||||
|
||||
import com.bonus.common.utils.DesensitizedUtil;
|
||||
import com.bonus.common.utils.GenerateUtil;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
|
@ -77,7 +78,11 @@ public class SysUserServiceImpl implements ISysUserService
|
|||
@DataScope(deptAlias = "d", userAlias = "u")
|
||||
public List<SysUser> selectUserList(SysUser user)
|
||||
{
|
||||
return userMapper.selectUserList(user);
|
||||
List<SysUser> sysUsers = userMapper.selectUserList(user);
|
||||
for (SysUser sysUser : sysUsers) {
|
||||
sysUser.setPhonenumberDes(DesensitizedUtil.maskPhone(sysUser.getPhonenumber()));
|
||||
}
|
||||
return sysUsers;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in New Issue