|
@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.google.common.collect.Lists;
|
|
|
+import com.qmth.boot.api.exception.ApiException;
|
|
|
import com.qmth.teachcloud.common.entity.BasicCourse;
|
|
|
import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
|
|
|
import com.qmth.teachcloud.common.service.BasicCourseService;
|
|
@@ -15,9 +16,11 @@ import com.qmth.teachcloud.common.util.ServletUtil;
|
|
|
import com.qmth.teachcloud.common.util.excel.ExcelError;
|
|
|
import com.qmth.teachcloud.report.business.bean.dto.ExamStudentTypeDto;
|
|
|
import com.qmth.teachcloud.report.business.bean.result.*;
|
|
|
-import com.qmth.teachcloud.report.business.entity.TBExamStudent;
|
|
|
-import com.qmth.teachcloud.report.business.mapper.TBExamStudentMapper;
|
|
|
+import com.qmth.teachcloud.report.business.entity.*;
|
|
|
+import com.qmth.teachcloud.report.business.enums.AssignEnum;
|
|
|
+import com.qmth.teachcloud.report.business.mapper.*;
|
|
|
import com.qmth.teachcloud.report.business.service.TBExamStudentService;
|
|
|
+import io.swagger.annotations.Api;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
@@ -30,6 +33,7 @@ import java.io.IOException;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
+import java.util.Set;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
@@ -49,6 +53,21 @@ public class TBExamStudentServiceImpl extends ServiceImpl<TBExamStudentMapper, T
|
|
|
@Autowired
|
|
|
BasicCourseService basicCourseService;
|
|
|
|
|
|
+ @Resource
|
|
|
+ TBStudentMapper tbStudentMapper;
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ TAExamCourseRecordMapper taExamCourseRecordMapper;
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ TBCommonRankLevelConfigMapper tbCommonRankLevelConfigMapper;
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ TBPaperMapper tbPaperMapper;
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ TAExamCourseRecordDioMapper taExamCourseRecordDioMapper;
|
|
|
+
|
|
|
/**
|
|
|
* 查询开课学院列表
|
|
|
*
|
|
@@ -207,8 +226,104 @@ public class TBExamStudentServiceImpl extends ServiceImpl<TBExamStudentMapper, T
|
|
|
return tbExamStudentMapper.reportList(iPage, schoolId, examId, collegeId, courseCode, clazzId, absent);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 学生报告-个人成绩总览接口
|
|
|
+ *
|
|
|
+ * @param schoolId
|
|
|
+ * @param studentCode
|
|
|
+ * @return
|
|
|
+ */
|
|
|
@Override
|
|
|
public ReportResult reportResult(Long schoolId, String studentCode) {
|
|
|
+ ReportResult reportResult = new ReportResult();
|
|
|
+ // 考生信息
|
|
|
+ StudentInfo studentInfo = tbStudentMapper.getStudentBySchoolIdAndStudentCode(schoolId, studentCode);
|
|
|
+ reportResult.setStudentInfo(studentInfo);
|
|
|
+
|
|
|
+ //考试信息
|
|
|
+ List<ExamInfo> examInfo = tbExamStudentMapper.listExamBySchoolIdAndStudentCode(schoolId, studentCode);
|
|
|
+ for (ExamInfo info : examInfo) {
|
|
|
+ List<CourseInfo> courseInfos = tbExamStudentMapper.listCourseByExamIdAndStudentCode(schoolId, info.getExamId(), studentCode);
|
|
|
+ info.setCourseInfo(courseInfos);
|
|
|
+ }
|
|
|
+ reportResult.setExamInfo(examInfo);
|
|
|
+ return reportResult;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public PersonalReportResult reportMark(String schoolId, String studentCode, String examId, String courseCode) {
|
|
|
+ PersonalReportResult personalReportResult = new PersonalReportResult();
|
|
|
+ // 考生信息
|
|
|
+ ExamStudentResult examStudentResult = buildExamStudentResult(schoolId, examId, studentCode, courseCode);
|
|
|
+ personalReportResult.setStudent(examStudentResult);
|
|
|
+
|
|
|
+ // 学院信息
|
|
|
+ CollegeResult collegeResult = buildCollegeResult(schoolId, examId, studentCode, courseCode);
|
|
|
+ personalReportResult.setCollege(collegeResult);
|
|
|
+ return personalReportResult;
|
|
|
+ }
|
|
|
+
|
|
|
+ private CollegeResult buildCollegeResult(String schoolId, String examId, String studentCode, String courseCode) {
|
|
|
+ CollegeResult collegeResult = new CollegeResult();
|
|
|
+ // 综合信息
|
|
|
+ SynthesisResult synthesisResult = taExamCourseRecordMapper.getSynthesisResult(schoolId, examId, studentCode, courseCode);
|
|
|
+ collegeResult.setSynthesis(synthesisResult);
|
|
|
+
|
|
|
+ // 诊断信息
|
|
|
+ DiagnosisResult diagnosisResult = new DiagnosisResult();
|
|
|
+
|
|
|
+ QueryWrapper<TAExamCourseRecord> examCourseRecordQueryWrapper = new QueryWrapper<>();
|
|
|
+ examCourseRecordQueryWrapper.lambda().eq(TAExamCourseRecord::getSchoolId, schoolId).eq(TAExamCourseRecord::getExamId, examId).eq(TAExamCourseRecord::getStudentCode, studentCode).eq(TAExamCourseRecord::getCourseCode, courseCode);
|
|
|
+ List<TAExamCourseRecord> examCourseRecords = taExamCourseRecordMapper.selectList(examCourseRecordQueryWrapper);
|
|
|
+
|
|
|
+ QueryWrapper<TBPaper> queryWrapper = new QueryWrapper<>();
|
|
|
+ queryWrapper.lambda().eq(TBPaper::getExamId, examId).eq(TBPaper::getCourseCode, courseCode);
|
|
|
+ List<TBPaper> papers = tbPaperMapper.selectList(queryWrapper);
|
|
|
+
|
|
|
+ if (examCourseRecords.size() != 1 || papers.size() != 1) {
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("获取数据异常,应该有且仅有一条数据");
|
|
|
+ }
|
|
|
+
|
|
|
+ AssignEnum scoreType = papers.get(0).getScoreType();
|
|
|
+ boolean isAssignedScore = false;
|
|
|
+ if (!AssignEnum.NO_NEED_ASSIGN_SCORE.equals(scoreType)) {
|
|
|
+ isAssignedScore = true;
|
|
|
+ }
|
|
|
+ diagnosisResult.setAssignedScore(isAssignedScore);
|
|
|
+ double passScore = papers.get(0).getPassScore().doubleValue();
|
|
|
+ boolean result = examCourseRecords.get(0).getAssignedScore().doubleValue() >=passScore;
|
|
|
+ diagnosisResult.setResult(result);
|
|
|
+
|
|
|
+ // 模块
|
|
|
+ QueryWrapper<TAExamCourseRecordDio> examCourseRecordDioQueryWrapper = new QueryWrapper<>();
|
|
|
+ examCourseRecordDioQueryWrapper.lambda().eq(TAExamCourseRecordDio::getSchoolId, schoolId).eq(TAExamCourseRecordDio::getExamId, examId).eq(TAExamCourseRecordDio::getCourseCode, courseCode);
|
|
|
+ List<TAExamCourseRecordDio> examCourseRecordDios = taExamCourseRecordDioMapper.selectList(examCourseRecordDioQueryWrapper);
|
|
|
+ Set<String> moduleNames = examCourseRecordDios.stream().map(m->m.getDimensionType()).collect(Collectors.toSet());
|
|
|
+ for (String moduleName : moduleNames) {
|
|
|
+ QueryWrapper<TAExamCourseRecordMod> examCourseRecordModQueryWrapper = new QueryWrapper<>();
|
|
|
+ examCourseRecordModQueryWrapper.lambda().eq(TAExamCourseRecordMod::getSchoolId, schoolId).eq(TAExamCourseRecordMod::getExamId, examId).eq(TAExamCourseRecordMod::getStudentCode, studentCode).eq(TAExamCourseRecordMod::getCourseCode, courseCode);
|
|
|
+ }
|
|
|
return null;
|
|
|
}
|
|
|
+
|
|
|
+ private ExamStudentResult buildExamStudentResult(String schoolId, String examId, String studentCode, String courseCode) {
|
|
|
+ ExamStudentResult examStudentResult = taExamCourseRecordMapper.getStudent(schoolId, examId, studentCode, courseCode);
|
|
|
+ if (examStudentResult != null) {
|
|
|
+ QueryWrapper<TBCommonRankLevelConfig> queryWrapper = new QueryWrapper<>();
|
|
|
+ queryWrapper.lambda().eq(TBCommonRankLevelConfig::getExamId, examId).eq(TBCommonRankLevelConfig::getCourseCode, courseCode);
|
|
|
+ List<TBCommonRankLevelConfig> commonRankLevelConfigs = tbCommonRankLevelConfigMapper.selectList(queryWrapper);
|
|
|
+ List<LevelResult> levelResults = new ArrayList<>();
|
|
|
+ for (TBCommonRankLevelConfig commonRankLevelConfig : commonRankLevelConfigs) {
|
|
|
+ LevelResult levelResult = new LevelResult();
|
|
|
+ levelResult.setLevel(commonRankLevelConfig.getLevel());
|
|
|
+ List<Integer> grades = new ArrayList<>();
|
|
|
+ grades.add(commonRankLevelConfig.getMin().intValue());
|
|
|
+ grades.add(commonRankLevelConfig.getMax().intValue());
|
|
|
+ levelResult.setGrade(grades);
|
|
|
+ levelResults.add(levelResult);
|
|
|
+ }
|
|
|
+ examStudentResult.setLevels(levelResults);
|
|
|
+ }
|
|
|
+ return examStudentResult;
|
|
|
+ }
|
|
|
}
|