Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
exam_master
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ai-tech
exam_master
Commits
172f9604
Commit
172f9604
authored
Jul 01, 2024
by
陈立彬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
log
parent
125cfeeb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
0 deletions
+6
-0
ExamController.java
src/main/java/cn/aibreeze/exam/api/ExamController.java
+6
-0
No files found.
src/main/java/cn/aibreeze/exam/api/ExamController.java
View file @
172f9604
...
...
@@ -12,6 +12,7 @@ import com.alibaba.fastjson.JSONObject;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
io.micrometer.common.util.StringUtils
;
import
lombok.RequiredArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.compress.utils.Lists
;
import
org.springframework.data.redis.core.StringRedisTemplate
;
import
org.springframework.util.CollectionUtils
;
...
...
@@ -25,6 +26,7 @@ import java.util.stream.Collectors;
@RestController
@Slf4j
@RequestMapping
(
value
=
"/exam"
)
@RequiredArgsConstructor
public
class
ExamController
{
...
...
@@ -60,6 +62,8 @@ public class ExamController {
String
redisKey
=
String
.
format
(
EXAM_REDIS_SESSION_KEY
,
tenant
,
sessionId
,
userId
);
String
currentQuestion
=
redisTemplate
.
opsForValue
().
get
(
redisKey
);
log
.
info
(
"获取当前出题,rediskey = {}, value = {}"
,
redisKey
,
currentQuestion
);
if
(
StringUtils
.
isNotEmpty
(
currentQuestion
))
{
ElehKnowledgeDo
knowledgeDo
=
knowledgeMapper
.
selectById
(
Long
.
valueOf
(
currentQuestion
));
if
(
Objects
.
nonNull
(
knowledgeDo
))
{
...
...
@@ -102,6 +106,8 @@ public class ExamController {
// 存储当前会话考试信息
String
redisKey
=
String
.
format
(
EXAM_REDIS_SESSION_KEY
,
tenant
,
sessionId
,
userId
);
redisTemplate
.
opsForValue
().
set
(
redisKey
,
result
.
getQuestionId
()+
""
,
10
,
TimeUnit
.
MINUTES
);
log
.
info
(
"出题结果:result = {}, rediskey = {}"
,
JSONObject
.
toJSONString
(
result
),
redisKey
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment