|
@@ -1,21 +1,5 @@
|
|
|
package com.qmth.teachcloud.mark.service.impl;
|
|
|
|
|
|
-import java.text.DecimalFormat;
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
-import java.util.stream.Collectors;
|
|
|
-
|
|
|
-import javax.annotation.Resource;
|
|
|
-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.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
@@ -36,11 +20,7 @@ import com.qmth.teachcloud.common.service.TeachcloudCommonService;
|
|
|
import com.qmth.teachcloud.mark.bean.UpdateTimeVo;
|
|
|
import com.qmth.teachcloud.mark.bean.omredit.OmrEditDomain;
|
|
|
import com.qmth.teachcloud.mark.bean.omredit.OmrEditPaper;
|
|
|
-import com.qmth.teachcloud.mark.bean.scananswer.AnswerPageVo;
|
|
|
-import com.qmth.teachcloud.mark.bean.scananswer.AnswerPaperVo;
|
|
|
-import com.qmth.teachcloud.mark.bean.scananswer.AnswerQueryDomain;
|
|
|
-import com.qmth.teachcloud.mark.bean.scananswer.AnswerQueryVo;
|
|
|
-import com.qmth.teachcloud.mark.bean.scananswer.StudentPaperVo;
|
|
|
+import com.qmth.teachcloud.mark.bean.scananswer.*;
|
|
|
import com.qmth.teachcloud.mark.bean.scanexaminfo.CheckTask;
|
|
|
import com.qmth.teachcloud.mark.bean.scanexaminfo.ScanExamCheckInfoVo;
|
|
|
import com.qmth.teachcloud.mark.bean.scanexaminfo.ScanExamInfoVo;
|
|
@@ -48,33 +28,29 @@ import com.qmth.teachcloud.mark.bean.student.AbsentManualUpdateVo;
|
|
|
import com.qmth.teachcloud.mark.bean.student.StudentQuery;
|
|
|
import com.qmth.teachcloud.mark.bean.student.StudentVo;
|
|
|
import com.qmth.teachcloud.mark.dto.mark.ScoreInfo;
|
|
|
-import com.qmth.teachcloud.mark.dto.mark.score.SheetUrlDto;
|
|
|
-import com.qmth.teachcloud.mark.dto.mark.score.StudentObjectiveAnswerDto;
|
|
|
-import com.qmth.teachcloud.mark.dto.mark.score.StudentObjectiveDetailDto;
|
|
|
-import com.qmth.teachcloud.mark.dto.mark.score.StudentPaperDetailDto;
|
|
|
-import com.qmth.teachcloud.mark.dto.mark.score.StudentScoreDetailDto;
|
|
|
-import com.qmth.teachcloud.mark.entity.MarkPaper;
|
|
|
-import com.qmth.teachcloud.mark.entity.MarkQuestion;
|
|
|
-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.dto.mark.score.*;
|
|
|
+import com.qmth.teachcloud.mark.entity.*;
|
|
|
import com.qmth.teachcloud.mark.enums.ExamStatus;
|
|
|
import com.qmth.teachcloud.mark.enums.LockType;
|
|
|
import com.qmth.teachcloud.mark.enums.OmrTaskStatus;
|
|
|
import com.qmth.teachcloud.mark.mapper.MarkStudentMapper;
|
|
|
-import com.qmth.teachcloud.mark.service.MarkPaperService;
|
|
|
-import com.qmth.teachcloud.mark.service.MarkQuestionService;
|
|
|
-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 com.qmth.teachcloud.mark.utils.BatchGetDataUtil;
|
|
|
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 javax.annotation.Resource;
|
|
|
+import javax.validation.constraints.NotNull;
|
|
|
+import java.text.DecimalFormat;
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* <p>
|
|
@@ -106,7 +82,7 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
|
|
|
private TeachcloudCommonService teachcloudCommonService;
|
|
|
@Autowired
|
|
|
private ConcurrentService concurrentService;
|
|
|
-
|
|
|
+
|
|
|
|
|
|
@Override
|
|
|
public List<String> listClassByExamIdAndCourseCode(Long examId, String paperNumber) {
|
|
@@ -123,14 +99,24 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public void updateSubjectiveStatusAndScore(Long studentId, SubjectiveStatus status, Double score,
|
|
|
- String scoreList) {
|
|
|
+ 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 void updateSubjectiveStatusAndScore(Long examId, String paperNumber, 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::getExamId, examId)
|
|
|
+ .eq(MarkStudent::getPaperNumber, paperNumber);
|
|
|
+ this.update(updateWrapper);
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public ScanExamInfoVo getScanExamInfo(BasicExam exam) {
|
|
|
ScanExamInfoVo vo = new ScanExamInfoVo();
|
|
@@ -479,104 +465,104 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
|
|
|
.eq(MarkStudent::getCoursePaperId, coursePaperId);
|
|
|
return this.list(queryWrapper);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
@Override
|
|
|
- public IPage<AnswerQueryVo> query(AnswerQueryDomain query) {
|
|
|
- // 查询考生分页信息
|
|
|
- IPage<AnswerQueryVo> iPage = baseMapper.queryPage(new Page<>(query.getPageNumber(), query.getPageSize()),
|
|
|
- query);
|
|
|
- if (CollectionUtils.isNotEmpty(iPage.getRecords())) {
|
|
|
- for (AnswerQueryVo vo : iPage.getRecords()) {
|
|
|
- if(vo.getIsAbsent()!=null&&vo.getIsAbsent()) {
|
|
|
- vo.setExamStatus(ExamStatus.ABSENT);
|
|
|
- }else {
|
|
|
- vo.setExamStatus(ExamStatus.OK);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- if (CollectionUtils.isNotEmpty(iPage.getRecords()) && (query.getWithPaper() != null && query.getWithPaper())) {
|
|
|
- Map<Long, AnswerQueryVo> map = new HashMap<>();
|
|
|
-
|
|
|
- for (AnswerQueryVo vo : iPage.getRecords()) {
|
|
|
- List<AnswerPaperVo> papers = new ArrayList<>();
|
|
|
- vo.setPapers(papers);
|
|
|
- if (vo.getCardPaperCount() != null) {
|
|
|
- for (int i = 1; i <= vo.getCardPaperCount(); i++) {
|
|
|
- AnswerPaperVo pv = new AnswerPaperVo();
|
|
|
- pv.setNumber(i);
|
|
|
- papers.add(pv);
|
|
|
- }
|
|
|
- }
|
|
|
- map.put(vo.getId(), vo);
|
|
|
- }
|
|
|
- // 根据考生id查找绑定paper
|
|
|
- List<Long> studentIds = iPage.getRecords().stream().map(p -> p.getId()).collect(Collectors.toList());
|
|
|
- List<StudentPaperVo> paperList = new BatchGetDataUtil<StudentPaperVo, Long>() {
|
|
|
-
|
|
|
- @Override
|
|
|
- public List<StudentPaperVo> getData(List<Long> paramList) {
|
|
|
- return scanPaperService.listByStudentIds(paramList);
|
|
|
- }
|
|
|
- }.getDataForBatch(studentIds, 200);
|
|
|
-
|
|
|
- if (CollectionUtils.isNotEmpty(paperList)) {
|
|
|
- Map<Long, AnswerPaperVo> paperMap = new HashMap<>();
|
|
|
- for (StudentPaperVo p : paperList) {
|
|
|
- AnswerQueryVo vo = map.get(p.getStudentId());
|
|
|
- if (vo == null) {
|
|
|
- continue;
|
|
|
- }
|
|
|
- List<AnswerPaperVo> papers = vo.getPapers();
|
|
|
- if (papers == null) {
|
|
|
- continue;
|
|
|
- }
|
|
|
- if (papers.size() < p.getNumber()) {
|
|
|
- continue;
|
|
|
- }
|
|
|
- AnswerPaperVo pvo = papers.get(p.getNumber() - 1);
|
|
|
- pvo.setId(p.getPaperId());
|
|
|
- pvo.setNumber(p.getNumber());
|
|
|
- pvo.setAssigned(p.getAssigned());
|
|
|
- paperMap.put(p.getPaperId(), pvo);
|
|
|
- }
|
|
|
- // 查找page
|
|
|
- List<Long> paperIds = paperList.stream().map(p -> p.getPaperId()).collect(Collectors.toList());
|
|
|
- List<ScanPaperPage> paperPageList = new BatchGetDataUtil<ScanPaperPage, Long>() {
|
|
|
-
|
|
|
- @Override
|
|
|
- public List<ScanPaperPage> getData(List<Long> paramList) {
|
|
|
- return scanPaperPageService.listByPaperList(paramList);
|
|
|
- }
|
|
|
- }.getDataForBatch(paperIds, 200);
|
|
|
-
|
|
|
- if (CollectionUtils.isNotEmpty(paperPageList)) {
|
|
|
- for (ScanPaperPage p : paperPageList) {
|
|
|
- AnswerPaperVo pvo = paperMap.get(p.getPaperId());
|
|
|
- if (pvo == null) {
|
|
|
- continue;
|
|
|
- }
|
|
|
- List<AnswerPageVo> pages = pvo.getPages();
|
|
|
- if (pages == null) {
|
|
|
- pages = new ArrayList<>();
|
|
|
- pvo.setPages(pages);
|
|
|
- }
|
|
|
- AnswerPageVo pageVo = new AnswerPageVo();
|
|
|
- pageVo.setIndex(p.getPageIndex());
|
|
|
- pageVo.setSheetUri(p.getSheetPath());
|
|
|
- if (query.getWithOmrDetail() != null && query.getWithOmrDetail()) {
|
|
|
- pageVo.setAbsent(p.getAbsent());
|
|
|
- pageVo.setBreach(p.getBreach());
|
|
|
- pageVo.setQuestion(p.getQuestion());
|
|
|
- pageVo.setRecogData(p.getRecogData());
|
|
|
- }
|
|
|
- pages.add(pageVo);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- return iPage;
|
|
|
- }
|
|
|
-
|
|
|
+ public IPage<AnswerQueryVo> query(AnswerQueryDomain query) {
|
|
|
+ // 查询考生分页信息
|
|
|
+ IPage<AnswerQueryVo> iPage = baseMapper.queryPage(new Page<>(query.getPageNumber(), query.getPageSize()),
|
|
|
+ query);
|
|
|
+ if (CollectionUtils.isNotEmpty(iPage.getRecords())) {
|
|
|
+ for (AnswerQueryVo vo : iPage.getRecords()) {
|
|
|
+ if (vo.getIsAbsent() != null && vo.getIsAbsent()) {
|
|
|
+ vo.setExamStatus(ExamStatus.ABSENT);
|
|
|
+ } else {
|
|
|
+ vo.setExamStatus(ExamStatus.OK);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (CollectionUtils.isNotEmpty(iPage.getRecords()) && (query.getWithPaper() != null && query.getWithPaper())) {
|
|
|
+ Map<Long, AnswerQueryVo> map = new HashMap<>();
|
|
|
+
|
|
|
+ for (AnswerQueryVo vo : iPage.getRecords()) {
|
|
|
+ List<AnswerPaperVo> papers = new ArrayList<>();
|
|
|
+ vo.setPapers(papers);
|
|
|
+ if (vo.getCardPaperCount() != null) {
|
|
|
+ for (int i = 1; i <= vo.getCardPaperCount(); i++) {
|
|
|
+ AnswerPaperVo pv = new AnswerPaperVo();
|
|
|
+ pv.setNumber(i);
|
|
|
+ papers.add(pv);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ map.put(vo.getId(), vo);
|
|
|
+ }
|
|
|
+ // 根据考生id查找绑定paper
|
|
|
+ List<Long> studentIds = iPage.getRecords().stream().map(p -> p.getId()).collect(Collectors.toList());
|
|
|
+ List<StudentPaperVo> paperList = new BatchGetDataUtil<StudentPaperVo, Long>() {
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<StudentPaperVo> getData(List<Long> paramList) {
|
|
|
+ return scanPaperService.listByStudentIds(paramList);
|
|
|
+ }
|
|
|
+ }.getDataForBatch(studentIds, 200);
|
|
|
+
|
|
|
+ if (CollectionUtils.isNotEmpty(paperList)) {
|
|
|
+ Map<Long, AnswerPaperVo> paperMap = new HashMap<>();
|
|
|
+ for (StudentPaperVo p : paperList) {
|
|
|
+ AnswerQueryVo vo = map.get(p.getStudentId());
|
|
|
+ if (vo == null) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ List<AnswerPaperVo> papers = vo.getPapers();
|
|
|
+ if (papers == null) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if (papers.size() < p.getNumber()) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ AnswerPaperVo pvo = papers.get(p.getNumber() - 1);
|
|
|
+ pvo.setId(p.getPaperId());
|
|
|
+ pvo.setNumber(p.getNumber());
|
|
|
+ pvo.setAssigned(p.getAssigned());
|
|
|
+ paperMap.put(p.getPaperId(), pvo);
|
|
|
+ }
|
|
|
+ // 查找page
|
|
|
+ List<Long> paperIds = paperList.stream().map(p -> p.getPaperId()).collect(Collectors.toList());
|
|
|
+ List<ScanPaperPage> paperPageList = new BatchGetDataUtil<ScanPaperPage, Long>() {
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<ScanPaperPage> getData(List<Long> paramList) {
|
|
|
+ return scanPaperPageService.listByPaperList(paramList);
|
|
|
+ }
|
|
|
+ }.getDataForBatch(paperIds, 200);
|
|
|
+
|
|
|
+ if (CollectionUtils.isNotEmpty(paperPageList)) {
|
|
|
+ for (ScanPaperPage p : paperPageList) {
|
|
|
+ AnswerPaperVo pvo = paperMap.get(p.getPaperId());
|
|
|
+ if (pvo == null) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ List<AnswerPageVo> pages = pvo.getPages();
|
|
|
+ if (pages == null) {
|
|
|
+ pages = new ArrayList<>();
|
|
|
+ pvo.setPages(pages);
|
|
|
+ }
|
|
|
+ AnswerPageVo pageVo = new AnswerPageVo();
|
|
|
+ pageVo.setIndex(p.getPageIndex());
|
|
|
+ pageVo.setSheetUri(p.getSheetPath());
|
|
|
+ if (query.getWithOmrDetail() != null && query.getWithOmrDetail()) {
|
|
|
+ pageVo.setAbsent(p.getAbsent());
|
|
|
+ pageVo.setBreach(p.getBreach());
|
|
|
+ pageVo.setQuestion(p.getQuestion());
|
|
|
+ pageVo.setRecogData(p.getRecogData());
|
|
|
+ }
|
|
|
+ pages.add(pageVo);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return iPage;
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public List<String> summary(AnswerQueryDomain query) {
|
|
|
// 不分页查询考生准考证号
|
|
@@ -584,9 +570,9 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
|
|
|
}
|
|
|
|
|
|
@Transactional
|
|
|
- @Override
|
|
|
- public UpdateTimeVo omrEdit(Long userId,OmrEditDomain domain) {
|
|
|
- MarkStudent student = findByExamIdAndStudentCode(domain.getExamId(), domain.getStudentCode());
|
|
|
+ @Override
|
|
|
+ public UpdateTimeVo omrEdit(Long userId, OmrEditDomain domain) {
|
|
|
+ MarkStudent student = findByExamIdAndStudentCode(domain.getExamId(), domain.getStudentCode());
|
|
|
if (student == null) {
|
|
|
throw new ParameterException("考生信息未找到");
|
|
|
}
|
|
@@ -615,7 +601,7 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
|
|
|
} finally {
|
|
|
concurrentService.getReadWriteLock(LockType.STUDENT + "-" + student.getId()).writeLock().unlock();
|
|
|
}
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
@Override
|
|
|
public MarkStudent findByExamIdAndStudentCode(Long examId, String studentCode) {
|
|
@@ -641,9 +627,9 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
|
|
|
}
|
|
|
|
|
|
@Transactional
|
|
|
- @Override
|
|
|
- public AbsentManualUpdateVo absentManualUpdate(Long examId, String coursePaperId, String studentCode) {
|
|
|
- MarkStudent student = findByExamIdAndCoursePaperIdAndStudentCode(examId, coursePaperId, studentCode);
|
|
|
+ @Override
|
|
|
+ public AbsentManualUpdateVo absentManualUpdate(Long examId, String coursePaperId, String studentCode) {
|
|
|
+ MarkStudent student = findByExamIdAndCoursePaperIdAndStudentCode(examId, coursePaperId, studentCode);
|
|
|
if (student == null) {
|
|
|
throw new ParameterException("考生未找到");
|
|
|
}
|
|
@@ -656,22 +642,27 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
|
|
|
lw.eq(MarkStudent::getScanStatus, ScanStatus.UNEXIST);
|
|
|
update(lw);
|
|
|
return AbsentManualUpdateVo.create(ScanStatus.MANUAL_ABSENT);
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
@Transactional
|
|
|
- @Override
|
|
|
- public UpdateTimeVo confirm(Long examId, String coursePaperId, String studentCode, Boolean omrAbsent) {
|
|
|
+ @Override
|
|
|
+ public UpdateTimeVo confirm(Long examId, String coursePaperId, String studentCode, Boolean omrAbsent) {
|
|
|
LambdaUpdateWrapper<MarkStudent> lw = new LambdaUpdateWrapper<>();
|
|
|
lw.set(MarkStudent::getOmrAbsentChecked, true);
|
|
|
lw.eq(MarkStudent::getExamId, examId);
|
|
|
lw.eq(MarkStudent::getCoursePaperId, coursePaperId);
|
|
|
lw.eq(MarkStudent::getStudentCode, studentCode);
|
|
|
if (omrAbsent != null) {
|
|
|
- lw.eq(MarkStudent::getOmrAbsent, omrAbsent);
|
|
|
+ lw.eq(MarkStudent::getOmrAbsent, omrAbsent);
|
|
|
}
|
|
|
if (!update(lw)) {
|
|
|
- throw new ParameterException("考生未找到");
|
|
|
+ throw new ParameterException("考生未找到");
|
|
|
}
|
|
|
- return UpdateTimeVo.create();
|
|
|
- }
|
|
|
+ return UpdateTimeVo.create();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<Long> findIdByExamIdAndPaperNumberAndSubjectiveStatus(Long examId, String paperNumber, SubjectiveStatus unmark, SubjectiveStatus marked) {
|
|
|
+ return this.baseMapper.findIdByExamIdAndPaperNumberAndSubjectiveStatus(examId, paperNumber, unmark.name(), marked.name());
|
|
|
+ }
|
|
|
}
|