修改各个页面得分逻辑

master
xiaoCJ 3 months ago
parent 236336e70a
commit 45ebb0818a

@ -48,10 +48,13 @@ public class ExerciseLearningEvaluation {
@AnonymousAccess
public ResultEntity commitObjectQuestionList(@RequestBody List<SysObjectiveQuestionDto> objectiveQuestionDtoList,
@RequestParam String userId,
@ApiParam("章节Id")@RequestParam String chapterId,@RequestParam String schoolId,@RequestParam String systemOwner){
@ApiParam("章节Id")@RequestParam String chapterId,
@RequestParam String schoolId,
@RequestParam String systemOwner,
@RequestParam String courseId){
Boolean flag= null;
try {
flag = exerciseService.commitObjectQuestionList(objectiveQuestionDtoList,userId,chapterId, schoolId, systemOwner);
flag = exerciseService.commitObjectQuestionList(objectiveQuestionDtoList,userId,chapterId, schoolId, systemOwner,courseId);
} catch (IOException e) {
return new ResultEntity<>(HttpStatus.BAD_REQUEST, "资源中心客观题主键查询失败");
}

@ -132,8 +132,10 @@ public class StuIndexController {
List<StuClass> stuClassList = stuClassMapper.selectByExample(example);
StuClass stuClass = stuClassList.get(0);
stuUserDto.setClassName(stuClass.getClassName());
stuUserDto.setIpPlace(sysLoginLogs.get(0).getIpAddress());
stuUserDto.setLastIP(sysLoginLogs.get(0).getLoginIp());
if(!sysLoginLogs.isEmpty()){
stuUserDto.setIpPlace(sysLoginLogs.get(0).getIpAddress());
stuUserDto.setLastIP(sysLoginLogs.get(0).getLoginIp());
}
return new ResultEntity<StuUserDto>(stuUserDto);
}

@ -194,12 +194,13 @@ public class StuKnowledgeNote {
stuTrainingWithBLOBs.setKnowledgeSummaryScore(knowledgeSummaryDefaultRule); //老师只能修改这个分值
} else {
int extraMinutes = minutes - 1;
int totalScore = 60 + extraMinutes * 10;
int totalScore = knowledgeSummaryDefaultRule.intValue() + extraMinutes * 10;
knowledgeSummaryDefaultRule = BigDecimal.valueOf(totalScore);
if(knowledgeSummaryDefaultRule.compareTo(BigDecimal.valueOf(100))>0){
knowledgeSummaryDefaultRule= BigDecimal.valueOf(100);
stuTrainingWithBLOBs.setKnowledgeSummaryScore(BigDecimal.valueOf(100));
}else {
stuTrainingWithBLOBs.setKnowledgeSummaryScore(knowledgeSummaryDefaultRule);
}
stuTrainingWithBLOBs.setKnowledgeSummaryScore(knowledgeSummaryDefaultRule);
}
stuTrainingWithBLOBs.setKnowledgeSummaryCompleteStatus(minutes);
stuTrainingMapper.updateByPrimaryKey(stuTrainingWithBLOBs);

@ -80,28 +80,33 @@ public class TeaResourceCenterController {
@ApiOperation("学习资源-算分")
@PostMapping("getResourceScore") //观看资源1分钟得60分,1分钟以下不得分多1分钟加10分。
public ResultEntity<BigDecimal> getScore(@ApiParam("数字 单位分钟") @RequestParam Integer minutes,
@RequestParam String courseId,
@RequestParam String schoolId,
@RequestParam String systemOwner,
@RequestParam String trainingId) {
@RequestParam String courseId,
@RequestParam String schoolId,
@RequestParam String systemOwner,
@RequestParam String trainingId) {
StuTrainingWithBLOBs stuTrainingWithBLOBs = stuTrainingMapper.selectByPrimaryKey(trainingId);
if (stuTrainingWithBLOBs.getKnowledgeSummaryCompleteStatus() != null) {
//不为空直接返回
return new ResultEntity<>(stuTrainingWithBLOBs.getResourceLearningScore());
}
//为空设置
SysWeight sysWeight = iTeaGradeManageService.getSysWeightResultEntity(courseId, schoolId, systemOwner);
BigDecimal resourceLearningDefaultRule = sysWeight.getResourceLearningDefaultRule();
if (stuTrainingWithBLOBs.getResourceLearningCompleteStatus() != null) {
minutes = minutes + stuTrainingWithBLOBs.getResourceLearningCompleteStatus(); //累加时间
}
if (minutes < 1) {
stuTrainingWithBLOBs.setResourceLearningScore(BigDecimal.ZERO);
} else if (minutes == 1) {
stuTrainingWithBLOBs.setResourceLearningScore(resourceLearningDefaultRule); //老师只能修改这个分值
} else {
int extraMinutes = minutes - 1;
int totalScore = 60 + extraMinutes * 10;
int totalScore = resourceLearningDefaultRule.intValue() + extraMinutes * 10;
resourceLearningDefaultRule = BigDecimal.valueOf(totalScore);
stuTrainingWithBLOBs.setResourceLearningScore(resourceLearningDefaultRule);
if (resourceLearningDefaultRule.compareTo(BigDecimal.valueOf(100)) > 0) {
stuTrainingWithBLOBs.setResourceLearningScore(BigDecimal.valueOf(100));
}else {
stuTrainingWithBLOBs.setResourceLearningScore(resourceLearningDefaultRule);
}
}
stuTrainingWithBLOBs.setResourceLearningCompleteStatus(minutes);
stuTrainingMapper.updateByPrimaryKey(stuTrainingWithBLOBs);

@ -9,5 +9,5 @@ import java.util.List;
public interface IExerciseService {
List<SysObjectiveQuestionDto> selectObjectQuestionListByChapterId(String chapterId, String userId,String schoolId,String systemOwner) throws IOException;
Boolean commitObjectQuestionList(List<SysObjectiveQuestionDto> objectiveQuestionDtoList, String userId, String chapterId,String schoolId,String systemOwner) throws IOException;
Boolean commitObjectQuestionList(List<SysObjectiveQuestionDto> objectiveQuestionDtoList, String userId, String chapterId,String schoolId,String systemOwner,String courseId) throws IOException;
}

@ -1,13 +1,13 @@
package com.sztzjy.financial_bigdata.service.stu.impl;
import com.sztzjy.financial_bigdata.entity.StuTraining;
import com.sztzjy.financial_bigdata.entity.StuTrainingExample;
import com.sztzjy.financial_bigdata.entity.StuTrainingWithBLOBs;
import com.sztzjy.financial_bigdata.entity.SysObjectiveQuestion;
import cn.hutool.core.util.IdUtil;
import com.sztzjy.financial_bigdata.entity.*;
import com.sztzjy.financial_bigdata.entity.resource_entity.SysObjectiveQuestions;
import com.sztzjy.financial_bigdata.entity.stu_dto.StuTrainingDto;
import com.sztzjy.financial_bigdata.entity.sys_dto.SysObjectiveQuestionDto;
import com.sztzjy.financial_bigdata.mapper.StuTrainingMapper;
import com.sztzjy.financial_bigdata.mapper.SysObjectiveQuestionMapper;
import com.sztzjy.financial_bigdata.mapper.SysWeightMapper;
import com.sztzjy.financial_bigdata.resourceCenterAPI.ObjectiveApi;
import com.sztzjy.financial_bigdata.service.stu.IExerciseService;
import com.sztzjy.financial_bigdata.service.tea.ITeaObjectiveService;
@ -27,6 +27,8 @@ public class ExerciseServiceImpl implements IExerciseService {
ITeaObjectiveService objectiveService;
@Autowired
SysObjectiveQuestionMapper objectiveQuestionMapper;
@Autowired
SysWeightMapper sysWeightMapper;
@Override
public List<SysObjectiveQuestionDto> selectObjectQuestionListByChapterId(String chapterId, String userId,String schoolId,String systemOwner) throws IOException {
@ -111,12 +113,37 @@ public class ExerciseServiceImpl implements IExerciseService {
}
@Override
public Boolean commitObjectQuestionList(List<SysObjectiveQuestionDto> objectiveQuestionDtoList, String userId, String chapterId,String schoolId,String systemOwner) throws IOException {
public Boolean commitObjectQuestionList(List<SysObjectiveQuestionDto> objectiveQuestionDtoList, String userId, String chapterId,String schoolId,String systemOwner,String courseId) throws IOException {
StuTrainingExample example = new StuTrainingExample();
example.createCriteria().andUserIdEqualTo(userId).andChapterIdEqualTo(chapterId);
List<StuTrainingWithBLOBs> stuTrainingWithBLOBs = trainingMapper.selectByExampleWithBLOBs(example);
SysWeightExample sysWeightExample =new SysWeightExample();
sysWeightExample.createCriteria().andSchoolIdEqualTo(schoolId).andSystemOwnerEqualTo(systemOwner).andCourseIdEqualTo(courseId);
List<SysWeight> sysWeights = sysWeightMapper.selectByExample(sysWeightExample);
SysWeight sysWeight = new SysWeight();
if (sysWeights.isEmpty()){
//设置默认权重
sysWeight.setCourseId(courseId);
sysWeight.setWeightId(IdUtil.randomUUID());
sysWeight.setSchoolId(schoolId);
sysWeight.setSystemOwner(systemOwner);
sysWeight.setKnowledgeSummaryDefaultRule(BigDecimal.valueOf(60)); //知识概要默认计分规则 阅读1分钟得60分,1分钟以下不得分多1分钟加10分。
sysWeight.setResourceLearningDefaultRule(BigDecimal.valueOf(60)); //资源学习默认计分规则 观看资源1分钟得60分,1分钟以下不得分多1分钟加10分。
sysWeight.setLearningEvalDefaultRule(BigDecimal.valueOf(10)); //学习测评默认计分规则 客观题10分每道
sysWeight.setExpTrainingDefautRule(BigDecimal.valueOf(2));//实训题,输错/选错次数扣2分最低0分
sysWeight.setKnowledgeSummaryWeight(BigDecimal.valueOf(5));
sysWeight.setResourceLearningWeight(BigDecimal.valueOf(5));
sysWeight.setLearningEvalWeight(BigDecimal.valueOf(20));
sysWeight.setExpTrainingWeight(BigDecimal.valueOf(60));
sysWeight.setReportWeight(BigDecimal.valueOf(10));
sysWeightMapper.insert(sysWeight);
}else {
sysWeight = sysWeights.get(0);
}
// if (stuTrainingWithBLOBs.get(0).getLearningEvalAnswer()!=null){
// return false;
// }
@ -133,7 +160,7 @@ public class ExerciseServiceImpl implements IExerciseService {
String answer = objectiveQuestion.getAnswer();
stuAnswerList.add(stuAnswer);
if(answer.equals(stuAnswer)){
learning_eval_score= learning_eval_score.add(objectiveQuestion.getScore());
learning_eval_score= learning_eval_score.add(sysWeight.getLearningEvalDefaultRule());
}else {
errorCount++;
}

@ -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());
}
}
}

@ -166,7 +166,7 @@ public class TeaGradeManageServiceImpl implements ITeaGradeManageService {
}
//其他模块算分
BigDecimal moduleScore = getModuleScore(training, sysWeight);
totalScore = moduleScore.add(totalScore).setScale(2,RoundingMode.HALF_UP);
totalScore = moduleScore.add(totalScore).setScale(2, RoundingMode.HALF_UP);
}
//这个综合得分的公式为 各个页面得分*权重 = 单个模块得分 所有模块得分之和/系统章节数 = 综合得分
@ -347,20 +347,21 @@ public class TeaGradeManageServiceImpl implements ITeaGradeManageService {
//计算模块得分
private BigDecimal getModuleScore(StuTrainingWithBLOBs stuTrainingWithBLOB, SysWeight sysWeight) {
BigDecimal knowledgeSummaryWeight = sysWeight.getKnowledgeSummaryWeight();
// BigDecimal knowledgeSummaryWeight = sysWeight.getKnowledgeSummaryWeight();
// BigDecimal resourceLearningWeight = sysWeight.getResourceLearningWeight();
BigDecimal learningEvalWeight = sysWeight.getLearningEvalWeight();
BigDecimal resourceLearningWeight = sysWeight.getResourceLearningWeight();
BigDecimal expTrainingWeight = sysWeight.getExpTrainingWeight();
//知识概要和学习资源乘过权重了
BigDecimal knowledgeSummaryScore = Optional.ofNullable(stuTrainingWithBLOB.getKnowledgeSummaryScore()).orElse(BigDecimal.ZERO);
BigDecimal resourceLearningScore = Optional.ofNullable(stuTrainingWithBLOB.getResourceLearningScore()).orElse(BigDecimal.ZERO);
BigDecimal learningEvalScore = Optional.ofNullable(stuTrainingWithBLOB.getLearningEvalScore()).orElse(BigDecimal.ZERO);
BigDecimal expTrainingScore = Optional.ofNullable(stuTrainingWithBLOB.getExpTrainingScore()).orElse(BigDecimal.ZERO);
knowledgeSummaryScore = knowledgeSummaryWeight.multiply(knowledgeSummaryScore);
learningEvalScore = learningEvalScore.multiply(learningEvalWeight);
resourceLearningScore = resourceLearningScore.multiply(resourceLearningWeight);
expTrainingScore = expTrainingScore.multiply(expTrainingWeight);
// knowledgeSummaryScore = knowledgeSummaryWeight.multiply(knowledgeSummaryScore)
// resourceLearningScore = resourceLearningScore.multiply(resourceLearningWeight);
learningEvalScore = learningEvalScore.multiply(learningEvalWeight).divide(BigDecimal.valueOf(100).setScale(2,RoundingMode.HALF_UP));
expTrainingScore = expTrainingScore.multiply(expTrainingWeight).divide(BigDecimal.valueOf(100).setScale(2,RoundingMode.HALF_UP));
return knowledgeSummaryScore.add(resourceLearningScore).add(learningEvalScore).add(expTrainingScore);
}
@ -631,7 +632,7 @@ public class TeaGradeManageServiceImpl implements ITeaGradeManageService {
}
}
BigDecimal moduleScore = getModuleScore(training, sysWeight);
totalScore = moduleScore.add(totalScore).setScale(2,RoundingMode.HALF_UP);
totalScore = moduleScore.add(totalScore).setScale(2, RoundingMode.HALF_UP);
}
BigDecimal score = totalScore;

Loading…
Cancel
Save