|
@@ -1,7 +1,6 @@
|
|
|
package com.qmth.teachcloud.mark.service.impl;
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
-import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
@@ -72,7 +71,6 @@ 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.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.util.FileCopyUtils;
|
|
@@ -90,7 +88,6 @@ import java.awt.image.ColorConvertOp;
|
|
|
import java.io.*;
|
|
|
import java.math.BigDecimal;
|
|
|
import java.net.URLEncoder;
|
|
|
-import java.nio.charset.StandardCharsets;
|
|
|
import java.util.List;
|
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
@@ -106,28 +103,28 @@ import java.util.stream.Collectors;
|
|
|
@Service
|
|
|
public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkStudent> implements MarkStudentService {
|
|
|
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private MarkPaperService markPaperService;
|
|
|
|
|
|
@Resource
|
|
|
private MarkPaperPackageService markPaperPackageService;
|
|
|
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private ScanPackageService scanPackageService;
|
|
|
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private ScanPaperService scanPaperService;
|
|
|
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private ScanPaperPageService scanPaperPageService;
|
|
|
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private ScanOmrTaskService scanOmrTaskService;
|
|
|
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private ScanAnswerCardService answerCardService;
|
|
|
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private ScanStudentPaperService studentPaperService;
|
|
|
|
|
|
@Resource
|
|
@@ -136,7 +133,7 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
|
|
|
@Resource
|
|
|
private TeachcloudCommonService teachcloudCommonService;
|
|
|
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private ConcurrentService concurrentService;
|
|
|
|
|
|
@Resource
|
|
@@ -151,7 +148,7 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
|
|
|
@Resource
|
|
|
private BasicRoleDataPermissionService basicRoleDataPermissionService;
|
|
|
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private MarkSubjectiveScoreService markSubjectiveScoreService;
|
|
|
|
|
|
@Resource
|
|
@@ -1212,8 +1209,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));
|
|
|
}
|
|
|
List<ArchiveStudentVo> studentList = baseMapper.studentList(sysUser.getSchoolId(), query, dpr);
|
|
@@ -1280,6 +1277,7 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
|
|
|
vo.setAvgScore(Calculator.round(vo.getAvgScore(), 2));
|
|
|
}
|
|
|
}
|
|
|
+ fillMainQuestionAnalysis(ret, studentList, query.getExamId(), query.getPaperNumber());
|
|
|
return ret;
|
|
|
}
|
|
|
|
|
@@ -1488,6 +1486,113 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
|
|
|
ret.setObjective(list);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 填充大题分析
|
|
|
+ *
|
|
|
+ * @param ret ret
|
|
|
+ * @param studentList 涉及的考生集合
|
|
|
+ * @param examId 考试id
|
|
|
+ * @param paperNumber 试卷编号
|
|
|
+ */
|
|
|
+ private void fillMainQuestionAnalysis(ScoreReportVo ret, List<ArchiveStudentVo> studentList, Long examId, String paperNumber) {
|
|
|
+ // 试卷结构数据
|
|
|
+ Map<String, QuestionVo> mainQuestionMap = new HashMap<>();
|
|
|
+
|
|
|
+ List<MarkQuestion> questionDatasource = markQuestionService.listByExamIdAndPaperNumberAndPaperType(examId,
|
|
|
+ paperNumber, null, null);
|
|
|
+ for (MarkQuestion question : questionDatasource) {
|
|
|
+ Integer mainNumber = question.getMainNumber();
|
|
|
+ String key = getMainQuestionMapKey(mainNumber, question.getObjective());
|
|
|
+ if (mainQuestionMap.containsKey(key)) {
|
|
|
+ QuestionVo questionVo = mainQuestionMap.get(key);
|
|
|
+ questionVo.setScore(questionVo.getScore() + question.getTotalScore());
|
|
|
+ } else {
|
|
|
+ QuestionVo questionVo = new QuestionVo();
|
|
|
+ questionVo.setMainNumber(mainNumber);
|
|
|
+ questionVo.setScore(question.getTotalScore());
|
|
|
+ questionVo.setTitle(question.getMainTitle());
|
|
|
+
|
|
|
+ // 初始化
|
|
|
+ questionVo.setStudentCount(0);
|
|
|
+ questionVo.setScoreCount(0);
|
|
|
+ questionVo.setFullScoreCount(0);
|
|
|
+ questionVo.setScoreSum(0.0);
|
|
|
+ mainQuestionMap.put(key, questionVo);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ List<Long> studentIdList = studentList.stream().map(ArchiveStudentVo::getStudentId).distinct().collect(Collectors.toList());
|
|
|
+ List<MarkSubjectiveScore> subjectiveScoreDatasource = new ArrayList<>();
|
|
|
+ if (CollectionUtils.isNotEmpty(studentIdList)) {
|
|
|
+ subjectiveScoreDatasource = markSubjectiveScoreService.list(
|
|
|
+ new QueryWrapper<MarkSubjectiveScore>().lambda().eq(MarkSubjectiveScore::getExamId, examId)
|
|
|
+ .eq(MarkSubjectiveScore::getPaperNumber, paperNumber).in(MarkSubjectiveScore::getStudentId, studentIdList));
|
|
|
+ }
|
|
|
+
|
|
|
+ List<MarkQuestion> objectiveQuestions = questionDatasource.stream().filter(MarkQuestion::getObjective).collect(Collectors.toList());
|
|
|
+ for (ArchiveStudentVo studentVo : studentList) {
|
|
|
+ List<ScoreItem> scoreItemList = studentVo.getScoreList(true, objectiveQuestions);
|
|
|
+ for (String key : mainQuestionMap.keySet()) {
|
|
|
+ String[] arr = key.split("-");
|
|
|
+ int mainNumber = Integer.parseInt(arr[0]);
|
|
|
+ boolean objective = Boolean.parseBoolean(arr[1]);
|
|
|
+ QuestionVo questionVo = mainQuestionMap.get(key);
|
|
|
+ // 考生总数
|
|
|
+ questionVo.setStudentCount(questionVo.getStudentCount() + 1);
|
|
|
+ // 考生在大题得分
|
|
|
+ double studentScore = 0;
|
|
|
+ if (objective) {
|
|
|
+ // 客观题处理
|
|
|
+ List<ScoreItem> mainScoreItemList = scoreItemList.stream()
|
|
|
+ .filter(e -> Objects.equals(mainNumber, e.getMainNumber())).collect(Collectors.toList());
|
|
|
+
|
|
|
+ for (ScoreItem scoreItem : mainScoreItemList) {
|
|
|
+ studentScore = studentScore + scoreItem.getScore();
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ // 主观题处理
|
|
|
+ List<MarkSubjectiveScore> subjectiveScoreList = subjectiveScoreDatasource.stream()
|
|
|
+ .filter(e -> Objects.equals(mainNumber, e.getMainNumber()) && Objects.equals(studentVo.getStudentId(), e.getStudentId())).collect(Collectors.toList());
|
|
|
+
|
|
|
+ for (MarkSubjectiveScore markSubjectiveScore : subjectiveScoreList) {
|
|
|
+ studentScore = studentScore + markSubjectiveScore.getScore();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 有得分总数
|
|
|
+ if (studentScore > 0) {
|
|
|
+ questionVo.setScoreCount(questionVo.getScoreCount() + 1);
|
|
|
+ }
|
|
|
+ // 满分总数
|
|
|
+ if (studentScore == questionVo.getScore()) {
|
|
|
+ questionVo.setFullScoreCount(questionVo.getFullScoreCount() + 1);
|
|
|
+ }
|
|
|
+ // 考生总得分
|
|
|
+ questionVo.setScoreSum(questionVo.getScoreSum() + studentScore);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ List<QuestionVo> questionVoList = new ArrayList<>(mainQuestionMap.values());
|
|
|
+ questionVoList.sort(Comparator.comparingInt(QuestionVo::getMainNumber));
|
|
|
+ questionVoList.forEach(e -> {
|
|
|
+ Integer total = e.getStudentCount();
|
|
|
+ Double avgScore = 0D;
|
|
|
+ double scoreRate = 0D;
|
|
|
+ double fullScoreRate = 0D;
|
|
|
+ if (total != null && total > 0) {
|
|
|
+ avgScore = Calculator.round(Calculator.divide(e.getScoreSum(), total), 2);
|
|
|
+ scoreRate = Calculator.divide(e.getScoreCount(), total, 2);
|
|
|
+ fullScoreRate = Calculator.divide(e.getFullScoreCount(), total, 2);
|
|
|
+ }
|
|
|
+ e.setAvgScore(avgScore);
|
|
|
+ e.setScoreRate(scoreRate);
|
|
|
+ e.setFullScoreRate(fullScoreRate);
|
|
|
+ });
|
|
|
+ ret.setMainQuestionAnalysis(questionVoList);
|
|
|
+ }
|
|
|
+
|
|
|
+ private String getMainQuestionMapKey(Integer mainNumber, boolean objective){
|
|
|
+ return mainNumber + "-" + objective;
|
|
|
+ }
|
|
|
+
|
|
|
private List<MarkStudentVo> listByExamIdAndPaperNumberAndNotAbsent(Long examId, String paperNumber) {
|
|
|
MarkStudentQuery markStudentQuery = new MarkStudentQuery();
|
|
|
markStudentQuery.setExamId(examId);
|