|
@@ -1,5 +1,22 @@
|
|
|
package com.qmth.teachcloud.mark.service.impl;
|
|
|
|
|
|
+import java.io.File;
|
|
|
+import java.nio.charset.StandardCharsets;
|
|
|
+import java.text.DecimalFormat;
|
|
|
+import java.util.*;
|
|
|
+import java.util.stream.Collectors;
|
|
|
+
|
|
|
+import javax.annotation.Resource;
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
+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 org.springframework.util.FileCopyUtils;
|
|
|
+
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
@@ -52,21 +69,6 @@ import com.qmth.teachcloud.mark.service.*;
|
|
|
import com.qmth.teachcloud.mark.utils.BatchGetDataUtil;
|
|
|
import com.qmth.teachcloud.mark.utils.Calculator;
|
|
|
import com.qmth.teachcloud.mark.utils.ScoreCalculateUtil;
|
|
|
-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 org.springframework.util.FileCopyUtils;
|
|
|
-
|
|
|
-import javax.annotation.Resource;
|
|
|
-import javax.servlet.http.HttpServletResponse;
|
|
|
-import javax.validation.constraints.NotNull;
|
|
|
-import java.io.File;
|
|
|
-import java.nio.charset.StandardCharsets;
|
|
|
-import java.text.DecimalFormat;
|
|
|
-import java.util.*;
|
|
|
-import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* <p>
|
|
@@ -78,39 +80,55 @@ import java.util.stream.Collectors;
|
|
|
*/
|
|
|
@Service
|
|
|
public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkStudent> implements MarkStudentService {
|
|
|
+
|
|
|
@Autowired
|
|
|
private MarkPaperService markPaperService;
|
|
|
+
|
|
|
@Resource
|
|
|
private MarkPaperPackageService markPaperPackageService;
|
|
|
+
|
|
|
@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 MarkQuestionService markQuestionService;
|
|
|
+
|
|
|
@Resource
|
|
|
private TeachcloudCommonService teachcloudCommonService;
|
|
|
+
|
|
|
@Autowired
|
|
|
private ConcurrentService concurrentService;
|
|
|
+
|
|
|
@Resource
|
|
|
private MarkService markService;
|
|
|
+
|
|
|
@Resource
|
|
|
private LockService lockService;
|
|
|
+
|
|
|
@Resource
|
|
|
private TaskService taskService;
|
|
|
+
|
|
|
@Resource
|
|
|
private BasicRoleDataPermissionService basicRoleDataPermissionService;
|
|
|
|
|
|
@Autowired
|
|
|
private MarkSubjectiveScoreService markSubjectiveScoreService;
|
|
|
+
|
|
|
@Resource
|
|
|
private MarkSyncService markSyncService;
|
|
|
|
|
@@ -130,17 +148,16 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
|
|
|
|
|
|
@Override
|
|
|
public void updateSubjectiveStatusAndScore(Long studentId, SubjectiveStatus status, Double score,
|
|
|
- String scoreList) {
|
|
|
+ String scoreList) {
|
|
|
UpdateWrapper<MarkStudent> updateWrapper = new UpdateWrapper<>();
|
|
|
- updateWrapper.lambda().set(MarkStudent::getSubjectiveStatus, status)
|
|
|
- .set(MarkStudent::getSubjectiveScore, score)
|
|
|
+ updateWrapper.lambda().set(MarkStudent::getSubjectiveStatus, status).set(MarkStudent::getSubjectiveScore, score)
|
|
|
.set(MarkStudent::getSubjectiveScoreList, scoreList).eq(MarkStudent::getId, studentId);
|
|
|
this.update(updateWrapper);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public void updateSubjectiveStatusAndScore(Long examId, String paperNumber, SubjectiveStatus status, double score,
|
|
|
- String scoreList) {
|
|
|
+ String scoreList) {
|
|
|
UpdateWrapper<MarkStudent> updateWrapper = new UpdateWrapper<>();
|
|
|
updateWrapper.lambda().set(MarkStudent::getSubjectiveStatus, status).set(MarkStudent::getSubjectiveScore, score)
|
|
|
.set(MarkStudent::getSubjectiveScoreList, scoreList).eq(MarkStudent::getExamId, examId)
|
|
@@ -151,24 +168,31 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
|
|
|
@Override
|
|
|
public ScanExamInfoVo getScanExamInfo(BasicExam exam, String courseCode, String coursePaperId) {
|
|
|
SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
|
|
|
- DataPermissionRule dpr = basicRoleDataPermissionService.findDataPermission(sysUser.getSchoolId(), sysUser.getId(), ServletUtil.getRequest().getServletPath());
|
|
|
+ DataPermissionRule dpr = basicRoleDataPermissionService.findDataPermission(sysUser.getSchoolId(),
|
|
|
+ sysUser.getId(), ServletUtil.getRequest().getServletPath());
|
|
|
ScanExamInfoVo vo = new ScanExamInfoVo();
|
|
|
vo.setId(exam.getId());
|
|
|
vo.setName(exam.getName());
|
|
|
- vo.getAnswerScan().setCourseCount(markPaperService.getCourseCount(exam.getId(), courseCode, coursePaperId, MarkPaperStatus.FORMAL, dpr));
|
|
|
- vo.getAnswerScan().setPaperNumberCount(markPaperService.getPaperNumberCount(exam.getId(), courseCode, coursePaperId, MarkPaperStatus.FORMAL, dpr));
|
|
|
- vo.getAnswerScan().setTotalCount(getCount(exam.getId(), null, courseCode, coursePaperId, MarkPaperStatus.FORMAL, dpr));
|
|
|
- vo.getAnswerScan().setScannedCount(getCount(exam.getId(), ScanStatus.SCANNED, courseCode, coursePaperId, MarkPaperStatus.FORMAL, dpr));
|
|
|
- vo.getPackageScan().setTotalCount(markPaperPackageService.getPackageCountByExamId(exam.getId(), courseCode, coursePaperId, MarkPaperStatus.FORMAL, dpr));
|
|
|
- vo.getPackageScan().setScannedCount(scanPackageService.getCount(exam.getId(), courseCode, coursePaperId, MarkPaperStatus.FORMAL, dpr));
|
|
|
+ vo.getAnswerScan().setCourseCount(
|
|
|
+ markPaperService.getCourseCount(exam.getId(), courseCode, coursePaperId, MarkPaperStatus.FORMAL, dpr));
|
|
|
+ vo.getAnswerScan().setPaperNumberCount(markPaperService.getPaperNumberCount(exam.getId(), courseCode,
|
|
|
+ coursePaperId, MarkPaperStatus.FORMAL, dpr));
|
|
|
+ vo.getAnswerScan()
|
|
|
+ .setTotalCount(getCount(exam.getId(), null, courseCode, coursePaperId, MarkPaperStatus.FORMAL, dpr));
|
|
|
+ vo.getAnswerScan().setScannedCount(
|
|
|
+ getCount(exam.getId(), ScanStatus.SCANNED, courseCode, coursePaperId, MarkPaperStatus.FORMAL, dpr));
|
|
|
+ vo.getPackageScan().setTotalCount(markPaperPackageService.getPackageCountByExamId(exam.getId(), courseCode,
|
|
|
+ coursePaperId, MarkPaperStatus.FORMAL, dpr));
|
|
|
+ vo.getPackageScan().setScannedCount(
|
|
|
+ scanPackageService.getCount(exam.getId(), courseCode, coursePaperId, MarkPaperStatus.FORMAL, dpr));
|
|
|
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,
|
|
|
- String orderType, String orderField, Integer pageNumber, Integer pageSize) {
|
|
|
+ String className, String teacher, Integer filter, Boolean absent, Boolean breach, Double startScore,
|
|
|
+ Double endScore, Double subScore, Integer objectiveScoreRateLt, String studentName, String studentCode,
|
|
|
+ String orderType, String orderField, Integer pageNumber, Integer pageSize) {
|
|
|
if (startScore != null && endScore == null) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("请输入结束分数值");
|
|
|
}
|
|
@@ -176,7 +200,7 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
|
|
|
MarkPaper markPaper = markPaperService.getByExamIdAndPaperNumber(examId, paperNumber);
|
|
|
Double objectiveScoreLt = objectiveScoreRateLt == null ? null
|
|
|
: Double.parseDouble(new DecimalFormat("####.##")
|
|
|
- .format(markPaper.getObjectiveScore() * objectiveScoreRateLt / 100));
|
|
|
+ .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, orderType, orderField);
|
|
@@ -202,7 +226,8 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
|
|
|
return sheetUrls;
|
|
|
}
|
|
|
|
|
|
- private int getCount(Long examId, ScanStatus status, String courseCode, String coursePaperId, MarkPaperStatus markPaperStatus, DataPermissionRule dpr) {
|
|
|
+ private int getCount(Long examId, ScanStatus status, String courseCode, String coursePaperId,
|
|
|
+ MarkPaperStatus markPaperStatus, DataPermissionRule dpr) {
|
|
|
MarkStudent markStudent = new MarkStudent();
|
|
|
markStudent.setExamId(examId);
|
|
|
markStudent.setCourseCode(courseCode);
|
|
@@ -212,7 +237,8 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
|
|
|
return baseMapper.selectCountByQuery(markStudent, dpr);
|
|
|
}
|
|
|
|
|
|
- private int getOmrAbsentCount(Long examId, Boolean checked, String courseCode, String coursePaperId, MarkPaperStatus status, DataPermissionRule dpr) {
|
|
|
+ private int getOmrAbsentCount(Long examId, Boolean checked, String courseCode, String coursePaperId,
|
|
|
+ MarkPaperStatus status, DataPermissionRule dpr) {
|
|
|
MarkStudent markStudent = new MarkStudent();
|
|
|
markStudent.setExamId(examId);
|
|
|
markStudent.setCourseCode(courseCode);
|
|
@@ -223,7 +249,8 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
|
|
|
return baseMapper.selectCountByQuery(markStudent, dpr);
|
|
|
}
|
|
|
|
|
|
- private int getIncompleteCount(Long examId, String courseCode, String coursePaperId, MarkPaperStatus status, DataPermissionRule dpr) {
|
|
|
+ private int getIncompleteCount(Long examId, String courseCode, String coursePaperId, MarkPaperStatus status,
|
|
|
+ DataPermissionRule dpr) {
|
|
|
MarkStudent markStudent = new MarkStudent();
|
|
|
markStudent.setExamId(examId);
|
|
|
markStudent.setCourseCode(courseCode);
|
|
@@ -236,20 +263,28 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
|
|
|
@Override
|
|
|
public ScanExamCheckInfoVo checkInfo(BasicExam exam, String courseCode, String coursePaperId) {
|
|
|
SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
|
|
|
- DataPermissionRule dpr = basicRoleDataPermissionService.findDataPermission(sysUser.getSchoolId(), sysUser.getId(), ServletUtil.getRequest().getServletPath());
|
|
|
+ DataPermissionRule dpr = basicRoleDataPermissionService.findDataPermission(sysUser.getSchoolId(),
|
|
|
+ sysUser.getId(), ServletUtil.getRequest().getServletPath());
|
|
|
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, courseCode, coursePaperId, MarkPaperStatus.FORMAL, dpr));
|
|
|
- ct.setUnexistCheckedCount(getCount(examId, ScanStatus.MANUAL_ABSENT, courseCode, coursePaperId, MarkPaperStatus.FORMAL, dpr));
|
|
|
+ ct.setUnexistCount(
|
|
|
+ getCount(examId, ScanStatus.UNEXIST, courseCode, coursePaperId, MarkPaperStatus.FORMAL, dpr));
|
|
|
+ ct.setUnexistCheckedCount(
|
|
|
+ getCount(examId, ScanStatus.MANUAL_ABSENT, courseCode, coursePaperId, MarkPaperStatus.FORMAL, dpr));
|
|
|
ct.setAssignedCount(getAssignedCount(examId, false, courseCode, coursePaperId, MarkPaperStatus.FORMAL, dpr));
|
|
|
- ct.setAssignedCheckedCount(getAssignedCount(examId, true, courseCode, coursePaperId, MarkPaperStatus.FORMAL, dpr));
|
|
|
- ct.setAbsentCheckCount(getOmrAbsentCount(examId, false, courseCode, coursePaperId, MarkPaperStatus.FORMAL, dpr));
|
|
|
- ct.setAbsentCheckedCount(getOmrAbsentCount(examId, true, courseCode, coursePaperId, MarkPaperStatus.FORMAL, dpr));
|
|
|
- ct.setObjectiveCheckCount(scanOmrTaskService.getCount(examId, OmrTaskStatus.WAITING, courseCode, coursePaperId, MarkPaperStatus.FORMAL, dpr));
|
|
|
- ct.setObjectiveCheckedCount(scanOmrTaskService.getCount(examId, OmrTaskStatus.PROCESSED, courseCode, coursePaperId, MarkPaperStatus.FORMAL, dpr));
|
|
|
+ ct.setAssignedCheckedCount(
|
|
|
+ getAssignedCount(examId, true, courseCode, coursePaperId, MarkPaperStatus.FORMAL, dpr));
|
|
|
+ ct.setAbsentCheckCount(
|
|
|
+ getOmrAbsentCount(examId, false, courseCode, coursePaperId, MarkPaperStatus.FORMAL, dpr));
|
|
|
+ ct.setAbsentCheckedCount(
|
|
|
+ getOmrAbsentCount(examId, true, courseCode, coursePaperId, MarkPaperStatus.FORMAL, dpr));
|
|
|
+ ct.setObjectiveCheckCount(scanOmrTaskService.getCount(examId, OmrTaskStatus.WAITING, courseCode, coursePaperId,
|
|
|
+ MarkPaperStatus.FORMAL, dpr));
|
|
|
+ ct.setObjectiveCheckedCount(scanOmrTaskService.getCount(examId, OmrTaskStatus.PROCESSED, courseCode,
|
|
|
+ coursePaperId, MarkPaperStatus.FORMAL, dpr));
|
|
|
ct.setIncompleteCount(getIncompleteCount(examId, courseCode, coursePaperId, MarkPaperStatus.FORMAL, dpr));
|
|
|
return vo;
|
|
|
}
|
|
@@ -268,7 +303,7 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
|
|
|
student.setIncomplete(false);
|
|
|
student.setAssigned(false);
|
|
|
student.setQuestionFilled(false);
|
|
|
-// student.setOmrAbsent(false);
|
|
|
+ // student.setOmrAbsent(false);
|
|
|
int paperCount = 0;
|
|
|
List<ScanStudentPaper> studentPaperList = studentPaperService.findByStudentId(studentId);
|
|
|
List<String> objectiveAnswers = new ArrayList<>();
|
|
@@ -284,12 +319,13 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
|
|
|
// 根据识别结果更新考生属性
|
|
|
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());
|
|
|
}
|
|
|
|
|
|
List<ScanPaperPage> scanPaperPages = scanPaperPageService.listByPaperId(studentPaper.getPaperId());
|
|
|
for (ScanPaperPage scanPaperPage : scanPaperPages) {
|
|
|
- if (scanPaperPage.getQuestion() != null && CollectionUtils.isNotEmpty(scanPaperPage.getQuestion().getResult())) {
|
|
|
+ if (scanPaperPage.getQuestion() != null
|
|
|
+ && CollectionUtils.isNotEmpty(scanPaperPage.getQuestion().getResult())) {
|
|
|
for (String s : scanPaperPage.getQuestion().getResult()) {
|
|
|
if (s.startsWith("?")) {
|
|
|
s = s.replace("?", "");
|
|
@@ -312,8 +348,8 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
|
|
|
} else {
|
|
|
student.setScanStatus(ScanStatus.UNEXIST);
|
|
|
}
|
|
|
-// student.setUpdaterId(userId);
|
|
|
-// student.setUpdateTime(System.currentTimeMillis());
|
|
|
+ // student.setUpdaterId(userId);
|
|
|
+ // student.setUpdateTime(System.currentTimeMillis());
|
|
|
this.saveOrUpdate(student);
|
|
|
// 客观题统分
|
|
|
this.calculateObjectiveScore(student);
|
|
@@ -348,7 +384,8 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public MarkStudent findByExamIdAndCoursePaperIdAndStudentCode(Long examId, String coursePaperId, String studentCode) {
|
|
|
+ public MarkStudent findByExamIdAndCoursePaperIdAndStudentCode(Long examId, String coursePaperId,
|
|
|
+ String studentCode) {
|
|
|
QueryWrapper<MarkStudent> wrapper = new QueryWrapper<>();
|
|
|
LambdaQueryWrapper<MarkStudent> lw = wrapper.lambda();
|
|
|
lw.eq(MarkStudent::getExamId, examId);
|
|
@@ -443,11 +480,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::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::getCardNumber, student.getCardNumber()).eq(MarkStudent::getId, student.getId());
|
|
|
return this.update(updateWrapper);
|
|
|
|
|
|
}
|
|
@@ -514,14 +549,18 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
|
|
|
@Override
|
|
|
@Transactional
|
|
|
public void updateStudentAndPaper(@NotNull SysUser user, @NotNull Long id,
|
|
|
- @NotNull List<ScanStudentPaper> studentPaperList) {
|
|
|
+ @NotNull List<ScanStudentPaper> studentPaperList) {
|
|
|
if (CollectionUtils.isNotEmpty(studentPaperList)) {
|
|
|
for (ScanStudentPaper studentPaper : studentPaperList) {
|
|
|
studentPaper.setStudentId(id);
|
|
|
}
|
|
|
}
|
|
|
// 清空原有绑定关系
|
|
|
- studentPaperService.removeByStudentId(id);
|
|
|
+ if (studentPaperService.removeByStudentId(id) > 0) {
|
|
|
+ // 删除评卷任务
|
|
|
+ MarkStudent student = this.getById(id);
|
|
|
+ markService.deleteMarkTaskByStudent(student);
|
|
|
+ }
|
|
|
if (CollectionUtils.isNotEmpty(studentPaperList)) {
|
|
|
// 保存绑定关系
|
|
|
studentPaperService.saveOrUpdateBatch(studentPaperList);
|
|
@@ -552,10 +591,12 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
|
|
|
@Override
|
|
|
public IPage<AnswerQueryVo> query(AnswerQueryDomain query) {
|
|
|
SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
|
|
|
- DataPermissionRule dpr = basicRoleDataPermissionService.findDataPermission(sysUser.getSchoolId(), sysUser.getId(), ServletUtil.getRequest().getServletPath());
|
|
|
+ DataPermissionRule dpr = basicRoleDataPermissionService.findDataPermission(sysUser.getSchoolId(),
|
|
|
+ sysUser.getId(), ServletUtil.getRequest().getServletPath());
|
|
|
// 查询考生分页信息
|
|
|
query.setMarkPaperStatus(MarkPaperStatus.FORMAL.name());
|
|
|
- IPage<AnswerQueryVo> iPage = baseMapper.queryPage(new Page<>(query.getPageNumber(), query.getPageSize()), query, dpr);
|
|
|
+ IPage<AnswerQueryVo> iPage = baseMapper.queryPage(new Page<>(query.getPageNumber(), query.getPageSize()), query,
|
|
|
+ dpr);
|
|
|
if (CollectionUtils.isNotEmpty(iPage.getRecords())) {
|
|
|
for (AnswerQueryVo vo : iPage.getRecords()) {
|
|
|
if (vo.getIsAbsent() != null && vo.getIsAbsent()) {
|
|
@@ -651,7 +692,8 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
|
|
|
@Override
|
|
|
public List<String> summary(AnswerQueryDomain query) {
|
|
|
SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
|
|
|
- DataPermissionRule dpr = basicRoleDataPermissionService.findDataPermission(sysUser.getSchoolId(), sysUser.getId(), ServletUtil.getRequest().getServletPath());
|
|
|
+ DataPermissionRule dpr = basicRoleDataPermissionService.findDataPermission(sysUser.getSchoolId(),
|
|
|
+ sysUser.getId(), ServletUtil.getRequest().getServletPath());
|
|
|
|
|
|
// 不分页查询考生准考证号
|
|
|
query.setMarkPaperStatus(MarkPaperStatus.FORMAL.name());
|
|
@@ -661,7 +703,8 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
|
|
|
@Transactional
|
|
|
@Override
|
|
|
public UpdateTimeVo omrEdit(Long userId, OmrEditDomain domain) {
|
|
|
- MarkStudent student = findByExamIdAndCoursePaperIdAndStudentCode(domain.getExamId(), domain.getCoursePaperId(), domain.getStudentCode());
|
|
|
+ MarkStudent student = findByExamIdAndCoursePaperIdAndStudentCode(domain.getExamId(), domain.getCoursePaperId(),
|
|
|
+ domain.getStudentCode());
|
|
|
if (student == null) {
|
|
|
throw new ParameterException("考生信息未找到");
|
|
|
}
|
|
@@ -702,7 +745,8 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
|
|
|
|
|
|
@Transactional
|
|
|
@Override
|
|
|
- public AbsentManualUpdateVo absentManualUpdate(Long examId, String coursePaperId, String studentCode, ScanStatus status) {
|
|
|
+ public AbsentManualUpdateVo absentManualUpdate(Long examId, String coursePaperId, String studentCode,
|
|
|
+ ScanStatus status) {
|
|
|
MarkStudent student = findByExamIdAndCoursePaperIdAndStudentCode(examId, coursePaperId, studentCode);
|
|
|
if (student == null) {
|
|
|
throw new ParameterException("考生未找到");
|
|
@@ -716,7 +760,8 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
|
|
|
lw.set(MarkStudent::getAbsent, ScanStatus.MANUAL_ABSENT.equals(status));
|
|
|
lw.eq(MarkStudent::getId, student.getId());
|
|
|
update(lw);
|
|
|
- markPaperService.updateAbsentCount(examId, student.getPaperNumber(), this.countAbsentByExamIdAndPaperNumber(examId, student.getPaperNumber()));
|
|
|
+ markPaperService.updateAbsentCount(examId, student.getPaperNumber(),
|
|
|
+ this.countAbsentByExamIdAndPaperNumber(examId, student.getPaperNumber()));
|
|
|
return AbsentManualUpdateVo.create(status);
|
|
|
}
|
|
|
|
|
@@ -731,13 +776,14 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
|
|
|
}
|
|
|
lw.eq(MarkStudent::getId, student.getId());
|
|
|
update(lw);
|
|
|
- markPaperService.updateAbsentCount(examId, student.getPaperNumber(), this.countAbsentByExamIdAndPaperNumber(examId, student.getPaperNumber()));
|
|
|
+ markPaperService.updateAbsentCount(examId, student.getPaperNumber(),
|
|
|
+ this.countAbsentByExamIdAndPaperNumber(examId, student.getPaperNumber()));
|
|
|
return UpdateTimeVo.create();
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public List<Long> findIdByExamIdAndPaperNumberAndSubjectiveStatus(Long examId, String paperNumber,
|
|
|
- SubjectiveStatus unmark, SubjectiveStatus marked) {
|
|
|
+ SubjectiveStatus unmark, SubjectiveStatus marked) {
|
|
|
return this.baseMapper.findIdByExamIdAndPaperNumberAndSubjectiveStatus(examId, paperNumber, unmark.name(),
|
|
|
marked.name());
|
|
|
}
|
|
@@ -763,7 +809,8 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
|
|
|
if (markStudent == null) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("考生不存在");
|
|
|
}
|
|
|
- MarkPaper markPaper = markPaperService.getByExamIdAndPaperNumber(markStudent.getExamId(), markStudent.getPaperNumber());
|
|
|
+ MarkPaper markPaper = markPaperService.getByExamIdAndPaperNumber(markStudent.getExamId(),
|
|
|
+ markStudent.getPaperNumber());
|
|
|
// 评卷是否结束
|
|
|
if (markPaper == null || MarkPaperStatus.FINISH.equals(markPaper.getStatus())) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("科目已结束评卷,无法打分");
|
|
@@ -799,7 +846,6 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
|
|
|
return ret;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
@Override
|
|
|
public void scoreExport(ArchiveStudentQuery query, HttpServletResponse response) {
|
|
|
List<ArchiveStudentVo> ret = baseMapper.studentList(query);
|
|
@@ -818,8 +864,8 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
|
|
|
double total = ret.getOverview().getStudentCount() - ret.getOverview().getAbsentCount();
|
|
|
ret.getOverview().setPassRate(
|
|
|
Calculator.divide2String(Calculator.multiply(ret.getOverview().getPassCount(), 100), total, 2));
|
|
|
- ret.getOverview().setExcellentRate(
|
|
|
- Calculator.divide2String(Calculator.multiply(ret.getOverview().getExcellentCount(), 100), total, 2));
|
|
|
+ ret.getOverview().setExcellentRate(Calculator
|
|
|
+ .divide2String(Calculator.multiply(ret.getOverview().getExcellentCount(), 100), total, 2));
|
|
|
ret.getOverview().setAvgScore(Calculator.round(ret.getOverview().getAvgScore(), 2));
|
|
|
}
|
|
|
|
|
@@ -885,8 +931,10 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
|
|
|
public void exportUnexist(Long examId, String courseCode, String coursePaperId, HttpServletResponse response) {
|
|
|
try {
|
|
|
SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
|
|
|
- DataPermissionRule dpr = basicRoleDataPermissionService.findDataPermission(sysUser.getSchoolId(), sysUser.getId(), ServletUtil.getRequest().getServletPath());
|
|
|
- List<UnexistStudentDto> unexistStudentDtoList = this.baseMapper.listUnexistStudentByExamIdAndCoursePaperId(examId, courseCode, coursePaperId, MarkPaperStatus.FORMAL.name(), dpr);
|
|
|
+ DataPermissionRule dpr = basicRoleDataPermissionService.findDataPermission(sysUser.getSchoolId(),
|
|
|
+ sysUser.getId(), ServletUtil.getRequest().getServletPath());
|
|
|
+ List<UnexistStudentDto> unexistStudentDtoList = this.baseMapper.listUnexistStudentByExamIdAndCoursePaperId(
|
|
|
+ examId, courseCode, coursePaperId, MarkPaperStatus.FORMAL.name(), dpr);
|
|
|
ExcelUtil.excelExport("评卷员工作量", UnexistStudentDto.class, unexistStudentDtoList, response);
|
|
|
} catch (Exception e) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("导出评卷员工作量失败");
|
|
@@ -897,15 +945,12 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
|
|
|
public int countByExamIdAndPaperNumberAndMarkStatus(Long examId, String paperNumber, SubjectiveStatus status) {
|
|
|
QueryWrapper<MarkStudent> queryWrapper = new QueryWrapper<>();
|
|
|
LambdaQueryWrapper<MarkStudent> lambdaQueryWrapper = queryWrapper.lambda();
|
|
|
- lambdaQueryWrapper.eq(MarkStudent::getExamId, examId)
|
|
|
- .eq(MarkStudent::getPaperNumber, paperNumber);
|
|
|
+ lambdaQueryWrapper.eq(MarkStudent::getExamId, examId).eq(MarkStudent::getPaperNumber, paperNumber);
|
|
|
if (status != null) {
|
|
|
lambdaQueryWrapper.eq(MarkStudent::getSubjectiveStatus, status);
|
|
|
}
|
|
|
- lambdaQueryWrapper.eq(MarkStudent::getUpload, true)
|
|
|
- .eq(MarkStudent::getAbsent, false)
|
|
|
- .eq(MarkStudent::getBreach, false)
|
|
|
- .eq(MarkStudent::getOmrAbsent, false);
|
|
|
+ lambdaQueryWrapper.eq(MarkStudent::getUpload, true).eq(MarkStudent::getAbsent, false)
|
|
|
+ .eq(MarkStudent::getBreach, false).eq(MarkStudent::getOmrAbsent, false);
|
|
|
return this.count(queryWrapper);
|
|
|
}
|
|
|
|
|
@@ -913,18 +958,15 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
|
|
|
public void updateCheckInfo(Long studentId, Long userId) {
|
|
|
UpdateWrapper<MarkStudent> updateWrapper = new UpdateWrapper<>();
|
|
|
updateWrapper.lambda().set(MarkStudent::getCheckUserId, userId)
|
|
|
- .set(MarkStudent::getCheckTime, System.currentTimeMillis())
|
|
|
- .eq(MarkStudent::getId, studentId);
|
|
|
+ .set(MarkStudent::getCheckTime, System.currentTimeMillis()).eq(MarkStudent::getId, studentId);
|
|
|
this.update(updateWrapper);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public int countOmrAbsentStudent(Long examId, String paperNumber, String paperType, boolean isOmrAbsentConfirm) {
|
|
|
QueryWrapper<MarkStudent> queryWrapper = new QueryWrapper<>();
|
|
|
- queryWrapper.lambda().eq(MarkStudent::getExamId, examId)
|
|
|
- .eq(MarkStudent::getPaperNumber, paperNumber)
|
|
|
- .eq(MarkStudent::getPaperType, paperType)
|
|
|
- .eq(MarkStudent::getOmrAbsent, true)
|
|
|
+ queryWrapper.lambda().eq(MarkStudent::getExamId, examId).eq(MarkStudent::getPaperNumber, paperNumber)
|
|
|
+ .eq(MarkStudent::getPaperType, paperType).eq(MarkStudent::getOmrAbsent, true)
|
|
|
.eq(MarkStudent::getOmrAbsentChecked, isOmrAbsentConfirm);
|
|
|
return this.count(queryWrapper);
|
|
|
}
|
|
@@ -936,7 +978,9 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
|
|
|
File pdfFile;
|
|
|
try {
|
|
|
// 本地保存目录
|
|
|
- File tempFile = SystemConstant.getFileTempDirVar(System.currentTimeMillis() + File.separator + SystemConstant.getNanoId(), SystemConstant.TEMP_PREFIX);
|
|
|
+ File tempFile = SystemConstant.getFileTempDirVar(
|
|
|
+ System.currentTimeMillis() + File.separator + SystemConstant.getNanoId(),
|
|
|
+ SystemConstant.TEMP_PREFIX);
|
|
|
rootPath = tempFile.getParent();
|
|
|
|
|
|
// 删除临时目录中创建的临时文件
|
|
@@ -944,7 +988,8 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
|
|
|
tempFile.delete();
|
|
|
}
|
|
|
// html文件
|
|
|
- String cardHtmlPath = rootPath + File.separator + System.currentTimeMillis() + File.separator + "temp" + SystemConstant.HTML_PREFIX;
|
|
|
+ String cardHtmlPath = rootPath + File.separator + System.currentTimeMillis() + File.separator + "temp"
|
|
|
+ + SystemConstant.HTML_PREFIX;
|
|
|
htmlFile = new File(cardHtmlPath);
|
|
|
if (!htmlFile.exists()) {
|
|
|
htmlFile.getParentFile().mkdirs();
|
|
@@ -954,7 +999,8 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
|
|
|
FileCopyUtils.copy(jsonObject.getString("htmlContent").getBytes(StandardCharsets.UTF_8), htmlFile);
|
|
|
|
|
|
// pdf文件
|
|
|
- String cardPdfPath = rootPath + File.separator + System.currentTimeMillis() + File.separator + "temp" + SystemConstant.PDF_PREFIX;
|
|
|
+ String cardPdfPath = rootPath + File.separator + System.currentTimeMillis() + File.separator + "temp"
|
|
|
+ + SystemConstant.PDF_PREFIX;
|
|
|
pdfFile = new File(cardPdfPath);
|
|
|
if (!pdfFile.exists()) {
|
|
|
pdfFile.getParentFile().mkdirs();
|
|
@@ -974,8 +1020,7 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
|
|
|
@Override
|
|
|
public void deleteByExamIdAndPaperNumber(Long examId, String paperNumber) {
|
|
|
UpdateWrapper<MarkStudent> updateWrapper = new UpdateWrapper<>();
|
|
|
- updateWrapper.lambda().eq(MarkStudent::getExamId, examId)
|
|
|
- .eq(MarkStudent::getPaperNumber, paperNumber);
|
|
|
+ updateWrapper.lambda().eq(MarkStudent::getExamId, examId).eq(MarkStudent::getPaperNumber, paperNumber);
|
|
|
this.remove(updateWrapper);
|
|
|
}
|
|
|
|
|
@@ -996,8 +1041,7 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
|
|
|
@Override
|
|
|
public IPage<MarkStudent> pageByExamAndPaperNumber(Long examId, String paperNumber, int pageNumber, int pageSize) {
|
|
|
QueryWrapper<MarkStudent> queryWrapper = new QueryWrapper<>();
|
|
|
- queryWrapper.lambda().eq(MarkStudent::getExamId, examId)
|
|
|
- .eq(MarkStudent::getPaperNumber, paperNumber)
|
|
|
+ queryWrapper.lambda().eq(MarkStudent::getExamId, examId).eq(MarkStudent::getPaperNumber, paperNumber)
|
|
|
.orderByAsc(MarkStudent::getId);
|
|
|
return this.page(new Page<>(pageNumber, pageSize), queryWrapper);
|
|
|
}
|
|
@@ -1014,13 +1058,13 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
|
|
|
@Override
|
|
|
public boolean updateAssignConfirm(Long studentId, boolean assignConfirm) {
|
|
|
UpdateWrapper<MarkStudent> updateWrapper = new UpdateWrapper<>();
|
|
|
- updateWrapper.lambda().set(MarkStudent::getAssignConfirmed, assignConfirm)
|
|
|
- .eq(MarkStudent::getId, studentId);
|
|
|
+ updateWrapper.lambda().set(MarkStudent::getAssignConfirmed, assignConfirm).eq(MarkStudent::getId, studentId);
|
|
|
return this.update(updateWrapper);
|
|
|
}
|
|
|
|
|
|
private void fillObjective(ScoreReportVo ret, Long examId, String paperNumber) {
|
|
|
- List<MarkQuestion> qs = markQuestionService.listQuestionByExamIdAndPaperNumberAndPaperType(examId, paperNumber, null);
|
|
|
+ List<MarkQuestion> qs = markQuestionService.listQuestionByExamIdAndPaperNumberAndPaperType(examId, paperNumber,
|
|
|
+ null);
|
|
|
List<MarkStudent> students = listByExamIdAndPaperNumberAndAbsent(examId, paperNumber, false);
|
|
|
Map<String, QuestionVo> map = new HashMap<>();
|
|
|
List<QuestionVo> list = new ArrayList<>();
|
|
@@ -1125,7 +1169,8 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public int getAssignedCount(Long examId, Boolean checked, String courseCode, String coursePaperId, MarkPaperStatus status, DataPermissionRule dpr) {
|
|
|
+ public int getAssignedCount(Long examId, Boolean checked, String courseCode, String coursePaperId,
|
|
|
+ MarkPaperStatus status, DataPermissionRule dpr) {
|
|
|
MarkStudent markStudent = new MarkStudent();
|
|
|
markStudent.setExamId(examId);
|
|
|
markStudent.setCourseCode(courseCode);
|
|
@@ -1145,8 +1190,10 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public List<MarkStudent> listScanCollegeByExamIdAndCourseCodeAndCoursePaperId(Long examId, String courseCode, String coursePaperId, String status, DataPermissionRule dpr) {
|
|
|
- return this.baseMapper.listScanCollegeByExamIdAndCourseCodeAndCoursePaperId(examId, courseCode, coursePaperId, status, dpr);
|
|
|
+ public List<MarkStudent> listScanCollegeByExamIdAndCourseCodeAndCoursePaperId(Long examId, String courseCode,
|
|
|
+ String coursePaperId, String status, DataPermissionRule dpr) {
|
|
|
+ return this.baseMapper.listScanCollegeByExamIdAndCourseCodeAndCoursePaperId(examId, courseCode, coursePaperId,
|
|
|
+ status, dpr);
|
|
|
}
|
|
|
|
|
|
@Override
|