|
@@ -17,19 +17,15 @@ import com.qmth.teachcloud.common.service.*;
|
|
|
import com.qmth.teachcloud.common.sync.CloudMarkingTaskUtils;
|
|
|
import com.qmth.teachcloud.common.util.JacksonUtil;
|
|
|
import com.qmth.teachcloud.common.util.ServletUtil;
|
|
|
-import org.apache.commons.text.StringEscapeUtils;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
-import org.springframework.util.CollectionUtils;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import java.io.IOException;
|
|
|
import java.net.URLEncoder;
|
|
|
import java.util.*;
|
|
|
-import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* @Date: 2021/5/20.
|
|
@@ -53,12 +49,6 @@ public class SsoServiceImpl implements SsoService {
|
|
|
@Resource
|
|
|
SysOrgService sysOrgService;
|
|
|
|
|
|
- @Value("${cas.config.questionLoginUri}")
|
|
|
- String questionLoginUri;
|
|
|
-
|
|
|
- @Value("${cas.config.questionHostUrl}")
|
|
|
- String questionHostUrl;
|
|
|
-
|
|
|
@Resource
|
|
|
SysRoleService sysRoleService;
|
|
|
|
|
@@ -148,7 +138,7 @@ public class SsoServiceImpl implements SsoService {
|
|
|
// throw ExceptionResultEnum.ERROR.exception("未找到顶级学校信息");
|
|
|
// }
|
|
|
// }
|
|
|
- if (Objects.isNull(sysOrg)){
|
|
|
+ if (Objects.isNull(sysOrg)) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("未找到顶级机构");
|
|
|
}
|
|
|
} else if (role == RoleTypeEnum.OFFICE_TEACHER && Objects.nonNull(sysUserCas.getOrgId())) {
|
|
@@ -195,7 +185,7 @@ public class SsoServiceImpl implements SsoService {
|
|
|
* @throws IOException
|
|
|
*/
|
|
|
@Override
|
|
|
- public Map<String, Object> questionLibraryLogin(String loginName,String realName, RoleTypeEnum role, String returnUrl, String params) throws IOException {
|
|
|
+ public Map<String, Object> questionLibraryLogin(String loginName, String realName, RoleTypeEnum role, String returnUrl, String params) throws IOException {
|
|
|
SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
|
|
|
BasicSchool basicSchool = commonCacheService.schoolCache(sysUser.getSchoolId());
|
|
|
|
|
@@ -217,10 +207,10 @@ public class SsoServiceImpl implements SsoService {
|
|
|
Optional.ofNullable(sysUserRole).orElseThrow(() -> ExceptionResultEnum.ERROR.exception("用户没有该角色"));
|
|
|
|
|
|
long timestamp = System.currentTimeMillis();
|
|
|
- String questionLoginUrl = questionHostUrl + questionLoginUri;
|
|
|
- String path = questionLoginUri;
|
|
|
+ String questionLoginUrl = dictionaryConfig.casDomain().getQuestionHostUrl() + dictionaryConfig.casDomain().getQuestionLoginUri();
|
|
|
+ String path = dictionaryConfig.casDomain().getQuestionLoginUri();
|
|
|
String signature = SignatureEntity.build(SignatureType.SECRET, SystemConstant.GET, path, timestamp, basicSchool.getAccessKey(), basicSchool.getAccessSecret());
|
|
|
- signature = URLEncoder.encode(signature,"utf-8");
|
|
|
+ signature = URLEncoder.encode(signature, SystemConstant.CHARSET_NAME);
|
|
|
|
|
|
StringJoiner stringJoiner = new StringJoiner("")
|
|
|
.add(questionLoginUrl)
|