|
@@ -379,7 +379,6 @@ public class BatchServiceImpl extends ServiceImpl<BatchDao, BatchEntity> impleme
|
|
|
concurrentService.getReadWriteLock(LockType.STUDENT + "-" + student.getId()).writeLock().lock();
|
|
|
try {
|
|
|
studentService.updateStudentAndPaper(user, student.getId(), studentPaperList);
|
|
|
- studentService.updateAssignedCheckCount(student.getId(), true);
|
|
|
} finally {
|
|
|
concurrentService.getReadWriteLock(LockType.STUDENT + "-" + student.getId()).writeLock().unlock();
|
|
|
}
|
|
@@ -913,7 +912,6 @@ public class BatchServiceImpl extends ServiceImpl<BatchDao, BatchEntity> impleme
|
|
|
concurrentService.getReadWriteLock(LockType.STUDENT + "-" + entry.getKey()).writeLock().lock();
|
|
|
try {
|
|
|
studentService.updateStudentAndPaper(user, entry.getKey(), entry.getValue());
|
|
|
- studentService.updateAssignedCheckCount(entry.getKey(), true);
|
|
|
} finally {
|
|
|
concurrentService.getReadWriteLock(LockType.STUDENT + "-" + entry.getKey()).writeLock().unlock();
|
|
|
}
|
|
@@ -1000,12 +998,13 @@ public class BatchServiceImpl extends ServiceImpl<BatchDao, BatchEntity> impleme
|
|
|
}
|
|
|
List<StudentEntity> ss = studentService.findByExamAndPackage(batch.getExamId(), batch.getPackageCode(),
|
|
|
batch.getSubjectCode());
|
|
|
- if (CollectionUtils.isEmpty(ss) || ss.size() != domain.getStudents().size()) {
|
|
|
+ Map<String,StudentEntity> studentMap = ss.stream().collect(Collectors.toMap(e->e.getExamNumber(), Function.identity()));
|
|
|
+ if (CollectionUtils.isEmpty(ss) || ss.size() != domain.getStudents().size()
|
|
|
+ ||studentMap.size()!=domain.getStudents().size()) {
|
|
|
throw new ParameterException("该批次考生数量与卷袋考生数量不一致");
|
|
|
}
|
|
|
|
|
|
Map<String,AnswerPackageStudent> answerPackageStudentMap = new HashMap<>();
|
|
|
- Map<String,StudentEntity> studentMap = ss.stream().collect(Collectors.toMap(e->e.getExamNumber(), Function.identity()));
|
|
|
Integer assignedCount = 0;
|
|
|
for (AnswerPackageStudent packageStudent:domain.getStudents()) {
|
|
|
String examNumber = packageStudent.getExamNumber();
|
|
@@ -1052,32 +1051,26 @@ public class BatchServiceImpl extends ServiceImpl<BatchDao, BatchEntity> impleme
|
|
|
// 创建student与paper的关联关系
|
|
|
studentPaperList.add(new StudentPaperEntity(student.getId(), paperNumber, paper.getId()));
|
|
|
studentAssigned = studentAssigned || paper.getAssigned();
|
|
|
- // 更新批次统计数量,改到finish的时候更新
|
|
|
- // updateAssignedCount(batch.getId());
|
|
|
- // updateScanCount(batch.getId());
|
|
|
// 不开启实时审核,或者当前批次无需审核,直接更新考生扫描状态
|
|
|
// if (VerifyStatus.CANCEL.equals(batch.getVerifyStatus()) || exam.getEnableSyncVerify() == null
|
|
|
// || !exam.getEnableSyncVerify()) {
|
|
|
concurrentService.getReadWriteLock(LockType.STUDENT + "-" + student.getId()).writeLock().lock();
|
|
|
try {
|
|
|
// studentService.updateStudentAndPaper(user, student.getId(), studentPaperList);
|
|
|
- // 清空原有绑定关系
|
|
|
- studentPaperService.removeByStudentId(student.getId());
|
|
|
- // 保存绑定关系
|
|
|
- studentPaperService.saveOrUpdateBatchByMultiId(studentPaperList);
|
|
|
+ // 更新绑定关系
|
|
|
+ studentPaper(student, studentPaperList);
|
|
|
// 更新考生状态
|
|
|
studentService.updateStudentByPaper(user, student.getId(), false);
|
|
|
//识别对照
|
|
|
for (OmrGroupEntity g : gs) {
|
|
|
concurrentService.getReadWriteLock(LockType.OMR_GROUP + "-" + g.getId()).readLock().lock();
|
|
|
- omrTaskService.deleteByStudentIdAndGroupId(g.getId(), student.getId());
|
|
|
+ omrTaskService.deleteByStudentIdAndGroupId(g.getId(), student.getId(),false);
|
|
|
List<OmrTaskEntity> list = omrTaskService.buildTask(g, student.getId());
|
|
|
if (list != null && !list.isEmpty()) {
|
|
|
omrTaskService.saveBatch(list);
|
|
|
}
|
|
|
concurrentService.getReadWriteLock(LockType.OMR_GROUP + "-" + g.getId()).readLock().unlock();
|
|
|
}
|
|
|
- studentService.updateAssignedCheckCount(student.getId(), true);
|
|
|
} finally {
|
|
|
concurrentService.getReadWriteLock(LockType.STUDENT + "-" + student.getId()).writeLock().unlock();
|
|
|
}
|
|
@@ -1091,6 +1084,7 @@ public class BatchServiceImpl extends ServiceImpl<BatchDao, BatchEntity> impleme
|
|
|
for (OmrGroupEntity g : gs) {
|
|
|
concurrentService.getReadWriteLock(LockType.OMR_GROUP + "-" + g.getId()).writeLock().lock();
|
|
|
g.setTotalCount(omrTaskService.countByGroupId(g.getId()));
|
|
|
+ omrGroupService.saveOrUpdate(g);
|
|
|
concurrentService.getReadWriteLock(LockType.OMR_GROUP + "-" + g.getId()).writeLock().unlock();
|
|
|
}
|
|
|
|
|
@@ -1116,4 +1110,15 @@ public class BatchServiceImpl extends ServiceImpl<BatchDao, BatchEntity> impleme
|
|
|
|
|
|
return AnswerPackageSave.create(findStudentCountByBatch(batch.getId()),batch.getStatus());
|
|
|
}
|
|
|
+
|
|
|
+ private void studentPaper(StudentEntity student, List<StudentPaperEntity> studentPaperList) {
|
|
|
+ List<StudentPaperEntity> list= studentPaperService.findByStudentId(student.getId());
|
|
|
+ if(list.isEmpty() || list.size() == studentPaperList.size()){
|
|
|
+ // 保存绑定关系
|
|
|
+ studentPaperService.saveOrUpdateBatchByMultiId(studentPaperList);
|
|
|
+ }else{
|
|
|
+ studentPaperService.removeByStudentId(student.getId());
|
|
|
+ studentPaperService.saveOrUpdateBatchByMultiId(studentPaperList);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|