修改各个页面得分逻辑

master
xiaoCJ
parent 236336e70a
commit 45ebb0818a

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

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

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

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

@ -9,5 +9,5 @@ import java.util.List;
public interface IExerciseService { public interface IExerciseService {
List<SysObjectiveQuestionDto> selectObjectQuestionListByChapterId(String chapterId, String userId,String schoolId,String systemOwner) throws IOException; 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; package com.sztzjy.financial_bigdata.service.stu.impl;
import com.sztzjy.financial_bigdata.entity.StuTraining; import cn.hutool.core.util.IdUtil;
import com.sztzjy.financial_bigdata.entity.StuTrainingExample; import com.sztzjy.financial_bigdata.entity.*;
import com.sztzjy.financial_bigdata.entity.StuTrainingWithBLOBs;
import com.sztzjy.financial_bigdata.entity.SysObjectiveQuestion;
import com.sztzjy.financial_bigdata.entity.resource_entity.SysObjectiveQuestions; 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.entity.sys_dto.SysObjectiveQuestionDto;
import com.sztzjy.financial_bigdata.mapper.StuTrainingMapper; import com.sztzjy.financial_bigdata.mapper.StuTrainingMapper;
import com.sztzjy.financial_bigdata.mapper.SysObjectiveQuestionMapper; 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.resourceCenterAPI.ObjectiveApi;
import com.sztzjy.financial_bigdata.service.stu.IExerciseService; import com.sztzjy.financial_bigdata.service.stu.IExerciseService;
import com.sztzjy.financial_bigdata.service.tea.ITeaObjectiveService; import com.sztzjy.financial_bigdata.service.tea.ITeaObjectiveService;
@ -27,6 +27,8 @@ public class ExerciseServiceImpl implements IExerciseService {
ITeaObjectiveService objectiveService; ITeaObjectiveService objectiveService;
@Autowired @Autowired
SysObjectiveQuestionMapper objectiveQuestionMapper; SysObjectiveQuestionMapper objectiveQuestionMapper;
@Autowired
SysWeightMapper sysWeightMapper;
@Override @Override
public List<SysObjectiveQuestionDto> selectObjectQuestionListByChapterId(String chapterId, String userId,String schoolId,String systemOwner) throws IOException { public List<SysObjectiveQuestionDto> selectObjectQuestionListByChapterId(String chapterId, String userId,String schoolId,String systemOwner) throws IOException {
@ -111,12 +113,37 @@ public class ExerciseServiceImpl implements IExerciseService {
} }
@Override @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(); StuTrainingExample example = new StuTrainingExample();
example.createCriteria().andUserIdEqualTo(userId).andChapterIdEqualTo(chapterId); example.createCriteria().andUserIdEqualTo(userId).andChapterIdEqualTo(chapterId);
List<StuTrainingWithBLOBs> stuTrainingWithBLOBs = trainingMapper.selectByExampleWithBLOBs(example); 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){ // if (stuTrainingWithBLOBs.get(0).getLearningEvalAnswer()!=null){
// return false; // return false;
// } // }
@ -133,7 +160,7 @@ public class ExerciseServiceImpl implements IExerciseService {
String answer = objectiveQuestion.getAnswer(); String answer = objectiveQuestion.getAnswer();
stuAnswerList.add(stuAnswer); stuAnswerList.add(stuAnswer);
if(answer.equals(stuAnswer)){ if(answer.equals(stuAnswer)){
learning_eval_score= learning_eval_score.add(objectiveQuestion.getScore()); learning_eval_score= learning_eval_score.add(sysWeight.getLearningEvalDefaultRule());
}else { }else {
errorCount++; errorCount++;
} }

@ -135,10 +135,60 @@ public class StuScoreServiceImpl implements StuScoreService {
BeanUtils.copyProperties(stuTrainingWithBLOBs, stuTrainingDto); // 完成情况和得分 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); setTotalScore(stuTrainingDto);
@ -149,27 +199,27 @@ public class StuScoreServiceImpl implements StuScoreService {
BigDecimal totalScore = BigDecimal.ZERO; BigDecimal totalScore = BigDecimal.ZERO;
if (stuTrainingDto.getKnowledgeSummaryScore() != null) { if (stuTrainingDto.getKnowledgeSummaryScore() != null) {
totalScore = totalScore.add(stuTrainingDto.getKnowledgeSummaryScore()); totalScore = totalScore.add(stuTrainingDto.getKnowledgeSummaryScore());
}else { } else {
stuTrainingDto.setKnowledgeSummaryScore(BigDecimal.ZERO); stuTrainingDto.setKnowledgeSummaryScore(BigDecimal.ZERO);
} }
if (stuTrainingDto.getResourceLearningScore() != null) { if (stuTrainingDto.getResourceLearningScore() != null) {
totalScore = totalScore.add(stuTrainingDto.getResourceLearningScore()); totalScore = totalScore.add(stuTrainingDto.getResourceLearningScore());
}else { } else {
stuTrainingDto.setResourceLearningScore(BigDecimal.ZERO); stuTrainingDto.setResourceLearningScore(BigDecimal.ZERO);
} }
if (stuTrainingDto.getLearningEvalScore() != null) { if (stuTrainingDto.getLearningEvalScore() != null) {
totalScore = totalScore.add(stuTrainingDto.getLearningEvalScore()); totalScore = totalScore.add(stuTrainingDto.getLearningEvalScore());
}else { } else {
stuTrainingDto.setLearningEvalScore(BigDecimal.ZERO); stuTrainingDto.setLearningEvalScore(BigDecimal.ZERO);
} }
if (stuTrainingDto.getCaseStuScore() != null) { if (stuTrainingDto.getCaseStuScore() != null) {
totalScore = totalScore.add(stuTrainingDto.getCaseStuScore()); totalScore = totalScore.add(stuTrainingDto.getCaseStuScore());
}else { } else {
stuTrainingDto.setCaseStuScore(BigDecimal.ZERO); stuTrainingDto.setCaseStuScore(BigDecimal.ZERO);
} }
if (stuTrainingDto.getReportScore() != null) { if (stuTrainingDto.getReportScore() != null) {
totalScore = totalScore.add(stuTrainingDto.getReportScore()); totalScore = totalScore.add(stuTrainingDto.getReportScore());
}else { } else {
stuTrainingDto.setReportScore(BigDecimal.ZERO); stuTrainingDto.setReportScore(BigDecimal.ZERO);
} }
stuTrainingDto.setModuleScore(totalScore); stuTrainingDto.setModuleScore(totalScore);
@ -187,58 +237,4 @@ public class StuScoreServiceImpl implements StuScoreService {
stuTrainingDto.setReportWeight(BigDecimal.valueOf(10)); 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); 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) { private BigDecimal getModuleScore(StuTrainingWithBLOBs stuTrainingWithBLOB, SysWeight sysWeight) {
BigDecimal knowledgeSummaryWeight = sysWeight.getKnowledgeSummaryWeight(); // BigDecimal knowledgeSummaryWeight = sysWeight.getKnowledgeSummaryWeight();
// BigDecimal resourceLearningWeight = sysWeight.getResourceLearningWeight();
BigDecimal learningEvalWeight = sysWeight.getLearningEvalWeight(); BigDecimal learningEvalWeight = sysWeight.getLearningEvalWeight();
BigDecimal resourceLearningWeight = sysWeight.getResourceLearningWeight();
BigDecimal expTrainingWeight = sysWeight.getExpTrainingWeight(); BigDecimal expTrainingWeight = sysWeight.getExpTrainingWeight();
//知识概要和学习资源乘过权重了
BigDecimal knowledgeSummaryScore = Optional.ofNullable(stuTrainingWithBLOB.getKnowledgeSummaryScore()).orElse(BigDecimal.ZERO); BigDecimal knowledgeSummaryScore = Optional.ofNullable(stuTrainingWithBLOB.getKnowledgeSummaryScore()).orElse(BigDecimal.ZERO);
BigDecimal resourceLearningScore = Optional.ofNullable(stuTrainingWithBLOB.getResourceLearningScore()).orElse(BigDecimal.ZERO); BigDecimal resourceLearningScore = Optional.ofNullable(stuTrainingWithBLOB.getResourceLearningScore()).orElse(BigDecimal.ZERO);
BigDecimal learningEvalScore = Optional.ofNullable(stuTrainingWithBLOB.getLearningEvalScore()).orElse(BigDecimal.ZERO); BigDecimal learningEvalScore = Optional.ofNullable(stuTrainingWithBLOB.getLearningEvalScore()).orElse(BigDecimal.ZERO);
BigDecimal expTrainingScore = Optional.ofNullable(stuTrainingWithBLOB.getExpTrainingScore()).orElse(BigDecimal.ZERO); BigDecimal expTrainingScore = Optional.ofNullable(stuTrainingWithBLOB.getExpTrainingScore()).orElse(BigDecimal.ZERO);
knowledgeSummaryScore = knowledgeSummaryWeight.multiply(knowledgeSummaryScore); // knowledgeSummaryScore = knowledgeSummaryWeight.multiply(knowledgeSummaryScore)
learningEvalScore = learningEvalScore.multiply(learningEvalWeight); // resourceLearningScore = resourceLearningScore.multiply(resourceLearningWeight);
resourceLearningScore = resourceLearningScore.multiply(resourceLearningWeight); learningEvalScore = learningEvalScore.multiply(learningEvalWeight).divide(BigDecimal.valueOf(100).setScale(2,RoundingMode.HALF_UP));
expTrainingScore = expTrainingScore.multiply(expTrainingWeight); expTrainingScore = expTrainingScore.multiply(expTrainingWeight).divide(BigDecimal.valueOf(100).setScale(2,RoundingMode.HALF_UP));
return knowledgeSummaryScore.add(resourceLearningScore).add(learningEvalScore).add(expTrainingScore); return knowledgeSummaryScore.add(resourceLearningScore).add(learningEvalScore).add(expTrainingScore);
} }
@ -631,7 +632,7 @@ public class TeaGradeManageServiceImpl implements ITeaGradeManageService {
} }
} }
BigDecimal moduleScore = getModuleScore(training, sysWeight); 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; BigDecimal score = totalScore;

Loading…
Cancel
Save