|
@@ -84,7 +84,7 @@ public class ScanOmrTaskServiceImpl extends ServiceImpl<ScanOmrTaskMapper, ScanO
|
|
|
|
|
|
@Override
|
|
|
@Transactional
|
|
|
- public ScanOmrTask buildTask(ConditionType c, Long studentId) {
|
|
|
+ public List<ScanOmrTask> buildTask(ConditionType c, Long studentId) {
|
|
|
List<ScanStudentPaper> paperIds = clearAndToDispose(c, studentId);
|
|
|
if (CollectionUtils.isEmpty(paperIds)) {
|
|
|
return null;
|
|
@@ -166,7 +166,7 @@ public class ScanOmrTaskServiceImpl extends ServiceImpl<ScanOmrTaskMapper, ScanO
|
|
|
if (ConditionType.QUESTION_MULTI_BLANK.equals(c)) {
|
|
|
List<MarkQuestion> questiongList = questionService
|
|
|
.listByExamIdAndPaperNumberAndPaperIndexAndPageIndex(student.getExamId(),
|
|
|
- student.getPaperNumber(), spe.getPaperIndex(), pageEntity.getPageIndex());
|
|
|
+ student.getPaperNumber(), spe.getPaperIndex(), pageEntity.getPageIndex(),true);
|
|
|
if (pageEntity.getQuestion() == null || pageEntity.getQuestion().getResult() == null
|
|
|
|| questiongList.isEmpty()) {
|
|
|
continue;
|
|
@@ -194,7 +194,7 @@ public class ScanOmrTaskServiceImpl extends ServiceImpl<ScanOmrTaskMapper, ScanO
|
|
|
&& !allObjectiveBlank) {
|
|
|
List<MarkQuestion> questiongList = questionService
|
|
|
.listByExamIdAndPaperNumberAndPaperIndexAndPageIndex(student.getExamId(),
|
|
|
- student.getPaperNumber(), spe.getPaperIndex(), pageEntity.getPageIndex());
|
|
|
+ student.getPaperNumber(), spe.getPaperIndex(), pageEntity.getPageIndex(),true);
|
|
|
if (pageEntity.getQuestion() == null || pageEntity.getQuestion().getResult() == null
|
|
|
|| questiongList.isEmpty()) {
|
|
|
continue;
|
|
@@ -204,7 +204,8 @@ public class ScanOmrTaskServiceImpl extends ServiceImpl<ScanOmrTaskMapper, ScanO
|
|
|
for (int i = 0; i < size; i++) {
|
|
|
String result = pageEntity.getQuestion().getResult().get(i);
|
|
|
MarkQuestion question = questiongList.get(i);
|
|
|
- if (question.getQuestionType().equals(QuestionType.SINGLE.getValue()) && result != null
|
|
|
+ if ((question.getQuestionType().equals(QuestionType.SINGLE.getValue())||question.getQuestionType().equals(QuestionType.TRUE_OR_FALSE.getValue()))
|
|
|
+ && result != null
|
|
|
&& result.contains(OMR_BLANK)) {
|
|
|
OmrTaskItem item = new OmrTaskItem();
|
|
|
item.setIndex(i + 1);
|
|
@@ -212,7 +213,6 @@ public class ScanOmrTaskServiceImpl extends ServiceImpl<ScanOmrTaskMapper, ScanO
|
|
|
item.setOmrResult(result);
|
|
|
pageDto.getPageSingleBlankItems().add(item);
|
|
|
single_blank_count++;
|
|
|
- multi_blank_count++;
|
|
|
if (single_blank_count > 0) {
|
|
|
single_blank = true;
|
|
|
}
|
|
@@ -223,7 +223,7 @@ public class ScanOmrTaskServiceImpl extends ServiceImpl<ScanOmrTaskMapper, ScanO
|
|
|
&& !allObjectiveBlank) {
|
|
|
List<MarkQuestion> questiongList = questionService
|
|
|
.listByExamIdAndPaperNumberAndPaperIndexAndPageIndex(student.getExamId(),
|
|
|
- student.getPaperNumber(), spe.getPaperIndex(), pageEntity.getPageIndex());
|
|
|
+ student.getPaperNumber(), spe.getPaperIndex(), pageEntity.getPageIndex(),true);
|
|
|
if (pageEntity.getQuestion() == null || pageEntity.getQuestion().getResult() == null
|
|
|
|| questiongList.isEmpty()) {
|
|
|
continue;
|
|
@@ -234,7 +234,8 @@ public class ScanOmrTaskServiceImpl extends ServiceImpl<ScanOmrTaskMapper, ScanO
|
|
|
String result = pageEntity.getQuestion().getResult().get(i);
|
|
|
MarkQuestion question = questiongList.get(i);
|
|
|
String newStr = result.replace(OMR_SUSPECT, "");
|
|
|
- if (question.getQuestionType().equals(QuestionType.SINGLE.getValue()) && result != null
|
|
|
+ if ((question.getQuestionType().equals(QuestionType.SINGLE.getValue())||question.getQuestionType().equals(QuestionType.TRUE_OR_FALSE.getValue()))
|
|
|
+ && result != null
|
|
|
&& newStr.length() > 1) {
|
|
|
OmrTaskItem item = new OmrTaskItem();
|
|
|
item.setIndex(i + 1);
|
|
@@ -247,8 +248,9 @@ public class ScanOmrTaskServiceImpl extends ServiceImpl<ScanOmrTaskMapper, ScanO
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ List<ScanOmrTask> result = new ArrayList<>();
|
|
|
if (retList.size() == 0) {
|
|
|
- return null;
|
|
|
+ return result;
|
|
|
}
|
|
|
for (OmrTaskDto dto : retList) {
|
|
|
for (OmrTaskPageDto pageDto : dto.getPage()) {
|
|
@@ -266,10 +268,10 @@ public class ScanOmrTaskServiceImpl extends ServiceImpl<ScanOmrTaskMapper, ScanO
|
|
|
}
|
|
|
}
|
|
|
if (dto.getTask().getPages().size() > 0) {
|
|
|
- return dto.getTask();
|
|
|
+ result.add(dto.getTask());
|
|
|
}
|
|
|
}
|
|
|
- return null;
|
|
|
+ return result;
|
|
|
}
|
|
|
|
|
|
private List<ScanStudentPaper> clearAndToDispose(ConditionType c, Long studentId) {
|
|
@@ -645,12 +647,12 @@ public class ScanOmrTaskServiceImpl extends ServiceImpl<ScanOmrTaskMapper, ScanO
|
|
|
public void saveTask(Long studentId) {
|
|
|
List<ScanOmrTask> omrTaskList = new ArrayList<ScanOmrTask>();
|
|
|
for (ConditionType c : ConditionType.values()) {
|
|
|
- ScanOmrTask omrTask = this.buildTask(c, studentId);
|
|
|
- if (omrTask != null) {
|
|
|
- omrTaskList.add(omrTask);
|
|
|
+ List<ScanOmrTask> omrTask = this.buildTask(c, studentId);
|
|
|
+ if (!omrTask.isEmpty()) {
|
|
|
+ omrTaskList.addAll(omrTask);
|
|
|
}
|
|
|
}
|
|
|
- if (!omrTaskList.isEmpty()) {
|
|
|
+ if (omrTaskList!=null && !omrTaskList.isEmpty()) {
|
|
|
this.saveBatch(omrTaskList);
|
|
|
}
|
|
|
}
|