|
|
@ -17,6 +17,7 @@ import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
import java.math.BigDecimal;
|
|
|
|
import java.math.BigDecimal;
|
|
|
|
|
|
|
|
import java.math.RoundingMode;
|
|
|
|
import java.util.*;
|
|
|
|
import java.util.*;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -199,8 +200,8 @@ public class TeaGradeManageServiceImpl implements ITeaGradeManageService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void exportTrainingDetailsInfo(HttpServletResponse response, String trainingId) {
|
|
|
|
public void exportTrainingDetailsInfo(HttpServletResponse response, String userId) {
|
|
|
|
List<TeaTrainingDto> list = getTrainingDetailsInfo(trainingId);
|
|
|
|
List<TeaTrainingDto> list = getTrainingDetailsInfo(userId);
|
|
|
|
//导出的表名
|
|
|
|
//导出的表名
|
|
|
|
String title = IdUtil.simpleUUID();
|
|
|
|
String title = IdUtil.simpleUUID();
|
|
|
|
//表中第一行表头字段
|
|
|
|
//表中第一行表头字段
|
|
|
@ -303,7 +304,12 @@ public class TeaGradeManageServiceImpl implements ITeaGradeManageService {
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
for (StuUser stuUser : stuUsers) { //先查出学校下所有的用户ID,再根据USERid去实训表中查实训记录,实训记录为空就跳过,有数据就封装
|
|
|
|
for (StuUser stuUser : stuUsers) { //先查出学校下所有的用户ID,再根据USERid去实训表中查实训记录,实训记录为空就跳过,有数据就封装
|
|
|
|
StuClass stuClass = classMapper.selectByPrimaryKey(stuUser.getClassId());
|
|
|
|
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 stuTrainingExample = new StuTrainingExample();
|
|
|
|
stuTrainingExample.createCriteria().andUserIdEqualTo(stuUser.getUserid());
|
|
|
|
stuTrainingExample.createCriteria().andUserIdEqualTo(stuUser.getUserid());
|
|
|
@ -313,17 +319,19 @@ public class TeaGradeManageServiceImpl implements ITeaGradeManageService {
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//初始化分数和进度参数
|
|
|
|
|
|
|
|
BigDecimal allProgress = BigDecimal.ZERO;
|
|
|
|
|
|
|
|
BigDecimal totalScore = BigDecimal.ZERO;
|
|
|
|
|
|
|
|
|
|
|
|
for (StuTrainingWithBLOBs stuTrainingWithBLOB : stuTrainings) {
|
|
|
|
for (StuTrainingWithBLOBs stuTrainingWithBLOB : stuTrainings) {
|
|
|
|
TeaTrainingInfoDTO teaTrainingInfoDTO = new TeaTrainingInfoDTO();
|
|
|
|
|
|
|
|
//封装user表的数据
|
|
|
|
//综合实训进度
|
|
|
|
teaTrainingInfoDTO.setClassName(stuClass.getClassName());
|
|
|
|
if (stuTrainingWithBLOB.getProgress() != null) {
|
|
|
|
teaTrainingInfoDTO.setStudentId(stuUser.getStudentId());
|
|
|
|
BigDecimal progress = stuTrainingWithBLOB.getProgress();
|
|
|
|
teaTrainingInfoDTO.setName(stuUser.getName());
|
|
|
|
allProgress = progress.add(allProgress);
|
|
|
|
teaTrainingInfoDTO.setUserId(stuUser.getUserid());
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//求综合得分 拿到每个已完成的章节分数
|
|
|
|
//求综合得分 拿到每个已完成的章节分数
|
|
|
|
BigDecimal totalScore = BigDecimal.valueOf(0);
|
|
|
|
|
|
|
|
teaTrainingInfoDTO.setTrainingId(stuTrainingWithBLOB.getTrainingId());
|
|
|
|
|
|
|
|
teaTrainingInfoDTO.setProgress(stuTrainingWithBLOB.getProgress());
|
|
|
|
|
|
|
|
TrainingReport trainingReport = trainingReportMapper.selectByPrimaryKey(stuTrainingWithBLOB.getReportId());
|
|
|
|
TrainingReport trainingReport = trainingReportMapper.selectByPrimaryKey(stuTrainingWithBLOB.getReportId());
|
|
|
|
BigDecimal reportScore = null;
|
|
|
|
BigDecimal reportScore = null;
|
|
|
|
if (trainingReport != null) {
|
|
|
|
if (trainingReport != null) {
|
|
|
@ -336,24 +344,32 @@ public class TeaGradeManageServiceImpl implements ITeaGradeManageService {
|
|
|
|
|
|
|
|
|
|
|
|
if (reportScore != null && BigDecimal.ZERO.compareTo(reportScore) == 0) { //报告得分不等于0或null
|
|
|
|
if (reportScore != null && BigDecimal.ZERO.compareTo(reportScore) == 0) { //报告得分不等于0或null
|
|
|
|
totalScore = totalScore.add(reportScore);
|
|
|
|
totalScore = totalScore.add(reportScore);
|
|
|
|
if (expTrainingScore != null && BigDecimal.ZERO.compareTo(expTrainingScore) == 0) {
|
|
|
|
}
|
|
|
|
|
|
|
|
if (expTrainingScore != null && BigDecimal.ZERO.compareTo(expTrainingScore) != 0) {
|
|
|
|
totalScore = totalScore.add(expTrainingScore);
|
|
|
|
totalScore = totalScore.add(expTrainingScore);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (knowledgeSummaryScore != null && BigDecimal.ZERO.compareTo(knowledgeSummaryScore) == 0) {
|
|
|
|
if (knowledgeSummaryScore != null && BigDecimal.ZERO.compareTo(knowledgeSummaryScore) != 0) {
|
|
|
|
totalScore = totalScore.add(knowledgeSummaryScore);
|
|
|
|
totalScore = totalScore.add(knowledgeSummaryScore);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (resourceLearningScore != null && BigDecimal.ZERO.compareTo(resourceLearningScore) == 0) {
|
|
|
|
if (resourceLearningScore != null && BigDecimal.ZERO.compareTo(resourceLearningScore) != 0) {
|
|
|
|
totalScore = totalScore.add(resourceLearningScore);
|
|
|
|
totalScore = totalScore.add(resourceLearningScore);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (learningEvalScore != null && BigDecimal.ZERO.compareTo(learningEvalScore) == 0) {
|
|
|
|
if (learningEvalScore != null && BigDecimal.ZERO.compareTo(learningEvalScore) != 0) {
|
|
|
|
totalScore = totalScore.add(learningEvalScore);
|
|
|
|
totalScore = totalScore.add(learningEvalScore);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//封装参数
|
|
|
|
int chapterNum = sysCourseChapterMapper.selectChapterBySchoolId(schoolId);
|
|
|
|
int chapterNum = sysCourseChapterMapper.selectChapterBySchoolId(schoolId);
|
|
|
|
|
|
|
|
if (totalScore.intValue() != 0) {
|
|
|
|
int score = totalScore.intValue() / chapterNum; //已完成的模块分数/总模块数量
|
|
|
|
int score = totalScore.intValue() / chapterNum; //已完成的模块分数/总模块数量
|
|
|
|
teaTrainingInfoDTO.setTotalScore(BigDecimal.valueOf(score));
|
|
|
|
teaTrainingInfoDTO.setTotalScore(BigDecimal.valueOf(score));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
list.add(teaTrainingInfoDTO);
|
|
|
|
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;
|
|
|
|
return list;
|
|
|
|
}
|
|
|
|
}
|
|
|
|