|
@@ -26,6 +26,7 @@ import org.springframework.util.CollectionUtils;
|
|
|
import javax.annotation.Resource;
|
|
|
import java.io.IOException;
|
|
|
import java.util.*;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* @Date: 2021/5/20.
|
|
@@ -100,8 +101,19 @@ public class SsoServiceImpl implements SsoService {
|
|
|
List<SysOrg> sysOrgList = sysOrgService.findByConnectByParentId(sysUser.getOrgId(), false, true);
|
|
|
if (CollectionUtils.isEmpty(sysOrgList)) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("未找到学院信息");
|
|
|
+ } else {
|
|
|
+ List<SysOrg> sysOrgSchool = sysOrgList.stream().filter(s -> s.getType() == OrgTypeEnum.SCHOOL).collect(Collectors.toList());
|
|
|
+ if (!CollectionUtils.isEmpty(sysOrgSchool)) {
|
|
|
+ for (SysOrg s : sysOrgList) {
|
|
|
+ if (Objects.nonNull(s.getParentId()) && s.getParentId().longValue() == sysOrgSchool.get(0).getId().longValue()) {
|
|
|
+ orgName = s.getName();
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("未找到顶级学校信息");
|
|
|
+ }
|
|
|
}
|
|
|
- orgName = sysOrgList.get(0).getName();
|
|
|
} else if (role == RoleTypeEnum.OFFICE_TEACHER && Objects.nonNull(sysUser.getOrgId())) {
|
|
|
SysOrg sysOrg = commonCacheService.orgCache(sysUser.getOrgId());
|
|
|
if (Objects.isNull(sysOrg)) {
|