Commit 172f9604 authored by 陈立彬's avatar 陈立彬

log

parent 125cfeeb
...@@ -12,6 +12,7 @@ import com.alibaba.fastjson.JSONObject; ...@@ -12,6 +12,7 @@ import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import io.micrometer.common.util.StringUtils; import io.micrometer.common.util.StringUtils;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.compress.utils.Lists; import org.apache.commons.compress.utils.Lists;
import org.springframework.data.redis.core.StringRedisTemplate; import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
...@@ -25,6 +26,7 @@ import java.util.stream.Collectors; ...@@ -25,6 +26,7 @@ import java.util.stream.Collectors;
@RestController @RestController
@Slf4j
@RequestMapping(value = "/exam") @RequestMapping(value = "/exam")
@RequiredArgsConstructor @RequiredArgsConstructor
public class ExamController { public class ExamController {
...@@ -60,6 +62,8 @@ public class ExamController { ...@@ -60,6 +62,8 @@ public class ExamController {
String redisKey = String.format(EXAM_REDIS_SESSION_KEY, tenant, sessionId, userId); String redisKey = String.format(EXAM_REDIS_SESSION_KEY, tenant, sessionId, userId);
String currentQuestion = redisTemplate.opsForValue().get(redisKey); String currentQuestion = redisTemplate.opsForValue().get(redisKey);
log.info("获取当前出题,rediskey = {}, value = {}", redisKey, currentQuestion);
if(StringUtils.isNotEmpty(currentQuestion)) { if(StringUtils.isNotEmpty(currentQuestion)) {
ElehKnowledgeDo knowledgeDo = knowledgeMapper.selectById(Long.valueOf(currentQuestion)); ElehKnowledgeDo knowledgeDo = knowledgeMapper.selectById(Long.valueOf(currentQuestion));
if(Objects.nonNull(knowledgeDo)) { if(Objects.nonNull(knowledgeDo)) {
...@@ -102,6 +106,8 @@ public class ExamController { ...@@ -102,6 +106,8 @@ public class ExamController {
// 存储当前会话考试信息 // 存储当前会话考试信息
String redisKey = String.format(EXAM_REDIS_SESSION_KEY, tenant, sessionId, userId); String redisKey = String.format(EXAM_REDIS_SESSION_KEY, tenant, sessionId, userId);
redisTemplate.opsForValue().set(redisKey, result.getQuestionId()+"", 10, TimeUnit.MINUTES); redisTemplate.opsForValue().set(redisKey, result.getQuestionId()+"", 10, TimeUnit.MINUTES);
log.info("出题结果:result = {}, rediskey = {}", JSONObject.toJSONString(result), redisKey);
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment