|
@@ -155,46 +155,52 @@ public class ScanOmrTaskServiceImpl extends ServiceImpl<ScanOmrTaskMapper, ScanO
|
|
|
// items.add(item);
|
|
|
// }
|
|
|
// }
|
|
|
- if (ConditionType.QUESTION_MULTI_BLANK.equals(c)) {
|
|
|
- List<MarkQuestion> questiongList=questionService.listByExamIdAndPaperNumberAndPaperIndexAndPageIndex(student.getExamId(), student.getPaperNumber(),spe.getPaperIndex(),pageEntity.getPageIndex());
|
|
|
- for (int i = 0; pageEntity.getQuestion() != null && pageEntity.getQuestion().getResult() != null
|
|
|
- && i < pageEntity.getQuestion().getResult().size(); i++) {
|
|
|
- String result = pageEntity.getQuestion().getResult().get(i);
|
|
|
- MarkQuestion question = questiongList.get(i);
|
|
|
- if (question.getQuestionType().equals(QuestionType.MULTIPLE.getValue()) && result != null && result.contains(OMR_BLANK)) {
|
|
|
- OmrTaskItem item = new OmrTaskItem();
|
|
|
- item.setIndex(i + 1);
|
|
|
- item.setField(OmrField.QUESTION);
|
|
|
- item.setOmrResult(result);
|
|
|
- pageDto.getPageMultiBlankItems().add(item);
|
|
|
- multi_blank_count++;
|
|
|
- if (multi_blank_count > 0) {
|
|
|
- multi_blank = true;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- if (ConditionType.QUESTION_SINGLE_BLANK.equals(c)
|
|
|
- && ScanStatus.SCANNED.equals(student.getScanStatus()) && !allObjectiveBlank) {
|
|
|
- List<MarkQuestion> questiongList=questionService.listByExamIdAndPaperNumberAndPaperIndexAndPageIndex(student.getExamId(), student.getPaperNumber(),spe.getPaperIndex(),pageEntity.getPageIndex());
|
|
|
- for (int i = 0; pageEntity.getQuestion() != null && pageEntity.getQuestion().getResult() != null
|
|
|
- && i < pageEntity.getQuestion().getResult().size(); i++) {
|
|
|
- String result = pageEntity.getQuestion().getResult().get(i);
|
|
|
- MarkQuestion question = questiongList.get(i);
|
|
|
- if (question.getQuestionType().equals(QuestionType.SINGLE.getValue()) && result != null && result.contains(OMR_BLANK)) {
|
|
|
- OmrTaskItem item = new OmrTaskItem();
|
|
|
- item.setIndex(i + 1);
|
|
|
- item.setField(OmrField.QUESTION);
|
|
|
- item.setOmrResult(result);
|
|
|
- pageDto.getPageSingleBlankItems().add(item);
|
|
|
- single_blank_count++;
|
|
|
- multi_blank_count++;
|
|
|
- if (single_blank_count > 0) {
|
|
|
- single_blank = true;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+ if (ConditionType.QUESTION_MULTI_BLANK.equals(c)) {
|
|
|
+ List<MarkQuestion> questiongList = questionService
|
|
|
+ .listByExamIdAndPaperNumberAndPaperIndexAndPageIndex(student.getExamId(),
|
|
|
+ student.getPaperNumber(), spe.getPaperIndex(), pageEntity.getPageIndex());
|
|
|
+ for (int i = 0; pageEntity.getQuestion() != null && pageEntity.getQuestion().getResult() != null
|
|
|
+ && i < pageEntity.getQuestion().getResult().size(); i++) {
|
|
|
+ String result = pageEntity.getQuestion().getResult().get(i);
|
|
|
+ MarkQuestion question = questiongList.get(i);
|
|
|
+ if (question.getQuestionType().equals(QuestionType.MULTIPLE.getValue()) && result != null
|
|
|
+ && result.contains(OMR_BLANK)) {
|
|
|
+ OmrTaskItem item = new OmrTaskItem();
|
|
|
+ item.setIndex(i + 1);
|
|
|
+ item.setField(OmrField.QUESTION);
|
|
|
+ item.setOmrResult(result);
|
|
|
+ pageDto.getPageMultiBlankItems().add(item);
|
|
|
+ multi_blank_count++;
|
|
|
+ if (multi_blank_count > 0) {
|
|
|
+ multi_blank = true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (ConditionType.QUESTION_SINGLE_BLANK.equals(c) && ScanStatus.SCANNED.equals(student.getScanStatus())
|
|
|
+ && !allObjectiveBlank) {
|
|
|
+ List<MarkQuestion> questiongList = questionService
|
|
|
+ .listByExamIdAndPaperNumberAndPaperIndexAndPageIndex(student.getExamId(),
|
|
|
+ student.getPaperNumber(), spe.getPaperIndex(), pageEntity.getPageIndex());
|
|
|
+ for (int i = 0; pageEntity.getQuestion() != null && pageEntity.getQuestion().getResult() != null
|
|
|
+ && i < pageEntity.getQuestion().getResult().size(); i++) {
|
|
|
+ String result = pageEntity.getQuestion().getResult().get(i);
|
|
|
+ MarkQuestion question = questiongList.get(i);
|
|
|
+ if (question.getQuestionType().equals(QuestionType.SINGLE.getValue()) && result != null
|
|
|
+ && result.contains(OMR_BLANK)) {
|
|
|
+ OmrTaskItem item = new OmrTaskItem();
|
|
|
+ item.setIndex(i + 1);
|
|
|
+ item.setField(OmrField.QUESTION);
|
|
|
+ item.setOmrResult(result);
|
|
|
+ pageDto.getPageSingleBlankItems().add(item);
|
|
|
+ single_blank_count++;
|
|
|
+ multi_blank_count++;
|
|
|
+ if (single_blank_count > 0) {
|
|
|
+ single_blank = true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
// if (ConditionType.QUESTION_SINGLE_EXCEED.equals(c)
|
|
|
// && ScanStatus.SCANNED.equals(student.getStatus()) && !allObjectiveBlank) {
|
|
|
// for (int i = 0; pageEntity.getQuestion() != null && pageEntity.getQuestion().getResult() != null
|
|
@@ -336,13 +342,13 @@ public class ScanOmrTaskServiceImpl extends ServiceImpl<ScanOmrTaskMapper, ScanO
|
|
|
@Override
|
|
|
public ScanOmrStudent getTask(Long studentId, Long userId) {
|
|
|
MarkStudent student = studentService.getById(studentId);
|
|
|
- if(student==null) {
|
|
|
+ if (student == null) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("没有识别对照任务");
|
|
|
}
|
|
|
QueryWrapper<ScanOmrTask> wrapper = new QueryWrapper<>();
|
|
|
LambdaQueryWrapper<ScanOmrTask> lw = wrapper.lambda();
|
|
|
lw.eq(ScanOmrTask::getStudentId, studentId);
|
|
|
- List<ScanOmrTask> list = baseMapper.selectList(wrapper);
|
|
|
+ List<ScanOmrTask> list = baseMapper.selectList(wrapper);
|
|
|
if (list.isEmpty()) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("没有识别对照任务");
|
|
|
}
|
|
@@ -447,10 +453,10 @@ public class ScanOmrTaskServiceImpl extends ServiceImpl<ScanOmrTaskMapper, ScanO
|
|
|
if (task == null) {
|
|
|
throw new ParameterException("任务不存在");
|
|
|
}
|
|
|
- if(studentId == null ) {
|
|
|
+ if (studentId == null) {
|
|
|
studentId = task.getStudentId();
|
|
|
}
|
|
|
- if(studentId != task.getStudentId()) {
|
|
|
+ if (studentId != task.getStudentId()) {
|
|
|
throw new ParameterException("任务非同一个学生");
|
|
|
}
|
|
|
concurrentService.getReadWriteLock(LockType.STUDENT + "-" + task.getStudentId()).writeLock().lock();
|
|
@@ -474,7 +480,8 @@ public class ScanOmrTaskServiceImpl extends ServiceImpl<ScanOmrTaskMapper, ScanO
|
|
|
item.setFirstResult(pageVo.getBreach().toString());
|
|
|
}
|
|
|
if (OmrField.QUESTION.equals(item.getField())) {
|
|
|
- String content = pageVo.getQuestion() != null ? pageVo.getQuestion().get(item.getIndex()) : null;
|
|
|
+ String content = pageVo.getQuestion() != null ? pageVo.getQuestion().get(item.getIndex())
|
|
|
+ : null;
|
|
|
if (content == null) {
|
|
|
throw new ParameterException(
|
|
|
"page[" + page.getIndex() + "].question[" + item.getIndex() + "]不存在");
|
|
@@ -482,7 +489,8 @@ public class ScanOmrTaskServiceImpl extends ServiceImpl<ScanOmrTaskMapper, ScanO
|
|
|
item.setFirstResult(content);
|
|
|
}
|
|
|
if (OmrField.SELECTIVE.equals(item.getField())) {
|
|
|
- String content = pageVo.getSelective() != null ? pageVo.getSelective().get(item.getIndex()) : null;
|
|
|
+ String content = pageVo.getSelective() != null ? pageVo.getSelective().get(item.getIndex())
|
|
|
+ : null;
|
|
|
if (content == null) {
|
|
|
throw new ParameterException(
|
|
|
"page[" + page.getIndex() + "].selective[" + item.getIndex() + "]不存在");
|
|
@@ -493,7 +501,7 @@ public class ScanOmrTaskServiceImpl extends ServiceImpl<ScanOmrTaskMapper, ScanO
|
|
|
}
|
|
|
task.setStatus(OmrTaskStatus.PROCESSED);
|
|
|
|
|
|
- updatePaperResult(result, task.getPaperId(),userId);
|
|
|
+ updatePaperResult(result, task.getPaperId(), userId);
|
|
|
task.setUserId(userId);
|
|
|
task.setUpdateTime(System.currentTimeMillis());
|
|
|
this.saveOrUpdate(task);
|
|
@@ -538,12 +546,12 @@ public class ScanOmrTaskServiceImpl extends ServiceImpl<ScanOmrTaskMapper, ScanO
|
|
|
|
|
|
@Override
|
|
|
public int getFinishStudentCountByExamAndUserId(Long examId, Long userId) {
|
|
|
- return this.baseMapper.getStudentCountByExamAndStatusAndUserId(examId,userId,OmrTaskStatus.PROCESSED);
|
|
|
+ return this.baseMapper.getStudentCountByExamAndStatusAndUserId(examId, userId, OmrTaskStatus.PROCESSED);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public int getTodoStudentCountByExam(Long examId) {
|
|
|
- return this.baseMapper.getStudentCountByExamAndStatus(examId,OmrTaskStatus.WAITING);
|
|
|
+ return this.baseMapper.getStudentCountByExamAndStatus(examId, OmrTaskStatus.WAITING);
|
|
|
}
|
|
|
|
|
|
@Transactional
|
|
@@ -560,23 +568,44 @@ public class ScanOmrTaskServiceImpl extends ServiceImpl<ScanOmrTaskMapper, ScanO
|
|
|
this.removeByIds(tasks);
|
|
|
concurrentService.getReadWriteLock(LockType.STUDENT + "-" + studentId).writeLock().unlock();
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
@Override
|
|
|
- public int getCount(Long examId,OmrTaskStatus status) {
|
|
|
+ public int getCount(Long examId, OmrTaskStatus status) {
|
|
|
QueryWrapper<ScanOmrTask> wrapper = new QueryWrapper<>();
|
|
|
- LambdaQueryWrapper<ScanOmrTask> lw = wrapper.lambda();
|
|
|
- lw.eq(ScanOmrTask::getExamId, examId);
|
|
|
- if(status!=null) {
|
|
|
- lw.eq(ScanOmrTask::getStatus, status);
|
|
|
- }
|
|
|
- return baseMapper.selectCount(wrapper);
|
|
|
+ LambdaQueryWrapper<ScanOmrTask> lw = wrapper.lambda();
|
|
|
+ lw.eq(ScanOmrTask::getExamId, examId);
|
|
|
+ if (status != null) {
|
|
|
+ lw.eq(ScanOmrTask::getStatus, status);
|
|
|
+ }
|
|
|
+ return baseMapper.selectCount(wrapper);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public List<ScanStudentDto> list(Long examId, OmrTaskStatus status, Long userId) {
|
|
|
- if(status.equals(OmrTaskStatus.WAITING)) {
|
|
|
+ if (status.equals(OmrTaskStatus.WAITING)) {
|
|
|
userId = null;
|
|
|
}
|
|
|
- return this.baseMapper.listByExamIdAndStatusAndUserId(examId,status,userId);
|
|
|
+ return this.baseMapper.listByExamIdAndStatusAndUserId(examId, status, userId);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void saveTask(Long studentId) {
|
|
|
+ List<ScanOmrTask> omrTaskList = new ArrayList<ScanOmrTask>();
|
|
|
+ ScanOmrTask omrTask = this.buildTask(ConditionType.FILL_SUSPECT, studentId);
|
|
|
+ if (omrTask != null) {
|
|
|
+ omrTaskList.add(omrTask);
|
|
|
+ }
|
|
|
+ omrTask = this.buildTask(ConditionType.QUESTION_MULTI_BLANK, studentId);
|
|
|
+ if (omrTask != null) {
|
|
|
+ omrTaskList.add(omrTask);
|
|
|
+ }
|
|
|
+ omrTask = this.buildTask(ConditionType.QUESTION_SINGLE_BLANK, studentId);
|
|
|
+ if (omrTask != null) {
|
|
|
+ omrTaskList.add(omrTask);
|
|
|
+ }
|
|
|
+ if (!omrTaskList.isEmpty()) {
|
|
|
+ this.saveBatch(omrTaskList);
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
}
|