|
@@ -64,11 +64,9 @@ import org.apache.commons.lang3.StringUtils;
|
|
|
import org.apache.poi.ss.usermodel.CellStyle;
|
|
|
import org.apache.poi.ss.usermodel.FillPatternType;
|
|
|
import org.apache.poi.ss.usermodel.IndexedColors;
|
|
|
-import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.util.FileCopyUtils;
|
|
|
-import org.springframework.util.ReflectionUtils;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
@@ -281,7 +279,7 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
|
|
|
scoreDetailDto.getSubjectiveScoreList()));
|
|
|
// 客观题检查标记
|
|
|
scoreDetailDto.setObjectiveCheckFlag(
|
|
|
- !scoreDetailDto.getAbsent() && !scoreDetailDto.getOmrAbsent() && scoreDetailDto.getUpload() && ScanStatus.SCANNED.equals(scoreDetailDto.getScanStatus()) && StringUtils.isNotBlank(
|
|
|
+ !scoreDetailDto.getAbsent() && !scoreDetailDto.getManualAbsent() && !scoreDetailDto.getOmrAbsent() && scoreDetailDto.getUpload() && ScanStatus.SCANNED.equals(scoreDetailDto.getScanStatus()) && StringUtils.isNotBlank(
|
|
|
scoreDetailDto.getObjectiveScore()) && StringUtils.isNotBlank(scoreDetailDto.getObjectiveScoreList()));
|
|
|
|
|
|
// 格式化分数
|
|
@@ -452,6 +450,18 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
|
|
|
return baseMapper.selectCountByQuery(markStudent, dpr);
|
|
|
}
|
|
|
|
|
|
+ private int getManualAbsentCount(Long examId, Long courseId, String coursePaperId,
|
|
|
+ MarkPaperStatus markPaperStatus, DataPermissionRule dpr) {
|
|
|
+ MarkStudent markStudent = new MarkStudent();
|
|
|
+ markStudent.setExamId(examId);
|
|
|
+ markStudent.setCourseId(courseId);
|
|
|
+ markStudent.setCoursePaperId(coursePaperId);
|
|
|
+ markStudent.setScanStatus(ScanStatus.UNEXIST);
|
|
|
+ markStudent.setManualAbsent(true);
|
|
|
+ markStudent.setMarkPaperStatus(markPaperStatus.name());
|
|
|
+ return baseMapper.selectCountByQuery(markStudent, dpr);
|
|
|
+ }
|
|
|
+
|
|
|
private int getMissScanCount(Long examId, Long courseId, String coursePaperId,
|
|
|
MarkPaperStatus markPaperStatus, DataPermissionRule dpr) {
|
|
|
MarkStudent markStudent = new MarkStudent();
|
|
@@ -486,7 +496,8 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
|
|
|
return baseMapper.selectCountByQuery(markStudent, dpr);
|
|
|
}
|
|
|
|
|
|
- private int getPaperTypeCheckCount(Long examId, Long courseId, String coursePaperId, PaperTypeCheckStatus status, DataPermissionRule dpr) {
|
|
|
+ @Override
|
|
|
+ public int getPaperTypeCheckCount(Long examId, Long courseId, String coursePaperId, PaperTypeCheckStatus status, DataPermissionRule dpr) {
|
|
|
MarkStudent markStudent = new MarkStudent();
|
|
|
markStudent.setExamId(examId);
|
|
|
markStudent.setCourseId(courseId);
|
|
@@ -506,8 +517,7 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
|
|
|
vo.setName(exam.getName());
|
|
|
CheckTask ct = vo.getCheckTask();
|
|
|
ct.setUnexistCount(getCount(examId, ScanStatus.UNEXIST, courseId, coursePaperId, MarkPaperStatus.FORMAL, dpr));
|
|
|
- ct.setUnexistCheckedCount(
|
|
|
- getCount(examId, ScanStatus.MANUAL_ABSENT, courseId, coursePaperId, MarkPaperStatus.FORMAL, dpr));
|
|
|
+ ct.setUnexistCheckedCount(getManualAbsentCount(examId, courseId, coursePaperId, MarkPaperStatus.FORMAL, dpr));
|
|
|
ct.setMissScanCount(getMissScanCount(examId, courseId, coursePaperId, MarkPaperStatus.FORMAL, dpr));
|
|
|
ct.setAssignedCount(getAssignedCount(examId, false, courseId, coursePaperId, MarkPaperStatus.FORMAL, dpr));
|
|
|
ct.setAssignedCheckedCount(
|
|
@@ -541,11 +551,12 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
|
|
|
|
|
|
// 重置状态
|
|
|
student.setIncomplete(false);
|
|
|
- student.setAssigned(false);
|
|
|
- student.setAssignConfirmed(false);
|
|
|
+ if (!omrEdit) {
|
|
|
+ student.setAssigned(false);
|
|
|
+ student.setAssignConfirmed(false);
|
|
|
+ }
|
|
|
student.setInvalid(false);
|
|
|
student.setQuestionFilled(false);
|
|
|
- // student.setOmrAbsent(false);
|
|
|
int paperCount = 0;
|
|
|
List<ScanStudentPaper> studentPaperList = studentPaperService.findByStudentId(studentId);
|
|
|
List<String> objectiveAnswers = new ArrayList<>();
|
|
@@ -565,21 +576,19 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
|
|
|
student.setOmrAbsent(page.getAbsent() != null && page.getAbsent().getResult());
|
|
|
student.setOmrBreach(page.getBreach() != null && page.getBreach().getResult());
|
|
|
student.setOmrAbsentChecked(false);
|
|
|
- student.setAbsent(false);
|
|
|
student.setManualAbsent(false);
|
|
|
+ student.setManualBreach(false);
|
|
|
if (student.getOmrAbsent()) {
|
|
|
student.setObjectiveScore(null);
|
|
|
student.setObjectiveScoreList(null);
|
|
|
}
|
|
|
} else {
|
|
|
- student.setScanStatus(page.getAbsent() != null && page.getAbsent().getResult() ? ScanStatus.MANUAL_ABSENT : student.getScanStatus());
|
|
|
- student.setManualAbsent(ScanStatus.MANUAL_ABSENT.equals(student.getScanStatus()));
|
|
|
- student.setBreach(page.getBreach() != null && page.getBreach().getResult());
|
|
|
+ student.setManualAbsent(page.getAbsent() != null && page.getAbsent().getResult());
|
|
|
+ student.setManualBreach(page.getBreach() != null && page.getBreach().getResult());
|
|
|
}
|
|
|
+ student.setAbsent(student.getOmrAbsent() || student.getManualAbsent());
|
|
|
+ student.setBreach(student.getOmrBreach() || student.getManualBreach());
|
|
|
|
|
|
- // student.setDevice(batchService.findByPaperId(paper.getId()).getDevice());
|
|
|
-
|
|
|
- PaperTypeCheckStatus paperTypeCheckStatus = PaperTypeCheckStatus.NORMAL;
|
|
|
// 根据卷型识别结果更新考生卷型,如果卷型识别结果异常则添加到卷型检查中
|
|
|
StringResult paperTypeResult = page.getPaperType();
|
|
|
|
|
@@ -599,15 +608,14 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
|
|
|
}
|
|
|
student.setPaperType(paperType);
|
|
|
if (!omrEdit) {
|
|
|
- if (paperType.length() > 1) {
|
|
|
- // 多卷型
|
|
|
- paperTypeCheckStatus = PaperTypeCheckStatus.WAITING;
|
|
|
- }
|
|
|
- if ("#".equals(paperType)) {
|
|
|
- // 没有识别到卷型
|
|
|
- paperTypeCheckStatus = PaperTypeCheckStatus.WAITING;
|
|
|
+ if (paperType.length() > 1 || "#".equals(paperType)) {
|
|
|
+ // 多卷型、没有识别到卷型
|
|
|
+ student.setPaperTypeCheckStatus(PaperTypeCheckStatus.WAITING);
|
|
|
+ } else {
|
|
|
+ student.setPaperTypeCheckStatus(PaperTypeCheckStatus.NORMAL);
|
|
|
}
|
|
|
- student.setPaperTypeCheckStatus(paperTypeCheckStatus);
|
|
|
+ } else {
|
|
|
+ student.setPaperTypeCheckStatus(PaperTypeCheckStatus.PROCESSED);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -731,7 +739,7 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
|
|
|
studentObjectiveDetailDto.setSubjectiveScore(
|
|
|
markStudent.getSubjectiveScore() != null ? markStudent.getSubjectiveScore() : 0);
|
|
|
studentObjectiveDetailDto.setUpload(markStudent.getUpload());
|
|
|
- studentObjectiveDetailDto.setAbsent(markStudent.getAbsent());
|
|
|
+ studentObjectiveDetailDto.setAbsent(markStudent.getAbsent() || markStudent.getManualAbsent() || markStudent.getOmrAbsent());
|
|
|
studentObjectiveDetailDto.setSheetUrls(this.buildSheetUrls(studentId));
|
|
|
|
|
|
List<MarkQuestionAnswerVo> questions = markQuestionService.listQuestionAnswerByExamIdAndPaperNumberAndPaperType(
|
|
@@ -779,14 +787,18 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
|
|
|
MarkPaper markPaper = markPaperService.getByExamIdAndPaperNumber(student.getExamId(), student.getPaperNumber());
|
|
|
// 评卷是否结束
|
|
|
if (markPaper == null || MarkPaperStatus.FINISH.equals(markPaper.getStatus())) {
|
|
|
- throw ExceptionResultEnum.ERROR.exception("科目已结束评卷,无法打分");
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("科目已结束评卷");
|
|
|
}
|
|
|
answers = StringUtils.trimToEmpty(answers);
|
|
|
if (student != null) {
|
|
|
student.setAnswers(answers.toUpperCase());
|
|
|
student.setCheckUserId(userId);
|
|
|
student.setCheckTime(System.currentTimeMillis());
|
|
|
- return saveUploadStudent(student);
|
|
|
+ boolean success = this.updateScanInfo(student);
|
|
|
+ if (success) {
|
|
|
+ calculateObjectiveScore(student);
|
|
|
+ }
|
|
|
+ return success;
|
|
|
} else {
|
|
|
return false;
|
|
|
}
|
|
@@ -798,9 +810,7 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
|
|
|
queryWrapper.lambda().eq(MarkStudent::getExamId, examId).eq(MarkStudent::getPaperNumber, paperNumber)
|
|
|
.eq(MarkStudent::getUpload, true)
|
|
|
.eq(MarkStudent::getScanStatus, ScanStatus.SCANNED)
|
|
|
- .eq(MarkStudent::getAbsent, false)
|
|
|
- .eq(MarkStudent::getBreach, false)
|
|
|
- .eq(MarkStudent::getOmrAbsent, false);
|
|
|
+ .eq(MarkStudent::getAbsent, false);
|
|
|
return this.count(queryWrapper);
|
|
|
}
|
|
|
|
|
@@ -808,9 +818,9 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
|
|
|
public boolean updateScanInfo(MarkStudent student) {
|
|
|
UpdateWrapper<MarkStudent> updateWrapper = new UpdateWrapper<>();
|
|
|
updateWrapper.lambda().set(MarkStudent::getAnswers, student.getAnswers())
|
|
|
- .set(MarkStudent::getBatchCode, student.getBatchCode()).set(MarkStudent::getAbsent, student.getAbsent())
|
|
|
- .set(MarkStudent::getUploadTime, System.currentTimeMillis())
|
|
|
- .set(MarkStudent::getCardNumber, student.getCardNumber()).eq(MarkStudent::getId, student.getId());
|
|
|
+ .set(MarkStudent::getCheckUserId, student.getCheckUserId())
|
|
|
+ .set(MarkStudent::getCheckTime, student.getCheckTime())
|
|
|
+ .eq(MarkStudent::getId, student.getId());
|
|
|
return this.update(updateWrapper);
|
|
|
|
|
|
}
|
|
@@ -821,7 +831,8 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public List<MarkStudent> listUnMarkTaskStudent(Long examId, String paperNumber, Integer groupNumber, int pageSize) {
|
|
|
+ public List<MarkStudent> listUnMarkTaskStudent(Long examId, String paperNumber, Integer groupNumber,
|
|
|
+ int pageSize) {
|
|
|
Page<MarkStudent> page = new Page<>(1, pageSize);
|
|
|
IPage<MarkStudent> markStudentIPage = this.baseMapper.listUnMarkTaskStudent(page, examId, paperNumber,
|
|
|
groupNumber);
|
|
@@ -830,44 +841,11 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
|
|
|
|
|
|
/**
|
|
|
* 客观题统分 统分场景: 1.后台-成绩检查-客观题检查 2.扫描端-考生图片上传 3.扫描端-客观题二次识别
|
|
|
- *
|
|
|
- * @param student
|
|
|
- * @return
|
|
|
*/
|
|
|
- @Override
|
|
|
- public boolean saveUploadStudent(MarkStudent student) {
|
|
|
- MarkStudent old = this.getById(student.getId());
|
|
|
- if (!student.getAbsent()) {// 正考
|
|
|
- MarkPaper markPaper = markPaperService.getByExamIdAndPaperNumber(student.getExamId(),
|
|
|
- student.getPaperNumber());
|
|
|
- if (markPaper.getStatus().equals(MarkPaperStatus.FINISH)) {
|
|
|
- markPaperService.updateStatus(markPaper.getExamId(), markPaper.getPaperNumber(), MarkPaperStatus.FORMAL,
|
|
|
- MarkPaperStatus.FINISH);
|
|
|
- }
|
|
|
- }
|
|
|
- calculateObjectiveScore(student);
|
|
|
- if (student.getAbsent()) {// 转缺考
|
|
|
- student.setObjectiveScore(null);
|
|
|
- student.setObjectiveScoreList(null);
|
|
|
- }
|
|
|
- if (!old.getAbsent() && student.getAbsent()) {// 正考转缺考
|
|
|
- student.setSubjectiveScore(null);
|
|
|
- student.setSubjectiveScoreList(null);
|
|
|
- student.setSubjectiveStatus(SubjectiveStatus.UNMARK);
|
|
|
- this.updateById(student);
|
|
|
- }
|
|
|
- boolean success = this.updateScanInfo(student);
|
|
|
- if (success) {
|
|
|
- markPaperService.updateUploadCount(student.getExamId(), student.getPaperNumber(),
|
|
|
- this.countUploadedByExamIdAndPaperNumber(student.getExamId(), student.getPaperNumber()));
|
|
|
- }
|
|
|
- return success;
|
|
|
- }
|
|
|
-
|
|
|
@Override
|
|
|
public void calculateObjectiveScore(MarkStudent student) {
|
|
|
// 缺考状态不统分(人工指定缺考、识别缺考)
|
|
|
- if (!ScanStatus.MANUAL_ABSENT.equals(student.getScanStatus()) && !student.getAbsent() && !student.getOmrAbsent()) {
|
|
|
+ if (!student.getManualAbsent() && !student.getAbsent() && !student.getOmrAbsent()) {
|
|
|
ScoreCalculateUtil util = ScoreCalculateUtil.instance(student);
|
|
|
ScoreInfo info = util.calculate(markQuestionService.listQuestionAnswerByExamIdAndPaperNumberAndPaperType(
|
|
|
student.getExamId(), student.getPaperNumber(), student.getPaperType(), true), null);
|
|
@@ -1101,7 +1079,7 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
|
|
|
LambdaUpdateWrapper<MarkStudent> lw = new LambdaUpdateWrapper<>();
|
|
|
lw.set(MarkStudent::getScanStatus, status);
|
|
|
lw.set(MarkStudent::getManualAbsent, ScanStatus.MANUAL_ABSENT.equals(status));
|
|
|
- lw.set(MarkStudent::getAbsent, ScanStatus.MANUAL_ABSENT.equals(status));
|
|
|
+ lw.set(MarkStudent::getAbsent, student.getOmrAbsent() || ScanStatus.MANUAL_ABSENT.equals(status));
|
|
|
lw.set(MarkStudent::getMissScan, false);
|
|
|
lw.eq(MarkStudent::getId, student.getId());
|
|
|
update(lw);
|
|
@@ -1434,7 +1412,7 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
|
|
|
lambdaQueryWrapper.eq(MarkStudent::getSubjectiveStatus, status);
|
|
|
}
|
|
|
lambdaQueryWrapper.eq(MarkStudent::getUpload, true).eq(MarkStudent::getAbsent, false)
|
|
|
- .eq(MarkStudent::getBreach, false).eq(MarkStudent::getOmrAbsent, false);
|
|
|
+ .eq(MarkStudent::getManualAbsent, false).eq(MarkStudent::getOmrAbsent, false);
|
|
|
return this.count(queryWrapper);
|
|
|
}
|
|
|
|
|
@@ -1456,7 +1434,8 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public int countOmrAbsentStudent(Long examId, String paperNumber, boolean isOmrAbsentConfirm, String teachClassName) {
|
|
|
+ public int countOmrAbsentStudent(Long examId, String paperNumber, boolean isOmrAbsentConfirm, String
|
|
|
+ teachClassName) {
|
|
|
return this.baseMapper.countOmrAbsentStudent(examId, paperNumber, isOmrAbsentConfirm, teachClassName);
|
|
|
}
|
|
|
|
|
@@ -1558,7 +1537,8 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
|
|
|
return this.update(updateWrapper);
|
|
|
}
|
|
|
|
|
|
- private void fillObjective(ScoreReportVo ret, List<ArchiveStudentVo> studentList, Long examId, String paperNumber) {
|
|
|
+ private void fillObjective(ScoreReportVo ret, List<ArchiveStudentVo> studentList, Long examId, String
|
|
|
+ paperNumber) {
|
|
|
List<MarkQuestion> qs = markQuestionService.listByExamIdAndPaperNumberAndObjective(examId, paperNumber, true);
|
|
|
Map<String, List<ArchiveStudentVo>> collect = studentList.stream().filter(m -> StringUtils.isNotBlank(m.getPaperType())).collect(Collectors.groupingBy(ArchiveStudentVo::getPaperType));
|
|
|
|
|
@@ -1633,7 +1613,8 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
|
|
|
* @param examId 考试id
|
|
|
* @param paperNumber 试卷编号
|
|
|
*/
|
|
|
- private void fillMainQuestionAnalysis(ScoreReportVo ret, List<ArchiveStudentVo> studentList, Long examId, String paperNumber) {
|
|
|
+ private void fillMainQuestionAnalysis(ScoreReportVo ret, List<ArchiveStudentVo> studentList, Long
|
|
|
+ examId, String paperNumber) {
|
|
|
// 试卷结构数据
|
|
|
Map<String, QuestionVo> mainQuestionMap = new HashMap<>();
|
|
|
|
|
@@ -1840,6 +1821,7 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
|
|
|
markStudent.setExamId(examId);
|
|
|
markStudent.setPaperNumber(paperNumber);
|
|
|
markStudent.setScanStatus(ScanStatus.UNEXIST);
|
|
|
+ markStudent.setAbsent(false);
|
|
|
markStudent.setMarkPaperStatus(MarkPaperStatus.FORMAL.name());
|
|
|
return baseMapper.selectCountByQuery(markStudent, null);
|
|
|
}
|
|
@@ -2025,7 +2007,8 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public MarkStudent assembleByBasicExamStudent(BasicExamStudent basicExamStudent, MarkPaper markPaper, Set<String> secretNumberSet) {
|
|
|
+ public MarkStudent assembleByBasicExamStudent(BasicExamStudent basicExamStudent, MarkPaper
|
|
|
+ markPaper, Set<String> secretNumberSet) {
|
|
|
MarkStudent markStudent = this.findByBasicStudentId(basicExamStudent.getId());
|
|
|
if (markStudent == null) {
|
|
|
if (MarkPaperStatus.FINISH.equals(markPaper.getStatus())) {
|