修改了用户信息模型
This commit is contained in:
@ -16,132 +16,131 @@ import java.util.Date;
|
||||
@Accessors(chain = true)
|
||||
public class BaseCacheUser {
|
||||
|
||||
/**
|
||||
* PKID
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* PKID
|
||||
*/
|
||||
private Long userId;
|
||||
/**
|
||||
* 姓名
|
||||
*/
|
||||
private String lastName;
|
||||
/**
|
||||
* 姓氏
|
||||
*/
|
||||
private String firstName;
|
||||
/**
|
||||
* 全名
|
||||
*/
|
||||
private String fullName;
|
||||
|
||||
/**
|
||||
* 姓名
|
||||
*/
|
||||
private String lastName;
|
||||
/**
|
||||
*姓氏
|
||||
*/
|
||||
private String firstName;
|
||||
/**
|
||||
* 全名
|
||||
*/
|
||||
private String fullName;
|
||||
/**
|
||||
* 电子邮件
|
||||
*/
|
||||
private String emailAddress;
|
||||
//
|
||||
/**
|
||||
* 用户名
|
||||
*/
|
||||
private String loginName;
|
||||
//
|
||||
/**
|
||||
* 手机号
|
||||
*/
|
||||
private String mobilePhone;
|
||||
/**
|
||||
* 办公号
|
||||
*/
|
||||
private String officePhone;
|
||||
|
||||
/**
|
||||
* 电子邮件
|
||||
*/
|
||||
private String emailAddress;
|
||||
//
|
||||
/**
|
||||
* 用户名
|
||||
*/
|
||||
private String loginName;
|
||||
//
|
||||
/**
|
||||
* 手机号
|
||||
*/
|
||||
private String mobilePhone;
|
||||
/**
|
||||
* 办公号
|
||||
*/
|
||||
private String officePhone;
|
||||
/**
|
||||
* 性别
|
||||
*/
|
||||
private String sex;
|
||||
|
||||
/**
|
||||
* 性别
|
||||
*/
|
||||
private String sex;
|
||||
/**
|
||||
* 员工类别
|
||||
*/
|
||||
private String employeeCategory;
|
||||
|
||||
/**
|
||||
* 员工类别
|
||||
*/
|
||||
private String employeeCategory;
|
||||
/**
|
||||
* 用户类型
|
||||
*/
|
||||
private String userType;
|
||||
|
||||
/**
|
||||
* 用户类型
|
||||
*/
|
||||
private String userType;
|
||||
/**
|
||||
* 出生日期
|
||||
*/
|
||||
private Date dateOfBirth;
|
||||
|
||||
/**
|
||||
* 出生日期
|
||||
*/
|
||||
private Date dateOfBirth;
|
||||
/**
|
||||
* 年龄
|
||||
*/
|
||||
private Integer age;
|
||||
|
||||
/**
|
||||
* 年龄
|
||||
*/
|
||||
private Integer age;
|
||||
/**
|
||||
* 员工编号
|
||||
*/
|
||||
private String employeeNumber;
|
||||
|
||||
/**
|
||||
* 员工编号
|
||||
*/
|
||||
private String employeeNumber;
|
||||
/**
|
||||
* 国籍ID
|
||||
*/
|
||||
private String nationalityId;
|
||||
|
||||
/**
|
||||
* 国籍ID
|
||||
*/
|
||||
private String nationalityId;
|
||||
/**
|
||||
* 国籍
|
||||
*/
|
||||
private String nationality;
|
||||
|
||||
/**
|
||||
* 国籍
|
||||
*/
|
||||
private String nationality;
|
||||
/**
|
||||
* 身份证号码
|
||||
*/
|
||||
private String nationalIdentifier;
|
||||
|
||||
/**
|
||||
* 身份证号码
|
||||
*/
|
||||
private String nationalIdentifier;
|
||||
/**
|
||||
* 主管ID
|
||||
*/
|
||||
private Integer supervisorId;
|
||||
|
||||
/**
|
||||
* 主管ID
|
||||
*/
|
||||
private Integer supervisorId;
|
||||
/**
|
||||
* 组织ID
|
||||
*/
|
||||
private String organizationId;
|
||||
|
||||
/**
|
||||
* 组织ID
|
||||
*/
|
||||
private String organizationId;
|
||||
/**
|
||||
* 组织名称
|
||||
*/
|
||||
private String organizationName;
|
||||
//
|
||||
/**
|
||||
* 组织机构类别
|
||||
*/
|
||||
private String orgCategory;
|
||||
|
||||
/**
|
||||
* 组织名称
|
||||
*/
|
||||
private String organizationName;
|
||||
//
|
||||
/**
|
||||
* 组织机构类别
|
||||
*/
|
||||
private String orgCategory;
|
||||
/**
|
||||
* 部门ID
|
||||
*/
|
||||
private String deptId;
|
||||
|
||||
/**
|
||||
* 部门ID
|
||||
*/
|
||||
private String deptId;
|
||||
/**
|
||||
* 部门名称
|
||||
*/
|
||||
private String deptName;
|
||||
|
||||
/**
|
||||
* 部门名称
|
||||
*/
|
||||
private String deptName;
|
||||
/**
|
||||
* 角色ID
|
||||
*/
|
||||
private String roleIds;
|
||||
|
||||
/**
|
||||
* 角色ID
|
||||
*/
|
||||
private String roleIds;
|
||||
/**
|
||||
* 业务组id
|
||||
*/
|
||||
private Integer bussiGroupId;
|
||||
|
||||
/**
|
||||
* 业务组id
|
||||
*/
|
||||
private Integer bussiGroupId;
|
||||
|
||||
/**
|
||||
* 职位ID
|
||||
*/
|
||||
private Integer positionId;
|
||||
/**
|
||||
* 职位ID
|
||||
*/
|
||||
private Integer positionId;
|
||||
|
||||
}
|
||||
|
@ -22,6 +22,8 @@ import lombok.extern.slf4j.Slf4j;
|
||||
@Service
|
||||
@Slf4j
|
||||
public class BaseCacheUserServiceImpl implements IBaseCacheUserService {
|
||||
// TODO 设置种子ID, 对其雪花ID长度
|
||||
private static final long ID_SEED = 1345977833027100000L;
|
||||
|
||||
private static final Map<String, BaseCacheUser> USERS = new ConcurrentHashMap<>();
|
||||
|
||||
@ -31,19 +33,10 @@ public class BaseCacheUserServiceImpl implements IBaseCacheUserService {
|
||||
|
||||
log.debug("Current user principal: " + map);
|
||||
|
||||
return new BaseCacheUser().setUserId(1L).setFullName((String) map.get("staffName"))
|
||||
.setLoginName((String) map.get("username")).setRoleIds((String) map.get("staffId"))
|
||||
.setOrganizationId((String) map.get("ou")).setOrganizationName((String) map.get("ouName"));
|
||||
|
||||
// BaseCacheUser user = new BaseCacheUser();
|
||||
// ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
|
||||
// if (attributes != null) {
|
||||
// HttpServletRequest request = attributes.getRequest();
|
||||
// String token = request.getHeader("JwtToken");
|
||||
// user = USERS.get(token);
|
||||
// }
|
||||
// log.info(" --------------- 当前用户:" + JsonUtils.objectToJson(user) + " ------------------------------");
|
||||
// return user;
|
||||
return new BaseCacheUser().setUserId(getUserId((String) map.get("staffId")))
|
||||
.setFullName((String) map.get("staffName")).setLoginName((String) map.get("username"))
|
||||
.setRoleIds((String) map.get("staffId")).setOrganizationId((String) map.get("ou"))
|
||||
.setOrganizationName((String) map.get("ouName"));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -51,6 +44,21 @@ public class BaseCacheUserServiceImpl implements IBaseCacheUserService {
|
||||
return USERS.values();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string
|
||||
* @return
|
||||
*/
|
||||
// TODO: 山东框架使用未使用雪花ID存放字符串,暂时使用该方法进行id转换
|
||||
private Long getUserId(String rawUid) {
|
||||
long id = ID_SEED;
|
||||
byte[] bytes = rawUid.getBytes();
|
||||
|
||||
for (byte b : bytes) {
|
||||
id += b;
|
||||
}
|
||||
return id;
|
||||
}
|
||||
|
||||
static {
|
||||
BaseCacheUser user = new BaseCacheUser().setUserId(1L).setFullName("采购经理").setLoginName("caigou")
|
||||
.setRoleIds("caigou").setOrganizationId("100").setOrganizationName("中国联通吉林分公司");
|
||||
|
Reference in New Issue
Block a user