wangliang 4 lat temu
rodzic
commit
c876f31c7d

+ 6 - 3
themis-business/src/main/java/com/qmth/themis/business/service/impl/TEMobileServiceImpl.java

@@ -59,6 +59,9 @@ public class TEMobileServiceImpl implements TEMobileService {
     @Resource
     MonitorUtil monitorUtil;
 
+    @Resource
+    CacheService cacheService;
+
     @Override
     public MobileAuthorizationBean authorization(MobileAuthorizationParamBean param) throws NoSuchAlgorithmException {
         MobileModeEnum mode = MobileModeEnum.valueOf(param.getMode().toUpperCase());
@@ -93,7 +96,7 @@ public class TEMobileServiceImpl implements TEMobileService {
             throw new BusinessException(ExceptionResultEnum.EXAM_ALREADY_FINISHED);
         }
         String deviceId = ServletUtil.getRequestDeviceId();
-        AuthDto authDto = (AuthDto) redisUtil.get(SystemConstant.studentOauth + es.getStudentId());
+        AuthDto authDto = cacheService.addStudentCache(es.getStudentId());
         // 生成token
         String token = RandomStringUtils.randomAlphanumeric(32);
         String sessionId = ret.getSessionId();
@@ -135,7 +138,7 @@ public class TEMobileServiceImpl implements TEMobileService {
         ExamStudentCacheBean es = examStudentService
                 .getExamStudentCacheBean(ExamRecordCacheUtil.getExamStudentId(ret.getRecordId()));
         String userType = MobileAuthCacheUtil.getUserType(mode, code);
-        AuthDto authDto = (AuthDto) redisUtil.get(SystemConstant.studentOauth + es.getStudentId());
+        AuthDto authDto = cacheService.addStudentCache(es.getStudentId());
         String sessionId = SessionUtil
                 .digest(es.getStudentId(), Math.abs(authDto.getRoleCodes().toString().hashCode()), sourceEnum);
         if (Objects.nonNull(userType) && userType.contains(RoleEnum.STUDENT.name())) {
@@ -161,7 +164,7 @@ public class TEMobileServiceImpl implements TEMobileService {
         ExamStudentCacheBean es = examStudentService
                 .getExamStudentCacheBean(ExamRecordCacheUtil.getExamStudentId(recordId));
         Source sourceEnum = Source.OE_ANSWER;
-        AuthDto authDto = (AuthDto) redisUtil.get(SystemConstant.studentOauth + es.getStudentId());
+        AuthDto authDto = cacheService.addStudentCache(es.getStudentId());
         String sessionId = SessionUtil
                 .digest(es.getStudentId(), Math.abs(authDto.getRoleCodes().toString().hashCode()), sourceEnum);
         ret.setRecordId(recordId);