|
@@ -18,6 +18,7 @@ import com.qmth.themis.business.service.*;
|
|
import com.qmth.themis.business.util.*;
|
|
import com.qmth.themis.business.util.*;
|
|
import com.qmth.themis.common.enums.ExceptionResultEnum;
|
|
import com.qmth.themis.common.enums.ExceptionResultEnum;
|
|
import com.qmth.themis.common.exception.BusinessException;
|
|
import com.qmth.themis.common.exception.BusinessException;
|
|
|
|
+import com.qmth.themis.common.util.GsonUtil;
|
|
import com.qmth.themis.common.util.Result;
|
|
import com.qmth.themis.common.util.Result;
|
|
import com.qmth.themis.common.util.ResultUtil;
|
|
import com.qmth.themis.common.util.ResultUtil;
|
|
import io.swagger.annotations.*;
|
|
import io.swagger.annotations.*;
|
|
@@ -96,9 +97,6 @@ public class TEExamController {
|
|
@Resource
|
|
@Resource
|
|
TEExamStudentService teExamStudentService;
|
|
TEExamStudentService teExamStudentService;
|
|
|
|
|
|
- @Resource
|
|
|
|
- CommonService commonService;
|
|
|
|
-
|
|
|
|
@ApiOperation(value = "考试批次修改/新增接口")
|
|
@ApiOperation(value = "考试批次修改/新增接口")
|
|
@RequestMapping(value = "/save", method = RequestMethod.POST)
|
|
@RequestMapping(value = "/save", method = RequestMethod.POST)
|
|
@Transactional
|
|
@Transactional
|
|
@@ -738,12 +736,12 @@ public class TEExamController {
|
|
@ApiParam(value = "考试场次id") @RequestParam(required = false) Long examActivityId,
|
|
@ApiParam(value = "考试场次id") @RequestParam(required = false) Long examActivityId,
|
|
@ApiParam(value = "考生id") @RequestParam(required = false) Long examStudentId,
|
|
@ApiParam(value = "考生id") @RequestParam(required = false) Long examStudentId,
|
|
@ApiParam(value = "是否批量处理") @RequestParam(required = false) Boolean batch,
|
|
@ApiParam(value = "是否批量处理") @RequestParam(required = false) Boolean batch,
|
|
- @ApiParam(value = "是否只处理答案", required = true) @RequestParam Boolean answer) {
|
|
|
|
|
|
+ @ApiParam(value = "补救措施", required = true) @RequestParam RepariEnum repariEnum,
|
|
|
|
+ @ApiParam(value = "考试状态") @RequestParam(required = false) ExamRecordStatusEnum status) {
|
|
List<TOeExamRecord> tOeExamRecordList = null;
|
|
List<TOeExamRecord> tOeExamRecordList = null;
|
|
if (Objects.nonNull(batch) && batch) {
|
|
if (Objects.nonNull(batch) && batch) {
|
|
Optional.ofNullable(examId).orElseThrow(() -> new BusinessException("考试批次id不能为空"));
|
|
Optional.ofNullable(examId).orElseThrow(() -> new BusinessException("考试批次id不能为空"));
|
|
- Optional.ofNullable(examActivityId).orElseThrow(() -> new BusinessException("考试场次id不能为空"));
|
|
|
|
- tOeExamRecordList = tOeExamRecordService.persistedAnswerBatch(examId, examActivityId);
|
|
|
|
|
|
+ tOeExamRecordList = tOeExamRecordService.persistedAnswerBatch(examId, examActivityId, status);
|
|
} else {
|
|
} else {
|
|
QueryWrapper<TOeExamRecord> tOeExamRecordQueryWrapper = new QueryWrapper<>();
|
|
QueryWrapper<TOeExamRecord> tOeExamRecordQueryWrapper = new QueryWrapper<>();
|
|
if (Objects.nonNull(examRecordId)) {
|
|
if (Objects.nonNull(examRecordId)) {
|
|
@@ -763,11 +761,22 @@ public class TEExamController {
|
|
if (!CollectionUtils.isEmpty(tOeExamRecordList)) {
|
|
if (!CollectionUtils.isEmpty(tOeExamRecordList)) {
|
|
for (TOeExamRecord t : tOeExamRecordList) {
|
|
for (TOeExamRecord t : tOeExamRecordList) {
|
|
try {
|
|
try {
|
|
- if (Objects.nonNull(answer) && answer) {
|
|
|
|
- tOeExamRecordService.saveDataByCachePersistedAnswer(t.getId());
|
|
|
|
- } else {
|
|
|
|
- ExamStudentCacheBean examStudentCacheBean = teExamStudentService.getExamStudentCacheBean(t.getExamStudentId());
|
|
|
|
- teExamService.finish(examStudentCacheBean.getStudentId(), t.getId(), FinishTypeEnum.AUTO.name(), t.getDurationSeconds());
|
|
|
|
|
|
+ switch (repariEnum) {
|
|
|
|
+ case ANSWER:
|
|
|
|
+ case FINISHED_ANSWER:
|
|
|
|
+ tOeExamRecordService.saveDataByCachePersistedAnswer(t.getId());
|
|
|
|
+ break;
|
|
|
|
+ case FINISHED:
|
|
|
|
+ ExamStudentCacheBean examStudentCacheBean = teExamStudentService.getExamStudentCacheBean(t.getExamStudentId());
|
|
|
|
+ teExamService.finish(examStudentCacheBean.getStudentId(), t.getId(), FinishTypeEnum.AUTO.name(), t.getDurationSeconds());
|
|
|
|
+ break;
|
|
|
|
+ case EXAM_STUDENT:
|
|
|
|
+ ExamStudentCacheBean examStudentCache = teExamStudentService.getExamStudentCacheBean(t.getExamStudentId());
|
|
|
|
+ TEExamStudent examStudent = GsonUtil.fromJson(GsonUtil.toJson(examStudentCache), TEExamStudent.class);
|
|
|
|
+ teExamStudentService.saveOrUpdate(examStudent);
|
|
|
|
+ break;
|
|
|
|
+ default:
|
|
|
|
+ break;
|
|
}
|
|
}
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
log.error(SystemConstant.LOG_ERROR, e);
|
|
log.error(SystemConstant.LOG_ERROR, e);
|