Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
school-paper-admin
Overview
Overview
Details
Activity
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
school-paper
school-paper-admin
Commits
0c702f45
Commit
0c702f45
authored
Jul 26, 2023
by
Wangmin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
完善学生答题业务
parent
aeef9ca8
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
5 deletions
+6
-5
school-paper/src/main/java/com/ruoyi/school/paper/controller/TestPaperController.java
+2
-2
school-paper/src/main/java/com/ruoyi/school/paper/service/impl/TestPaperServiceImpl.java
+4
-3
No files found.
school-paper/src/main/java/com/ruoyi/school/paper/controller/TestPaperController.java
View file @
0c702f45
...
@@ -66,8 +66,8 @@ public class TestPaperController extends BaseController {
...
@@ -66,8 +66,8 @@ public class TestPaperController extends BaseController {
*/
*/
@Log
(
title
=
"交卷"
,
businessType
=
BusinessType
.
INSERT
)
@Log
(
title
=
"交卷"
,
businessType
=
BusinessType
.
INSERT
)
@PostMapping
(
"/endTest/"
)
@PostMapping
(
"/endTest/"
)
public
R
<
Void
>
paperTestEnd
(
@RequestBody
TestPaperAnswerBo
bo
)
{
public
R
<
Boolean
>
paperTestEnd
(
@RequestBody
TestPaperAnswerBo
bo
)
{
return
toAjax
(
testPaperService
.
paperTestEnd
(
bo
));
return
R
.
ok
(
testPaperService
.
paperTestEnd
(
bo
));
}
}
/**
/**
...
...
school-paper/src/main/java/com/ruoyi/school/paper/service/impl/TestPaperServiceImpl.java
View file @
0c702f45
...
@@ -149,7 +149,6 @@ public class TestPaperServiceImpl implements ITestPaperService {
...
@@ -149,7 +149,6 @@ public class TestPaperServiceImpl implements ITestPaperService {
buffer
.
setScore
(
bankTestPaperVo
.
getRightAnswers
().
equals
(
buffer
.
getAnswer
())
?
BigDecimal
.
valueOf
(
bankTestPaperVo
.
getScore
())
:
BigDecimal
.
ZERO
);
buffer
.
setScore
(
bankTestPaperVo
.
getRightAnswers
().
equals
(
buffer
.
getAnswer
())
?
BigDecimal
.
valueOf
(
bankTestPaperVo
.
getScore
())
:
BigDecimal
.
ZERO
);
}
}
insertPaperRecords
.
add
(
buffer
);
insertPaperRecords
.
add
(
buffer
);
RedisUtils
.
deleteKeys
(
key
);
});
});
if
(
CollUtil
.
isNotEmpty
(
insertPaperRecords
))
{
if
(
CollUtil
.
isNotEmpty
(
insertPaperRecords
))
{
if
(!
paperRecordDetailService
.
saveBatch
(
insertPaperRecords
))
{
if
(!
paperRecordDetailService
.
saveBatch
(
insertPaperRecords
))
{
...
@@ -157,9 +156,11 @@ public class TestPaperServiceImpl implements ITestPaperService {
...
@@ -157,9 +156,11 @@ public class TestPaperServiceImpl implements ITestPaperService {
}
}
// 修改考试记录状态为待批阅
// 修改考试记录状态为待批阅
testPaperRecord
.
setStatus
(
1
);
testPaperRecord
.
setStatus
(
1
);
if
(!
paperRecordService
.
updateByBo
(
BeanUtil
.
toBean
(
testPaper
Service
,
DbTestPaperRecordBo
.
class
)))
{
if
(!
paperRecordService
.
updateByBo
(
BeanUtil
.
toBean
(
testPaper
Record
,
DbTestPaperRecordBo
.
class
)))
{
throw
new
ServiceException
(
"考试记录状态修改失败"
);
throw
new
ServiceException
(
"考试记录状态修改失败"
);
}
}
// 清除Redis缓存
RedisUtils
.
deleteKeys
(
String
.
format
(
"%s:record:%d"
,
TEST_PAPER_ANSWER_KEY
,
bo
.
getRecordId
()));
return
true
;
return
true
;
}
}
return
true
;
return
true
;
...
@@ -183,7 +184,7 @@ public class TestPaperServiceImpl implements ITestPaperService {
...
@@ -183,7 +184,7 @@ public class TestPaperServiceImpl implements ITestPaperService {
// 查询Redis中是否有该题的提交记录
// 查询Redis中是否有该题的提交记录
String
key
=
String
.
format
(
TEST_PAPER_ANSWER_KEY_FORMAT
,
TEST_PAPER_ANSWER_KEY
,
recordId
,
question
.
getId
());
String
key
=
String
.
format
(
TEST_PAPER_ANSWER_KEY_FORMAT
,
TEST_PAPER_ANSWER_KEY
,
recordId
,
question
.
getId
());
TestPaperAnswerItemBo
cacheObject
=
RedisUtils
.
getCacheObject
(
key
);
TestPaperAnswerItemBo
cacheObject
=
RedisUtils
.
getCacheObject
(
key
);
if
(
cacheObject
==
null
||
cacheObject
.
getId
()
==
null
||
if
(
cacheObject
==
null
||
(
StringUtils
.
isEmpty
(
cacheObject
.
getAnswer
())
&&
StringUtils
.
isEmpty
(
cacheObject
.
getAnswerPic
())))
{
(
StringUtils
.
isEmpty
(
cacheObject
.
getAnswer
())
&&
StringUtils
.
isEmpty
(
cacheObject
.
getAnswerPic
())))
{
return
false
;
return
false
;
}
}
...
...
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