Commit 0c702f45 by Wangmin

完善学生答题业务

parent aeef9ca8
......@@ -66,8 +66,8 @@ public class TestPaperController extends BaseController {
*/
@Log(title = "交卷", businessType = BusinessType.INSERT)
@PostMapping("/endTest/")
public R<Void> paperTestEnd(@RequestBody TestPaperAnswerBo bo) {
return toAjax(testPaperService.paperTestEnd(bo));
public R<Boolean> paperTestEnd(@RequestBody TestPaperAnswerBo bo) {
return R.ok(testPaperService.paperTestEnd(bo));
}
/**
......
......@@ -149,7 +149,6 @@ public class TestPaperServiceImpl implements ITestPaperService {
buffer.setScore(bankTestPaperVo.getRightAnswers().equals(buffer.getAnswer()) ? BigDecimal.valueOf(bankTestPaperVo.getScore()) : BigDecimal.ZERO);
}
insertPaperRecords.add(buffer);
RedisUtils.deleteKeys(key);
});
if (CollUtil.isNotEmpty(insertPaperRecords)) {
if (!paperRecordDetailService.saveBatch(insertPaperRecords)) {
......@@ -157,9 +156,11 @@ public class TestPaperServiceImpl implements ITestPaperService {
}
// 修改考试记录状态为待批阅
testPaperRecord.setStatus(1);
if (!paperRecordService.updateByBo(BeanUtil.toBean(testPaperService, DbTestPaperRecordBo.class))) {
if (!paperRecordService.updateByBo(BeanUtil.toBean(testPaperRecord, DbTestPaperRecordBo.class))) {
throw new ServiceException("考试记录状态修改失败");
}
// 清除Redis缓存
RedisUtils.deleteKeys(String.format("%s:record:%d", TEST_PAPER_ANSWER_KEY, bo.getRecordId()));
return true;
}
return true;
......@@ -183,7 +184,7 @@ public class TestPaperServiceImpl implements ITestPaperService {
// 查询Redis中是否有该题的提交记录
String key = String.format(TEST_PAPER_ANSWER_KEY_FORMAT, TEST_PAPER_ANSWER_KEY, recordId, question.getId());
TestPaperAnswerItemBo cacheObject = RedisUtils.getCacheObject(key);
if (cacheObject == null || cacheObject.getId() == null ||
if (cacheObject == null ||
(StringUtils.isEmpty(cacheObject.getAnswer()) && StringUtils.isEmpty(cacheObject.getAnswerPic()))) {
return false;
}
......
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