|
|
|
@ -1,21 +1,27 @@
|
|
|
|
|
package com.sztzjy.financial_bigdata.service.stu.impl;
|
|
|
|
|
|
|
|
|
|
import com.sztzjy.financial_bigdata.entity.StuTrainingWithBLOBs;
|
|
|
|
|
import com.sztzjy.financial_bigdata.entity.SysWeight;
|
|
|
|
|
import com.sztzjy.financial_bigdata.entity.SysWeightExample;
|
|
|
|
|
import com.sztzjy.financial_bigdata.entity.TrainingReport;
|
|
|
|
|
import com.sztzjy.financial_bigdata.entity.*;
|
|
|
|
|
import com.sztzjy.financial_bigdata.entity.resource_entity.SysThreeCatalog;
|
|
|
|
|
import com.sztzjy.financial_bigdata.entity.resource_entity.TestSysCaseQuestionStep;
|
|
|
|
|
import com.sztzjy.financial_bigdata.entity.resource_entity.TestTestSysCaseQuestionStepWithBLOBs;
|
|
|
|
|
import com.sztzjy.financial_bigdata.entity.stu_dto.StuTrainingDto;
|
|
|
|
|
import com.sztzjy.financial_bigdata.mapper.StuTrainingStepRecordMapper;
|
|
|
|
|
import com.sztzjy.financial_bigdata.mapper.SysWeightMapper;
|
|
|
|
|
import com.sztzjy.financial_bigdata.mapper.TrainingReportMapper;
|
|
|
|
|
import com.sztzjy.financial_bigdata.resourceCenterAPI.CaseApi;
|
|
|
|
|
import com.sztzjy.financial_bigdata.resourceCenterAPI.CourseAPI;
|
|
|
|
|
import com.sztzjy.financial_bigdata.service.stu.StuScoreService;
|
|
|
|
|
import com.sztzjy.financial_bigdata.util.ResultEntity;
|
|
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.http.HttpStatus;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
import java.io.IOException;
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
|
|
import java.math.RoundingMode;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @Author xcj
|
|
|
|
@ -27,7 +33,8 @@ public class StuScoreServiceImpl implements StuScoreService {
|
|
|
|
|
private SysWeightMapper sysWeightMapper;
|
|
|
|
|
@Autowired
|
|
|
|
|
TrainingReportMapper trainingReportMapper;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
StuTrainingStepRecordMapper trainingStepRecordMapper;
|
|
|
|
|
|
|
|
|
|
// @Override
|
|
|
|
|
// public StuTrainingDto getScoreByChapterId(String schoolId, String systemOwner, StuTrainingWithBLOBs stuTrainingWithBLOBs, StuTrainingDto stuTrainingDto, SysThreeCatalog sysCourseChapter) {
|
|
|
|
@ -118,7 +125,7 @@ public class StuScoreServiceImpl implements StuScoreService {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public StuTrainingDto getScoreByChapterId(String schoolId, String systemOwner, StuTrainingWithBLOBs stuTrainingWithBLOBs, StuTrainingDto stuTrainingDto, SysThreeCatalog sysCourseChapter) {
|
|
|
|
|
public StuTrainingDto getScoreByChapterId(String schoolId, String systemOwner, StuTrainingWithBLOBs stuTrainingWithBLOBs, StuTrainingDto stuTrainingDto, SysThreeCatalog sysCourseChapter){
|
|
|
|
|
SysWeightExample sysWeightExample = new SysWeightExample();
|
|
|
|
|
sysWeightExample.createCriteria().andCourseIdEqualTo(sysCourseChapter.getTwoId())
|
|
|
|
|
.andSchoolIdEqualTo(schoolId)
|
|
|
|
@ -136,13 +143,43 @@ public class StuScoreServiceImpl implements StuScoreService {
|
|
|
|
|
|
|
|
|
|
// 计算各模块得分
|
|
|
|
|
//知识概要和学习资源得分已经乘过权重,直接返回
|
|
|
|
|
//实验实训得分
|
|
|
|
|
if (stuTrainingDto.getCaseStuScore() == null) {
|
|
|
|
|
stuTrainingDto.setCaseStuScore(BigDecimal.ZERO);
|
|
|
|
|
} else {
|
|
|
|
|
BigDecimal caseStuScore = stuTrainingDto.getCaseStuScore(); //实验实训得分
|
|
|
|
|
|
|
|
|
|
//1.取出章节下的有所案例ID
|
|
|
|
|
List<TestTestSysCaseQuestionStepWithBLOBs> stepList = null;
|
|
|
|
|
try {
|
|
|
|
|
stepList = CaseApi.selectCaseStepListBatchByIdListAndSort(sysCourseChapter.getThreeId());
|
|
|
|
|
} catch (IOException e) {
|
|
|
|
|
throw new RuntimeException("资源中心根据根据案例题IDS批量查询失败");
|
|
|
|
|
}
|
|
|
|
|
List<String> stepIdList = stepList.stream().map(TestSysCaseQuestionStep::getCaseStepId).collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
|
//2.步骤表中所有得分之和
|
|
|
|
|
BigDecimal rightTotalScore = stepList.stream()
|
|
|
|
|
.map(TestTestSysCaseQuestionStepWithBLOBs::getScore)
|
|
|
|
|
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
|
|
|
|
|
|
|
//3.记录表中所有ID得分之和
|
|
|
|
|
StuTrainingStepRecordExample example =new StuTrainingStepRecordExample();
|
|
|
|
|
example.createCriteria().andCaseStepIdIn(stepIdList);
|
|
|
|
|
List<StuTrainingStepRecord> stuTrainingStepRecords = trainingStepRecordMapper.selectByExampleWithBLOBs(example);
|
|
|
|
|
|
|
|
|
|
double stuTotalScore = stuTrainingStepRecords.stream() //学生总共得分
|
|
|
|
|
.map(StuTrainingStepRecord::getScore)
|
|
|
|
|
.mapToDouble(Double::parseDouble)
|
|
|
|
|
.sum();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
BigDecimal expTrainingWeight = stuTrainingDto.getExpTrainingWeight(); //实验实训权重
|
|
|
|
|
BigDecimal weightCaseScore = expTrainingWeight.multiply(caseStuScore).divide(BigDecimal.valueOf(100), 2, RoundingMode.HALF_UP);
|
|
|
|
|
stuTrainingDto.setCaseStuScore(weightCaseScore); //返回乘过权重的
|
|
|
|
|
BigDecimal accuracy = BigDecimal.valueOf(stuTotalScore).divide(rightTotalScore,2,RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).multiply(expTrainingWeight.divide(BigDecimal.valueOf(100)));
|
|
|
|
|
if (accuracy.compareTo(expTrainingWeight)>0){
|
|
|
|
|
accuracy = expTrainingWeight;
|
|
|
|
|
}
|
|
|
|
|
//这里返回正确率 模块得分/模块案例满分*100*权重
|
|
|
|
|
stuTrainingDto.setCaseStuScore(accuracy); //返回乘过权重的
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//学习测评
|
|
|
|
@ -152,6 +189,9 @@ public class StuScoreServiceImpl implements StuScoreService {
|
|
|
|
|
BigDecimal learningEvalScore = stuTrainingDto.getLearningEvalScore();
|
|
|
|
|
BigDecimal learningEvalWeight = stuTrainingDto.getLearningEvalWeight();
|
|
|
|
|
BigDecimal weightLearningEvalScore = learningEvalWeight.multiply(learningEvalScore).divide(BigDecimal.valueOf(100), 2, RoundingMode.HALF_UP);
|
|
|
|
|
if (weightLearningEvalScore.compareTo(learningEvalWeight)>0){
|
|
|
|
|
weightLearningEvalScore = learningEvalWeight;
|
|
|
|
|
}
|
|
|
|
|
stuTrainingDto.setLearningEvalScore(weightLearningEvalScore);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -162,8 +202,11 @@ public class StuScoreServiceImpl implements StuScoreService {
|
|
|
|
|
}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);
|
|
|
|
|
BigDecimal weightresourceLearningScore = resourceLearningWeight.multiply(resourceLearningScore).divide(BigDecimal.valueOf(100), 2, RoundingMode.HALF_UP);
|
|
|
|
|
if (weightresourceLearningScore.compareTo(resourceLearningWeight)>0){
|
|
|
|
|
weightresourceLearningScore = resourceLearningWeight;
|
|
|
|
|
}
|
|
|
|
|
stuTrainingDto.setResourceLearningScore(weightresourceLearningScore);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//知识概要
|
|
|
|
@ -173,6 +216,9 @@ public class StuScoreServiceImpl implements StuScoreService {
|
|
|
|
|
BigDecimal knowledgeSummaryScore = stuTrainingDto.getKnowledgeSummaryScore();
|
|
|
|
|
BigDecimal knowledgeSummaryWeight = stuTrainingDto.getKnowledgeSummaryWeight();
|
|
|
|
|
BigDecimal weightKnowledgeSummaryScore = knowledgeSummaryWeight.multiply(knowledgeSummaryScore).divide(BigDecimal.valueOf(100), 2, RoundingMode.HALF_UP);
|
|
|
|
|
if (weightKnowledgeSummaryScore.compareTo(knowledgeSummaryWeight)>0){
|
|
|
|
|
weightKnowledgeSummaryScore = knowledgeSummaryWeight;
|
|
|
|
|
}
|
|
|
|
|
stuTrainingDto.setKnowledgeSummaryScore(weightKnowledgeSummaryScore);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -186,6 +232,9 @@ public class StuScoreServiceImpl implements StuScoreService {
|
|
|
|
|
BigDecimal reportScore = trainingReport.getTeacherScore();
|
|
|
|
|
BigDecimal reportWeight = stuTrainingDto.getReportWeight();
|
|
|
|
|
BigDecimal weightReportScore = reportScore.multiply(reportWeight).divide(BigDecimal.valueOf(100), 2, RoundingMode.HALF_UP);
|
|
|
|
|
if (weightReportScore.compareTo(reportWeight)>0){
|
|
|
|
|
weightReportScore = reportWeight;
|
|
|
|
|
}
|
|
|
|
|
stuTrainingDto.setReportScore(weightReportScore);
|
|
|
|
|
stuTrainingDto.setReportCompleteStatus("已提交");
|
|
|
|
|
}
|
|
|
|
|