|
@@ -6,11 +6,13 @@ import com.qmth.distributed.print.business.service.SsoService;
|
|
|
import com.qmth.teachcloud.common.config.DictionaryConfig;
|
|
|
import com.qmth.teachcloud.common.contant.SystemConstant;
|
|
|
import com.qmth.teachcloud.common.entity.BasicSchool;
|
|
|
+import com.qmth.teachcloud.common.entity.SysOrg;
|
|
|
import com.qmth.teachcloud.common.entity.SysUser;
|
|
|
import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
|
|
|
import com.qmth.teachcloud.common.enums.RoleTypeEnum;
|
|
|
import com.qmth.teachcloud.common.enums.userPush.SpecialPrivilegeEnum;
|
|
|
import com.qmth.teachcloud.common.service.CommonCacheService;
|
|
|
+import com.qmth.teachcloud.common.service.SysOrgService;
|
|
|
import com.qmth.teachcloud.common.service.SysUserService;
|
|
|
import com.qmth.teachcloud.common.sync.CloudMarkingTaskUtils;
|
|
|
import com.qmth.teachcloud.common.util.ServletUtil;
|
|
@@ -18,10 +20,12 @@ import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.util.CollectionUtils;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import java.io.IOException;
|
|
|
import java.util.HashMap;
|
|
|
+import java.util.List;
|
|
|
import java.util.Map;
|
|
|
import java.util.Optional;
|
|
|
|
|
@@ -44,6 +48,9 @@ public class SsoServiceImpl implements SsoService {
|
|
|
@Resource
|
|
|
CommonCacheService commonCacheService;
|
|
|
|
|
|
+ @Resource
|
|
|
+ SysOrgService sysOrgService;
|
|
|
+
|
|
|
@Override
|
|
|
public Map<String, Object> markerLoginInfo() {
|
|
|
try {
|
|
@@ -89,13 +96,17 @@ public class SsoServiceImpl implements SsoService {
|
|
|
*/
|
|
|
@Override
|
|
|
public Map<String, Object> analysisLogin(String loginName, RoleTypeEnum role, String orgName, String realName, String mobileNumber, Boolean enable, String returnUrl) throws IOException {
|
|
|
- Long schoolId = SystemConstant.getHeadOrUserSchoolId();
|
|
|
- BasicSchool basicSchool = commonCacheService.schoolCache(schoolId);
|
|
|
+ SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
|
|
|
+ BasicSchool basicSchool = commonCacheService.schoolCache(sysUser.getSchoolId());
|
|
|
+ List<SysOrg> sysOrgList = sysOrgService.findByConnectByParentId(sysUser.getOrgId(), false, true);
|
|
|
+ if (CollectionUtils.isEmpty(sysOrgList)) {
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("未找到学院信息");
|
|
|
+ }
|
|
|
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
map.computeIfAbsent("loginName", v -> loginName);
|
|
|
map.computeIfAbsent("role", v -> role);
|
|
|
- map.computeIfAbsent("orgName", v -> orgName);
|
|
|
+ map.computeIfAbsent("orgName", v -> sysOrgList.get(0).getName());
|
|
|
map.computeIfAbsent("realName", v -> realName);
|
|
|
map.computeIfAbsent("mobileNumber", v -> mobileNumber);
|
|
|
map.computeIfAbsent("returnUrl", v -> returnUrl);
|