Jelajahi Sumber

add:知学知考单点登录题库

caozixuan 1 tahun lalu
induk
melakukan
9abb1912f0

+ 19 - 18
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/SsoServiceImpl.java

@@ -7,7 +7,6 @@ import com.qmth.boot.tools.signature.SignatureType;
 import com.qmth.distributed.print.business.bean.result.DictionaryResult;
 import com.qmth.distributed.print.business.service.SsoService;
 import com.qmth.distributed.print.business.service.TeachCourseService;
-import com.qmth.teachcloud.common.bean.params.OpenParams;
 import com.qmth.teachcloud.common.contant.SystemConstant;
 import com.qmth.teachcloud.common.entity.*;
 import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
@@ -15,7 +14,6 @@ import com.qmth.teachcloud.common.enums.OrgTypeEnum;
 import com.qmth.teachcloud.common.enums.RoleTypeEnum;
 import com.qmth.teachcloud.common.enums.userPush.SpecialPrivilegeEnum;
 import com.qmth.teachcloud.common.service.*;
-import com.qmth.teachcloud.common.util.JacksonUtil;
 import com.qmth.teachcloud.common.util.ServletUtil;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -239,35 +237,38 @@ public class SsoServiceImpl implements SsoService {
             questionLoginUrl = questionLoginUrl.replace(SystemConstant.PATH_MATCH, basicSchool.getCode());
         }
         questionLoginUrl = questionLoginUrl + SystemConstant.TIKU_CAS_ADMIN_LOGIN_OPEN_API;
-        String path = SystemConstant.TIKU_CAS_ADMIN_LOGIN_OPEN_API;
+        String path = SystemConstant.TIKU_SSO_LOGIN_API;
+
         String signature = SignatureEntity.build(SignatureType.SECRET, SystemConstant.GET, path, timestamp, basicSchool.getAccessKey(), basicSchool.getAccessSecret());
         signature = URLEncoder.encode(signature, SystemConstant.CHARSET_NAME);
 
+        Long userId = sysUser.getId();
+        List<DictionaryResult> dictionaryResultList = teachCourseService.findTeacherCourseInfo(userId);
+
         StringJoiner stringJoiner = new StringJoiner("")
                 .add(questionLoginUrl)
                 .add(SystemConstant.GET_UNKNOWN).add(SystemConstant.HEADER_TIME).add(SystemConstant.GET_EQUAL).add(String.valueOf(timestamp))
-                .add(SystemConstant.GET_SYMBOL).add(SystemConstant.SIGNATURE).add(SystemConstant.GET_EQUAL).add(signature)
-                .add(SystemConstant.GET_SYMBOL).add(SystemConstant.USER).add(SystemConstant.GET_EQUAL).add(loginName);
+                .add(SystemConstant.GET_SYMBOL).add(SystemConstant.HEADER_AUTHORIZATION).add(SystemConstant.GET_EQUAL).add(signature)
+                .add(SystemConstant.GET_SYMBOL).add(SystemConstant.USER).add(SystemConstant.GET_EQUAL).add(loginName)
+                .add(SystemConstant.GET_SYMBOL).add("name").add(SystemConstant.GET_EQUAL).add(realName)
+                .add(SystemConstant.GET_SYMBOL).add("roleCode").add(SystemConstant.GET_EQUAL).add(role.name())
+                .add(SystemConstant.GET_SYMBOL).add("courses").add(SystemConstant.GET_EQUAL).add(JSON.toJSONString(dictionaryResultList));
 
         if (Objects.nonNull(returnUrl) && !Objects.equals(returnUrl, "")) {
             stringJoiner = stringJoiner.add(SystemConstant.GET_SYMBOL).add(SystemConstant.RETURN_URL).add(SystemConstant.GET_EQUAL).add(returnUrl);
         }
 
         Map<String, Object> map = new HashMap<>();
-        if (Objects.nonNull(params) && !Objects.equals(params, "")) {
-            OpenParams openParams = JacksonUtil.readJson(params, OpenParams.class);
-            stringJoiner = stringJoiner.add(SystemConstant.GET_SYMBOL).add(SystemConstant.PARAMS).add(SystemConstant.GET_EQUAL).add(JacksonUtil.parseJson(openParams));
-            map.computeIfAbsent(SystemConstant.PARAMS, v -> JacksonUtil.parseJson(openParams));
-        }
-        Long userId = sysUser.getId();
-        List<DictionaryResult> dictionaryResultList = teachCourseService.findTeacherCourseInfo(userId);
-
-
-        map.computeIfAbsent("loginName", v -> loginName);
-        map.computeIfAbsent("realName", v -> realName);
-        map.computeIfAbsent("roleCode", v -> role);
+//        if (Objects.nonNull(params) && !Objects.equals(params, "")) {
+//            OpenParams openParams = JacksonUtil.readJson(params, OpenParams.class);
+//            stringJoiner = stringJoiner.add(SystemConstant.GET_SYMBOL).add(SystemConstant.PARAMS).add(SystemConstant.GET_EQUAL).add(JacksonUtil.parseJson(openParams));
+//            map.computeIfAbsent(SystemConstant.PARAMS, v -> JacksonUtil.parseJson(openParams));
+//        }
+//
+//        map.computeIfAbsent("loginName", v -> loginName);
+//        map.computeIfAbsent("realName", v -> realName);
+//        map.computeIfAbsent("roleCode", v -> role);
         map.computeIfAbsent("returnUrl", v -> returnUrl);
-        map.computeIfAbsent("courses", v -> dictionaryResultList);
         map.put("redirectUrl", stringJoiner.toString());
         return map;
     }

+ 1 - 0
teachcloud-common/src/main/java/com/qmth/teachcloud/common/contant/SystemConstant.java

@@ -138,6 +138,7 @@ public class SystemConstant {
      * 题库接口地址
      */
     public static final String TIKU_CAS_ADMIN_LOGIN_OPEN_API = "/admin/login-open";// 题库cas登录地址
+    public static final String TIKU_SSO_LOGIN_API = "/api/open/sso/login";// 题库单点登录接口地址
     public static final String TIKU_PAPER_LIST_API = "/api/open/paper/page";// 获取试卷列表接口地址
     public static final String TIKU_PAPER_DATA_API = "/api/open/paper/data";// 获取试卷数据接口地址
     public static final String TIKU_PAPER_PROPERTY_API = "/api/open/property";// 获取知识点接口地址