|
@@ -1,18 +1,5 @@
|
|
package com.qmth.teachcloud.mark.service.impl;
|
|
package com.qmth.teachcloud.mark.service.impl;
|
|
|
|
|
|
-import java.text.DecimalFormat;
|
|
|
|
-import java.util.ArrayList;
|
|
|
|
-import java.util.List;
|
|
|
|
-import java.util.stream.Collectors;
|
|
|
|
-
|
|
|
|
-import javax.validation.constraints.NotNull;
|
|
|
|
-
|
|
|
|
-import org.apache.commons.collections4.CollectionUtils;
|
|
|
|
-import org.apache.commons.lang3.StringUtils;
|
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
-import org.springframework.stereotype.Service;
|
|
|
|
-import org.springframework.transaction.annotation.Transactional;
|
|
|
|
-
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
@@ -25,26 +12,29 @@ import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
|
|
import com.qmth.teachcloud.common.enums.ScanStatus;
|
|
import com.qmth.teachcloud.common.enums.ScanStatus;
|
|
import com.qmth.teachcloud.common.enums.mark.SubjectiveStatus;
|
|
import com.qmth.teachcloud.common.enums.mark.SubjectiveStatus;
|
|
import com.qmth.teachcloud.common.enums.scan.ConditionType;
|
|
import com.qmth.teachcloud.common.enums.scan.ConditionType;
|
|
|
|
+import com.qmth.teachcloud.common.service.TeachcloudCommonService;
|
|
import com.qmth.teachcloud.mark.bean.scanexaminfo.CheckTask;
|
|
import com.qmth.teachcloud.mark.bean.scanexaminfo.CheckTask;
|
|
import com.qmth.teachcloud.mark.bean.scanexaminfo.ScanExamCheckInfoVo;
|
|
import com.qmth.teachcloud.mark.bean.scanexaminfo.ScanExamCheckInfoVo;
|
|
import com.qmth.teachcloud.mark.bean.scanexaminfo.ScanExamInfoVo;
|
|
import com.qmth.teachcloud.mark.bean.scanexaminfo.ScanExamInfoVo;
|
|
|
|
+import com.qmth.teachcloud.mark.dto.mark.score.SheetUrlDto;
|
|
|
|
+import com.qmth.teachcloud.mark.dto.mark.score.StudentPaperDetailDto;
|
|
import com.qmth.teachcloud.mark.dto.mark.score.StudentScoreDetailDto;
|
|
import com.qmth.teachcloud.mark.dto.mark.score.StudentScoreDetailDto;
|
|
-import com.qmth.teachcloud.mark.entity.MarkPaper;
|
|
|
|
-import com.qmth.teachcloud.mark.entity.MarkStudent;
|
|
|
|
-import com.qmth.teachcloud.mark.entity.ScanAnswerCard;
|
|
|
|
-import com.qmth.teachcloud.mark.entity.ScanPaper;
|
|
|
|
-import com.qmth.teachcloud.mark.entity.ScanPaperPage;
|
|
|
|
-import com.qmth.teachcloud.mark.entity.ScanStudentPaper;
|
|
|
|
|
|
+import com.qmth.teachcloud.mark.entity.*;
|
|
import com.qmth.teachcloud.mark.enums.OmrTaskStatus;
|
|
import com.qmth.teachcloud.mark.enums.OmrTaskStatus;
|
|
import com.qmth.teachcloud.mark.mapper.MarkStudentMapper;
|
|
import com.qmth.teachcloud.mark.mapper.MarkStudentMapper;
|
|
-import com.qmth.teachcloud.mark.service.MarkPaperService;
|
|
|
|
-import com.qmth.teachcloud.mark.service.MarkStudentService;
|
|
|
|
-import com.qmth.teachcloud.mark.service.ScanAnswerCardService;
|
|
|
|
-import com.qmth.teachcloud.mark.service.ScanOmrTaskService;
|
|
|
|
-import com.qmth.teachcloud.mark.service.ScanPackageService;
|
|
|
|
-import com.qmth.teachcloud.mark.service.ScanPaperPageService;
|
|
|
|
-import com.qmth.teachcloud.mark.service.ScanPaperService;
|
|
|
|
-import com.qmth.teachcloud.mark.service.ScanStudentPaperService;
|
|
|
|
|
|
+import com.qmth.teachcloud.mark.service.*;
|
|
|
|
+import org.apache.commons.collections4.CollectionUtils;
|
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
|
+
|
|
|
|
+import javax.annotation.Resource;
|
|
|
|
+import javax.validation.constraints.NotNull;
|
|
|
|
+import java.text.DecimalFormat;
|
|
|
|
+import java.util.ArrayList;
|
|
|
|
+import java.util.List;
|
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
/**
|
|
* <p>
|
|
* <p>
|
|
@@ -56,188 +46,202 @@ import com.qmth.teachcloud.mark.service.ScanStudentPaperService;
|
|
*/
|
|
*/
|
|
@Service
|
|
@Service
|
|
public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkStudent> implements MarkStudentService {
|
|
public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkStudent> implements MarkStudentService {
|
|
- @Autowired
|
|
|
|
- private MarkPaperService markPaperService;
|
|
|
|
- @Autowired
|
|
|
|
- private ScanPackageService scanPackageService;
|
|
|
|
- @Autowired
|
|
|
|
- private ScanPaperService scanPaperService;
|
|
|
|
- @Autowired
|
|
|
|
- private ScanPaperPageService scanPaperPageService;
|
|
|
|
- @Autowired
|
|
|
|
- private ScanOmrTaskService scanOmrTaskService;
|
|
|
|
- @Autowired
|
|
|
|
- private ScanAnswerCardService answerCardService;
|
|
|
|
- @Autowired
|
|
|
|
- private ScanStudentPaperService studentPaperService;
|
|
|
|
-
|
|
|
|
- @Override
|
|
|
|
- public List<String> listClassByExamIdAndCourseCode(Long examId, String paperNumber) {
|
|
|
|
- QueryWrapper<MarkStudent> queryWrapper = new QueryWrapper<>();
|
|
|
|
- queryWrapper.lambda().eq(MarkStudent::getExamId, examId).eq(MarkStudent::getPaperNumber, paperNumber);
|
|
|
|
- List<MarkStudent> markStudentList = this.list(queryWrapper);
|
|
|
|
-
|
|
|
|
- List<String> classNameList = new ArrayList<>();
|
|
|
|
- if (CollectionUtils.isNotEmpty(markStudentList)) {
|
|
|
|
- classNameList = markStudentList.stream().filter(m -> StringUtils.isNotBlank(m.getClassName()))
|
|
|
|
- .map(MarkStudent::getClassName).distinct().collect(Collectors.toList());
|
|
|
|
- }
|
|
|
|
- return classNameList;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- @Override
|
|
|
|
- public void updateSubjectiveStatusAndScore(Long studentId, SubjectiveStatus status, Double score,
|
|
|
|
- String scoreList) {
|
|
|
|
- UpdateWrapper<MarkStudent> updateWrapper = new UpdateWrapper<>();
|
|
|
|
- updateWrapper.lambda().set(MarkStudent::getSubjectiveStatus, status).set(MarkStudent::getSubjectiveScore, score)
|
|
|
|
- .set(MarkStudent::getSubjectiveScoreList, scoreList).eq(MarkStudent::getId, studentId);
|
|
|
|
- this.update(updateWrapper);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- @Override
|
|
|
|
- public ScanExamInfoVo getScanExamInfo(BasicExam exam) {
|
|
|
|
- ScanExamInfoVo vo = new ScanExamInfoVo();
|
|
|
|
- vo.setId(exam.getId());
|
|
|
|
- vo.setName(exam.getName());
|
|
|
|
- vo.getAnswerScan().setCourseCount(markPaperService.getCountByExam(exam.getId()));
|
|
|
|
- vo.getAnswerScan().setTotalCount(getCount(exam.getId(), null));
|
|
|
|
- vo.getAnswerScan().setScannedCount(getCount(exam.getId(), ScanStatus.SCANNED));
|
|
|
|
- vo.getPackageScan().setScannedCount(scanPackageService.getCount(exam.getId()));
|
|
|
|
- return vo;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- @Override
|
|
|
|
- public IPage<StudentScoreDetailDto> pageStudentScore(Long examId, String paperNumber, String college,
|
|
|
|
- String className, String teacher, Integer filter, Boolean absent, Boolean breach, Double startScore,
|
|
|
|
- Double endScore, Double subScore, Integer objectiveScoreRateLt, String studentName, String studentCode,
|
|
|
|
- Integer pageNumber, Integer pageSize) {
|
|
|
|
- if (startScore != null && endScore == null) {
|
|
|
|
- throw ExceptionResultEnum.ERROR.exception("请输入结束分数值");
|
|
|
|
- }
|
|
|
|
- Page<StudentScoreDetailDto> page = new Page<>(pageNumber, pageSize);
|
|
|
|
- MarkPaper markPaper = markPaperService.getByExamIdAndPaperNumber(examId, paperNumber);
|
|
|
|
- Double objectiveScoreLt = objectiveScoreRateLt == null ? null
|
|
|
|
- : Double.parseDouble(new DecimalFormat("####.###")
|
|
|
|
- .format(markPaper.getObjectiveScore() * objectiveScoreRateLt / 100));
|
|
|
|
- IPage<StudentScoreDetailDto> studentScoreDetailDtoIPage = this.baseMapper.pageStudentScore(page, examId,
|
|
|
|
- paperNumber, college, className, teacher, filter, absent, breach, startScore, endScore, subScore,
|
|
|
|
- objectiveScoreLt, studentName, studentCode);
|
|
|
|
- for (StudentScoreDetailDto scoreDetailDto : studentScoreDetailDtoIPage.getRecords()) {
|
|
|
|
- // 原图
|
|
|
|
- }
|
|
|
|
- return studentScoreDetailDtoIPage;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- private int getCount(Long examId, ScanStatus status) {
|
|
|
|
- QueryWrapper<MarkStudent> wrapper = new QueryWrapper<>();
|
|
|
|
- LambdaQueryWrapper<MarkStudent> lw = wrapper.lambda();
|
|
|
|
- lw.eq(MarkStudent::getExamId, examId);
|
|
|
|
- if (status != null) {
|
|
|
|
- lw.eq(MarkStudent::getScanStatus, status);
|
|
|
|
- }
|
|
|
|
- return baseMapper.selectCount(wrapper);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- private int getOmrAbsentCount(Long examId, Boolean checked) {
|
|
|
|
- QueryWrapper<MarkStudent> wrapper = new QueryWrapper<>();
|
|
|
|
- LambdaQueryWrapper<MarkStudent> lw = wrapper.lambda();
|
|
|
|
- lw.eq(MarkStudent::getExamId, examId);
|
|
|
|
- lw.eq(MarkStudent::getOmrAbsent, true);
|
|
|
|
- if (checked != null) {
|
|
|
|
- lw.eq(MarkStudent::getOmrAbsentChecked, checked);
|
|
|
|
- }
|
|
|
|
- return baseMapper.selectCount(wrapper);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- private int getIncompleteCount(Long examId) {
|
|
|
|
- QueryWrapper<MarkStudent> wrapper = new QueryWrapper<>();
|
|
|
|
- LambdaQueryWrapper<MarkStudent> lw = wrapper.lambda();
|
|
|
|
- lw.eq(MarkStudent::getExamId, examId);
|
|
|
|
- lw.eq(MarkStudent::getIncomplete, true);
|
|
|
|
- return baseMapper.selectCount(wrapper);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- @Override
|
|
|
|
- public ScanExamCheckInfoVo checkInfo(BasicExam exam) {
|
|
|
|
- Long examId = exam.getId();
|
|
|
|
- ScanExamCheckInfoVo vo = new ScanExamCheckInfoVo();
|
|
|
|
- vo.setId(exam.getId());
|
|
|
|
- vo.setName(exam.getName());
|
|
|
|
- CheckTask ct = vo.getCheckTask();
|
|
|
|
- ct.setUnexistCount(getCount(examId, ScanStatus.UNEXIST));
|
|
|
|
- ct.setUnexistCheckedCount(getCount(examId, ScanStatus.MANUAL_ABSENT));
|
|
|
|
- ct.setAssignedCount(scanPaperService.getAssignedCount(examId, false));
|
|
|
|
- ct.setAssignedCheckedCount(scanPaperService.getAssignedCount(examId, true));
|
|
|
|
- ct.setAbsentCheckCount(getOmrAbsentCount(examId, false));
|
|
|
|
- ct.setAbsentCheckedCount(getOmrAbsentCount(examId, true));
|
|
|
|
- ct.setObjectiveCheckCount(scanOmrTaskService.getCount(examId, OmrTaskStatus.WAITING));
|
|
|
|
- ct.setObjectiveCheckedCount(scanOmrTaskService.getCount(examId, OmrTaskStatus.PROCESSED));
|
|
|
|
- ct.setIncompleteCount(getIncompleteCount(examId));
|
|
|
|
- return vo;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * 根据考生当前绑定的paper刷新考生状态,需要在外部调用处对考生上锁
|
|
|
|
- *
|
|
|
|
- * @param id
|
|
|
|
- */
|
|
|
|
- @Override
|
|
|
|
- @Transactional
|
|
|
|
- public void updateStudentByPaper(@NotNull Long userId, @NotNull Long studentId, @NotNull boolean updateOmrTask) {
|
|
|
|
- MarkStudent student = this.getById(studentId);
|
|
|
|
- if (student == null) {
|
|
|
|
- throw new ParameterException("找不到对应的考生");
|
|
|
|
- }
|
|
|
|
- // 重置状态
|
|
|
|
- student.setIncomplete(false);
|
|
|
|
- student.setAssigned(false);
|
|
|
|
- student.setQuestionFilled(false);
|
|
|
|
- student.setOmrAbsent(false);
|
|
|
|
- int paperCount = 0;
|
|
|
|
- List<ScanStudentPaper> studentPaperList = studentPaperService.findByStudentId(studentId);
|
|
|
|
- for (ScanStudentPaper studentPaper : studentPaperList) {
|
|
|
|
- paperCount++;
|
|
|
|
- // 获取paper详情更新考生状态
|
|
|
|
- ScanPaper paper = scanPaperService.getById(studentPaper.getPaperId());
|
|
|
|
- student.setAssigned(student.getAssigned() || paper.getAssigned());
|
|
|
|
- student.setQuestionFilled(student.getQuestionFilled() || paper.getQuestionFilled());
|
|
|
|
- student.setCardNumber(paper.getCardNumber());
|
|
|
|
- // 单独判断首张纸正面的识别结果
|
|
|
|
- if (studentPaper.getPaperIndex() == 1) {
|
|
|
|
- // 根据识别结果更新考生属性
|
|
|
|
- ScanPaperPage page = scanPaperPageService.findPaperIdAndIndex(paper.getId(), 1);
|
|
|
|
- student.setOmrAbsent(page.getAbsent() == null ? false : page.getAbsent().getResult());
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private MarkPaperService markPaperService;
|
|
|
|
+ @Autowired
|
|
|
|
+ private ScanPackageService scanPackageService;
|
|
|
|
+ @Autowired
|
|
|
|
+ private ScanPaperService scanPaperService;
|
|
|
|
+ @Autowired
|
|
|
|
+ private ScanPaperPageService scanPaperPageService;
|
|
|
|
+ @Autowired
|
|
|
|
+ private ScanOmrTaskService scanOmrTaskService;
|
|
|
|
+ @Autowired
|
|
|
|
+ private ScanAnswerCardService answerCardService;
|
|
|
|
+ @Autowired
|
|
|
|
+ private ScanStudentPaperService studentPaperService;
|
|
|
|
+ @Resource
|
|
|
|
+ private TeachcloudCommonService teachcloudCommonService;
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public List<String> listClassByExamIdAndCourseCode(Long examId, String paperNumber) {
|
|
|
|
+ QueryWrapper<MarkStudent> queryWrapper = new QueryWrapper<>();
|
|
|
|
+ queryWrapper.lambda().eq(MarkStudent::getExamId, examId).eq(MarkStudent::getPaperNumber, paperNumber);
|
|
|
|
+ List<MarkStudent> markStudentList = this.list(queryWrapper);
|
|
|
|
+
|
|
|
|
+ List<String> classNameList = new ArrayList<>();
|
|
|
|
+ if (CollectionUtils.isNotEmpty(markStudentList)) {
|
|
|
|
+ classNameList = markStudentList.stream().filter(m -> StringUtils.isNotBlank(m.getClassName()))
|
|
|
|
+ .map(MarkStudent::getClassName).distinct().collect(Collectors.toList());
|
|
|
|
+ }
|
|
|
|
+ return classNameList;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public void updateSubjectiveStatusAndScore(Long studentId, SubjectiveStatus status, Double score,
|
|
|
|
+ String scoreList) {
|
|
|
|
+ UpdateWrapper<MarkStudent> updateWrapper = new UpdateWrapper<>();
|
|
|
|
+ updateWrapper.lambda().set(MarkStudent::getSubjectiveStatus, status).set(MarkStudent::getSubjectiveScore, score)
|
|
|
|
+ .set(MarkStudent::getSubjectiveScoreList, scoreList).eq(MarkStudent::getId, studentId);
|
|
|
|
+ this.update(updateWrapper);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public ScanExamInfoVo getScanExamInfo(BasicExam exam) {
|
|
|
|
+ ScanExamInfoVo vo = new ScanExamInfoVo();
|
|
|
|
+ vo.setId(exam.getId());
|
|
|
|
+ vo.setName(exam.getName());
|
|
|
|
+ vo.getAnswerScan().setCourseCount(markPaperService.getCountByExam(exam.getId()));
|
|
|
|
+ vo.getAnswerScan().setTotalCount(getCount(exam.getId(), null));
|
|
|
|
+ vo.getAnswerScan().setScannedCount(getCount(exam.getId(), ScanStatus.SCANNED));
|
|
|
|
+ vo.getPackageScan().setScannedCount(scanPackageService.getCount(exam.getId()));
|
|
|
|
+ return vo;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public IPage<StudentScoreDetailDto> pageStudentScore(Long examId, String paperNumber, String college,
|
|
|
|
+ String className, String teacher, Integer filter, Boolean absent, Boolean breach, Double startScore,
|
|
|
|
+ Double endScore, Double subScore, Integer objectiveScoreRateLt, String studentName, String studentCode,
|
|
|
|
+ Integer pageNumber, Integer pageSize) {
|
|
|
|
+ if (startScore != null && endScore == null) {
|
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("请输入结束分数值");
|
|
|
|
+ }
|
|
|
|
+ Page<StudentScoreDetailDto> page = new Page<>(pageNumber, pageSize);
|
|
|
|
+ MarkPaper markPaper = markPaperService.getByExamIdAndPaperNumber(examId, paperNumber);
|
|
|
|
+ Double objectiveScoreLt = objectiveScoreRateLt == null ? null
|
|
|
|
+ : Double.parseDouble(new DecimalFormat("####.###")
|
|
|
|
+ .format(markPaper.getObjectiveScore() * objectiveScoreRateLt / 100));
|
|
|
|
+ IPage<StudentScoreDetailDto> studentScoreDetailDtoIPage = this.baseMapper.pageStudentScore(page, examId,
|
|
|
|
+ paperNumber, college, className, teacher, filter, absent, breach, startScore, endScore, subScore,
|
|
|
|
+ objectiveScoreLt, studentName, studentCode);
|
|
|
|
+ for (StudentScoreDetailDto scoreDetailDto : studentScoreDetailDtoIPage.getRecords()) {
|
|
|
|
+ // 原图
|
|
|
|
+ scoreDetailDto.setSheetUrls(buildSheetUrls(scoreDetailDto.getStudentId()));
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ return studentScoreDetailDtoIPage;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public List<SheetUrlDto> buildSheetUrls(Long studentId) {
|
|
|
|
+ // 原图
|
|
|
|
+ List<SheetUrlDto> sheetUrls = new ArrayList<>();
|
|
|
|
+ List<StudentPaperDetailDto> studentPaperDetailDtoList = scanPaperService.listStudentPaperDetail(studentId);
|
|
|
|
+ for (int i = 0; i < studentPaperDetailDtoList.size(); i++) {
|
|
|
|
+ StudentPaperDetailDto studentPaperDetailDto = studentPaperDetailDtoList.get(i);
|
|
|
|
+ sheetUrls.add(new SheetUrlDto(2 * (studentPaperDetailDto.getPaperIndex() - 1) + studentPaperDetailDto.getPageIndex(), teachcloudCommonService.filePreview(studentPaperDetailDto.getSheetPath())));
|
|
|
|
+ }
|
|
|
|
+ return sheetUrls;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private int getCount(Long examId, ScanStatus status) {
|
|
|
|
+ QueryWrapper<MarkStudent> wrapper = new QueryWrapper<>();
|
|
|
|
+ LambdaQueryWrapper<MarkStudent> lw = wrapper.lambda();
|
|
|
|
+ lw.eq(MarkStudent::getExamId, examId);
|
|
|
|
+ if (status != null) {
|
|
|
|
+ lw.eq(MarkStudent::getScanStatus, status);
|
|
|
|
+ }
|
|
|
|
+ return baseMapper.selectCount(wrapper);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private int getOmrAbsentCount(Long examId, Boolean checked) {
|
|
|
|
+ QueryWrapper<MarkStudent> wrapper = new QueryWrapper<>();
|
|
|
|
+ LambdaQueryWrapper<MarkStudent> lw = wrapper.lambda();
|
|
|
|
+ lw.eq(MarkStudent::getExamId, examId);
|
|
|
|
+ lw.eq(MarkStudent::getOmrAbsent, true);
|
|
|
|
+ if (checked != null) {
|
|
|
|
+ lw.eq(MarkStudent::getOmrAbsentChecked, checked);
|
|
|
|
+ }
|
|
|
|
+ return baseMapper.selectCount(wrapper);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private int getIncompleteCount(Long examId) {
|
|
|
|
+ QueryWrapper<MarkStudent> wrapper = new QueryWrapper<>();
|
|
|
|
+ LambdaQueryWrapper<MarkStudent> lw = wrapper.lambda();
|
|
|
|
+ lw.eq(MarkStudent::getExamId, examId);
|
|
|
|
+ lw.eq(MarkStudent::getIncomplete, true);
|
|
|
|
+ return baseMapper.selectCount(wrapper);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public ScanExamCheckInfoVo checkInfo(BasicExam exam) {
|
|
|
|
+ Long examId = exam.getId();
|
|
|
|
+ ScanExamCheckInfoVo vo = new ScanExamCheckInfoVo();
|
|
|
|
+ vo.setId(exam.getId());
|
|
|
|
+ vo.setName(exam.getName());
|
|
|
|
+ CheckTask ct = vo.getCheckTask();
|
|
|
|
+ ct.setUnexistCount(getCount(examId, ScanStatus.UNEXIST));
|
|
|
|
+ ct.setUnexistCheckedCount(getCount(examId, ScanStatus.MANUAL_ABSENT));
|
|
|
|
+ ct.setAssignedCount(scanPaperService.getAssignedCount(examId, false));
|
|
|
|
+ ct.setAssignedCheckedCount(scanPaperService.getAssignedCount(examId, true));
|
|
|
|
+ ct.setAbsentCheckCount(getOmrAbsentCount(examId, false));
|
|
|
|
+ ct.setAbsentCheckedCount(getOmrAbsentCount(examId, true));
|
|
|
|
+ ct.setObjectiveCheckCount(scanOmrTaskService.getCount(examId, OmrTaskStatus.WAITING));
|
|
|
|
+ ct.setObjectiveCheckedCount(scanOmrTaskService.getCount(examId, OmrTaskStatus.PROCESSED));
|
|
|
|
+ ct.setIncompleteCount(getIncompleteCount(examId));
|
|
|
|
+ return vo;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 根据考生当前绑定的paper刷新考生状态,需要在外部调用处对考生上锁
|
|
|
|
+ */
|
|
|
|
+ @Override
|
|
|
|
+ @Transactional
|
|
|
|
+ public void updateStudentByPaper(@NotNull Long userId, @NotNull Long studentId, @NotNull boolean updateOmrTask) {
|
|
|
|
+ MarkStudent student = this.getById(studentId);
|
|
|
|
+ if (student == null) {
|
|
|
|
+ throw new ParameterException("找不到对应的考生");
|
|
|
|
+ }
|
|
|
|
+ // 重置状态
|
|
|
|
+ student.setIncomplete(false);
|
|
|
|
+ student.setAssigned(false);
|
|
|
|
+ student.setQuestionFilled(false);
|
|
|
|
+ student.setOmrAbsent(false);
|
|
|
|
+ int paperCount = 0;
|
|
|
|
+ List<ScanStudentPaper> studentPaperList = studentPaperService.findByStudentId(studentId);
|
|
|
|
+ for (ScanStudentPaper studentPaper : studentPaperList) {
|
|
|
|
+ paperCount++;
|
|
|
|
+ // 获取paper详情更新考生状态
|
|
|
|
+ ScanPaper paper = scanPaperService.getById(studentPaper.getPaperId());
|
|
|
|
+ student.setAssigned(student.getAssigned() || paper.getAssigned());
|
|
|
|
+ student.setQuestionFilled(student.getQuestionFilled() || paper.getQuestionFilled());
|
|
|
|
+ student.setCardNumber(paper.getCardNumber());
|
|
|
|
+ // 单独判断首张纸正面的识别结果
|
|
|
|
+ if (studentPaper.getPaperIndex() == 1) {
|
|
|
|
+ // 根据识别结果更新考生属性
|
|
|
|
+ ScanPaperPage page = scanPaperPageService.findPaperIdAndIndex(paper.getId(), 1);
|
|
|
|
+ student.setOmrAbsent(page.getAbsent() == null ? false : page.getAbsent().getResult());
|
|
// student.setDevice(batchService.findByPaperId(paper.getId()).getDevice());
|
|
// student.setDevice(batchService.findByPaperId(paper.getId()).getDevice());
|
|
- }
|
|
|
|
- }
|
|
|
|
- // 更新考生状态
|
|
|
|
- if (paperCount > 0) {
|
|
|
|
- ScanAnswerCard answerCard = answerCardService.findByExamAndNumber(student.getExamId(),
|
|
|
|
- student.getCardNumber());
|
|
|
|
- student.setIncomplete(paperCount != answerCard.getPaperCount());
|
|
|
|
- student.setScanStatus(ScanStatus.SCANNED);
|
|
|
|
- } else {
|
|
|
|
- student.setScanStatus(ScanStatus.UNEXIST);
|
|
|
|
- }
|
|
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ // 更新考生状态
|
|
|
|
+ if (paperCount > 0) {
|
|
|
|
+ ScanAnswerCard answerCard = answerCardService.findByExamAndNumber(student.getExamId(),
|
|
|
|
+ student.getCardNumber());
|
|
|
|
+ student.setIncomplete(paperCount != answerCard.getPaperCount());
|
|
|
|
+ student.setScanStatus(ScanStatus.SCANNED);
|
|
|
|
+ } else {
|
|
|
|
+ student.setScanStatus(ScanStatus.UNEXIST);
|
|
|
|
+ }
|
|
// student.setUpdaterId(userId);
|
|
// student.setUpdaterId(userId);
|
|
// student.setUpdateTime(System.currentTimeMillis());
|
|
// student.setUpdateTime(System.currentTimeMillis());
|
|
- this.saveOrUpdate(student);
|
|
|
|
- if (updateOmrTask) {
|
|
|
|
- // 清除识别对照任务
|
|
|
|
- scanOmrTaskService.deleteByStudentId(student.getExamId(), student.getId());
|
|
|
|
- // 重新生成识别对照任务
|
|
|
|
- scanOmrTaskService.buildTask(ConditionType.FILL_SUSPECT, student.getId());
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- @Override
|
|
|
|
- public MarkStudent findByExamIdAndCoursePaperIdAndStudentCode(Long examId, String coursePaperId,
|
|
|
|
- String studentCode) {
|
|
|
|
- QueryWrapper<MarkStudent> wrapper = new QueryWrapper<>();
|
|
|
|
- LambdaQueryWrapper<MarkStudent> lw = wrapper.lambda();
|
|
|
|
- lw.eq(MarkStudent::getExamId, examId);
|
|
|
|
- lw.eq(MarkStudent::getCoursePaperId, coursePaperId);
|
|
|
|
- lw.eq(MarkStudent::getStudentCode, studentCode);
|
|
|
|
- return baseMapper.selectOne(wrapper);
|
|
|
|
- }
|
|
|
|
|
|
+ this.saveOrUpdate(student);
|
|
|
|
+ if (updateOmrTask) {
|
|
|
|
+ // 清除识别对照任务
|
|
|
|
+ scanOmrTaskService.deleteByStudentId(student.getExamId(), student.getId());
|
|
|
|
+ // 重新生成识别对照任务
|
|
|
|
+ scanOmrTaskService.buildTask(ConditionType.FILL_SUSPECT, student.getId());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public MarkStudent findByExamIdAndCoursePaperIdAndStudentCode(Long examId, String coursePaperId,
|
|
|
|
+ String studentCode) {
|
|
|
|
+ QueryWrapper<MarkStudent> wrapper = new QueryWrapper<>();
|
|
|
|
+ LambdaQueryWrapper<MarkStudent> lw = wrapper.lambda();
|
|
|
|
+ lw.eq(MarkStudent::getExamId, examId);
|
|
|
|
+ lw.eq(MarkStudent::getCoursePaperId, coursePaperId);
|
|
|
|
+ lw.eq(MarkStudent::getStudentCode, studentCode);
|
|
|
|
+ return baseMapper.selectOne(wrapper);
|
|
|
|
+ }
|
|
}
|
|
}
|