|
|
|
@ -135,10 +135,60 @@ public class StuScoreServiceImpl implements StuScoreService {
|
|
|
|
|
BeanUtils.copyProperties(stuTrainingWithBLOBs, stuTrainingDto); // 完成情况和得分
|
|
|
|
|
|
|
|
|
|
// 计算各模块得分
|
|
|
|
|
calculateModuleScores(stuTrainingWithBLOBs, stuTrainingDto);
|
|
|
|
|
//知识概要和学习资源得分已经乘过权重,直接返回
|
|
|
|
|
if (stuTrainingDto.getCaseStuScore() == null) {
|
|
|
|
|
stuTrainingDto.setCaseStuScore(BigDecimal.ZERO);
|
|
|
|
|
} else {
|
|
|
|
|
BigDecimal caseStuScore = stuTrainingDto.getCaseStuScore(); //实验实训得分
|
|
|
|
|
BigDecimal expTrainingWeight = stuTrainingDto.getExpTrainingWeight(); //实验实训权重
|
|
|
|
|
BigDecimal weightCaseScore = expTrainingWeight.multiply(caseStuScore).divide(BigDecimal.valueOf(100), 2, RoundingMode.HALF_UP);
|
|
|
|
|
stuTrainingDto.setCaseStuScore(weightCaseScore); //返回乘过权重的
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//学习测评
|
|
|
|
|
if (stuTrainingDto.getLearningEvalScore() == null) {
|
|
|
|
|
stuTrainingDto.setLearningEvalScore(BigDecimal.ZERO);
|
|
|
|
|
} else {
|
|
|
|
|
BigDecimal learningEvalScore = stuTrainingDto.getLearningEvalScore();
|
|
|
|
|
BigDecimal learningEvalWeight = stuTrainingDto.getLearningEvalWeight();
|
|
|
|
|
BigDecimal weightLearningEvalScore = learningEvalWeight.multiply(learningEvalScore).divide(BigDecimal.valueOf(100), 2, RoundingMode.HALF_UP);
|
|
|
|
|
stuTrainingDto.setLearningEvalScore(weightLearningEvalScore);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//学习资源
|
|
|
|
|
if (stuTrainingDto.getResourceLearningScore()==null){
|
|
|
|
|
stuTrainingDto.setResourceLearningScore(BigDecimal.ZERO);
|
|
|
|
|
}else {
|
|
|
|
|
BigDecimal resourceLearningScore = stuTrainingDto.getResourceLearningScore();
|
|
|
|
|
BigDecimal resourceLearningWeight = stuTrainingDto.getResourceLearningWeight();
|
|
|
|
|
BigDecimal weightLearningEvalScore = resourceLearningWeight.multiply(resourceLearningScore).divide(BigDecimal.valueOf(100), 2, RoundingMode.HALF_UP);
|
|
|
|
|
stuTrainingDto.setResourceLearningScore(weightLearningEvalScore);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//知识概要
|
|
|
|
|
if (stuTrainingDto.getKnowledgeSummaryScore() == null) {
|
|
|
|
|
stuTrainingDto.setKnowledgeSummaryScore(BigDecimal.ZERO);
|
|
|
|
|
} else {
|
|
|
|
|
BigDecimal knowledgeSummaryScore = stuTrainingDto.getKnowledgeSummaryScore();
|
|
|
|
|
BigDecimal knowledgeSummaryWeight = stuTrainingDto.getKnowledgeSummaryWeight();
|
|
|
|
|
BigDecimal weightKnowledgeSummaryScore = knowledgeSummaryWeight.multiply(knowledgeSummaryScore).divide(BigDecimal.valueOf(100), 2, RoundingMode.HALF_UP);
|
|
|
|
|
stuTrainingDto.setKnowledgeSummaryScore(weightKnowledgeSummaryScore);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 设置报告相关数据
|
|
|
|
|
setReportData(stuTrainingDto, stuTrainingWithBLOBs.getReportId());
|
|
|
|
|
TrainingReport trainingReport = trainingReportMapper.selectByPrimaryKey(stuTrainingWithBLOBs.getReportId());
|
|
|
|
|
if (trainingReport == null) {
|
|
|
|
|
stuTrainingDto.setReportCompleteStatus("未提交");
|
|
|
|
|
stuTrainingDto.setReportScore(BigDecimal.ZERO);
|
|
|
|
|
} else {
|
|
|
|
|
BigDecimal reportScore = trainingReport.getTeacherScore();
|
|
|
|
|
BigDecimal reportWeight = stuTrainingDto.getReportWeight();
|
|
|
|
|
BigDecimal weightReportScore = reportScore.multiply(reportWeight).divide(BigDecimal.valueOf(100), 2, RoundingMode.HALF_UP);
|
|
|
|
|
stuTrainingDto.setReportScore(weightReportScore);
|
|
|
|
|
stuTrainingDto.setReportCompleteStatus("已提交");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//计算模块总得分
|
|
|
|
|
setTotalScore(stuTrainingDto);
|
|
|
|
@ -149,27 +199,27 @@ public class StuScoreServiceImpl implements StuScoreService {
|
|
|
|
|
BigDecimal totalScore = BigDecimal.ZERO;
|
|
|
|
|
if (stuTrainingDto.getKnowledgeSummaryScore() != null) {
|
|
|
|
|
totalScore = totalScore.add(stuTrainingDto.getKnowledgeSummaryScore());
|
|
|
|
|
}else {
|
|
|
|
|
} else {
|
|
|
|
|
stuTrainingDto.setKnowledgeSummaryScore(BigDecimal.ZERO);
|
|
|
|
|
}
|
|
|
|
|
if (stuTrainingDto.getResourceLearningScore() != null) {
|
|
|
|
|
totalScore = totalScore.add(stuTrainingDto.getResourceLearningScore());
|
|
|
|
|
}else {
|
|
|
|
|
} else {
|
|
|
|
|
stuTrainingDto.setResourceLearningScore(BigDecimal.ZERO);
|
|
|
|
|
}
|
|
|
|
|
if (stuTrainingDto.getLearningEvalScore() != null) {
|
|
|
|
|
totalScore = totalScore.add(stuTrainingDto.getLearningEvalScore());
|
|
|
|
|
}else {
|
|
|
|
|
} else {
|
|
|
|
|
stuTrainingDto.setLearningEvalScore(BigDecimal.ZERO);
|
|
|
|
|
}
|
|
|
|
|
if (stuTrainingDto.getCaseStuScore() != null) {
|
|
|
|
|
totalScore = totalScore.add(stuTrainingDto.getCaseStuScore());
|
|
|
|
|
}else {
|
|
|
|
|
} else {
|
|
|
|
|
stuTrainingDto.setCaseStuScore(BigDecimal.ZERO);
|
|
|
|
|
}
|
|
|
|
|
if (stuTrainingDto.getReportScore() != null) {
|
|
|
|
|
totalScore = totalScore.add(stuTrainingDto.getReportScore());
|
|
|
|
|
}else {
|
|
|
|
|
} else {
|
|
|
|
|
stuTrainingDto.setReportScore(BigDecimal.ZERO);
|
|
|
|
|
}
|
|
|
|
|
stuTrainingDto.setModuleScore(totalScore);
|
|
|
|
@ -187,58 +237,4 @@ public class StuScoreServiceImpl implements StuScoreService {
|
|
|
|
|
stuTrainingDto.setReportWeight(BigDecimal.valueOf(10));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void calculateModuleScores(StuTrainingWithBLOBs stuTrainingWithBLOBs, StuTrainingDto stuTrainingDto) {
|
|
|
|
|
stuTrainingDto.setKnowledgeSummaryScore(calculateScore(
|
|
|
|
|
stuTrainingDto.getKnowledgeSummaryDefaultRule(),
|
|
|
|
|
stuTrainingDto.getKnowledgeSummaryWeight(),
|
|
|
|
|
stuTrainingWithBLOBs.getKnowledgeSummaryCompleteStatus()
|
|
|
|
|
));
|
|
|
|
|
|
|
|
|
|
stuTrainingDto.setResourceLearningScore(calculateScore(
|
|
|
|
|
stuTrainingDto.getResourceLearningDefaultRule(),
|
|
|
|
|
stuTrainingDto.getResourceLearningWeight(),
|
|
|
|
|
stuTrainingWithBLOBs.getResourceLearningCompleteStatus()
|
|
|
|
|
));
|
|
|
|
|
|
|
|
|
|
stuTrainingDto.setLearningEvalScore(calculateEvaluationScore(
|
|
|
|
|
stuTrainingDto.getLearningEvalDefaultRule(),
|
|
|
|
|
stuTrainingDto.getLearningEvalWeight(),
|
|
|
|
|
stuTrainingWithBLOBs.getLearningEvalCompleteStatus()
|
|
|
|
|
));
|
|
|
|
|
|
|
|
|
|
stuTrainingDto.setCaseStuScore(calculateEvaluationScore(
|
|
|
|
|
stuTrainingDto.getExpTrainingDefautRule(),
|
|
|
|
|
stuTrainingDto.getExpTrainingWeight(),
|
|
|
|
|
stuTrainingWithBLOBs.getExpTrainingCompleteStatus()
|
|
|
|
|
));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private BigDecimal calculateScore(BigDecimal defaultRule, BigDecimal weight, Integer completeStatus) {
|
|
|
|
|
if (completeStatus != null && completeStatus > 0) {
|
|
|
|
|
BigDecimal score = defaultRule.add(BigDecimal.valueOf((completeStatus - 1) * 10));
|
|
|
|
|
score = score.min(BigDecimal.valueOf(100)); // 确保分数不超过100
|
|
|
|
|
return score.multiply(weight.divide(BigDecimal.valueOf(100), 2, RoundingMode.HALF_UP));
|
|
|
|
|
}
|
|
|
|
|
return BigDecimal.ZERO;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private BigDecimal calculateEvaluationScore(BigDecimal defaultRule, BigDecimal weight, Integer completeStatus) {
|
|
|
|
|
if (completeStatus != null) {
|
|
|
|
|
BigDecimal score = BigDecimal.valueOf(100).subtract(defaultRule.multiply(BigDecimal.valueOf(completeStatus)));
|
|
|
|
|
return score.max(BigDecimal.ZERO).multiply(weight.divide(BigDecimal.valueOf(100), 2, RoundingMode.HALF_UP));
|
|
|
|
|
}
|
|
|
|
|
return BigDecimal.ZERO;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void setReportData(StuTrainingDto stuTrainingDto, String reportId) {
|
|
|
|
|
TrainingReport trainingReport = trainingReportMapper.selectByPrimaryKey(reportId);
|
|
|
|
|
if (trainingReport == null || trainingReport.getTeacherScore() == null) {
|
|
|
|
|
stuTrainingDto.setReportCompleteStatus("未提交");
|
|
|
|
|
stuTrainingDto.setReportScore(null);
|
|
|
|
|
} else {
|
|
|
|
|
stuTrainingDto.setReportCompleteStatus("已提交");
|
|
|
|
|
stuTrainingDto.setReportScore(trainingReport.getTeacherScore());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|