|
@@ -18,6 +18,7 @@ import javax.servlet.ServletOutputStream;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
import javax.validation.constraints.NotNull;
|
|
|
|
|
|
+import com.qmth.teachcloud.mark.dto.mark.manage.TaskQuestion;
|
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
|
import org.apache.commons.io.FilenameUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
@@ -157,7 +158,7 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
|
|
|
private BasicCourseService basicCourseService;
|
|
|
|
|
|
@Resource
|
|
|
- CommonCacheService commonCacheService;
|
|
|
+ MarkArchiveStudentService markArchiveStudentService;
|
|
|
|
|
|
@Autowired
|
|
|
private MarkHeaderHistoryService markHeaderHistoryService;
|
|
@@ -1468,6 +1469,7 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
|
|
|
SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
|
|
|
String postUrl = "/api/admin/mark/archive/score/list";
|
|
|
DataPermissionRule dpr = basicRoleDataPermissionService.findDataPermission(sysUser.getSchoolId(), sysUser.getId(), postUrl);
|
|
|
+ MarkPaper markPaper = markPaperService.getByExamIdAndPaperNumber(query.getExamId(), query.getPaperNumber());
|
|
|
ScoreReportVo ret = new ScoreReportVo();
|
|
|
// 考试概况
|
|
|
ret.setOverview(baseMapper.overview(sysUser.getSchoolId(), query, dpr));
|
|
@@ -1543,7 +1545,7 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
|
|
|
|
|
|
// 主观题成绩分析
|
|
|
List<Long> studentIds = studentList.stream().map(ArchiveStudentVo::getStudentId).collect(Collectors.toList());
|
|
|
- ret.setSubjective(markSubjectiveScoreService.getSubjectiveVo(studentIds));
|
|
|
+ ret.setSubjective(markSubjectiveScoreService.getSubjectiveVo(markPaper, studentIds));
|
|
|
if (CollectionUtils.isNotEmpty(ret.getSubjective())) {
|
|
|
for (QuestionVo vo : ret.getSubjective()) {
|
|
|
double total = vo.getStudentCount();
|
|
@@ -1554,7 +1556,7 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
|
|
|
}
|
|
|
|
|
|
// 大题分析
|
|
|
- fillMainQuestionAnalysis(ret, studentList, query.getExamId(), query.getPaperNumber());
|
|
|
+ fillMainQuestionAnalysis(ret, markPaper, studentList, query.getExamId(), query.getPaperNumber());
|
|
|
return ret;
|
|
|
}
|
|
|
|
|
@@ -1786,16 +1788,71 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
|
|
|
* 填充大题分析
|
|
|
*
|
|
|
* @param ret ret
|
|
|
+ * @param markPaper
|
|
|
* @param studentList 涉及的考生集合
|
|
|
* @param examId 考试id
|
|
|
* @param paperNumber 试卷编号
|
|
|
*/
|
|
|
- private void fillMainQuestionAnalysis(ScoreReportVo ret, List<ArchiveStudentVo> studentList, Long
|
|
|
- examId, String paperNumber) {
|
|
|
+ private void fillMainQuestionAnalysis(ScoreReportVo ret, MarkPaper markPaper, List<ArchiveStudentVo> studentList, Long examId, String paperNumber) {
|
|
|
+ studentList = studentList.stream().filter(e -> !BasicExamStudentStatusEnum.M.equals(e.getStatus())).collect(Collectors.toList());
|
|
|
+ List<Long> studentIdList = studentList.stream().map(ArchiveStudentVo::getStudentId).distinct().collect(Collectors.toList());
|
|
|
+ Map<String, Double> studentMainNumberScoreMap = new HashMap<>();
|
|
|
+ List<MarkQuestion> questionDatasource = new ArrayList<>();
|
|
|
+ if (markPaper.getArchive()) {
|
|
|
+ List<MarkArchiveStudent> markArchiveStudents = new ArrayList<>();
|
|
|
+ if (CollectionUtils.isNotEmpty(studentIdList)) {
|
|
|
+ markArchiveStudents = markArchiveStudentService.listByStudentIds(studentIdList);
|
|
|
+ }
|
|
|
+ if(CollectionUtils.isNotEmpty(markArchiveStudents)) {
|
|
|
+ for (MarkArchiveStudent markArchiveStudent : markArchiveStudents) {
|
|
|
+ List<TaskQuestion> taskQuestionList = JSON.parseArray(markArchiveStudent.getSubjectiveQuestions(), TaskQuestion.class);
|
|
|
+ Map<Integer, Double> listMap = taskQuestionList.stream().collect(Collectors.groupingBy(m -> m.getMainNumber(), Collectors.summingDouble(n -> n.getMarkerScore())));
|
|
|
+ for (Map.Entry<Integer, Double> entry : listMap.entrySet()) {
|
|
|
+ studentMainNumberScoreMap.put(markArchiveStudent.getStudentId() + "-" + entry.getKey(), entry.getValue());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ MarkArchiveStudent markArchiveStudent = markArchiveStudents.get(0);
|
|
|
+ if(markArchiveStudent!= null) {
|
|
|
+ if(StringUtils.isNotBlank(markArchiveStudent.getObjectiveQuestions())) {
|
|
|
+ List<StudentObjectiveAnswerDto> taskQuestions = JSON.parseArray(markArchiveStudent.getObjectiveQuestions(), StudentObjectiveAnswerDto.class);
|
|
|
+ for (StudentObjectiveAnswerDto taskQuestion : taskQuestions) {
|
|
|
+ MarkQuestion markQuestion = new MarkQuestion();
|
|
|
+ markQuestion.setMainTitle(taskQuestion.getTitle());
|
|
|
+ markQuestion.setMainNumber(taskQuestion.getMainNumber());
|
|
|
+ markQuestion.setSubNumber(taskQuestion.getSubNumber());
|
|
|
+ markQuestion.setTotalScore(taskQuestion.getTotalScore());
|
|
|
+ markQuestion.setObjective(true);
|
|
|
+ questionDatasource.add(markQuestion);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(StringUtils.isNotBlank(markArchiveStudent.getSubjectiveQuestions())) {
|
|
|
+ List<TaskQuestion> taskQuestions = JSON.parseArray(markArchiveStudent.getSubjectiveQuestions(), TaskQuestion.class);
|
|
|
+ for (TaskQuestion taskQuestion : taskQuestions) {
|
|
|
+ MarkQuestion markQuestion = new MarkQuestion();
|
|
|
+ markQuestion.setMainTitle(taskQuestion.getTitle());
|
|
|
+ markQuestion.setMainNumber(taskQuestion.getMainNumber());
|
|
|
+ markQuestion.setSubNumber(taskQuestion.getSubNumber());
|
|
|
+ markQuestion.setTotalScore(taskQuestion.getMaxScore());
|
|
|
+ markQuestion.setObjective(false);
|
|
|
+ questionDatasource.add(markQuestion);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ 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));
|
|
|
+ }
|
|
|
+
|
|
|
+ studentMainNumberScoreMap = subjectiveScoreDatasource.stream().collect(Collectors.groupingBy(m -> m.getStudentId() + "-" + m.getMainNumber(), Collectors.summingDouble(n -> n.getScore())));
|
|
|
+ questionDatasource = markQuestionService.listByExamIdAndPaperNumber(examId, paperNumber);
|
|
|
+ }
|
|
|
+
|
|
|
// 试卷结构数据
|
|
|
Map<String, QuestionVo> mainQuestionMap = new HashMap<>();
|
|
|
-
|
|
|
- List<MarkQuestion> questionDatasource = markQuestionService.listByExamIdAndPaperNumber(examId, paperNumber);
|
|
|
for (MarkQuestion question : questionDatasource) {
|
|
|
Integer mainNumber = question.getMainNumber();
|
|
|
String key = getMainQuestionMapKey(mainNumber, question.getObjective());
|
|
@@ -1817,16 +1874,6 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
|
|
|
mainQuestionMap.put(key, questionVo);
|
|
|
}
|
|
|
}
|
|
|
- studentList = studentList.stream().filter(e -> !BasicExamStudentStatusEnum.M.equals(e.getStatus())).collect(Collectors.toList());
|
|
|
- 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));
|
|
|
- }
|
|
|
-
|
|
|
- Map<String, Double> studentMainNumberScoreMap = subjectiveScoreDatasource.stream().collect(Collectors.groupingBy(m -> m.getStudentId() + "-" + m.getMainNumber(), Collectors.summingDouble(n -> n.getScore())));
|
|
|
|
|
|
List<MarkQuestion> objectiveQuestions = questionDatasource.stream().filter(MarkQuestion::getObjective).collect(Collectors.toList());
|
|
|
for (ArchiveStudentVo studentVo : studentList) {
|