|
@@ -6,9 +6,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.qmth.teachcloud.common.contant.SystemConstant;
|
|
|
import com.qmth.teachcloud.common.entity.SysUser;
|
|
|
import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
|
|
|
-import com.qmth.teachcloud.common.service.BasicCourseService;
|
|
|
import com.qmth.teachcloud.common.util.ServletUtil;
|
|
|
-import com.qmth.teachcloud.report.business.bean.dto.query.BasicExamRecordDto;
|
|
|
import com.qmth.teachcloud.report.business.bean.result.*;
|
|
|
import com.qmth.teachcloud.report.business.entity.TAExamCourse;
|
|
|
import com.qmth.teachcloud.report.business.entity.TAExamCourseRecord;
|
|
@@ -17,7 +15,10 @@ import com.qmth.teachcloud.report.business.enums.PublishStatusEnum;
|
|
|
import com.qmth.teachcloud.report.business.enums.SemesterEnum;
|
|
|
import com.qmth.teachcloud.report.business.mapper.TAExamCourseMapper;
|
|
|
import com.qmth.teachcloud.report.business.mapper.TAExamCourseRecordMapper;
|
|
|
-import com.qmth.teachcloud.report.business.service.*;
|
|
|
+import com.qmth.teachcloud.report.business.service.ReportCommonService;
|
|
|
+import com.qmth.teachcloud.report.business.service.TAExamCourseService;
|
|
|
+import com.qmth.teachcloud.report.business.service.TBPaperService;
|
|
|
+import com.qmth.teachcloud.report.business.service.TBPaperStructService;
|
|
|
import org.springframework.cache.annotation.Cacheable;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
@@ -43,23 +44,11 @@ public class TAExamCourseServiceImpl extends ServiceImpl<TAExamCourseMapper, TAE
|
|
|
@Resource
|
|
|
TAExamCourseRecordMapper taExamCourseRecordMapper;
|
|
|
|
|
|
- @Resource
|
|
|
- TBPaperStructService tbPaperStructService;
|
|
|
-
|
|
|
@Resource
|
|
|
ReportCommonService reportCommonService;
|
|
|
|
|
|
@Resource
|
|
|
- TBExamRecordService tbExamRecordService;
|
|
|
-
|
|
|
- @Resource
|
|
|
- TBExamCourseService tbExamCourseService;
|
|
|
-
|
|
|
- @Resource
|
|
|
- TBExamService tbExamService;
|
|
|
-
|
|
|
- @Resource
|
|
|
- BasicCourseService basicCourseService;
|
|
|
+ TBPaperService tbPaperService;
|
|
|
|
|
|
/**
|
|
|
* 开课课程考试总览列表接口
|
|
@@ -72,7 +61,7 @@ public class TAExamCourseServiceImpl extends ServiceImpl<TAExamCourseMapper, TAE
|
|
|
*/
|
|
|
@Override
|
|
|
public IPage<TAExamCourseResult> surveyTeacherList(IPage<Map> iPage, Long examId, SemesterEnum semester, Long schoolId) {
|
|
|
- return taExamCourseMapper.surveyTeacherList(iPage, examId, semester.name(), schoolId);
|
|
|
+ return taExamCourseMapper.surveyTeacherList(iPage, examId, Objects.nonNull(semester) ? semester.name() : null, schoolId);
|
|
|
}
|
|
|
|
|
|
|
|
@@ -90,11 +79,12 @@ public class TAExamCourseServiceImpl extends ServiceImpl<TAExamCourseMapper, TAE
|
|
|
* @param examId
|
|
|
* @param courseCode
|
|
|
* @param publishStatus
|
|
|
+ * @param semester
|
|
|
* @return
|
|
|
*/
|
|
|
@Override
|
|
|
- public IPage<TAExamCourseResult> surveyAspointsList(IPage<Map> iPage, Long schoolId, Long examId, String courseCode, PublishStatusEnum publishStatus) {
|
|
|
- return taExamCourseMapper.surveyAspointsList(iPage, schoolId, examId, courseCode, publishStatus.name());
|
|
|
+ public IPage<TAExamCourseResult> surveyAspointsList(IPage<Map> iPage, Long schoolId, Long examId, String courseCode, PublishStatusEnum publishStatus, SemesterEnum semester) {
|
|
|
+ return taExamCourseMapper.surveyAspointsList(iPage, schoolId, examId, courseCode, Objects.nonNull(publishStatus) ? publishStatus.name() : null, Objects.nonNull(semester) ? semester.name() : null);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -154,14 +144,12 @@ public class TAExamCourseServiceImpl extends ServiceImpl<TAExamCourseMapper, TAE
|
|
|
CollegeAndSchoolGradeDistributionResult collegeAndSchoolGradeDistributionResult = reportCommonService.findCourseDistribution(examId, courseCode, sysUser.getOrgId());
|
|
|
//学院学科报表维度查询
|
|
|
DimensionAnalyzeResult dimensionAnalyzeResult = reportCommonService.findDimensionInfo(examId, courseCode, sysUser.getOrgId(), null);
|
|
|
- //查找试卷结构
|
|
|
- List<TBPaperStructResult> questionDatasource = tbPaperStructService.findQuestionInfo(examId, courseCode);
|
|
|
//查找题目相关
|
|
|
- QuestionInfoResult questionInfoResult = reportCommonService.findSituationOfQuestions(examId, courseCode, sysUser.getOrgId(), questionDatasource);
|
|
|
+ QuestionInfoResult questionInfoResult = reportCommonService.findSituationOfQuestions(examId, courseCode, sysUser.getOrgId(), null);
|
|
|
//查找老师得分
|
|
|
TeacherInfoListResult teacherInfoListResult = reportCommonService.findTeacherInfo(examId, courseCode, sysUser.getOrgId());
|
|
|
//查找题目信息
|
|
|
- QuestionListResult questionListResult = reportCommonService.findQuestionInfo(examId, courseCode, sysUser.getOrgId(), questionDatasource);
|
|
|
+ QuestionListResult questionListResult = reportCommonService.findQuestionInfo(examId, courseCode, sysUser.getOrgId());
|
|
|
|
|
|
return new CollegeAndCourseResult(courseInfoResult, collegeAndSchoolGradeDistributionResult, dimensionAnalyzeResult,
|
|
|
questionInfoResult, teacherInfoListResult, questionListResult);
|
|
@@ -200,10 +188,8 @@ public class TAExamCourseServiceImpl extends ServiceImpl<TAExamCourseMapper, TAE
|
|
|
|
|
|
//学院学科报表科目描述
|
|
|
List<SurveyTeacherGradeDistributionResult> surveyTeacherGradeDistributionResultList = reportCommonService.surveyTeacherDistribution(examId, courseCode, sysUser.getOrgId());
|
|
|
- //查找试卷结构
|
|
|
- List<TBPaperStructResult> questionDatasource = tbPaperStructService.findQuestionInfo(examId, courseCode);
|
|
|
//查找题目信息
|
|
|
- QuestionListResult questionListResult = reportCommonService.findQuestionInfo(examId, courseCode, sysUser.getOrgId(), questionDatasource);
|
|
|
+ QuestionListResult questionListResult = reportCommonService.findQuestionInfo(examId, courseCode, sysUser.getOrgId());
|
|
|
return new SurveyTeacherViewResult(surveyTeacherGradeDistributionResultList, questionListResult, surveyTeacherExamCourseResult);
|
|
|
}
|
|
|
|
|
@@ -219,7 +205,7 @@ public class TAExamCourseServiceImpl extends ServiceImpl<TAExamCourseMapper, TAE
|
|
|
*/
|
|
|
@Override
|
|
|
public IPage<TAExamCourseCollegeTeacherResult> surveyTeacherTeacherView(IPage<Map> iPage, Long schoolId, SemesterEnum semester, Long examId, String courseCode) {
|
|
|
- return taExamCourseMapper.surveyTeacherTeacherView(iPage, schoolId, semester.name(), examId, courseCode);
|
|
|
+ return taExamCourseMapper.surveyTeacherTeacherView(iPage, schoolId, Objects.nonNull(semester) ? semester.name() : null, examId, courseCode);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -251,75 +237,86 @@ public class TAExamCourseServiceImpl extends ServiceImpl<TAExamCourseMapper, TAE
|
|
|
* @return
|
|
|
*/
|
|
|
@Override
|
|
|
- public Object surveyTeacherQuestionAnswerView(Long schoolId, SemesterEnum semester, Long examId, String courseCode, Long collegeId, Long teacherId) {
|
|
|
- //查找试卷结构
|
|
|
- List<TBPaperStructResult> questionDatasource = tbPaperStructService.findQuestionInfo(examId, courseCode);
|
|
|
- //开课课程考试总览-按学院/教师查询
|
|
|
- QuestionInfoResult questionInfoResult = reportCommonService.findSituationOfQuestions(examId, courseCode, collegeId, questionDatasource);
|
|
|
- return questionInfoResult;
|
|
|
+ @Cacheable(value = SystemConstant.TEACHER_ANSWER_VIEW_REPORT, key = "#schoolId + '-' + #semester + '-' + #examId + '-' + #courseCode + '-' + #collegeId + '-' + #teacherId")
|
|
|
+ public QuestionInfoResult surveyTeacherQuestionAnswerView(Long schoolId, SemesterEnum semester, Long examId, String courseCode, Long collegeId, Long teacherId) {
|
|
|
+ return reportCommonService.findSituationOfQuestions(examId, courseCode, collegeId, teacherId);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public TrialCalculationResult trialCalculate(Long examId, String courseCode) {
|
|
|
- List<String> courseCodeList = new ArrayList<>();
|
|
|
- courseCodeList.add(courseCode);
|
|
|
+ public TrialCalculationResult trialCalculate(Long examId, String courseCode, BigDecimal coefficient) {
|
|
|
+ // 试卷分数设置
|
|
|
+ List<TBPaper> tbPaperList = tbPaperService.list(new QueryWrapper<TBPaper>().lambda().eq(TBPaper::getExamId, examId).eq(TBPaper::getCourseCode, courseCode));
|
|
|
+ if (tbPaperList.size() == 0) {
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("该课程不存在");
|
|
|
+ }
|
|
|
+ TBPaper tbPaper = tbPaperList.get(0);
|
|
|
+ BigDecimal fullScore = tbPaper.getTotalScore();
|
|
|
+ BigDecimal passScore = tbPaper.getPassScore();
|
|
|
+ // 参考的考生数据
|
|
|
+ List<TAExamCourseRecord> taExamCourseRecordList = taExamCourseRecordMapper.selectList(new QueryWrapper<TAExamCourseRecord>().lambda()
|
|
|
+ .eq(TAExamCourseRecord::getExamId, examId)
|
|
|
+ .eq(TAExamCourseRecord::getCourseCode, courseCode)
|
|
|
+ .eq(TAExamCourseRecord::getAbsent, false));
|
|
|
+ for (TAExamCourseRecord taExamCourseRecord : taExamCourseRecordList) {
|
|
|
+ BigDecimal paperScore = taExamCourseRecord.getTotalScore();
|
|
|
+ BigDecimal assignScore = paperScore.add((fullScore.subtract(paperScore)).divide(coefficient, 4, BigDecimal.ROUND_HALF_UP));
|
|
|
+ assignScore = assignScore.setScale(0, BigDecimal.ROUND_HALF_UP);
|
|
|
+ taExamCourseRecord.setAssignedScore(assignScore);
|
|
|
+ }
|
|
|
+ int totalCount = taExamCourseRecordList.size();
|
|
|
+ int currentCount = (int) taExamCourseRecordList.stream().filter(TAExamCourseRecord::getStudentCurrent).count();
|
|
|
+
|
|
|
+ // 查找卷面数据
|
|
|
+ // 总体
|
|
|
+ List<Double> paperTotalScoreList = taExamCourseRecordList.stream().map(e -> e.getTotalScore().doubleValue()).collect(Collectors.toList());
|
|
|
+ DoubleSummaryStatistics paperTotalStatistics = paperTotalScoreList.stream().collect(Collectors.summarizingDouble(e -> e));
|
|
|
+ double paperTotalAvgScore = paperTotalStatistics.getAverage();
|
|
|
+ long paperTotalFailCount = paperTotalScoreList.stream().filter(e -> e < passScore.doubleValue()).count();
|
|
|
+ BigDecimal paperTotalFailRate = BigDecimal.valueOf(paperTotalFailCount).divide(BigDecimal.valueOf(paperTotalScoreList.size()), 4, BigDecimal.ROUND_HALF_UP);
|
|
|
+
|
|
|
+ // 应届
|
|
|
+ List<Double> paperCurrentScoreList = taExamCourseRecordList.stream().filter(TAExamCourseRecord::getStudentCurrent).map(e -> e.getTotalScore().doubleValue()).collect(Collectors.toList());
|
|
|
+ DoubleSummaryStatistics paperCurrentStatistics = paperCurrentScoreList.stream().collect(Collectors.summarizingDouble(e -> e));
|
|
|
+ double paperCurrentAvgScore = paperCurrentStatistics.getAverage();
|
|
|
+ long paperCurrentFailCount = paperCurrentScoreList.stream().filter(e -> e < passScore.doubleValue()).count();
|
|
|
+ BigDecimal paperCurrentFailRate = BigDecimal.valueOf(paperCurrentFailCount).divide(BigDecimal.valueOf(paperCurrentScoreList.size()), 4, BigDecimal.ROUND_HALF_UP);
|
|
|
+
|
|
|
+ // 查找赋分试算后数据
|
|
|
+ // 总体
|
|
|
+ List<Double> totalScoreList = taExamCourseRecordList.stream().map(e -> e.getAssignedScore().doubleValue()).collect(Collectors.toList());
|
|
|
+ DoubleSummaryStatistics totalStatistics = totalScoreList.stream().collect(Collectors.summarizingDouble(e -> e));
|
|
|
+ double totalAvgScore = totalStatistics.getAverage();
|
|
|
+ long totalFailCount = totalScoreList.stream().filter(e -> e < passScore.doubleValue()).count();
|
|
|
+ BigDecimal totalFailRate = BigDecimal.valueOf(totalFailCount).divide(BigDecimal.valueOf(totalScoreList.size()), 4, BigDecimal.ROUND_HALF_UP);
|
|
|
+
|
|
|
+ // 应届
|
|
|
+ List<Double> currentScoreList = taExamCourseRecordList.stream().filter(TAExamCourseRecord::getStudentCurrent).map(e -> e.getAssignedScore().doubleValue()).collect(Collectors.toList());
|
|
|
+ DoubleSummaryStatistics currentStatistics = currentScoreList.stream().collect(Collectors.summarizingDouble(e -> e));
|
|
|
+ double currentAvgScore = currentStatistics.getAverage();
|
|
|
+ long currentFailCount = currentScoreList.stream().filter(e -> e < passScore.doubleValue()).count();
|
|
|
+ BigDecimal currentFailRate = BigDecimal.valueOf(currentFailCount).divide(BigDecimal.valueOf(currentScoreList.size()), 4, BigDecimal.ROUND_HALF_UP);
|
|
|
+
|
|
|
+ // 组装
|
|
|
+ TrialCalculationResult trialCalculationResult = new TrialCalculationResult();
|
|
|
+ trialCalculationResult.setTotalCount(totalCount);
|
|
|
+ trialCalculationResult.setCurrentCount(currentCount);
|
|
|
+ // - 卷面-总体
|
|
|
+ trialCalculationResult.setAvgScore(BigDecimal.valueOf(paperTotalAvgScore));
|
|
|
+ trialCalculationResult.setFailRate(paperTotalFailRate);
|
|
|
+ trialCalculationResult.setFailCount((int) paperTotalFailCount);
|
|
|
+ // - 卷面-应届
|
|
|
+ trialCalculationResult.setCurrentAvgScore(BigDecimal.valueOf(paperCurrentAvgScore));
|
|
|
+ trialCalculationResult.setCurrentFailRate(paperCurrentFailRate);
|
|
|
+ trialCalculationResult.setCurrentFailCount((int) paperCurrentFailCount);
|
|
|
+ // - 赋分-总体
|
|
|
+ trialCalculationResult.setAvgScoreAssign(BigDecimal.valueOf(totalAvgScore));
|
|
|
+ trialCalculationResult.setFailRateAssign(totalFailRate);
|
|
|
+ trialCalculationResult.setFailCountAssign((int) totalFailCount);
|
|
|
+ // - 赋分-应届
|
|
|
+ trialCalculationResult.setCurrentAvgScoreAssign(BigDecimal.valueOf(currentAvgScore));
|
|
|
+ trialCalculationResult.setCurrentFailRateAssign(currentFailRate);
|
|
|
+ trialCalculationResult.setCurrentFailCountAssign((int) currentFailCount);
|
|
|
|
|
|
-// // 数据同步操作
|
|
|
-// // 获取当前课程下所有学生考试成绩记录
|
|
|
-// List<BasicExamRecordDto> basicExamRecordDtoDatasource = tbExamRecordService.findByExamIdAndCourseCodeS(examId, courseCodeList);
|
|
|
-// for (String s : courseCodeList) {
|
|
|
-// if (tbExamCourseService.verifyExamCourseCantRun(examId, tbExamService.getById(examId).getSchoolId(), s, basicCourseService.findByCourseCode(s).getName())) {
|
|
|
-// throw ExceptionResultEnum.ERROR.exception("课程编号[" + s + "]的课程分析数据已测试或发布,不能变更基础数据");
|
|
|
-// }
|
|
|
-// List<BasicExamRecordDto> basicExamRecordDtoList = basicExamRecordDtoDatasource.stream()
|
|
|
-// .filter(e -> s.equals(e.getCourseCode())).collect(Collectors.toList());
|
|
|
-// if (basicExamRecordDtoList.size() > 0) {
|
|
|
-// // 迁移数据至't_a_exam_course_record'
|
|
|
-// List<TAExamCourseRecord> taExamCourseRecordList = new ArrayList<>();
|
|
|
-// for (BasicExamRecordDto basicExamRecordDto : basicExamRecordDtoList) {
|
|
|
-// boolean absent = basicExamRecordDto.getAbsent();
|
|
|
-// // 正常公式赋分操作
|
|
|
-// Long paperId = basicExamRecordDto.getPaperId();
|
|
|
-// TBPaper tbPaper = tbPaperService.getById(paperId);
|
|
|
-// if (Objects.isNull(tbPaper)) {
|
|
|
-// throw ExceptionResultEnum.ERROR.exception("试卷信息数据异常");
|
|
|
-// }
|
|
|
-// BigDecimal fullScore = tbPaper.getTotalScore();
|
|
|
-// BigDecimal myScore = basicExamRecordDto.getTotalScore();
|
|
|
-// BigDecimal coefficient = tbPaper.getCoefficient();
|
|
|
-// BigDecimal assignScore;
|
|
|
-// // 当该试卷的赋分系数不为0时赋分
|
|
|
-// if (coefficient != null && coefficient.compareTo(BigDecimal.ZERO) > 0 && !absent) {
|
|
|
-// assignScore = myScore.add((fullScore.subtract(myScore)).divide(coefficient, 0, BigDecimal.ROUND_HALF_UP));
|
|
|
-// } else {
|
|
|
-// assignScore = myScore;
|
|
|
-// }
|
|
|
-//
|
|
|
-// TAExamCourseRecord taExamCourseRecord = new TAExamCourseRecord();
|
|
|
-// taExamCourseRecord.setId(SystemConstant.getDbUuid());
|
|
|
-// taExamCourseRecord.setExamRecordId(basicExamRecordDto.getTbExamRecordId());
|
|
|
-// // 数据同步默认赋分成绩为卷面成绩
|
|
|
-// taExamCourseRecord.setSchoolId(tbExamService.getById(examId).getSchoolId());
|
|
|
-// taExamCourseRecord.setAssignedScore(assignScore);
|
|
|
-// taExamCourseRecord.setExamId(examId);
|
|
|
-// taExamCourseRecord.setCourseCode(basicExamRecordDto.getCourseCode());
|
|
|
-// taExamCourseRecord.setPaperId(basicExamRecordDto.getPaperId());
|
|
|
-// taExamCourseRecord.setPaperType(basicExamRecordDto.getPaperType());
|
|
|
-// taExamCourseRecord.setStudentId(basicExamRecordDto.getStudentId());
|
|
|
-// taExamCourseRecord.setStudentCode(basicExamRecordDto.getStudentCode());
|
|
|
-// taExamCourseRecord.setTeacherId(basicExamRecordDto.getTeacherId());
|
|
|
-// taExamCourseRecord.setClazzId(basicExamRecordDto.getClazzId());
|
|
|
-// taExamCourseRecord.setTeachCollegeId(basicExamRecordDto.getTeachCollegeId());
|
|
|
-// taExamCourseRecord.setInspectCollegeId(basicExamRecordDto.getInspectCollegeId());
|
|
|
-// taExamCourseRecord.setMajorId(basicExamRecordDto.getMajorId());
|
|
|
-// taExamCourseRecord.setTotalScore(myScore);
|
|
|
-// taExamCourseRecord.setAbsent(absent);
|
|
|
-// taExamCourseRecord.setStudentCurrent(basicExamRecordDto.getStudentCurrent());
|
|
|
-// taExamCourseRecordList.add(taExamCourseRecord);
|
|
|
-// }
|
|
|
-// taExamCourseRecordService.saveBatch(taExamCourseRecordList);
|
|
|
-// }
|
|
|
-// }
|
|
|
- return null;
|
|
|
+ return trialCalculationResult;
|
|
|
}
|
|
|
}
|