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