|
@@ -12,6 +12,7 @@ import com.qmth.teachcloud.report.business.bean.dto.query.BasicAnswerDto;
|
|
|
import com.qmth.teachcloud.report.business.bean.dto.query.ValidAnswerDetailDto;
|
|
|
import com.qmth.teachcloud.report.business.entity.*;
|
|
|
import com.qmth.teachcloud.report.business.enums.LevelRuleEnum;
|
|
|
+import com.qmth.teachcloud.report.business.enums.PublishStatusEnum;
|
|
|
import com.qmth.teachcloud.report.business.enums.QuantileEnum;
|
|
|
import com.qmth.teachcloud.report.business.enums.ValidityEnum;
|
|
|
import com.qmth.teachcloud.report.business.service.*;
|
|
@@ -35,7 +36,7 @@ import java.util.stream.Collectors;
|
|
|
* @Date: 2021-06-06
|
|
|
*/
|
|
|
@Service
|
|
|
-public class AnalyzeForStudentServiceImpl implements AnalyzeForStudentService {
|
|
|
+public class AnalyzeForReportServiceImpl implements AnalyzeForReportService {
|
|
|
@Resource
|
|
|
private TAExamCourseRecordService taExamCourseRecordService;
|
|
|
@Resource
|
|
@@ -95,22 +96,22 @@ public class AnalyzeForStudentServiceImpl implements AnalyzeForStudentService {
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
@Override
|
|
|
public String buildAnalyzeExamCourse(Long examId, String courseCode) {
|
|
|
- List<String> effectiveCourseCodeList = tbExamCourseService.findEffectiveByExamId(examId,courseCode);
|
|
|
+ List<String> effectiveCourseCodeList = tbExamCourseService.findEffectiveByExamId(examId, courseCode);
|
|
|
// 考试下考生作答数据源
|
|
|
List<TAExamCourseRecord> dataSource = taExamCourseRecordService.list(new QueryWrapper<TAExamCourseRecord>().lambda()
|
|
|
- .eq(TAExamCourseRecord::getExamId,examId));
|
|
|
+ .eq(TAExamCourseRecord::getExamId, examId));
|
|
|
List<TAExamCourse> taExamCourseList = new ArrayList<>();
|
|
|
// 有效的课程
|
|
|
for (String effectiveCourseCode : effectiveCourseCodeList) {
|
|
|
// 原数据删除
|
|
|
taExamCourseService.remove(new QueryWrapper<TAExamCourse>().lambda()
|
|
|
- .eq(TAExamCourse::getExamId,examId)
|
|
|
- .eq(TAExamCourse::getCourseCode,effectiveCourseCode));
|
|
|
+ .eq(TAExamCourse::getExamId, examId)
|
|
|
+ .eq(TAExamCourse::getCourseCode, effectiveCourseCode));
|
|
|
|
|
|
// TODO: 2021/6/7 查询试卷信息AB卷的准确方式(目前AB卷规则视为一致)
|
|
|
List<TBPaper> tbPaperList = tbPaperService.list(new QueryWrapper<TBPaper>().lambda()
|
|
|
- .eq(TBPaper::getExamId,examId).eq(TBPaper::getCourseCode,effectiveCourseCode));
|
|
|
- if (tbPaperList.size() < 1){
|
|
|
+ .eq(TBPaper::getExamId, examId).eq(TBPaper::getCourseCode, effectiveCourseCode));
|
|
|
+ if (tbPaperList.size() < 1) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("未找到试卷基础信息");
|
|
|
}
|
|
|
TBPaper tbPaper = tbPaperList.get(0);
|
|
@@ -130,7 +131,7 @@ public class AnalyzeForStudentServiceImpl implements AnalyzeForStudentService {
|
|
|
int totalCount = totalDatasource.size();
|
|
|
long realityCount = totalDatasource.stream().filter(e -> !e.getAbsent()).count();
|
|
|
long absentCount = totalDatasource.stream().filter(TAExamCourseRecord::getAbsent).count();
|
|
|
- if (totalCount != realityCount + absentCount){
|
|
|
+ if (totalCount != realityCount + absentCount) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("考试人数数据异常");
|
|
|
}
|
|
|
// 赋分数据集合
|
|
@@ -139,14 +140,14 @@ public class AnalyzeForStudentServiceImpl implements AnalyzeForStudentService {
|
|
|
DoubleSummaryStatistics totalStatistics = totalScoreList.stream().collect(Collectors.summarizingDouble(e -> e));
|
|
|
double avgScore = totalStatistics.getAverage();
|
|
|
long passCount = totalScoreList.stream().filter(e -> e >= passScore.doubleValue()).count();
|
|
|
- BigDecimal passRate = BigDecimal.valueOf(passCount).divide(BigDecimal.valueOf(realityCount),4,BigDecimal.ROUND_HALF_DOWN);
|
|
|
+ BigDecimal passRate = BigDecimal.valueOf(passCount).divide(BigDecimal.valueOf(realityCount), 4, BigDecimal.ROUND_HALF_DOWN);
|
|
|
|
|
|
// -------------------卷面分------------------------
|
|
|
List<Double> paperTotalScoreList = totalDatasource.stream().filter(e -> !e.getAbsent()).map(e -> e.getTotalScore().doubleValue()).collect(Collectors.toList());
|
|
|
DoubleSummaryStatistics paperTotalStatistics = paperTotalScoreList.stream().collect(Collectors.summarizingDouble(e -> e));
|
|
|
double paperAvgScore = paperTotalStatistics.getAverage();
|
|
|
long paperPassCount = paperTotalScoreList.stream().filter(e -> e >= passScore.doubleValue()).count();
|
|
|
- BigDecimal paperPassRate = BigDecimal.valueOf(paperPassCount).divide(BigDecimal.valueOf(realityCount),4,BigDecimal.ROUND_HALF_DOWN);
|
|
|
+ BigDecimal paperPassRate = BigDecimal.valueOf(paperPassCount).divide(BigDecimal.valueOf(realityCount), 4, BigDecimal.ROUND_HALF_DOWN);
|
|
|
|
|
|
|
|
|
|
|
@@ -159,10 +160,10 @@ public class AnalyzeForStudentServiceImpl implements AnalyzeForStudentService {
|
|
|
int pastTotalCount = pastDatasource.size();
|
|
|
long pastRealityCount = pastDatasource.stream().filter(e -> !e.getAbsent()).count();
|
|
|
long pastAbsentCount = pastDatasource.stream().filter(TAExamCourseRecord::getAbsent).count();
|
|
|
- if (pastTotalCount != pastRealityCount + pastAbsentCount){
|
|
|
+ if (pastTotalCount != pastRealityCount + pastAbsentCount) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("考试往届生人数数据异常");
|
|
|
}
|
|
|
- BigDecimal pastRealityRate = BigDecimal.valueOf(pastRealityCount).divide(BigDecimal.valueOf(realityCount),4,BigDecimal.ROUND_HALF_DOWN);
|
|
|
+ BigDecimal pastRealityRate = BigDecimal.valueOf(pastRealityCount).divide(BigDecimal.valueOf(realityCount), 4, BigDecimal.ROUND_HALF_DOWN);
|
|
|
|
|
|
/*
|
|
|
该课程应届生成绩分析
|
|
@@ -174,16 +175,16 @@ public class AnalyzeForStudentServiceImpl implements AnalyzeForStudentService {
|
|
|
int currentTotalCount = currentDatasource.size();
|
|
|
long currentRealityCount = currentDatasource.stream().filter(e -> !e.getAbsent()).count();
|
|
|
long currentAbsentCount = currentDatasource.stream().filter(TAExamCourseRecord::getAbsent).count();
|
|
|
- if (currentTotalCount != currentRealityCount + currentAbsentCount){
|
|
|
+ if (currentTotalCount != currentRealityCount + currentAbsentCount) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("考试应届生人数数据异常");
|
|
|
}
|
|
|
- BigDecimal currentRealityRate = BigDecimal.valueOf(currentRealityCount).divide(BigDecimal.valueOf(realityCount),4,BigDecimal.ROUND_HALF_DOWN);
|
|
|
+ BigDecimal currentRealityRate = BigDecimal.valueOf(currentRealityCount).divide(BigDecimal.valueOf(realityCount), 4, BigDecimal.ROUND_HALF_DOWN);
|
|
|
|
|
|
// 通过率统计
|
|
|
List<Double> currentScoreList = currentDatasource.stream().filter(e -> !e.getAbsent()).map(e -> e.getAssignedScore().doubleValue()).collect(Collectors.toList());
|
|
|
DoubleSummaryStatistics currentStatistics = currentScoreList.stream().collect(Collectors.summarizingDouble(e -> e));
|
|
|
long currentPassCount = currentScoreList.stream().filter(e -> e >= passScore.doubleValue()).count();
|
|
|
- BigDecimal currentPassRate = BigDecimal.valueOf(currentPassCount).divide(BigDecimal.valueOf(currentRealityCount),4,BigDecimal.ROUND_HALF_DOWN);
|
|
|
+ BigDecimal currentPassRate = BigDecimal.valueOf(currentPassCount).divide(BigDecimal.valueOf(currentRealityCount), 4, BigDecimal.ROUND_HALF_DOWN);
|
|
|
|
|
|
// 描述统计
|
|
|
double currentMinScore = currentStatistics.getMin();
|
|
@@ -213,39 +214,39 @@ public class AnalyzeForStudentServiceImpl implements AnalyzeForStudentService {
|
|
|
BigDecimal scoreRate;
|
|
|
double standardAvgScore = currentDatasource.stream().collect(Collectors.summarizingDouble(e -> e.getTotalScore().doubleValue())).getAverage();
|
|
|
if (standardAvgScore != 0 && totalScore.compareTo(BigDecimal.ZERO) > 0) {
|
|
|
- scoreRate = BigDecimal.valueOf(standardAvgScore).divide(totalScore,4,BigDecimal.ROUND_HALF_DOWN);
|
|
|
+ scoreRate = BigDecimal.valueOf(standardAvgScore).divide(totalScore, 4, BigDecimal.ROUND_HALF_DOWN);
|
|
|
} else {
|
|
|
scoreRate = BigDecimal.ZERO;
|
|
|
}
|
|
|
// 难度系数保留1位数
|
|
|
- scoreRate = scoreRate.setScale(1,BigDecimal.ROUND_HALF_DOWN); // 难度系数保留1位有效数字
|
|
|
- String difficulty = this.handleLevel(examId,effectiveCourseCode,"难度等级", scoreRate.doubleValue());
|
|
|
+ scoreRate = scoreRate.setScale(1, BigDecimal.ROUND_HALF_DOWN); // 难度系数保留1位有效数字
|
|
|
+ String difficulty = this.handleLevel(examId, effectiveCourseCode, "难度等级", scoreRate.doubleValue());
|
|
|
//--------------------------应届-卷面成绩-----------------------
|
|
|
List<Double> paperCurrentScoreList = currentDatasource.stream().filter(e -> !e.getAbsent()).map(e -> e.getTotalScore().doubleValue()).collect(Collectors.toList());
|
|
|
DoubleSummaryStatistics paperCurrentStatistics = paperCurrentScoreList.stream().collect(Collectors.summarizingDouble(e -> e));
|
|
|
double paperCurrentAvgScore = paperCurrentStatistics.getAverage();
|
|
|
long paperCurrentPassCount = paperCurrentScoreList.stream().filter(e -> e >= passScore.doubleValue()).count();
|
|
|
- BigDecimal paperCurrentPassRate = BigDecimal.valueOf(paperCurrentPassCount).divide(BigDecimal.valueOf(currentRealityCount),4,BigDecimal.ROUND_HALF_DOWN);
|
|
|
+ BigDecimal paperCurrentPassRate = BigDecimal.valueOf(paperCurrentPassCount).divide(BigDecimal.valueOf(currentRealityCount), 4, BigDecimal.ROUND_HALF_DOWN);
|
|
|
|
|
|
/*
|
|
|
学院信息
|
|
|
*/
|
|
|
// TODO: 2021/6/7 考察学院数量算进去往届和缺考的吗
|
|
|
List<TBExamStudent> tbExamStudentList = tbExamStudentService.list(new QueryWrapper<TBExamStudent>().lambda()
|
|
|
- .eq(TBExamStudent::getExamId,examId).eq(TBExamStudent::getCourseCode,effectiveCourseCode));
|
|
|
+ .eq(TBExamStudent::getExamId, examId).eq(TBExamStudent::getCourseCode, effectiveCourseCode));
|
|
|
|
|
|
List<Long> teachCollegeIdList = tbExamStudentList.stream().map(TBExamStudent::getTeachCollegeId).distinct().collect(Collectors.toList());
|
|
|
List<Long> inspectCollegeIdList = tbExamStudentList.stream().map(TBExamStudent::getInspectCollegeId).distinct().collect(Collectors.toList());
|
|
|
- if (teachCollegeIdList.size() != 1){
|
|
|
+ if (teachCollegeIdList.size() != 1) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("该课程有多个开课学院异常");
|
|
|
}
|
|
|
Long teachCollegeId = teachCollegeIdList.get(0);
|
|
|
SysOrg tbSchoolCollege = sysOrgService.getById(teachCollegeId);
|
|
|
String teachCollegeName;
|
|
|
- if (Objects.isNull(tbSchoolCollege)){
|
|
|
+ if (Objects.isNull(tbSchoolCollege)) {
|
|
|
teachCollegeName = SystemConstant.DEFAULT_SIGN;
|
|
|
- }else {
|
|
|
- teachCollegeName= tbSchoolCollege.getName();
|
|
|
+ } else {
|
|
|
+ teachCollegeName = tbSchoolCollege.getName();
|
|
|
}
|
|
|
int inspectCollegeCount = inspectCollegeIdList.size();
|
|
|
|
|
@@ -298,25 +299,25 @@ public class AnalyzeForStudentServiceImpl implements AnalyzeForStudentService {
|
|
|
taExamCourseList.add(taExamCourse);
|
|
|
}
|
|
|
taExamCourseService.saveBatch(taExamCourseList);
|
|
|
- return " 't_a_exam_course' 表构建完毕 " ;
|
|
|
+ return " 't_a_exam_course' 表构建完毕 ";
|
|
|
}
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
@Override
|
|
|
- public String buildAnalyzeExamCourseRecord(Long examId,String courseCode) {
|
|
|
+ public String buildAnalyzeExamCourseRecord(Long examId, String courseCode) {
|
|
|
// 获取本次考试所有考试记录数据源
|
|
|
List<TAExamCourseRecord> taExamCourseRecordDatasource = taExamCourseRecordService.list(new QueryWrapper<TAExamCourseRecord>().lambda()
|
|
|
- .eq(TAExamCourseRecord::getExamId,examId)
|
|
|
- .eq(TAExamCourseRecord::getAbsent,false)
|
|
|
- .eq(TAExamCourseRecord::getStudentCurrent,true));
|
|
|
+ .eq(TAExamCourseRecord::getExamId, examId)
|
|
|
+ .eq(TAExamCourseRecord::getAbsent, false)
|
|
|
+ .eq(TAExamCourseRecord::getStudentCurrent, true));
|
|
|
|
|
|
- List<String> effectiveCourseCodeList = tbExamCourseService.findEffectiveByExamId(examId,courseCode);
|
|
|
+ List<String> effectiveCourseCodeList = tbExamCourseService.findEffectiveByExamId(examId, courseCode);
|
|
|
|
|
|
for (String effectiveCourseCode : effectiveCourseCodeList) {
|
|
|
List<TAExamCourse> taExamCourseList = taExamCourseService.list(new QueryWrapper<TAExamCourse>().lambda()
|
|
|
- .eq(TAExamCourse::getExamId,examId)
|
|
|
- .eq(TAExamCourse::getCourseCode,effectiveCourseCode));
|
|
|
- if (taExamCourseList.size() != 1){
|
|
|
+ .eq(TAExamCourse::getExamId, examId)
|
|
|
+ .eq(TAExamCourse::getCourseCode, effectiveCourseCode));
|
|
|
+ if (taExamCourseList.size() != 1) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("考试课程分析数据获取失败");
|
|
|
}
|
|
|
TAExamCourse taExamCourse = taExamCourseList.get(0);
|
|
@@ -330,15 +331,15 @@ public class AnalyzeForStudentServiceImpl implements AnalyzeForStudentService {
|
|
|
long sameCount = dataSource.stream().filter(e -> e.getTotalScore().compareTo(totalScore) == 0).count(); // 和我相同的人数
|
|
|
int totalCount = dataSource.size(); //总人数
|
|
|
// 标准回归系数
|
|
|
- BigDecimal standardizedCoefficients = (taExamCourseRecord.getAssignedScore().subtract(avgScore)).divide(standardDeviation,4,BigDecimal.ROUND_HALF_DOWN);
|
|
|
+ BigDecimal standardizedCoefficients = (taExamCourseRecord.getAssignedScore().subtract(avgScore)).divide(standardDeviation, 4, BigDecimal.ROUND_HALF_DOWN);
|
|
|
|
|
|
- int percentGrade = this.handlePercentGrade(BigDecimal.valueOf(lowCount),BigDecimal.valueOf(sameCount),BigDecimal.valueOf(totalCount));
|
|
|
+ int percentGrade = this.handlePercentGrade(BigDecimal.valueOf(lowCount), BigDecimal.valueOf(sameCount), BigDecimal.valueOf(totalCount));
|
|
|
taExamCourseRecord.setPercentGrade(percentGrade);
|
|
|
|
|
|
- String scoreLevel = this.handleLevel(examId,effectiveCourseCode,"百分等级",percentGrade);
|
|
|
+ String scoreLevel = this.handleLevel(examId, effectiveCourseCode, "百分等级", percentGrade);
|
|
|
taExamCourseRecord.setScoreLevel(scoreLevel);
|
|
|
taExamCourseRecord.setStandardizedCoefficients(standardizedCoefficients);
|
|
|
- this.buildColData(taExamCourseRecord,dataSource); // 总成绩在学院的排名、排名等级档位、超过学院百分比
|
|
|
+ this.buildColData(taExamCourseRecord, dataSource); // 总成绩在学院的排名、排名等级档位、超过学院百分比
|
|
|
}
|
|
|
taExamCourseRecordService.saveOrUpdateBatch(dataSource);
|
|
|
}
|
|
@@ -349,15 +350,15 @@ public class AnalyzeForStudentServiceImpl implements AnalyzeForStudentService {
|
|
|
@Override
|
|
|
public String buildAnalyzeExamCourseCollegeInspect(Long examId, String courseCode) {
|
|
|
List<TAExamCourseRecord> recordDatasource = taExamCourseRecordService.list(new QueryWrapper<TAExamCourseRecord>().lambda()
|
|
|
- .eq(TAExamCourseRecord::getExamId,examId));
|
|
|
+ .eq(TAExamCourseRecord::getExamId, examId));
|
|
|
// 可分析有效课程信息
|
|
|
- List<String> effectiveCourseCodeList = tbExamCourseService.findEffectiveByExamId(examId,courseCode);
|
|
|
+ List<String> effectiveCourseCodeList = tbExamCourseService.findEffectiveByExamId(examId, courseCode);
|
|
|
List<TAExamCourseCollegeInspect> inspectCollegeList = new ArrayList<>();
|
|
|
|
|
|
for (String effectiveCourseCode : effectiveCourseCodeList) {
|
|
|
// 删除原有数据
|
|
|
taExamCourseCollegeInspectService.remove(new QueryWrapper<TAExamCourseCollegeInspect>().lambda()
|
|
|
- .eq(TAExamCourseCollegeInspect::getExamId,examId).eq(TAExamCourseCollegeInspect::getCourseCode,effectiveCourseCode));
|
|
|
+ .eq(TAExamCourseCollegeInspect::getExamId, examId).eq(TAExamCourseCollegeInspect::getCourseCode, effectiveCourseCode));
|
|
|
|
|
|
// 本课程下所有应届考生考生记录
|
|
|
List<TAExamCourseRecord> recordCourseCurrentDatasource = recordDatasource.stream()
|
|
@@ -387,7 +388,7 @@ public class AnalyzeForStudentServiceImpl implements AnalyzeForStudentService {
|
|
|
double lowerQuartile = MathUtil.calculateQuantile(assignedScoreList, QuantileEnum.LOWER_QUARTILE.getValue());
|
|
|
|
|
|
// TODO: 2021/6/7 缺考的学院信息处理
|
|
|
- if (effectiveList.size() == 0){
|
|
|
+ if (effectiveList.size() == 0) {
|
|
|
minScore = 0;
|
|
|
maxScore = 0;
|
|
|
avgScore = 0;
|
|
@@ -438,16 +439,16 @@ public class AnalyzeForStudentServiceImpl implements AnalyzeForStudentService {
|
|
|
@Override
|
|
|
public String buildAnalyzeExamCourseClazz(Long examId, String courseCode) {
|
|
|
List<TAExamCourseRecord> recordDatasource = taExamCourseRecordService.list(new QueryWrapper<TAExamCourseRecord>().lambda()
|
|
|
- .eq(TAExamCourseRecord::getExamId,examId));
|
|
|
+ .eq(TAExamCourseRecord::getExamId, examId));
|
|
|
// 可分析有效课程信息
|
|
|
- List<String> effectiveCourseCodeList = tbExamCourseService.findEffectiveByExamId(examId,courseCode);
|
|
|
+ List<String> effectiveCourseCodeList = tbExamCourseService.findEffectiveByExamId(examId, courseCode);
|
|
|
|
|
|
List<TAExamCourseClazz> taExamCourseClazzList = new ArrayList<>();
|
|
|
for (String effectiveCourseCode : effectiveCourseCodeList) {
|
|
|
// 删除原有数据
|
|
|
taExamCourseClazzService.remove(new QueryWrapper<TAExamCourseClazz>().lambda()
|
|
|
- .eq(TAExamCourseClazz::getExamId,examId)
|
|
|
- .eq(TAExamCourseClazz::getCourseCode,effectiveCourseCode));
|
|
|
+ .eq(TAExamCourseClazz::getExamId, examId)
|
|
|
+ .eq(TAExamCourseClazz::getCourseCode, effectiveCourseCode));
|
|
|
|
|
|
List<TAExamCourseRecord> recordCourseCurrentDatasource = recordDatasource.stream()
|
|
|
.filter(e -> effectiveCourseCode.equals(e.getCourseCode()) && e.getStudentCurrent()).collect(Collectors.toList());
|
|
@@ -472,20 +473,20 @@ public class AnalyzeForStudentServiceImpl implements AnalyzeForStudentService {
|
|
|
double avgScore = doubleSummaryStatistics.getAverage();
|
|
|
|
|
|
List<TBExamStudent> tbExamStudentList = tbExamStudentService.list(new QueryWrapper<TBExamStudent>().lambda()
|
|
|
- .eq(TBExamStudent::getExamId,examId)
|
|
|
- .eq(TBExamStudent::getCourseCode,effectiveCourseCode)
|
|
|
- .eq(TBExamStudent::getClazzId,clazzId));
|
|
|
+ .eq(TBExamStudent::getExamId, examId)
|
|
|
+ .eq(TBExamStudent::getCourseCode, effectiveCourseCode)
|
|
|
+ .eq(TBExamStudent::getClazzId, clazzId));
|
|
|
List<Long> teachCollegeIdList = tbExamStudentList.stream().map(TBExamStudent::getTeachCollegeId).distinct().collect(Collectors.toList());
|
|
|
String collegeName = "";
|
|
|
for (Long collegeId : teachCollegeIdList) {
|
|
|
SysOrg tbSchoolCollege = sysOrgService.getById(collegeId);
|
|
|
- if (Objects.isNull(tbSchoolCollege)){
|
|
|
+ if (Objects.isNull(tbSchoolCollege)) {
|
|
|
collegeName = collegeName + SystemConstant.DEFAULT_SIGN + ",";
|
|
|
} else {
|
|
|
collegeName = collegeName + tbSchoolCollege.getName() + ",";
|
|
|
}
|
|
|
}
|
|
|
- collegeName = collegeName.substring(0,collegeName.length() - 1);
|
|
|
+ collegeName = collegeName.substring(0, collegeName.length() - 1);
|
|
|
|
|
|
TAExamCourseClazz taExamCourseClazz = new TAExamCourseClazz();
|
|
|
taExamCourseClazz.setId(SystemConstant.getDbUuid());
|
|
@@ -512,10 +513,10 @@ public class AnalyzeForStudentServiceImpl implements AnalyzeForStudentService {
|
|
|
@Override
|
|
|
public String AnalyzePointScoreRate(Long examId, String courseCode) throws Exception {
|
|
|
// 可分析有效课程信息
|
|
|
- List<String> effectiveCourseCodeList = tbExamCourseService.findEffectiveByExamId(examId,courseCode);
|
|
|
+ List<String> effectiveCourseCodeList = tbExamCourseService.findEffectiveByExamId(examId, courseCode);
|
|
|
|
|
|
List<TAExamCourseRecord> dataSource = taExamCourseRecordService.list(new QueryWrapper<TAExamCourseRecord>().lambda()
|
|
|
- .eq(TAExamCourseRecord::getExamId,examId));
|
|
|
+ .eq(TAExamCourseRecord::getExamId, examId));
|
|
|
|
|
|
// 循环进入每次考试课程下
|
|
|
for (String effectiveCourseCode : effectiveCourseCodeList) {
|
|
@@ -525,31 +526,31 @@ public class AnalyzeForStudentServiceImpl implements AnalyzeForStudentService {
|
|
|
|
|
|
// 考察点数据源
|
|
|
List<TBDimension> dimensionDatasource = tbDimensionService.list(new QueryWrapper<TBDimension>().lambda()
|
|
|
- .eq(TBDimension::getExamId,examId)
|
|
|
- .eq(TBDimension::getCourseCode,courseCode));
|
|
|
+ .eq(TBDimension::getExamId, examId)
|
|
|
+ .eq(TBDimension::getCourseCode, courseCode));
|
|
|
|
|
|
- if (dimensionDatasource.size() < 1){
|
|
|
+ if (dimensionDatasource.size() < 1) {
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
// 删除原数据
|
|
|
taExamCourseDioService.remove(new QueryWrapper<TAExamCourseDio>().lambda()
|
|
|
- .eq(TAExamCourseDio::getExamId,examId)
|
|
|
- .eq(TAExamCourseDio::getCourseCode,effectiveCourseCode));
|
|
|
+ .eq(TAExamCourseDio::getExamId, examId)
|
|
|
+ .eq(TAExamCourseDio::getCourseCode, effectiveCourseCode));
|
|
|
|
|
|
taExamCourseRecordDioService.remove(new QueryWrapper<TAExamCourseRecordDio>().lambda()
|
|
|
- .eq(TAExamCourseRecordDio::getExamId,examId)
|
|
|
- .eq(TAExamCourseRecordDio::getCourseCode,effectiveCourseCode));
|
|
|
+ .eq(TAExamCourseRecordDio::getExamId, examId)
|
|
|
+ .eq(TAExamCourseRecordDio::getCourseCode, effectiveCourseCode));
|
|
|
|
|
|
taExamCourseRecordModService.remove(new QueryWrapper<TAExamCourseRecordMod>().lambda()
|
|
|
- .eq(TAExamCourseRecordMod::getExamId,examId)
|
|
|
- .eq(TAExamCourseRecordMod::getCourseCode,courseCode));
|
|
|
+ .eq(TAExamCourseRecordMod::getExamId, examId)
|
|
|
+ .eq(TAExamCourseRecordMod::getCourseCode, courseCode));
|
|
|
|
|
|
List<TBPaper> tbPaperList = tbPaperService.list(new QueryWrapper<TBPaper>().lambda()
|
|
|
- .eq(TBPaper::getExamId,examId)
|
|
|
- .eq(TBPaper::getCourseCode,courseCode));
|
|
|
+ .eq(TBPaper::getExamId, examId)
|
|
|
+ .eq(TBPaper::getCourseCode, courseCode));
|
|
|
|
|
|
- if (tbPaperList.size() == 0){
|
|
|
+ if (tbPaperList.size() == 0) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("试卷基础数据查找失败");
|
|
|
}
|
|
|
for (TBPaper tbPaper : tbPaperList) {
|
|
@@ -557,18 +558,18 @@ public class AnalyzeForStudentServiceImpl implements AnalyzeForStudentService {
|
|
|
Long paperId = tbPaper.getId();
|
|
|
// 试卷结构数据源
|
|
|
List<TBPaperStruct> tbPaperStructList = tbPaperStructService.list(new QueryWrapper<TBPaperStruct>().lambda()
|
|
|
- .eq(TBPaperStruct::getPaperId,paperId));
|
|
|
- if (tbPaperStructList.size() == 0){
|
|
|
+ .eq(TBPaperStruct::getPaperId, paperId));
|
|
|
+ if (tbPaperStructList.size() == 0) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("试卷结构数据查找失败");
|
|
|
}
|
|
|
// 该试卷下所有考生作答数据
|
|
|
List<BasicAnswerDto> answerDtoList = tbAnswerService.findByPaperId(paperId);
|
|
|
- if (answerDtoList.size() == 0){
|
|
|
+ if (answerDtoList.size() == 0) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("试卷id为[" + paperId + "]的考生作答详细记录不存在");
|
|
|
}
|
|
|
|
|
|
// 5.计算每个考察点所对应的题目集合
|
|
|
- Map<String, List<TBPaperStruct>> pointToPaper = this.handlePointToPaper(dimensionDatasource, tbPaperStructList, examId,courseCode);
|
|
|
+ Map<String, List<TBPaperStruct>> pointToPaper = this.handlePointToPaper(dimensionDatasource, tbPaperStructList, examId, courseCode);
|
|
|
|
|
|
// 计算每个模块对应的题目集合
|
|
|
Map<String, List<TBPaperStruct>> moduleToPaper = this.handleModuleToPaper(dimensionDatasource, tbPaperStructList, examId, courseCode);
|
|
@@ -589,7 +590,7 @@ public class AnalyzeForStudentServiceImpl implements AnalyzeForStudentService {
|
|
|
List<BasicAnswerDto> oneStudentAnswerDetailDataSource = answerDtoList.stream()
|
|
|
.filter(e -> taExamCourseRecord.getExamRecordId().equals(e.getExamRecordId()))
|
|
|
.collect(Collectors.toList());
|
|
|
- if (oneStudentAnswerDetailDataSource.size() == 0){
|
|
|
+ if (oneStudentAnswerDetailDataSource.size() == 0) {
|
|
|
continue; // 当AB卷时,examPaperTikDataSource还是整体数据,所以会匹配不到,匹配不到的说明不是本套试卷,因此匹配不到的不能处理。
|
|
|
}
|
|
|
// 考察点得分率
|
|
@@ -641,7 +642,7 @@ public class AnalyzeForStudentServiceImpl implements AnalyzeForStudentService {
|
|
|
taExamCourseRecordDio.setDimensionCode(dimensionCode);
|
|
|
taExamCourseRecordDio.setStudentScore(BigDecimal.valueOf(studentScore));
|
|
|
taExamCourseRecordDio.setScoreRate(BigDecimal.valueOf(rate));
|
|
|
- taExamCourseRecordDio.setProficiency(this.handleModuleProficiency(examId,effectiveCourseCode, dimensionType, rate));
|
|
|
+ taExamCourseRecordDio.setProficiency(this.handleModuleProficiency(examId, effectiveCourseCode, dimensionType, rate));
|
|
|
taExamCourseRecordDio.setInspectCollegeId(inspectCollegeId);
|
|
|
taExamCourseRecordDio.setInspectCollegeName(inspectCollegeName);
|
|
|
taExamCourseRecordDioList.add(taExamCourseRecordDio);
|
|
@@ -686,7 +687,7 @@ public class AnalyzeForStudentServiceImpl implements AnalyzeForStudentService {
|
|
|
taExamCourseRecordMod.setTotalScore(BigDecimal.valueOf(studentScore));
|
|
|
taExamCourseRecordMod.setScoreRate(BigDecimal.valueOf(rate));
|
|
|
taExamCourseRecordMod.setFullScore(BigDecimal.valueOf(totalScore));
|
|
|
- taExamCourseRecordMod.setProficiency(this.handleModuleProficiency(examId,effectiveCourseCode,s,rate));
|
|
|
+ taExamCourseRecordMod.setProficiency(this.handleModuleProficiency(examId, effectiveCourseCode, s, rate));
|
|
|
taExamCourseRecordMod.setInspectCollegeId(inspectCollegeId);
|
|
|
taExamCourseRecordMod.setInspectCollegeName(inspectCollegeName);
|
|
|
taExamCourseRecordMod.setStudentId(taExamCourseRecord.getStudentId());
|
|
@@ -739,11 +740,11 @@ public class AnalyzeForStudentServiceImpl implements AnalyzeForStudentService {
|
|
|
}
|
|
|
|
|
|
List<TAExamCourseRecordMod> examCourseRecordModList = taExamCourseRecordModService.list(new QueryWrapper<TAExamCourseRecordMod>().lambda()
|
|
|
- .eq(TAExamCourseRecordMod::getExamId,examId)
|
|
|
- .eq(TAExamCourseRecordMod::getCourseCode,effectiveCourseCode));
|
|
|
+ .eq(TAExamCourseRecordMod::getExamId, examId)
|
|
|
+ .eq(TAExamCourseRecordMod::getCourseCode, effectiveCourseCode));
|
|
|
|
|
|
// 计算该考生在该模块得分率在该学院排名
|
|
|
- List<TBModuleConfig> tbModuleConfigList = tbModuleConfigService.findDistinctModuleInfoByExamIdAndCourseCode(examId,effectiveCourseCode);
|
|
|
+ List<TBModuleConfig> tbModuleConfigList = tbModuleConfigService.findDistinctModuleInfoByExamIdAndCourseCode(examId, effectiveCourseCode);
|
|
|
for (TAExamCourseRecordMod taExamCourseRecordMod : examCourseRecordModList) {
|
|
|
String moduleType = taExamCourseRecordMod.getModuleType();
|
|
|
Long myCollegeId = taExamCourseRecordMod.getInspectCollegeId();
|
|
@@ -754,7 +755,7 @@ public class AnalyzeForStudentServiceImpl implements AnalyzeForStudentService {
|
|
|
|
|
|
|
|
|
BigDecimal myScoreRate = taExamCourseRecordMod.getScoreRate();
|
|
|
- double myNumber = sameColModuleList.stream().filter(e -> e.getScoreRate().compareTo(myScoreRate) > 0 ).count() + 1; //我在学院的排名
|
|
|
+ double myNumber = sameColModuleList.stream().filter(e -> e.getScoreRate().compareTo(myScoreRate) > 0).count() + 1; //我在学院的排名
|
|
|
taExamCourseRecordMod.setColRank((int) myNumber);
|
|
|
|
|
|
|
|
@@ -762,7 +763,7 @@ public class AnalyzeForStudentServiceImpl implements AnalyzeForStudentService {
|
|
|
double lowCount = sameColModuleList.stream().filter(e -> e.getScoreRate().compareTo(myScoreRate) < 0).count(); // 在学院该模块得分低于我的人数
|
|
|
double sameCount = sameColModuleList.stream().filter(e -> e.getScoreRate().compareTo(myScoreRate) == 0).count(); // 在学院该模块得分等于我的人数
|
|
|
double totalCount = sameColModuleList.size(); // 该学院总人数
|
|
|
- int percentGrade = this.handlePercentGrade(BigDecimal.valueOf(lowCount),BigDecimal.valueOf(sameCount), BigDecimal.valueOf(totalCount)); // 该学生该模块成绩在该学院的百分等级
|
|
|
+ int percentGrade = this.handlePercentGrade(BigDecimal.valueOf(lowCount), BigDecimal.valueOf(sameCount), BigDecimal.valueOf(totalCount)); // 该学生该模块成绩在该学院的百分等级
|
|
|
taExamCourseRecordMod.setPercentGrade(percentGrade);
|
|
|
|
|
|
// 计算模块等级
|
|
@@ -781,7 +782,7 @@ public class AnalyzeForStudentServiceImpl implements AnalyzeForStudentService {
|
|
|
if (!formula.equals(LevelRuleEnum.COLLEGE_RANK.getValue())) { // 当计算规则不为学院排名时,为了方便计算,将minNumber设置为1 使其无效
|
|
|
size = -1;
|
|
|
}
|
|
|
- taExamCourseRecordMod.setLevel(this.handleModuleRankLevel(examId,courseCode,moduleType, value, size));
|
|
|
+ taExamCourseRecordMod.setLevel(this.handleModuleRankLevel(examId, courseCode, moduleType, value, size));
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -795,14 +796,14 @@ public class AnalyzeForStudentServiceImpl implements AnalyzeForStudentService {
|
|
|
@Override
|
|
|
public String buildAnalyzeExamCourseCollegeInspectDio(Long examId, String courseCode) {
|
|
|
// 可分析有效课程信息
|
|
|
- List<String> effectiveCourseCodeList = tbExamCourseService.findEffectiveByExamId(examId,courseCode);
|
|
|
+ List<String> effectiveCourseCodeList = tbExamCourseService.findEffectiveByExamId(examId, courseCode);
|
|
|
for (String effectiveCourseCode : effectiveCourseCodeList) {
|
|
|
// 删除原有数据
|
|
|
taExamCourseCollegeInspectDioService.remove(new QueryWrapper<TAExamCourseCollegeInspectDio>().lambda()
|
|
|
- .eq(TAExamCourseCollegeInspectDio::getExamId,examId)
|
|
|
- .eq(TAExamCourseCollegeInspectDio::getCourseCode,effectiveCourseCode));
|
|
|
+ .eq(TAExamCourseCollegeInspectDio::getExamId, examId)
|
|
|
+ .eq(TAExamCourseCollegeInspectDio::getCourseCode, effectiveCourseCode));
|
|
|
|
|
|
- taExamCourseCollegeInspectDioService.insertByTAExamCourseRecordDio(examId,courseCode);
|
|
|
+ taExamCourseCollegeInspectDioService.insertByTAExamCourseRecordDio(examId, courseCode);
|
|
|
}
|
|
|
return "'t_a_exam_course_college_inspect_dio'表构建完成 ";
|
|
|
}
|
|
@@ -811,26 +812,26 @@ public class AnalyzeForStudentServiceImpl implements AnalyzeForStudentService {
|
|
|
@Override
|
|
|
public String buildAnalyzePaperStruct(Long examId, String courseCode) {
|
|
|
// 可分析有效课程信息
|
|
|
- List<String> effectiveCourseCodeList = tbExamCourseService.findEffectiveByExamId(examId,courseCode);
|
|
|
+ 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){
|
|
|
+ .eq(TBPaper::getExamId, examId).eq(TBPaper::getCourseCode, effectiveCourseCode));
|
|
|
+ if (tbPaperList.size() == 0) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("基础试卷信息异常");
|
|
|
}
|
|
|
// 删除原有数据
|
|
|
taPaperStructService.remove(new QueryWrapper<TAPaperStruct>().lambda()
|
|
|
- .eq(TAPaperStruct::getExamId,examId)
|
|
|
- .eq(TAPaperStruct::getCourseCode,effectiveCourseCode));
|
|
|
+ .eq(TAPaperStruct::getExamId, examId)
|
|
|
+ .eq(TAPaperStruct::getCourseCode, effectiveCourseCode));
|
|
|
List<TAPaperStruct> taPaperStructList = new ArrayList<>();
|
|
|
// 该课程有效试卷结构数据
|
|
|
- List<ValidAnswerDetailDto> answerDetailDtoList = tbAnswerService.findValid(examId,courseCode);
|
|
|
+ List<ValidAnswerDetailDto> answerDetailDtoList = tbAnswerService.findValid(examId, courseCode);
|
|
|
for (TBPaper tbPaper : tbPaperList) {
|
|
|
Long paperId = tbPaper.getId();
|
|
|
String paperType = tbPaper.getPaperType();
|
|
|
List<TBPaperStruct> tbPaperStructList = tbPaperStructService.list(new QueryWrapper<TBPaperStruct>().lambda()
|
|
|
- .eq(TBPaperStruct::getPaperId,paperId));
|
|
|
- if (tbPaperStructList.size() == 0){
|
|
|
+ .eq(TBPaperStruct::getPaperId, paperId));
|
|
|
+ if (tbPaperStructList.size() == 0) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("试卷结构数据异常");
|
|
|
}
|
|
|
for (TBPaperStruct paperStruct : tbPaperStructList) {
|
|
@@ -848,9 +849,9 @@ public class AnalyzeForStudentServiceImpl implements AnalyzeForStudentService {
|
|
|
.collect(Collectors.summarizingDouble(e -> e.getScore().doubleValue()));
|
|
|
BigDecimal fullScore = paperStruct.getFullScore();
|
|
|
double scoreAvg = descriptiveStatistics.getAverage();
|
|
|
- BigDecimal scoreRate = BigDecimal.valueOf(scoreAvg).divide(fullScore,4,BigDecimal.ROUND_HALF_DOWN);
|
|
|
- scoreRate = scoreRate.setScale(1,BigDecimal.ROUND_HALF_DOWN);
|
|
|
- String difficult = this.analyzeDifficult(examId,courseCode, scoreRate.doubleValue());
|
|
|
+ BigDecimal scoreRate = BigDecimal.valueOf(scoreAvg).divide(fullScore, 4, BigDecimal.ROUND_HALF_DOWN);
|
|
|
+ scoreRate = scoreRate.setScale(1, BigDecimal.ROUND_HALF_DOWN);
|
|
|
+ String difficult = this.analyzeDifficult(examId, courseCode, scoreRate.doubleValue());
|
|
|
|
|
|
double validity = this.calculateValidity(oneQuestionAnswerDetailList, fullScore.doubleValue());
|
|
|
|
|
@@ -890,22 +891,22 @@ public class AnalyzeForStudentServiceImpl implements AnalyzeForStudentService {
|
|
|
@Override
|
|
|
public String buildExamPaperDifficult(Long examId, String courseCode) {
|
|
|
// 可分析有效课程信息
|
|
|
- List<String> effectiveCourseCodeList = tbExamCourseService.findEffectiveByExamId(examId,courseCode);
|
|
|
+ List<String> effectiveCourseCodeList = tbExamCourseService.findEffectiveByExamId(examId, courseCode);
|
|
|
|
|
|
for (String effectiveCourseCode : effectiveCourseCodeList) {
|
|
|
taExamCourseDifficultService.remove(new QueryWrapper<TAExamCourseDifficult>().lambda()
|
|
|
- .eq(TAExamCourseDifficult::getExamId,examId)
|
|
|
- .eq(TAExamCourseDifficult::getCourseCode,courseCode));
|
|
|
+ .eq(TAExamCourseDifficult::getExamId, examId)
|
|
|
+ .eq(TAExamCourseDifficult::getCourseCode, courseCode));
|
|
|
|
|
|
List<TAExamCourseDifficult> taExamCourseDifficultList = new ArrayList<>();
|
|
|
|
|
|
List<TBCommonLevelConfig> configLevelDatasource = tbCommonLevelConfigService.list(new QueryWrapper<TBCommonLevelConfig>().lambda()
|
|
|
- .eq(TBCommonLevelConfig::getExamId,examId).eq(TBCommonLevelConfig::getCourseCode,effectiveCourseCode));// 该科目试题难度情况数据源
|
|
|
+ .eq(TBCommonLevelConfig::getExamId, examId).eq(TBCommonLevelConfig::getCourseCode, effectiveCourseCode));// 该科目试题难度情况数据源
|
|
|
|
|
|
List<TAPaperStruct> questionDatasource = taPaperStructService.list(new QueryWrapper<TAPaperStruct>().lambda()
|
|
|
- .eq(TAPaperStruct::getExamId,examId).eq(TAPaperStruct::getCourseCode,effectiveCourseCode));// 该科目试题情况数据源
|
|
|
+ .eq(TAPaperStruct::getExamId, examId).eq(TAPaperStruct::getCourseCode, effectiveCourseCode));// 该科目试题情况数据源
|
|
|
|
|
|
- LinkedList<AnswerDetailBean> answerDetailDatasource = tbAnswerService.findValidAnswerDetailWithPap(examId,courseCode);
|
|
|
+ LinkedList<AnswerDetailBean> answerDetailDatasource = tbAnswerService.findValidAnswerDetailWithPap(examId, courseCode);
|
|
|
Set<Long> paperTypeList = questionDatasource.stream().map(TAPaperStruct::getPaperId).collect(Collectors.toSet());
|
|
|
|
|
|
for (Long paperId : paperTypeList) {
|
|
@@ -927,11 +928,11 @@ public class AnalyzeForStudentServiceImpl implements AnalyzeForStudentService {
|
|
|
|
|
|
// 学院id集合
|
|
|
List<Long> collegeIdList = taExamCourseRecordService.list(new QueryWrapper<TAExamCourseRecord>().lambda()
|
|
|
- .eq(TAExamCourseRecord::getExamId,examId)
|
|
|
- .eq(TAExamCourseRecord::getCourseCode,courseCode)
|
|
|
- .eq(TAExamCourseRecord::getPaperId,paperId)
|
|
|
- .eq(TAExamCourseRecord::getAbsent,false)
|
|
|
- .eq(TAExamCourseRecord::getStudentCurrent,true))
|
|
|
+ .eq(TAExamCourseRecord::getExamId, examId)
|
|
|
+ .eq(TAExamCourseRecord::getCourseCode, courseCode)
|
|
|
+ .eq(TAExamCourseRecord::getPaperId, paperId)
|
|
|
+ .eq(TAExamCourseRecord::getAbsent, false)
|
|
|
+ .eq(TAExamCourseRecord::getStudentCurrent, true))
|
|
|
.stream()
|
|
|
.map(TAExamCourseRecord::getInspectCollegeId).distinct()
|
|
|
.collect(Collectors.toList());
|
|
@@ -976,11 +977,11 @@ public class AnalyzeForStudentServiceImpl implements AnalyzeForStudentService {
|
|
|
public String buildAnalyzeExamTotal(Long examId) {
|
|
|
// 删除原数据
|
|
|
taExamTotalService.remove(new QueryWrapper<TAExamTotal>().lambda()
|
|
|
- .eq(TAExamTotal::getExamId,examId));
|
|
|
+ .eq(TAExamTotal::getExamId, examId));
|
|
|
|
|
|
// 数据源
|
|
|
List<TAExamCourseRecord> taExamCourseRecordList = taExamCourseRecordService.list(new QueryWrapper<TAExamCourseRecord>().lambda()
|
|
|
- .eq(TAExamCourseRecord::getExamId,examId));
|
|
|
+ .eq(TAExamCourseRecord::getExamId, examId));
|
|
|
|
|
|
//考察学院
|
|
|
// TODO: 2021/6/8 是否计算只有缺考的学院 是否计算只有往届的学院
|
|
@@ -989,13 +990,13 @@ public class AnalyzeForStudentServiceImpl implements AnalyzeForStudentService {
|
|
|
// 考察学院数量
|
|
|
int collegeCount = inspectCollegeInfo.size();
|
|
|
String inspectCollegeNames = "";
|
|
|
- if (collegeCount > 0){
|
|
|
+ if (collegeCount > 0) {
|
|
|
for (Long inspectCollegeId : inspectCollegeInfo) {
|
|
|
SysOrg college = sysOrgService.getById(inspectCollegeId);
|
|
|
inspectCollegeNames = inspectCollegeNames + college.getName() + "、";
|
|
|
}
|
|
|
// 考察学院名称
|
|
|
- inspectCollegeNames = inspectCollegeNames.substring(0,inspectCollegeNames.length() - 1);
|
|
|
+ inspectCollegeNames = inspectCollegeNames.substring(0, inspectCollegeNames.length() - 1);
|
|
|
}
|
|
|
|
|
|
// 课程
|
|
@@ -1049,18 +1050,18 @@ public class AnalyzeForStudentServiceImpl implements AnalyzeForStudentService {
|
|
|
@Override
|
|
|
public String buildAnalyzeExamCourseCollegeTeacher(Long examId, String courseCode) {
|
|
|
// 可分析有效课程信息
|
|
|
- List<String> effectiveCourseCodeList = tbExamCourseService.findEffectiveByExamId(examId,courseCode);
|
|
|
+ List<String> effectiveCourseCodeList = tbExamCourseService.findEffectiveByExamId(examId, courseCode);
|
|
|
for (String effectiveCourseCode : effectiveCourseCodeList) {
|
|
|
// 删除该课程原有分析
|
|
|
taExamCourseCollegeTeacherService.remove(new QueryWrapper<TAExamCourseCollegeTeacher>().lambda()
|
|
|
- .eq(TAExamCourseCollegeTeacher::getExamId,examId)
|
|
|
- .eq(TAExamCourseCollegeTeacher::getCourseCode,courseCode));
|
|
|
+ .eq(TAExamCourseCollegeTeacher::getExamId, examId)
|
|
|
+ .eq(TAExamCourseCollegeTeacher::getCourseCode, courseCode));
|
|
|
|
|
|
List<TAExamCourseCollegeTeacher> taExamCourseCollegeTeacherList = new ArrayList<>();
|
|
|
// 整体该课程下数据源
|
|
|
List<TAExamCourseRecord> dataSource = taExamCourseRecordService.list(new QueryWrapper<TAExamCourseRecord>().lambda()
|
|
|
- .eq(TAExamCourseRecord::getExamId,examId)
|
|
|
- .eq(TAExamCourseRecord::getCourseCode,courseCode));
|
|
|
+ .eq(TAExamCourseRecord::getExamId, examId)
|
|
|
+ .eq(TAExamCourseRecord::getCourseCode, courseCode));
|
|
|
|
|
|
// 考察学院
|
|
|
Set<Long> inspectCollegeIdSet = dataSource.stream().map(TAExamCourseRecord::getInspectCollegeId).collect(Collectors.toSet());
|
|
@@ -1087,7 +1088,7 @@ public class AnalyzeForStudentServiceImpl implements AnalyzeForStudentService {
|
|
|
int totalCount = teacherRecordList.size();
|
|
|
List<TAExamCourseRecord> teacherEffectiveList = teacherRecordList.stream().filter(e -> !e.getAbsent()).collect(Collectors.toList());
|
|
|
int realityCount = teacherEffectiveList.size();
|
|
|
- if (realityCount == 0){
|
|
|
+ if (realityCount == 0) {
|
|
|
continue;
|
|
|
}
|
|
|
int absentCount = totalCount - realityCount;
|
|
@@ -1126,12 +1127,12 @@ public class AnalyzeForStudentServiceImpl implements AnalyzeForStudentService {
|
|
|
|
|
|
// 开课学院数据
|
|
|
List<Long> teachCollegeIdList = teacherEffectiveList.stream().map(TAExamCourseRecord::getTeachCollegeId).distinct().collect(Collectors.toList());
|
|
|
- if (teachCollegeIdList.size() > 1){
|
|
|
+ if (teachCollegeIdList.size() > 1) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("有多个开课学院");
|
|
|
}
|
|
|
Long teachCollegeId = teachCollegeIdList.get(0);
|
|
|
String teachCollegeName = SystemConstant.DEFAULT_SIGN;
|
|
|
- if (teachCollegeId > 0){
|
|
|
+ if (teachCollegeId > 0) {
|
|
|
teachCollegeName = sysOrgService.getById(teachCollegeId).getName();
|
|
|
}
|
|
|
|
|
@@ -1181,15 +1182,15 @@ public class AnalyzeForStudentServiceImpl implements AnalyzeForStudentService {
|
|
|
@Override
|
|
|
public String buildAnalyzeExamCourseTeacher(Long examId, String courseCode) {
|
|
|
// 可分析有效课程信息
|
|
|
- List<String> effectiveCourseCodeList = tbExamCourseService.findEffectiveByExamId(examId,courseCode);
|
|
|
+ List<String> effectiveCourseCodeList = tbExamCourseService.findEffectiveByExamId(examId, courseCode);
|
|
|
for (String effectiveCourseCode : effectiveCourseCodeList) {
|
|
|
taExamCourseTeacherService.remove(new QueryWrapper<TAExamCourseTeacher>().lambda()
|
|
|
- .eq(TAExamCourseTeacher::getExamId,examId)
|
|
|
- .eq(TAExamCourseTeacher::getCourseCode,courseCode));
|
|
|
+ .eq(TAExamCourseTeacher::getExamId, examId)
|
|
|
+ .eq(TAExamCourseTeacher::getCourseCode, courseCode));
|
|
|
|
|
|
List<TAExamCourseTeacher> taExamCourseTeacherList = new ArrayList<>();
|
|
|
List<TAExamCourseRecord> dataSource = taExamCourseRecordService.list(new QueryWrapper<TAExamCourseRecord>().lambda()
|
|
|
- .eq(TAExamCourseRecord::getExamId,examId).eq(TAExamCourseRecord::getCourseCode,effectiveCourseCode));
|
|
|
+ .eq(TAExamCourseRecord::getExamId, examId).eq(TAExamCourseRecord::getCourseCode, effectiveCourseCode));
|
|
|
List<TAExamCourseRecord> currentSource = dataSource.stream().filter(TAExamCourseRecord::getStudentCurrent).collect(Collectors.toList());
|
|
|
|
|
|
Set<Long> teacherIdList = currentSource.stream().map(TAExamCourseRecord::getTeacherId).collect(Collectors.toSet());
|
|
@@ -1198,7 +1199,7 @@ public class AnalyzeForStudentServiceImpl implements AnalyzeForStudentService {
|
|
|
.filter(e -> teacherId.equals(e.getTeacherId())).collect(Collectors.toList());
|
|
|
int totalCount = teacherRecordList.size();
|
|
|
List<TAExamCourseRecord> effectiveList = teacherRecordList.stream().filter(e -> !e.getAbsent()).collect(Collectors.toList());
|
|
|
- if (effectiveList.size() == 0){
|
|
|
+ if (effectiveList.size() == 0) {
|
|
|
continue;
|
|
|
}
|
|
|
int realityCount = effectiveList.size();
|
|
@@ -1262,6 +1263,23 @@ public class AnalyzeForStudentServiceImpl implements AnalyzeForStudentService {
|
|
|
return " 't_a_exam_course_teacher'表构建完毕 ";
|
|
|
}
|
|
|
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ @Override
|
|
|
+ public String finishCalculate(Long examId, String courseCode) {
|
|
|
+ // 可分析有效课程信息
|
|
|
+ List<String> effectiveCourseCodeList = tbExamCourseService.findEffectiveByExamId(examId, courseCode);
|
|
|
+ List<TBExamCourse> tbExamCourseList = new ArrayList<>();
|
|
|
+ for (String effectiveCourseCode : effectiveCourseCodeList) {
|
|
|
+ TBExamCourse tbExamCourse = tbExamCourseService.getOne(new QueryWrapper<TBExamCourse>().lambda()
|
|
|
+ .eq(TBExamCourse::getExamId, examId)
|
|
|
+ .eq(TBExamCourse::getCourseCode, effectiveCourseCode));
|
|
|
+ tbExamCourse.setPublishStatus(PublishStatusEnum.UN_PUBLISH);
|
|
|
+ tbExamCourseList.add(tbExamCourse);
|
|
|
+ }
|
|
|
+ tbExamCourseService.updateBatchById(tbExamCourseList);
|
|
|
+ return " 't_b_exam_course' 表状态更新完成";
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 计算百分位等级
|
|
|
*
|
|
@@ -1273,8 +1291,8 @@ public class AnalyzeForStudentServiceImpl implements AnalyzeForStudentService {
|
|
|
private int handlePercentGrade(BigDecimal lowCount, BigDecimal sameCount, BigDecimal totalCount) {
|
|
|
// ((lowCount + sameCount * 0.5) / totalCount) * 100
|
|
|
BigDecimal percentGrade = (lowCount.add(sameCount.multiply(new BigDecimal("0.5"))))
|
|
|
- .divide(totalCount,4,BigDecimal.ROUND_HALF_DOWN).multiply(new BigDecimal("100"));
|
|
|
- int result = percentGrade.setScale(0,BigDecimal.ROUND_HALF_DOWN).intValue();
|
|
|
+ .divide(totalCount, 4, BigDecimal.ROUND_HALF_DOWN).multiply(new BigDecimal("100"));
|
|
|
+ int result = percentGrade.setScale(0, BigDecimal.ROUND_HALF_DOWN).intValue();
|
|
|
if (result == 100) {
|
|
|
result = 99;
|
|
|
}
|
|
@@ -1291,11 +1309,11 @@ public class AnalyzeForStudentServiceImpl implements AnalyzeForStudentService {
|
|
|
* @param value 值
|
|
|
* @return 档位
|
|
|
*/
|
|
|
- private String handleLevel(Long examId,String courseCode, String type, double value) {
|
|
|
+ private String handleLevel(Long examId, String courseCode, String type, double value) {
|
|
|
List<TBCommonLevelConfig> levelList = tbCommonLevelConfigService.list(new QueryWrapper<TBCommonLevelConfig>().lambda()
|
|
|
- .eq(TBCommonLevelConfig::getExamId,examId)
|
|
|
- .eq(TBCommonLevelConfig::getCourseCode,courseCode)
|
|
|
- .eq(TBCommonLevelConfig::getLevelType,type));
|
|
|
+ .eq(TBCommonLevelConfig::getExamId, examId)
|
|
|
+ .eq(TBCommonLevelConfig::getCourseCode, courseCode)
|
|
|
+ .eq(TBCommonLevelConfig::getLevelType, type));
|
|
|
String level = "";
|
|
|
if ("百分等级".equals(type) || "难度等级".equals(type)) {
|
|
|
for (TBCommonLevelConfig levelTemp : levelList) {
|
|
@@ -1329,7 +1347,8 @@ public class AnalyzeForStudentServiceImpl implements AnalyzeForStudentService {
|
|
|
|
|
|
/**
|
|
|
* 构建和学院比较的有关信息(超过学院百分比、排名、排名等级)
|
|
|
- * @param taExamCourseRecord 该学生数据
|
|
|
+ *
|
|
|
+ * @param taExamCourseRecord 该学生数据
|
|
|
* @param taExamCourseRecordList 该课程下学生数据
|
|
|
*/
|
|
|
private void buildColData(TAExamCourseRecord taExamCourseRecord, List<TAExamCourseRecord> taExamCourseRecordList) {
|
|
@@ -1342,7 +1361,7 @@ public class AnalyzeForStudentServiceImpl implements AnalyzeForStudentService {
|
|
|
double lowCount = examRecordSameCol.stream().filter(e -> e.getAssignedScore().compareTo(taExamCourseRecord.getAssignedScore()) < 0).count();
|
|
|
BigDecimal overCollegeRate;
|
|
|
if (examRecordSameCol.size() > 1) {
|
|
|
- overCollegeRate = BigDecimal.valueOf(lowCount).divide(BigDecimal.valueOf(examRecordSameCol.size() - 1),4,BigDecimal.ROUND_HALF_DOWN);
|
|
|
+ overCollegeRate = BigDecimal.valueOf(lowCount).divide(BigDecimal.valueOf(examRecordSameCol.size() - 1), 4, BigDecimal.ROUND_HALF_DOWN);
|
|
|
} else {
|
|
|
overCollegeRate = BigDecimal.ONE;
|
|
|
}
|
|
@@ -1356,9 +1375,8 @@ public class AnalyzeForStudentServiceImpl implements AnalyzeForStudentService {
|
|
|
//计算在学院排名的档次
|
|
|
double size = examRecordSameCol.size();
|
|
|
List<TBCommonRankLevelConfig> tbCommonRankLevelConfigList = tbCommonRankLevelConfigService.list(new QueryWrapper<TBCommonRankLevelConfig>().lambda()
|
|
|
- .eq(TBCommonRankLevelConfig::getExamId,taExamCourseRecord.getExamId())
|
|
|
- .eq(TBCommonRankLevelConfig::getCourseCode,taExamCourseRecord.getCourseCode()));
|
|
|
-
|
|
|
+ .eq(TBCommonRankLevelConfig::getExamId, taExamCourseRecord.getExamId())
|
|
|
+ .eq(TBCommonRankLevelConfig::getCourseCode, taExamCourseRecord.getCourseCode()));
|
|
|
|
|
|
|
|
|
if (tbCommonRankLevelConfigList.size() < 1) {
|
|
@@ -1402,8 +1420,8 @@ public class AnalyzeForStudentServiceImpl implements AnalyzeForStudentService {
|
|
|
*
|
|
|
* @param dimensionDatasource 知识点数据源
|
|
|
* @param tbPaperStructList 试卷结构数据源
|
|
|
- * @param examId 考试id
|
|
|
- * @param courseCode 课程编号
|
|
|
+ * @param examId 考试id
|
|
|
+ * @param courseCode 课程编号
|
|
|
* @return 键值对 (类型-考察点 -> 考察此考察点的题目信息集合) 例如 :”知识模块-A“,List<>
|
|
|
*/
|
|
|
private Map<String, List<TBPaperStruct>> handlePointToPaper(List<TBDimension> dimensionDatasource, List<TBPaperStruct> tbPaperStructList, Long examId, String courseCode) throws NoSuchFieldException, NoSuchMethodException, InvocationTargetException, IllegalAccessException {
|
|
@@ -1411,7 +1429,7 @@ public class AnalyzeForStudentServiceImpl implements AnalyzeForStudentService {
|
|
|
|
|
|
// 模块配置信息
|
|
|
List<TBModuleConfig> tbModuleConfigList = tbModuleConfigService.findDistinctModuleInfoByExamIdAndCourseCode(examId, courseCode);
|
|
|
- if (tbModuleConfigList.size() < 1){
|
|
|
+ if (tbModuleConfigList.size() < 1) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("基础模块信息异常");
|
|
|
}
|
|
|
|
|
@@ -1468,8 +1486,8 @@ public class AnalyzeForStudentServiceImpl implements AnalyzeForStudentService {
|
|
|
*
|
|
|
* @param dimensionDatasource 知识点数据源
|
|
|
* @param tbPaperStructList 试卷结构数据源
|
|
|
- * @param examId 考试id
|
|
|
- * @param courseCode 课程编号
|
|
|
+ * @param examId 考试id
|
|
|
+ * @param courseCode 课程编号
|
|
|
* @return 键值对 (考察模块 -> 考察此考模块的题目信息集合) 例如 :”知识模块“,List<>
|
|
|
* @throws Exception 反射异常
|
|
|
*/
|
|
@@ -1478,7 +1496,7 @@ public class AnalyzeForStudentServiceImpl implements AnalyzeForStudentService {
|
|
|
|
|
|
// 模块配置信息
|
|
|
List<TBModuleConfig> tbModuleConfigList = tbModuleConfigService.findDistinctModuleInfoByExamIdAndCourseCode(examId, courseCode);
|
|
|
- if (tbModuleConfigList.size() < 1){
|
|
|
+ if (tbModuleConfigList.size() < 1) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("基础模块信息异常");
|
|
|
}
|
|
|
|
|
@@ -1525,17 +1543,17 @@ public class AnalyzeForStudentServiceImpl implements AnalyzeForStudentService {
|
|
|
/**
|
|
|
* 根据考察点得分率计算该考察点的熟练度
|
|
|
*
|
|
|
- * @param examId 考试id
|
|
|
- * @param courseCode 课程编号
|
|
|
+ * @param examId 考试id
|
|
|
+ * @param courseCode 课程编号
|
|
|
* @param dimensionType 考察点类型
|
|
|
- * @param value 得分率
|
|
|
+ * @param value 得分率
|
|
|
* @return 熟练度等级
|
|
|
*/
|
|
|
private String handleModuleProficiency(Long examId, String courseCode, String dimensionType, double value) {
|
|
|
List<TBModuleProficiency> tbModuleProficiencyList = tbModuleProficiencyService.list(new QueryWrapper<TBModuleProficiency>().lambda()
|
|
|
- .eq(TBModuleProficiency::getExamId,examId)
|
|
|
- .eq(TBModuleProficiency::getCourseCode,courseCode)
|
|
|
- .eq(TBModuleProficiency::getModuleType,dimensionType));
|
|
|
+ .eq(TBModuleProficiency::getExamId, examId)
|
|
|
+ .eq(TBModuleProficiency::getCourseCode, courseCode)
|
|
|
+ .eq(TBModuleProficiency::getModuleType, dimensionType));
|
|
|
|
|
|
if (tbModuleProficiencyList.size() < 1) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("模块二级维度熟练度配置信息不存在");
|
|
@@ -1570,18 +1588,18 @@ public class AnalyzeForStudentServiceImpl implements AnalyzeForStudentService {
|
|
|
/**
|
|
|
* 处理学生在该模块成绩在该学院的排名等级
|
|
|
*
|
|
|
- * @param examId 考试id
|
|
|
- * @param courseCode 考试编号
|
|
|
- * @param module 模块类型
|
|
|
- * @param value 值(排名、得分率、百分等级)
|
|
|
- * @param size 该学院最低分排名(当其不为排名时,赋值-1)
|
|
|
+ * @param examId 考试id
|
|
|
+ * @param courseCode 考试编号
|
|
|
+ * @param module 模块类型
|
|
|
+ * @param value 值(排名、得分率、百分等级)
|
|
|
+ * @param size 该学院最低分排名(当其不为排名时,赋值-1)
|
|
|
* @return 排名等级编号
|
|
|
*/
|
|
|
private String handleModuleRankLevel(Long examId, String courseCode, String module, double value, double size) {
|
|
|
List<TBModuleConfig> tbModuleConfigList = tbModuleConfigService.list(new QueryWrapper<TBModuleConfig>().lambda()
|
|
|
- .eq(TBModuleConfig::getExamId,examId)
|
|
|
- .eq(TBModuleConfig::getCourseCode,courseCode)
|
|
|
- .eq(TBModuleConfig::getModuleType,module));
|
|
|
+ .eq(TBModuleConfig::getExamId, examId)
|
|
|
+ .eq(TBModuleConfig::getCourseCode, courseCode)
|
|
|
+ .eq(TBModuleConfig::getModuleType, module));
|
|
|
|
|
|
String result = null;
|
|
|
if (size < tbModuleConfigList.size() && size > 0) {
|
|
@@ -1623,16 +1641,16 @@ public class AnalyzeForStudentServiceImpl implements AnalyzeForStudentService {
|
|
|
/**
|
|
|
* 根据得分率计算每道题目的难度
|
|
|
*
|
|
|
- * @param examId 考试id
|
|
|
+ * @param examId 考试id
|
|
|
* @param courseCode 课程编号
|
|
|
- * @param scoreRate 题目得分率
|
|
|
+ * @param scoreRate 题目得分率
|
|
|
* @return 难度
|
|
|
*/
|
|
|
private String analyzeDifficult(Long examId, String courseCode, double scoreRate) {
|
|
|
List<TBCommonLevelConfig> levelConfigList = tbCommonLevelConfigService.list(new QueryWrapper<TBCommonLevelConfig>().lambda()
|
|
|
- .eq(TBCommonLevelConfig::getExamId,examId)
|
|
|
- .eq(TBCommonLevelConfig::getCourseCode,courseCode)
|
|
|
- .eq(TBCommonLevelConfig::getLevelType,"难度等级"));
|
|
|
+ .eq(TBCommonLevelConfig::getExamId, examId)
|
|
|
+ .eq(TBCommonLevelConfig::getCourseCode, courseCode)
|
|
|
+ .eq(TBCommonLevelConfig::getLevelType, "难度等级"));
|
|
|
String difficult = "";
|
|
|
for (TBCommonLevelConfig levelConfig : levelConfigList) {
|
|
|
Map<String, Object> scopeMap = AnalyzeScopeUtil.analyzeScope(levelConfig.getScope());
|