SecurityUtils.getSubject().getPrincipal(); shiro 框架中这个在首次登陆为null,不知道从呢里去排除代码
protected XtyhxxbEntity getUser() {
XtyhxxbEntity entity = (XtyhxxbEntity) SecurityUtils.getSubject().getPrincipal();
if (entity != null && StringUtils.isEmpty(entity.getJsmc())) {
try {
entity.setJsmc(sysDepartmentService.getDepartment(entity.getJsbh()));
} catch (Exception e) {
entity.setJsmc(" ");
}
}
// 登陆人不是系统管理员并且民警编号不为空的情况下查询数据
if (!Constant.SUPER_ADMIN.equals(entity.getYhbh()) && StrUtil.isNotBlank(entity.getMjbh())) {
MjMjxxbEntity mjInfo = mjMjxxbService.getById(entity.getMjbh());
entity.setMjgwid(mjInfo.getMjgwdm());
entity.setMjgwmc(mjInfo.getMjgwmc());
}
return entity;
}