|
@@ -318,6 +318,8 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
|
|
|
// 更新课程表中上传人数
|
|
|
markPaperService.updateUploadCount(student.getExamId(), student.getPaperNumber(),
|
|
|
this.countUploadedByExamIdAndPaperNumber(student.getExamId(), student.getPaperNumber()));
|
|
|
+ markPaperService.updateAbsentCount(student.getExamId(), student.getPaperNumber(),
|
|
|
+ this.countAbsentByExamIdAndPaperNumber(student.getExamId(), student.getPaperNumber()));
|
|
|
if (updateOmrTask) {
|
|
|
// 清除识别对照任务
|
|
|
scanOmrTaskService.deleteByStudentId(student.getExamId(), student.getId());
|
|
@@ -505,16 +507,16 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
|
|
|
@Transactional
|
|
|
public void updateStudentAndPaper(@NotNull SysUser user, @NotNull Long id,
|
|
|
@NotNull List<ScanStudentPaper> studentPaperList) {
|
|
|
- if(CollectionUtils.isNotEmpty(studentPaperList)) {
|
|
|
- for (ScanStudentPaper studentPaper : studentPaperList) {
|
|
|
- studentPaper.setStudentId(id);
|
|
|
- }
|
|
|
+ if (CollectionUtils.isNotEmpty(studentPaperList)) {
|
|
|
+ for (ScanStudentPaper studentPaper : studentPaperList) {
|
|
|
+ studentPaper.setStudentId(id);
|
|
|
+ }
|
|
|
}
|
|
|
// 清空原有绑定关系
|
|
|
studentPaperService.removeByStudentId(id);
|
|
|
- if(CollectionUtils.isNotEmpty(studentPaperList)) {
|
|
|
- // 保存绑定关系
|
|
|
- studentPaperService.saveOrUpdateBatch(studentPaperList);
|
|
|
+ if (CollectionUtils.isNotEmpty(studentPaperList)) {
|
|
|
+ // 保存绑定关系
|
|
|
+ studentPaperService.saveOrUpdateBatch(studentPaperList);
|
|
|
}
|
|
|
// 更新考生状态
|
|
|
updateStudentByPaper(user.getId(), id, true);
|
|
@@ -690,37 +692,36 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
|
|
|
|
|
|
@Transactional
|
|
|
@Override
|
|
|
- public AbsentManualUpdateVo absentManualUpdate(Long examId, String coursePaperId, String studentCode) {
|
|
|
+ public AbsentManualUpdateVo absentManualUpdate(Long examId, String coursePaperId, String studentCode, ScanStatus status) {
|
|
|
MarkStudent student = findByExamIdAndCoursePaperIdAndStudentCode(examId, coursePaperId, studentCode);
|
|
|
if (student == null) {
|
|
|
throw new ParameterException("考生未找到");
|
|
|
}
|
|
|
- if (student.getScanStatus() != ScanStatus.UNEXIST) {
|
|
|
+ if (ScanStatus.MANUAL_ABSENT.equals(status) && !ScanStatus.UNEXIST.equals(student.getScanStatus())) {
|
|
|
throw new ParameterException("考生不是未扫描状态");
|
|
|
}
|
|
|
LambdaUpdateWrapper<MarkStudent> lw = new LambdaUpdateWrapper<>();
|
|
|
- lw.set(MarkStudent::getScanStatus, ScanStatus.MANUAL_ABSENT);
|
|
|
+ lw.set(MarkStudent::getScanStatus, status);
|
|
|
+ lw.set(MarkStudent::getManualAbsent, ScanStatus.MANUAL_ABSENT.equals(status));
|
|
|
+ lw.set(MarkStudent::getAbsent, ScanStatus.MANUAL_ABSENT.equals(status));
|
|
|
lw.eq(MarkStudent::getId, student.getId());
|
|
|
- lw.eq(MarkStudent::getScanStatus, ScanStatus.UNEXIST);
|
|
|
update(lw);
|
|
|
- return AbsentManualUpdateVo.create(ScanStatus.MANUAL_ABSENT);
|
|
|
+ markPaperService.updateAbsentCount(examId, student.getPaperNumber(), this.countAbsentByExamIdAndPaperNumber(examId, student.getPaperNumber()));
|
|
|
+ return AbsentManualUpdateVo.create(status);
|
|
|
}
|
|
|
|
|
|
@Transactional
|
|
|
@Override
|
|
|
public UpdateTimeVo confirm(Long examId, String coursePaperId, String studentCode, Boolean omrAbsent) {
|
|
|
+ MarkStudent student = findByExamIdAndCoursePaperIdAndStudentCode(examId, coursePaperId, studentCode);
|
|
|
LambdaUpdateWrapper<MarkStudent> lw = new LambdaUpdateWrapper<>();
|
|
|
lw.set(MarkStudent::getOmrAbsentChecked, omrAbsent);
|
|
|
- lw.eq(MarkStudent::getExamId, examId);
|
|
|
- lw.eq(MarkStudent::getCoursePaperId, coursePaperId);
|
|
|
- lw.eq(MarkStudent::getStudentCode, studentCode);
|
|
|
-// if (omrAbsent != null) {
|
|
|
-// lw.eq(MarkStudent::getOmrAbsent, omrAbsent);
|
|
|
-// }
|
|
|
+ if (!omrAbsent) {
|
|
|
+ lw.set(MarkStudent::getOmrAbsent, false);
|
|
|
+ }
|
|
|
+ lw.eq(MarkStudent::getId, student.getId());
|
|
|
update(lw);
|
|
|
-// if (!update(lw)) {
|
|
|
-// throw new ParameterException("考生未找到");
|
|
|
-// }
|
|
|
+ markPaperService.updateAbsentCount(examId, student.getPaperNumber(), this.countAbsentByExamIdAndPaperNumber(examId, student.getPaperNumber()));
|
|
|
return UpdateTimeVo.create();
|
|
|
}
|
|
|
|
|
@@ -1115,4 +1116,12 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
|
|
|
markStudent.setAssignConfirmed(checked);
|
|
|
return baseMapper.countAssigned(markStudent, dpr);
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public int countAbsentByExamIdAndPaperNumber(Long examId, String paperNumber) {
|
|
|
+ QueryWrapper<MarkStudent> queryWrapper = new QueryWrapper<>();
|
|
|
+ queryWrapper.lambda().eq(MarkStudent::getExamId, examId).eq(MarkStudent::getPaperNumber, paperNumber)
|
|
|
+ .and(o -> o.eq(MarkStudent::getAbsent, true).or().eq(MarkStudent::getOmrAbsent, true));
|
|
|
+ return this.count(queryWrapper);
|
|
|
+ }
|
|
|
}
|