|
@@ -2,6 +2,8 @@ package com.qmth.teachcloud.mark.service.impl;
|
|
|
|
|
|
import java.text.DecimalFormat;
|
|
|
import java.util.ArrayList;
|
|
|
+import java.util.Collections;
|
|
|
+import java.util.Comparator;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
@@ -61,6 +63,7 @@ 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.ScoreItem;
|
|
|
import com.qmth.teachcloud.mark.dto.mark.manage.Task;
|
|
|
import com.qmth.teachcloud.mark.dto.mark.score.SheetUrlDto;
|
|
|
import com.qmth.teachcloud.mark.dto.mark.score.StudentObjectiveAnswerDto;
|
|
@@ -858,6 +861,8 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ fillObjective(ret, examId, paperNumber);
|
|
|
+
|
|
|
ret.setSubjective(markSubjectiveScoreService.getSubjectiveVo(examId, paperNumber));
|
|
|
if (CollectionUtils.isNotEmpty(ret.getSubjective())) {
|
|
|
for (QuestionVo vo : ret.getSubjective()) {
|
|
@@ -868,7 +873,73 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
|
|
|
}
|
|
|
return ret;
|
|
|
}
|
|
|
+
|
|
|
+ private void fillObjective(ScoreReportVo ret, Long examId, String paperNumber) {
|
|
|
+ List<MarkQuestion> qs=markQuestionService.listQuestionByExamIdAndPaperNumber(examId, paperNumber);
|
|
|
+ List<MarkStudent> students=listByExamIdAndPaperNumberAndAbsent(examId, paperNumber, false);
|
|
|
+ Map<String,QuestionVo> map=new HashMap<>();
|
|
|
+ for(MarkStudent s:students) {
|
|
|
+ List<ScoreItem> sis=s.getScoreList(true, qs);
|
|
|
+ if(CollectionUtils.isNotEmpty(sis)) {
|
|
|
+ for(ScoreItem si:sis) {
|
|
|
+ String key=si.getMainNumber()+"-"+si.getSubNumber();
|
|
|
+ QuestionVo vo=map.get(key);
|
|
|
+ if(vo==null) {
|
|
|
+ vo=new QuestionVo();
|
|
|
+ vo.setScoreCount(0);
|
|
|
+ vo.setFullScoreCount(0);
|
|
|
+ vo.setStudentCount(0);
|
|
|
+ vo.setScoreSum(0.0);
|
|
|
+ vo.setTitle(si.getTitle());
|
|
|
+ vo.setScore(si.getTotalScore());
|
|
|
+ map.put(key, vo);
|
|
|
+ }
|
|
|
+ vo.setStudentCount(vo.getStudentCount()+1);
|
|
|
+ vo.setScoreSum(vo.getScoreSum()+si.getScore());
|
|
|
+ if(si.getScore()==si.getTotalScore()) {
|
|
|
+ vo.setFullScoreCount(vo.getFullScoreCount()+1);
|
|
|
+ }
|
|
|
+ if(si.getScore()>0) {
|
|
|
+ vo.setScoreCount(vo.getScoreCount()+1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(map.isEmpty()) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ List<QuestionVo> list=new ArrayList<>(map.values());
|
|
|
+ Collections.sort(list, new Comparator<QuestionVo>() {
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public int compare(QuestionVo o1, QuestionVo o2) {
|
|
|
+ if (o1.getMainNumber() > o2.getMainNumber()) {
|
|
|
+ return 1;
|
|
|
+ } else if (o1.getSubNumber() < o2.getSubNumber()) {
|
|
|
+ return -1;
|
|
|
+ } else {
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
+ });
|
|
|
+ for (QuestionVo vo : list) {
|
|
|
+ double total = vo.getStudentCount();
|
|
|
+ vo.setScoreRate(Calculator.divide(vo.getScoreCount(), total, 2));
|
|
|
+ vo.setFullScoreRate(Calculator.divide(vo.getFullScoreCount(), total, 2));
|
|
|
+ }
|
|
|
+ ret.setObjective(list);
|
|
|
+ }
|
|
|
+ private List<MarkStudent> listByExamIdAndPaperNumberAndAbsent(Long examId,String paperNumber,Boolean absent) {
|
|
|
+ QueryWrapper<MarkStudent> wrapper = new QueryWrapper<>();
|
|
|
+ LambdaQueryWrapper<MarkStudent> lw = wrapper.lambda();
|
|
|
+ lw.eq(MarkStudent::getExamId, examId);
|
|
|
+ lw.eq(MarkStudent::getPaperNumber, paperNumber);
|
|
|
+ if(absent!=null) {
|
|
|
+ lw.eq(MarkStudent::getAbsent, absent);
|
|
|
+ }
|
|
|
+ return this.list(wrapper);
|
|
|
+ }
|
|
|
private void fillScoreRange(ScoreReportVo ret, Long examId, String paperNumber) {
|
|
|
int toltal = getCountByPaperNumber(examId, paperNumber);
|
|
|
List<ScoreRangeVo> scoreRange = new ArrayList<>();
|