|
@@ -1,5 +1,21 @@
|
|
|
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.UpdateWrapper;
|
|
@@ -15,32 +31,43 @@ import com.qmth.teachcloud.common.enums.mark.MarkPaperStatus;
|
|
|
import com.qmth.teachcloud.common.enums.mark.SubjectiveStatus;
|
|
|
import com.qmth.teachcloud.common.enums.scan.ConditionType;
|
|
|
import com.qmth.teachcloud.common.service.TeachcloudCommonService;
|
|
|
+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.scanexaminfo.CheckTask;
|
|
|
import com.qmth.teachcloud.mark.bean.scanexaminfo.ScanExamCheckInfoVo;
|
|
|
import com.qmth.teachcloud.mark.bean.scanexaminfo.ScanExamInfoVo;
|
|
|
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.*;
|
|
|
-import com.qmth.teachcloud.mark.entity.*;
|
|
|
+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.enums.ExamStatus;
|
|
|
import com.qmth.teachcloud.mark.enums.OmrTaskStatus;
|
|
|
import com.qmth.teachcloud.mark.mapper.MarkStudentMapper;
|
|
|
-import com.qmth.teachcloud.mark.service.*;
|
|
|
+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.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>
|
|
@@ -442,4 +469,101 @@ 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;
|
|
|
+ }
|
|
|
}
|