|
@@ -51,6 +51,9 @@ public class SsoServiceImpl implements SsoService {
|
|
|
@Resource
|
|
|
SysUserRoleService sysUserRoleService;
|
|
|
|
|
|
+ @Resource
|
|
|
+ CloudMarkingTaskUtils cloudMarkingTaskUtils;
|
|
|
+
|
|
|
@Override
|
|
|
public Map<String, Object> markerLoginInfo() {
|
|
|
try {
|
|
@@ -60,17 +63,23 @@ public class SsoServiceImpl implements SsoService {
|
|
|
|| SpecialPrivilegeEnum.SUBJECT_HEADER.equals(userSpecialPrivilege)) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("该用户没有评卷员角色,无法登录");
|
|
|
}
|
|
|
- // 顶级机构
|
|
|
- SysOrg rootOrg = sysOrgService.findRootOrg(sysUser.getSchoolId());
|
|
|
- List<SysOrg> sysOrgList = sysOrgService.findByConnectByParentId(sysUser.getOrgId(), false, false);
|
|
|
- if(sysOrgList.isEmpty()){
|
|
|
- throw ExceptionResultEnum.ERROR.exception(String.format("未找到用户账号[%s]所属机构及上级机构", sysUser.getLoginName()));
|
|
|
- }
|
|
|
- SysOrg collegeOrg = sysOrgList.stream().filter(m->m.getParentId().equals(rootOrg.getId())).findFirst().orElseGet(null);
|
|
|
- if(collegeOrg == null){
|
|
|
- throw ExceptionResultEnum.ERROR.exception(String.format("未找到用户账号[%s]所属学院", sysUser.getLoginName()));
|
|
|
+
|
|
|
+ String orgCode = null;
|
|
|
+ if (cloudMarkingTaskUtils.isCollegeMode(sysUser.getSchoolId())) {
|
|
|
+ // 顶级机构
|
|
|
+ SysOrg rootOrg = sysOrgService.findRootOrg(sysUser.getSchoolId());
|
|
|
+ List<SysOrg> sysOrgList = sysOrgService.findByConnectByParentId(sysUser.getOrgId(), false, false);
|
|
|
+ if (sysOrgList.isEmpty()) {
|
|
|
+ throw ExceptionResultEnum.ERROR.exception(String.format("未找到用户账号[%s]所属机构及上级机构", sysUser.getLoginName()));
|
|
|
+ }
|
|
|
+ Optional<SysOrg> orgOptional = sysOrgList.stream().filter(m -> m.getParentId() != null && m.getParentId().equals(rootOrg.getId())).findFirst();
|
|
|
+ if (!orgOptional.isPresent()) {
|
|
|
+ throw ExceptionResultEnum.ERROR.exception(String.format("未找到用户账号[%s]所属学院", sysUser.getLoginName()));
|
|
|
+ }
|
|
|
+ SysOrg collegeOrg = orgOptional.get();
|
|
|
+ orgCode = collegeOrg.getCode();
|
|
|
}
|
|
|
- return stmmsUtils.markLogin(sysUser, collegeOrg.getCode());
|
|
|
+ return stmmsUtils.markLogin(sysUser, orgCode);
|
|
|
} catch (Exception e) {
|
|
|
throw ExceptionResultEnum.ERROR.exception(e.getMessage());
|
|
|
}
|
|
@@ -85,17 +94,23 @@ public class SsoServiceImpl implements SsoService {
|
|
|
|| SpecialPrivilegeEnum.MARKER.equals(userSpecialPrivilege)) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("该用户没有科组长角色,无法登录");
|
|
|
}
|
|
|
- // 顶级机构
|
|
|
- SysOrg rootOrg = sysOrgService.findRootOrg(sysUser.getSchoolId());
|
|
|
- List<SysOrg> sysOrgList = sysOrgService.findByConnectByParentId(sysUser.getOrgId(), false, false);
|
|
|
- if(sysOrgList.isEmpty()){
|
|
|
- throw ExceptionResultEnum.ERROR.exception(String.format("未找到用户账号[%s]所属机构及上级机构", sysUser.getLoginName()));
|
|
|
- }
|
|
|
- SysOrg collegeOrg = sysOrgList.stream().filter(m->m.getParentId().equals(rootOrg.getId())).findFirst().orElseGet(null);
|
|
|
- if(collegeOrg == null){
|
|
|
- throw ExceptionResultEnum.ERROR.exception(String.format("未找到用户账号[%s]所属学院", sysUser.getLoginName()));
|
|
|
+
|
|
|
+ String orgCode = null;
|
|
|
+ if (cloudMarkingTaskUtils.isCollegeMode(sysUser.getSchoolId())) {
|
|
|
+ // 顶级机构
|
|
|
+ SysOrg rootOrg = sysOrgService.findRootOrg(sysUser.getSchoolId());
|
|
|
+ List<SysOrg> sysOrgList = sysOrgService.findByConnectByParentId(sysUser.getOrgId(), false, false);
|
|
|
+ if (sysOrgList.isEmpty()) {
|
|
|
+ throw ExceptionResultEnum.ERROR.exception(String.format("未找到用户账号[%s]所属机构及上级机构", sysUser.getLoginName()));
|
|
|
+ }
|
|
|
+ Optional<SysOrg> orgOptional = sysOrgList.stream().filter(m -> m.getParentId() != null && m.getParentId().equals(rootOrg.getId())).findFirst();
|
|
|
+ if (!orgOptional.isPresent()) {
|
|
|
+ throw ExceptionResultEnum.ERROR.exception(String.format("未找到用户账号[%s]所属学院", sysUser.getLoginName()));
|
|
|
+ }
|
|
|
+ SysOrg collegeOrg = orgOptional.get();
|
|
|
+ orgCode = collegeOrg.getCode();
|
|
|
}
|
|
|
- return stmmsUtils.markLeaderLogin(sysUser, collegeOrg.getCode());
|
|
|
+ return stmmsUtils.markLeaderLogin(sysUser, orgCode);
|
|
|
} catch (Exception e) {
|
|
|
throw ExceptionResultEnum.ERROR.exception(e.getMessage());
|
|
|
}
|