|
|
|
@ -17,6 +17,7 @@ import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
|
|
import java.math.RoundingMode;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -113,53 +114,53 @@ public class TeaGradeManageServiceImpl implements ITeaGradeManageService {
|
|
|
|
|
} else {
|
|
|
|
|
teaExaminationDetailsDto.setExamActualNum(stuStudentExamWithBLOBs.size()); //否则为集合的长度
|
|
|
|
|
for (StuStudentExamWithBLOBs stuStudentExamWithBLOB : stuStudentExamWithBLOBs) { //不为就求分数
|
|
|
|
|
if (stuStudentExamWithBLOB.getTotalScore()==null){
|
|
|
|
|
if (stuStudentExamWithBLOB.getTotalScore() == null) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
BigDecimal score = stuStudentExamWithBLOB.getTotalScore();
|
|
|
|
|
int passThreshold = 60; // 60是及格分数
|
|
|
|
|
int totalStudents = stuStudentExamWithBLOBs.size();
|
|
|
|
|
int totalScore = 0;
|
|
|
|
|
totalScore += score.intValue();
|
|
|
|
|
if (score.intValue() >= passThreshold) {
|
|
|
|
|
passNum++;
|
|
|
|
|
}
|
|
|
|
|
// 更新最高分和最低分
|
|
|
|
|
if (score.intValue() > topScore) {
|
|
|
|
|
topScore = score.intValue();
|
|
|
|
|
}
|
|
|
|
|
if (score.intValue() < lowScore) {
|
|
|
|
|
lowScore = score.intValue();
|
|
|
|
|
}
|
|
|
|
|
BigDecimal score = stuStudentExamWithBLOB.getTotalScore();
|
|
|
|
|
int passThreshold = 60; // 60是及格分数
|
|
|
|
|
int totalStudents = stuStudentExamWithBLOBs.size();
|
|
|
|
|
int totalScore = 0;
|
|
|
|
|
totalScore += score.intValue();
|
|
|
|
|
if (score.intValue() >= passThreshold) {
|
|
|
|
|
passNum++;
|
|
|
|
|
}
|
|
|
|
|
// 更新最高分和最低分
|
|
|
|
|
if (score.intValue() > topScore) {
|
|
|
|
|
topScore = score.intValue();
|
|
|
|
|
}
|
|
|
|
|
if (score.intValue() < lowScore) {
|
|
|
|
|
lowScore = score.intValue();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 更新不同成绩等级的学生人数
|
|
|
|
|
if (score.intValue() >= 90) {
|
|
|
|
|
excellentNum++;
|
|
|
|
|
} else if (score.intValue() >= 80) {
|
|
|
|
|
goodNum++;
|
|
|
|
|
} else if (score.intValue() >= 60) {
|
|
|
|
|
generalNum++;
|
|
|
|
|
} else {
|
|
|
|
|
failNumber++;
|
|
|
|
|
}
|
|
|
|
|
// 更新不同成绩等级的学生人数
|
|
|
|
|
if (score.intValue() >= 90) {
|
|
|
|
|
excellentNum++;
|
|
|
|
|
} else if (score.intValue() >= 80) {
|
|
|
|
|
goodNum++;
|
|
|
|
|
} else if (score.intValue() >= 60) {
|
|
|
|
|
generalNum++;
|
|
|
|
|
} else {
|
|
|
|
|
failNumber++;
|
|
|
|
|
}
|
|
|
|
|
// 计算平均分
|
|
|
|
|
if (totalStudents > 0) {
|
|
|
|
|
avgScore = totalScore / totalStudents;
|
|
|
|
|
}
|
|
|
|
|
if (totalStudents > 0) {
|
|
|
|
|
avgScore = totalScore / totalStudents;
|
|
|
|
|
}
|
|
|
|
|
// 将计算出的值设置到 TeaExaminationDetailsDto 对象中
|
|
|
|
|
teaExaminationDetailsDto.setExamPassNum(passNum);
|
|
|
|
|
teaExaminationDetailsDto.setTopScore(topScore);
|
|
|
|
|
teaExaminationDetailsDto.setLossScore(lowScore);
|
|
|
|
|
teaExaminationDetailsDto.setAverageScore(avgScore);
|
|
|
|
|
teaExaminationDetailsDto.setExcellentNumber(excellentNum);
|
|
|
|
|
teaExaminationDetailsDto.setGoodNumber(goodNum);
|
|
|
|
|
teaExaminationDetailsDto.setGeneralNum(generalNum);
|
|
|
|
|
teaExaminationDetailsDto.setFailingNumber(failNumber);
|
|
|
|
|
teaExaminationDetailsDto.setCaseName(""); //todo 错误率最高的三个案例名称 补充 暂时没有
|
|
|
|
|
teaExaminationDetailsDto.setExamPassNum(passNum);
|
|
|
|
|
teaExaminationDetailsDto.setTopScore(topScore);
|
|
|
|
|
teaExaminationDetailsDto.setLossScore(lowScore);
|
|
|
|
|
teaExaminationDetailsDto.setAverageScore(avgScore);
|
|
|
|
|
teaExaminationDetailsDto.setExcellentNumber(excellentNum);
|
|
|
|
|
teaExaminationDetailsDto.setGoodNumber(goodNum);
|
|
|
|
|
teaExaminationDetailsDto.setGeneralNum(generalNum);
|
|
|
|
|
teaExaminationDetailsDto.setFailingNumber(failNumber);
|
|
|
|
|
teaExaminationDetailsDto.setCaseName(""); //todo 错误率最高的三个案例名称 补充 暂时没有
|
|
|
|
|
|
|
|
|
|
// 返回填充好数值的 teaExaminationDetailsDto 对象
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return teaExaminationDetailsDto;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -199,8 +200,8 @@ public class TeaGradeManageServiceImpl implements ITeaGradeManageService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void exportTrainingDetailsInfo(HttpServletResponse response, String trainingId) {
|
|
|
|
|
List<TeaTrainingDto> list = getTrainingDetailsInfo(trainingId);
|
|
|
|
|
public void exportTrainingDetailsInfo(HttpServletResponse response, String userId) {
|
|
|
|
|
List<TeaTrainingDto> list = getTrainingDetailsInfo(userId);
|
|
|
|
|
//导出的表名
|
|
|
|
|
String title = IdUtil.simpleUUID();
|
|
|
|
|
//表中第一行表头字段
|
|
|
|
@ -303,7 +304,12 @@ public class TeaGradeManageServiceImpl implements ITeaGradeManageService {
|
|
|
|
|
} else {
|
|
|
|
|
for (StuUser stuUser : stuUsers) { //先查出学校下所有的用户ID,再根据USERid去实训表中查实训记录,实训记录为空就跳过,有数据就封装
|
|
|
|
|
StuClass stuClass = classMapper.selectByPrimaryKey(stuUser.getClassId());
|
|
|
|
|
|
|
|
|
|
TeaTrainingInfoDTO teaTrainingInfoDTO = new TeaTrainingInfoDTO();
|
|
|
|
|
//封装user表的数据
|
|
|
|
|
teaTrainingInfoDTO.setClassName(stuClass.getClassName());
|
|
|
|
|
teaTrainingInfoDTO.setStudentId(stuUser.getStudentId());
|
|
|
|
|
teaTrainingInfoDTO.setName(stuUser.getName());
|
|
|
|
|
teaTrainingInfoDTO.setUserId(stuUser.getUserid());
|
|
|
|
|
//看用户在实训表有没有记录
|
|
|
|
|
StuTrainingExample stuTrainingExample = new StuTrainingExample();
|
|
|
|
|
stuTrainingExample.createCriteria().andUserIdEqualTo(stuUser.getUserid());
|
|
|
|
@ -313,17 +319,19 @@ public class TeaGradeManageServiceImpl implements ITeaGradeManageService {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//初始化分数和进度参数
|
|
|
|
|
BigDecimal allProgress = BigDecimal.ZERO;
|
|
|
|
|
BigDecimal totalScore = BigDecimal.ZERO;
|
|
|
|
|
|
|
|
|
|
for (StuTrainingWithBLOBs stuTrainingWithBLOB : stuTrainings) {
|
|
|
|
|
TeaTrainingInfoDTO teaTrainingInfoDTO = new TeaTrainingInfoDTO();
|
|
|
|
|
//封装user表的数据
|
|
|
|
|
teaTrainingInfoDTO.setClassName(stuClass.getClassName());
|
|
|
|
|
teaTrainingInfoDTO.setStudentId(stuUser.getStudentId());
|
|
|
|
|
teaTrainingInfoDTO.setName(stuUser.getName());
|
|
|
|
|
teaTrainingInfoDTO.setUserId(stuUser.getUserid());
|
|
|
|
|
|
|
|
|
|
//综合实训进度
|
|
|
|
|
if (stuTrainingWithBLOB.getProgress() != null) {
|
|
|
|
|
BigDecimal progress = stuTrainingWithBLOB.getProgress();
|
|
|
|
|
allProgress = progress.add(allProgress);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//求综合得分 拿到每个已完成的章节分数
|
|
|
|
|
BigDecimal totalScore = BigDecimal.valueOf(0);
|
|
|
|
|
teaTrainingInfoDTO.setTrainingId(stuTrainingWithBLOB.getTrainingId());
|
|
|
|
|
teaTrainingInfoDTO.setProgress(stuTrainingWithBLOB.getProgress());
|
|
|
|
|
TrainingReport trainingReport = trainingReportMapper.selectByPrimaryKey(stuTrainingWithBLOB.getReportId());
|
|
|
|
|
BigDecimal reportScore = null;
|
|
|
|
|
if (trainingReport != null) {
|
|
|
|
@ -336,24 +344,32 @@ public class TeaGradeManageServiceImpl implements ITeaGradeManageService {
|
|
|
|
|
|
|
|
|
|
if (reportScore != null && BigDecimal.ZERO.compareTo(reportScore) == 0) { //报告得分不等于0或null
|
|
|
|
|
totalScore = totalScore.add(reportScore);
|
|
|
|
|
if (expTrainingScore != null && BigDecimal.ZERO.compareTo(expTrainingScore) == 0) {
|
|
|
|
|
totalScore = totalScore.add(expTrainingScore);
|
|
|
|
|
}
|
|
|
|
|
if (knowledgeSummaryScore != null && BigDecimal.ZERO.compareTo(knowledgeSummaryScore) == 0) {
|
|
|
|
|
totalScore = totalScore.add(knowledgeSummaryScore);
|
|
|
|
|
}
|
|
|
|
|
if (resourceLearningScore != null && BigDecimal.ZERO.compareTo(resourceLearningScore) == 0) {
|
|
|
|
|
totalScore = totalScore.add(resourceLearningScore);
|
|
|
|
|
}
|
|
|
|
|
if (learningEvalScore != null && BigDecimal.ZERO.compareTo(learningEvalScore) == 0) {
|
|
|
|
|
totalScore = totalScore.add(learningEvalScore);
|
|
|
|
|
}
|
|
|
|
|
int chapterNum = sysCourseChapterMapper.selectChapterBySchoolId(schoolId);
|
|
|
|
|
int score = totalScore.intValue() / chapterNum; //已完成的模块分数/总模块数量
|
|
|
|
|
teaTrainingInfoDTO.setTotalScore(BigDecimal.valueOf(score));
|
|
|
|
|
}
|
|
|
|
|
list.add(teaTrainingInfoDTO);
|
|
|
|
|
if (expTrainingScore != null && BigDecimal.ZERO.compareTo(expTrainingScore) != 0) {
|
|
|
|
|
totalScore = totalScore.add(expTrainingScore);
|
|
|
|
|
}
|
|
|
|
|
if (knowledgeSummaryScore != null && BigDecimal.ZERO.compareTo(knowledgeSummaryScore) != 0) {
|
|
|
|
|
totalScore = totalScore.add(knowledgeSummaryScore);
|
|
|
|
|
}
|
|
|
|
|
if (resourceLearningScore != null && BigDecimal.ZERO.compareTo(resourceLearningScore) != 0) {
|
|
|
|
|
totalScore = totalScore.add(resourceLearningScore);
|
|
|
|
|
}
|
|
|
|
|
if (learningEvalScore != null && BigDecimal.ZERO.compareTo(learningEvalScore) != 0) {
|
|
|
|
|
totalScore = totalScore.add(learningEvalScore);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//封装参数
|
|
|
|
|
int chapterNum = sysCourseChapterMapper.selectChapterBySchoolId(schoolId);
|
|
|
|
|
if (totalScore.intValue() != 0) {
|
|
|
|
|
int score = totalScore.intValue() / chapterNum; //已完成的模块分数/总模块数量
|
|
|
|
|
teaTrainingInfoDTO.setTotalScore(BigDecimal.valueOf(score));
|
|
|
|
|
}
|
|
|
|
|
if (allProgress.intValue() != 0 && stuTrainings.size() != 0) {
|
|
|
|
|
BigDecimal divide = allProgress.divide(BigDecimal.valueOf(stuTrainings.size()), 2, RoundingMode.HALF_UP);
|
|
|
|
|
teaTrainingInfoDTO.setProgress(divide);
|
|
|
|
|
}
|
|
|
|
|
list.add(teaTrainingInfoDTO);
|
|
|
|
|
}
|
|
|
|
|
return list;
|
|
|
|
|
}
|
|
|
|
|