|
@@ -7,6 +7,8 @@ import com.qmth.boot.core.concurrent.service.ConcurrentService;
|
|
|
import com.qmth.boot.core.exception.ParameterException;
|
|
|
import com.qmth.teachcloud.common.entity.SysUser;
|
|
|
import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
|
|
|
+import com.qmth.teachcloud.common.enums.ScanStatus;
|
|
|
+import com.qmth.teachcloud.common.enums.mark.SubjectiveStatus;
|
|
|
import com.qmth.teachcloud.mark.bean.papermigrate.PaperMigrateDomain;
|
|
|
import com.qmth.teachcloud.mark.bean.papermigrate.PaperMigratePage;
|
|
|
import com.qmth.teachcloud.mark.bean.papermigrate.PaperMigratePaper;
|
|
@@ -48,7 +50,9 @@ public class ScanPaperServiceImpl extends ServiceImpl<ScanPaperMapper, ScanPaper
|
|
|
private ConcurrentService concurrentService;
|
|
|
@Autowired
|
|
|
private ScanStudentPaperService scanStudentPaperService;
|
|
|
-
|
|
|
+ @Autowired
|
|
|
+ private MarkService markService;
|
|
|
+
|
|
|
/**
|
|
|
* 全量更新paper和所属的page集合,并刷新paper相关属性
|
|
|
*
|
|
@@ -144,12 +148,6 @@ public class ScanPaperServiceImpl extends ServiceImpl<ScanPaperMapper, ScanPaper
|
|
|
if (answerCard == null) {
|
|
|
throw new ParameterException("卡格式信息未找到");
|
|
|
}
|
|
|
- // 验证卡格式所属科目
|
|
|
-// boolean allowSubject = scanAnswerCardSubjectService.checkSubject(answerCard.getExamId(), answerCard.getNumber(),
|
|
|
-// student.getCoursePaperId());
|
|
|
-// if (!allowSubject) {
|
|
|
-// throw new ParameterException("卡格式与考生科目不一致");
|
|
|
-// }
|
|
|
// cardNumber有变化,需要重新识别
|
|
|
if (student.getCardNumber()!=null&&!student.getCardNumber().equals(domain.getCardNumber())
|
|
|
&& isEmptyPage(domain)) {
|
|
@@ -159,13 +157,14 @@ public class ScanPaperServiceImpl extends ServiceImpl<ScanPaperMapper, ScanPaper
|
|
|
// 指定paper现有绑定考生
|
|
|
MarkStudent previousStudent = null;
|
|
|
List<ScanStudentPaper> previousStudentPapers = scanStudentPaperService.findByPaperIds(paperIds);
|
|
|
- if (CollectionUtils.isNotEmpty(previousStudentPapers)) {
|
|
|
- checkStudent(previousStudentPapers);
|
|
|
- Long previousStudentId=previousStudentPapers.get(0).getStudentId();
|
|
|
- // 考生ID变了才需要获取原考生
|
|
|
- if (!previousStudentId.equals(student.getId())) {
|
|
|
- previousStudent = markStudentService.getById(previousStudentId);
|
|
|
- }
|
|
|
+ if (CollectionUtils.isEmpty(previousStudentPapers)) {
|
|
|
+ throw new ParameterException("被绑定的题卡信息未关联考生");
|
|
|
+ }
|
|
|
+ checkStudent(previousStudentPapers,paperIds);
|
|
|
+ Long previousStudentId=previousStudentPapers.get(0).getStudentId();
|
|
|
+ // 考生ID变了才需要获取原考生
|
|
|
+ if (!previousStudentId.equals(student.getId())) {
|
|
|
+ previousStudent = markStudentService.getById(previousStudentId);
|
|
|
}
|
|
|
if (previousStudent != null) {
|
|
|
concurrentService.getReadWriteLock(LockType.STUDENT + "-" + previousStudent.getId()).writeLock().lock();
|
|
@@ -174,6 +173,10 @@ public class ScanPaperServiceImpl extends ServiceImpl<ScanPaperMapper, ScanPaper
|
|
|
try {
|
|
|
// 解绑paper和原有考生
|
|
|
if (previousStudent != null) {
|
|
|
+ //重置考生状态
|
|
|
+ resetStudent(previousStudent);
|
|
|
+ //删除阅卷任务信息
|
|
|
+ markService.deleteMarkTaskByStudent(previousStudent);
|
|
|
markStudentService.updateStudentAndPaper(user, previousStudent.getId(), null);
|
|
|
}
|
|
|
for(PaperMigratePaper vp:domain.getPapers()) {
|
|
@@ -215,6 +218,8 @@ public class ScanPaperServiceImpl extends ServiceImpl<ScanPaperMapper, ScanPaper
|
|
|
for(PaperMigratePaper vp:domain.getPapers()) {
|
|
|
currentStudentPaperList.add(new ScanStudentPaper(student.getId(), vp.getPaperNumber(), vp.getPaperId()));
|
|
|
}
|
|
|
+ //删除阅卷任务信息
|
|
|
+ markService.deleteMarkTaskByStudent(student);
|
|
|
markStudentService.updateStudentAndPaper(user, student.getId(), currentStudentPaperList);
|
|
|
// 返回数据结果
|
|
|
return PaperMigrateVo.create(student.getId());
|
|
@@ -226,10 +231,42 @@ public class ScanPaperServiceImpl extends ServiceImpl<ScanPaperMapper, ScanPaper
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ private void resetStudent(MarkStudent ms) {
|
|
|
+ ms.setSheetCount(0);
|
|
|
+ ms.setSheetPath(null);
|
|
|
+ ms.setAnswers(null);
|
|
|
+ ms.setUpload(false);
|
|
|
+ ms.setAbsent(false);
|
|
|
+ ms.setBreach(false);
|
|
|
+ ms.setUploadTime(null);
|
|
|
+ ms.setObjectiveScore(null);
|
|
|
+ ms.setObjectiveScoreList(null);
|
|
|
+ ms.setSubjectiveStatus(SubjectiveStatus.UNMARK);
|
|
|
+ ms.setSubjectiveScore(null);
|
|
|
+ ms.setSubjectiveScoreList(null);
|
|
|
+ ms.setScanStatus(ScanStatus.UNEXIST);
|
|
|
+ ms.setQuestionFilled(false);
|
|
|
+ ms.setAssigned(false);
|
|
|
+ ms.setAssignConfirmed(false);
|
|
|
+ ms.setAbsentSuspect(false);
|
|
|
+ ms.setIncomplete(false);
|
|
|
+ ms.setBreachCode(null);
|
|
|
+ ms.setOmrAbsent(false);
|
|
|
+ ms.setOmrAbsentChecked(false);
|
|
|
+ ms.setCardNumber(null);
|
|
|
+ markStudentService.saveOrUpdate(ms);
|
|
|
+ }
|
|
|
|
|
|
- private void checkStudent(List<ScanStudentPaper> previousStudentPapers) {
|
|
|
+ private void checkStudent(List<ScanStudentPaper> previousStudentPapers,List<Long> paperIds) {
|
|
|
+ if(previousStudentPapers.size()!=paperIds.size()) {
|
|
|
+ throw new ParameterException("被绑定的题卡不属于同一个考生");
|
|
|
+ }
|
|
|
Long studentId=null;
|
|
|
for(ScanStudentPaper sp:previousStudentPapers) {
|
|
|
+ if(!paperIds.contains(sp.getPaperId())) {
|
|
|
+ throw new ParameterException("被绑定的题卡不属于同一个考生");
|
|
|
+ }
|
|
|
if(studentId==null) {
|
|
|
studentId=sp.getStudentId();
|
|
|
}else {
|