获取当前医院错误
This commit is contained in:
parent
a7964e2e2c
commit
c2ba966fa4
|
@ -144,15 +144,19 @@ public class SysHospitalServiceImpl extends ServiceImpl<SysHospitalMapper, SysHo
|
|||
|
||||
@Override
|
||||
public String getCurrentHospital() {
|
||||
RaxUser raxUser = (RaxUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
|
||||
String userId = String.valueOf(raxUser.getId());
|
||||
String hospitalId = (String) redisTemplate.opsForValue().get(CacheConstants.CURRENT_HOSPITAL + ":" + userId);
|
||||
if (!StringUtils.hasText(hospitalId)) {
|
||||
List<Map> currentHospital = sysHospitalMapper.getCurrentHospital(userId);
|
||||
if (currentHospital.isEmpty()) {
|
||||
hospitalId = raxUser.getHospitalId() != null ? raxUser.getHospitalId().toString() : null;
|
||||
} else {
|
||||
hospitalId = (String) currentHospital.get(0).get("hospital_id");
|
||||
String hospitalId = null;
|
||||
Object principal = SecurityContextHolder.getContext().getAuthentication().getPrincipal();
|
||||
if (!(principal instanceof String)) {
|
||||
RaxUser raxUser = (RaxUser) principal;
|
||||
String userId = String.valueOf(raxUser.getId());
|
||||
hospitalId = (String) redisTemplate.opsForValue().get(CacheConstants.CURRENT_HOSPITAL + ":" + userId);
|
||||
if (!StringUtils.hasText(hospitalId)) {
|
||||
List<Map> currentHospital = sysHospitalMapper.getCurrentHospital(userId);
|
||||
if (currentHospital.isEmpty()) {
|
||||
hospitalId = raxUser.getHospitalId() != null ? raxUser.getHospitalId().toString() : null;
|
||||
} else {
|
||||
hospitalId = (String) currentHospital.get(0).get("hospital_id");
|
||||
}
|
||||
}
|
||||
}
|
||||
return hospitalId;
|
||||
|
|
Loading…
Reference in New Issue
Block a user