|
@@ -1063,19 +1063,237 @@ public class AnalyzeForReportServiceImpl implements AnalyzeForReportService {
|
|
|
}
|
|
|
taExamCourseCollegePaperStructService.saveBatch(taExamCourseCollegePaperStructList);
|
|
|
}
|
|
|
- return " 't_a_paper_struct'表构建成功 ";
|
|
|
+ return "'t_a_exam_course_college_paper_struct'表构建成功 ";
|
|
|
}
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
@Override
|
|
|
public String buildAnalyzeTeacherPaperStruct(Long examId, String courseCode) {
|
|
|
- return null;
|
|
|
+ // 可分析有效课程信息
|
|
|
+ List<String> effectiveCourseCodeList = tbExamCourseService.findEffectiveByExamId(examId, courseCode);
|
|
|
+ for (String effectiveCourseCode : effectiveCourseCodeList) {
|
|
|
+ List<TBPaper> tbPaperList = tbPaperService.list(new QueryWrapper<TBPaper>().lambda()
|
|
|
+ .eq(TBPaper::getExamId, examId).eq(TBPaper::getCourseCode, effectiveCourseCode));
|
|
|
+ if (tbPaperList.size() == 0) {
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("基础试卷信息异常");
|
|
|
+ }
|
|
|
+ // 删除原有数据
|
|
|
+ taExamCourseTeacherPaperStructService.remove(new QueryWrapper<TAExamCourseTeacherPaperStruct>().lambda()
|
|
|
+ .eq(TAExamCourseTeacherPaperStruct::getExamId, examId)
|
|
|
+ .eq(TAExamCourseTeacherPaperStruct::getCourseCode, effectiveCourseCode));
|
|
|
+ List<TAExamCourseTeacherPaperStruct> taExamCourseTeacherPaperStructList = new ArrayList<>();
|
|
|
+ // 该课程有效试卷结构数据
|
|
|
+ List<ValidAnswerDetailDto> answerDetailDtoList = tbAnswerService.findValid(examId, effectiveCourseCode);
|
|
|
+ for (TBPaper tbPaper : tbPaperList) {
|
|
|
+ Long paperId = tbPaper.getId();
|
|
|
+ String paperType = tbPaper.getPaperType();
|
|
|
+
|
|
|
+ // 参考该试卷的考察学院id集合
|
|
|
+ Set<Long> teacherIdSet = answerDetailDtoList.stream()
|
|
|
+ .filter(e -> paperId.equals(e.getPaperId()))
|
|
|
+ .map(ValidAnswerDetailDto::getTeacherId)
|
|
|
+ .collect(Collectors.toSet());
|
|
|
+
|
|
|
+ List<TBPaperStruct> tbPaperStructList = tbPaperStructService.list(new QueryWrapper<TBPaperStruct>().lambda()
|
|
|
+ .eq(TBPaperStruct::getPaperId, paperId));
|
|
|
+ if (tbPaperStructList.size() == 0) {
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("试卷结构数据异常");
|
|
|
+ }
|
|
|
+ for (Long teacherId : teacherIdSet) {
|
|
|
+ String teacherName = sysUserService.getById(teacherId).getRealName();
|
|
|
+ for (TBPaperStruct paperStruct : tbPaperStructList) {
|
|
|
+ String numberType = paperStruct.getNumberType();
|
|
|
+ String mainNumber = paperStruct.getBigQuestionNumber();
|
|
|
+ String subNumber = paperStruct.getSmallQuestionNumber();
|
|
|
+
|
|
|
+ List<ValidAnswerDetailDto> oneQuestionAnswerDetailList = answerDetailDtoList
|
|
|
+ .stream().filter(e -> paperType.equals(e.getPaperType()) &&
|
|
|
+ teacherId.equals(e.getTeacherId()) &&
|
|
|
+ numberType.equals(e.getNumberType()) &&
|
|
|
+ mainNumber.equals(e.getMainNumber()) &&
|
|
|
+ subNumber.equals(e.getSubNumber())).collect(Collectors.toList()); //某教师某道小题的所有参考学生作答信息(并且按照该科目的参考学生百分等级从高到低排序了)
|
|
|
+ if (oneQuestionAnswerDetailList.size() == 0){
|
|
|
+ System.out.println("异常");
|
|
|
+ }
|
|
|
+ BigDecimal fullScore = paperStruct.getFullScore();
|
|
|
+ PaperStructJudgeEnum paperStructJudgeEnum;
|
|
|
+ if (oneQuestionAnswerDetailList.stream().anyMatch(e -> fullScore.compareTo(e.getScore()) != 0)){
|
|
|
+ paperStructJudgeEnum = PaperStructJudgeEnum.NOT_QUITE_RIGHT;
|
|
|
+ }else {
|
|
|
+ paperStructJudgeEnum = PaperStructJudgeEnum.ALL_CORRECT;
|
|
|
+ }
|
|
|
+
|
|
|
+ DoubleSummaryStatistics descriptiveStatistics = oneQuestionAnswerDetailList.stream()
|
|
|
+ .collect(Collectors.summarizingDouble(e -> e.getScore().doubleValue()));
|
|
|
+
|
|
|
+ double scoreAvg = descriptiveStatistics.getAverage();
|
|
|
+ BigDecimal standardScoreRate = BigDecimal.valueOf(scoreAvg).divide(fullScore, 4, BigDecimal.ROUND_HALF_UP);
|
|
|
+ BigDecimal scoreRate = standardScoreRate.setScale(1, BigDecimal.ROUND_HALF_UP);
|
|
|
+ String difficult = this.analyzeDifficult(examId, effectiveCourseCode, scoreRate.doubleValue());
|
|
|
+
|
|
|
+ TAExamCourseTeacherPaperStruct taExamCourseTeacherPaperStruct = new TAExamCourseTeacherPaperStruct();
|
|
|
+ taExamCourseTeacherPaperStruct.setId(SystemConstant.getDbUuid());
|
|
|
+ taExamCourseTeacherPaperStruct.setPaperStructId(paperStruct.getId());
|
|
|
+ taExamCourseTeacherPaperStruct.setExamId(examId);
|
|
|
+ taExamCourseTeacherPaperStruct.setSchoolId(tbExamService.getById(examId).getSchoolId());
|
|
|
+ taExamCourseTeacherPaperStruct.setCourseCode(effectiveCourseCode);
|
|
|
+ taExamCourseTeacherPaperStruct.setCourseName(basicCourseService.findByCourseCode(effectiveCourseCode).getName());
|
|
|
+ taExamCourseTeacherPaperStruct.setPaperId(paperId);
|
|
|
+ taExamCourseTeacherPaperStruct.setTeacherId(teacherId);
|
|
|
+ taExamCourseTeacherPaperStruct.setTeacherName(teacherName);
|
|
|
+ taExamCourseTeacherPaperStruct.setPaperType(paperType);
|
|
|
+ taExamCourseTeacherPaperStruct.setQuestionName(paperStruct.getQuestionName());
|
|
|
+ taExamCourseTeacherPaperStruct.setNumberType(paperStruct.getNumberType());
|
|
|
+ taExamCourseTeacherPaperStruct.setBigQuestionNumber(paperStruct.getBigQuestionNumber());
|
|
|
+ taExamCourseTeacherPaperStruct.setSmallQuestionNumber(paperStruct.getSmallQuestionNumber());
|
|
|
+ taExamCourseTeacherPaperStruct.setQuestionType(paperStruct.getQuestionType());
|
|
|
+ taExamCourseTeacherPaperStruct.setFullScore(paperStruct.getFullScore());
|
|
|
+ taExamCourseTeacherPaperStruct.setScoreRules(paperStruct.getScoreRules());
|
|
|
+ taExamCourseTeacherPaperStruct.setRulesDesc(paperStruct.getRulesDesc());
|
|
|
+ taExamCourseTeacherPaperStruct.setKnowledgeDimension(paperStruct.getKnowledgeDimension());
|
|
|
+ taExamCourseTeacherPaperStruct.setAbilityDimension(paperStruct.getAbilityDimension());
|
|
|
+ taExamCourseTeacherPaperStruct.setLiteracyDimension(paperStruct.getLiteracyDimension());
|
|
|
+ taExamCourseTeacherPaperStruct.setStandardScoreRate(standardScoreRate);
|
|
|
+ taExamCourseTeacherPaperStruct.setScoreRate(scoreRate);
|
|
|
+ taExamCourseTeacherPaperStruct.setDifficult(difficult);
|
|
|
+ taExamCourseTeacherPaperStruct.setPaperStructJudge(paperStructJudgeEnum);
|
|
|
+ taExamCourseTeacherPaperStructList.add(taExamCourseTeacherPaperStruct);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ taExamCourseTeacherPaperStructService.saveBatch(taExamCourseTeacherPaperStructList);
|
|
|
+ }
|
|
|
+ return "'t_a_exam_course_teacher_paper_struct'表构建成功 ";
|
|
|
}
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
@Override
|
|
|
public String buildAnalyzeTeacherCollegePaperStruct(Long examId, String courseCode) {
|
|
|
- return null;
|
|
|
+ // 可分析有效课程信息
|
|
|
+ List<String> effectiveCourseCodeList = tbExamCourseService.findEffectiveByExamId(examId, courseCode);
|
|
|
+ for (String effectiveCourseCode : effectiveCourseCodeList) {
|
|
|
+ List<TBPaper> tbPaperList = tbPaperService.list(new QueryWrapper<TBPaper>().lambda()
|
|
|
+ .eq(TBPaper::getExamId, examId).eq(TBPaper::getCourseCode, effectiveCourseCode));
|
|
|
+ if (tbPaperList.size() == 0) {
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("基础试卷信息异常");
|
|
|
+ }
|
|
|
+ // 删除原有数据
|
|
|
+ taExamCourseTeacherCollegePaperStructService.remove(new QueryWrapper<TAExamCourseTeacherCollegePaperStruct>().lambda()
|
|
|
+ .eq(TAExamCourseTeacherCollegePaperStruct::getExamId, examId)
|
|
|
+ .eq(TAExamCourseTeacherCollegePaperStruct::getCourseCode, effectiveCourseCode));
|
|
|
+ List<TAExamCourseTeacherCollegePaperStruct> tAExamCourseTeacherCollegePaperStructList = new ArrayList<>();
|
|
|
+ // 该课程有效试卷结构数据
|
|
|
+ List<ValidAnswerDetailDto> answerDetailDtoList = tbAnswerService.findValid(examId, effectiveCourseCode);
|
|
|
+ for (TBPaper tbPaper : tbPaperList) {
|
|
|
+ Long paperId = tbPaper.getId();
|
|
|
+ String paperType = tbPaper.getPaperType();
|
|
|
+
|
|
|
+ // 参考该试卷的考察学院id集合
|
|
|
+ Set<Long> teacherIdSet = answerDetailDtoList.stream()
|
|
|
+ .filter(e -> paperId.equals(e.getPaperId()))
|
|
|
+ .map(ValidAnswerDetailDto::getTeacherId)
|
|
|
+ .collect(Collectors.toSet());
|
|
|
+
|
|
|
+ List<TBPaperStruct> tbPaperStructList = tbPaperStructService.list(new QueryWrapper<TBPaperStruct>().lambda()
|
|
|
+ .eq(TBPaperStruct::getPaperId, paperId));
|
|
|
+ if (tbPaperStructList.size() == 0) {
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("试卷结构数据异常");
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 试卷下
|
|
|
+ */
|
|
|
+ for (Long teacherId : teacherIdSet) {
|
|
|
+ /**
|
|
|
+ * 教师下
|
|
|
+ */
|
|
|
+ String teacherName = sysUserService.getById(teacherId).getRealName();
|
|
|
+
|
|
|
+ // 参考该试卷的考察学院id集合
|
|
|
+ Set<Long> inspectCollegeIdSet = answerDetailDtoList.stream()
|
|
|
+ .filter(e -> paperId.equals(e.getPaperId()))
|
|
|
+ .filter(e -> teacherId.equals(e.getTeacherId()))
|
|
|
+ .map(ValidAnswerDetailDto::getInspectCollegeId)
|
|
|
+ .collect(Collectors.toSet());
|
|
|
+
|
|
|
+ for (Long inspectCollegeId : inspectCollegeIdSet) {
|
|
|
+ /**
|
|
|
+ * 学院下
|
|
|
+ */
|
|
|
+ String inspectCollegeName = sysOrgService.getById(inspectCollegeId).getName();
|
|
|
+
|
|
|
+ for (TBPaperStruct paperStruct : tbPaperStructList) {
|
|
|
+ /**
|
|
|
+ * 试题下
|
|
|
+ */
|
|
|
+ String numberType = paperStruct.getNumberType();
|
|
|
+ String mainNumber = paperStruct.getBigQuestionNumber();
|
|
|
+ String subNumber = paperStruct.getSmallQuestionNumber();
|
|
|
+
|
|
|
+ List<ValidAnswerDetailDto> oneQuestionAnswerDetailList = answerDetailDtoList
|
|
|
+ .stream().filter(e -> paperType.equals(e.getPaperType()) &&
|
|
|
+ teacherId.equals(e.getTeacherId()) &&
|
|
|
+ inspectCollegeId.equals(e.getInspectCollegeId()) &&
|
|
|
+ numberType.equals(e.getNumberType()) &&
|
|
|
+ mainNumber.equals(e.getMainNumber()) &&
|
|
|
+ subNumber.equals(e.getSubNumber())).collect(Collectors.toList()); //某教师某道小题的所有参考学生作答信息(并且按照该科目的参考学生百分等级从高到低排序了)
|
|
|
+ if (oneQuestionAnswerDetailList.size() == 0){
|
|
|
+ System.out.println("异常");
|
|
|
+ }
|
|
|
+ BigDecimal fullScore = paperStruct.getFullScore();
|
|
|
+ PaperStructJudgeEnum paperStructJudgeEnum;
|
|
|
+ if (oneQuestionAnswerDetailList.stream().anyMatch(e -> fullScore.compareTo(e.getScore()) != 0)){
|
|
|
+ paperStructJudgeEnum = PaperStructJudgeEnum.NOT_QUITE_RIGHT;
|
|
|
+ }else {
|
|
|
+ paperStructJudgeEnum = PaperStructJudgeEnum.ALL_CORRECT;
|
|
|
+ }
|
|
|
+
|
|
|
+ DoubleSummaryStatistics descriptiveStatistics = oneQuestionAnswerDetailList.stream()
|
|
|
+ .collect(Collectors.summarizingDouble(e -> e.getScore().doubleValue()));
|
|
|
+
|
|
|
+ double scoreAvg = descriptiveStatistics.getAverage();
|
|
|
+ BigDecimal standardScoreRate = BigDecimal.valueOf(scoreAvg).divide(fullScore, 4, BigDecimal.ROUND_HALF_UP);
|
|
|
+ BigDecimal scoreRate = standardScoreRate.setScale(1, BigDecimal.ROUND_HALF_UP);
|
|
|
+ String difficult = this.analyzeDifficult(examId, effectiveCourseCode, scoreRate.doubleValue());
|
|
|
+
|
|
|
+ TAExamCourseTeacherCollegePaperStruct taExamCourseTeacherCollegePaperStruct = new TAExamCourseTeacherCollegePaperStruct();
|
|
|
+ taExamCourseTeacherCollegePaperStruct.setId(SystemConstant.getDbUuid());
|
|
|
+ taExamCourseTeacherCollegePaperStruct.setPaperStructId(paperStruct.getId());
|
|
|
+ taExamCourseTeacherCollegePaperStruct.setExamId(examId);
|
|
|
+ taExamCourseTeacherCollegePaperStruct.setSchoolId(tbExamService.getById(examId).getSchoolId());
|
|
|
+ taExamCourseTeacherCollegePaperStruct.setCourseCode(effectiveCourseCode);
|
|
|
+ taExamCourseTeacherCollegePaperStruct.setCourseName(basicCourseService.findByCourseCode(effectiveCourseCode).getName());
|
|
|
+ taExamCourseTeacherCollegePaperStruct.setPaperId(paperId);
|
|
|
+ taExamCourseTeacherCollegePaperStruct.setTeacherId(teacherId);
|
|
|
+ taExamCourseTeacherCollegePaperStruct.setTeacherName(teacherName);
|
|
|
+ taExamCourseTeacherCollegePaperStruct.setInspectCollegeId(inspectCollegeId);
|
|
|
+ taExamCourseTeacherCollegePaperStruct.setInspectCollegeName(inspectCollegeName);
|
|
|
+ taExamCourseTeacherCollegePaperStruct.setPaperType(paperType);
|
|
|
+ taExamCourseTeacherCollegePaperStruct.setQuestionName(paperStruct.getQuestionName());
|
|
|
+ taExamCourseTeacherCollegePaperStruct.setNumberType(paperStruct.getNumberType());
|
|
|
+ taExamCourseTeacherCollegePaperStruct.setBigQuestionNumber(paperStruct.getBigQuestionNumber());
|
|
|
+ taExamCourseTeacherCollegePaperStruct.setSmallQuestionNumber(paperStruct.getSmallQuestionNumber());
|
|
|
+ taExamCourseTeacherCollegePaperStruct.setQuestionType(paperStruct.getQuestionType());
|
|
|
+ taExamCourseTeacherCollegePaperStruct.setFullScore(paperStruct.getFullScore());
|
|
|
+ taExamCourseTeacherCollegePaperStruct.setScoreRules(paperStruct.getScoreRules());
|
|
|
+ taExamCourseTeacherCollegePaperStruct.setRulesDesc(paperStruct.getRulesDesc());
|
|
|
+ taExamCourseTeacherCollegePaperStruct.setKnowledgeDimension(paperStruct.getKnowledgeDimension());
|
|
|
+ taExamCourseTeacherCollegePaperStruct.setAbilityDimension(paperStruct.getAbilityDimension());
|
|
|
+ taExamCourseTeacherCollegePaperStruct.setLiteracyDimension(paperStruct.getLiteracyDimension());
|
|
|
+ taExamCourseTeacherCollegePaperStruct.setStandardScoreRate(standardScoreRate);
|
|
|
+ taExamCourseTeacherCollegePaperStruct.setScoreRate(scoreRate);
|
|
|
+ taExamCourseTeacherCollegePaperStruct.setDifficult(difficult);
|
|
|
+ taExamCourseTeacherCollegePaperStruct.setPaperStructJudge(paperStructJudgeEnum);
|
|
|
+ tAExamCourseTeacherCollegePaperStructList.add(taExamCourseTeacherCollegePaperStruct);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ taExamCourseTeacherCollegePaperStructService.saveBatch(tAExamCourseTeacherCollegePaperStructList);
|
|
|
+ }
|
|
|
+ return "'t_a_exam_course_teacher_college_paper_struct'表构建成功 ";
|
|
|
}
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|