自动生成配置文件和mapper xml

newBigdata
xiaoCJ
parent cf59c6f205
commit 316f678242

@ -381,8 +381,8 @@ public class TeaGradeManageController {
@AnonymousAccess @AnonymousAccess
@GetMapping("/exportTrainingDetailsInfo") @GetMapping("/exportTrainingDetailsInfo")
@ApiOperation("练习模式--详情页面导出") @ApiOperation("练习模式--详情页面导出")
public void exportTrainingDetailsInfo(HttpServletResponse response, @RequestParam String trainingId) { public void exportTrainingDetailsInfo(HttpServletResponse response, @RequestParam String userId) {
iTeaGradeManageService.exportTrainingDetailsInfo(response, trainingId); iTeaGradeManageService.exportTrainingDetailsInfo(response, userId);
} }
@AnonymousAccess @AnonymousAccess

@ -15,9 +15,6 @@ import java.math.BigDecimal;
public class TeaTrainingInfoDTO { public class TeaTrainingInfoDTO {
private String userId; private String userId;
@ApiModelProperty("实训ID")
private String trainingId;
@ApiModelProperty("排名") @ApiModelProperty("排名")
private int rank; private int rank;

@ -23,7 +23,7 @@ public interface ITeaGradeManageService {
List<TeaTrainingDto> getTrainingDetailsInfo(String userId); List<TeaTrainingDto> getTrainingDetailsInfo(String userId);
void exportTrainingDetailsInfo(HttpServletResponse response, String trainingId); void exportTrainingDetailsInfo(HttpServletResponse response, String userId);
PageInfo<StuUserDto> getReportCorrect(String schoolId, Integer index, Integer size, String module, String classId, String keyWord); PageInfo<StuUserDto> getReportCorrect(String schoolId, Integer index, Integer size, String module, String classId, String keyWord);

@ -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.*;
/** /**
@ -113,53 +114,53 @@ public class TeaGradeManageServiceImpl implements ITeaGradeManageService {
} else { } else {
teaExaminationDetailsDto.setExamActualNum(stuStudentExamWithBLOBs.size()); //否则为集合的长度 teaExaminationDetailsDto.setExamActualNum(stuStudentExamWithBLOBs.size()); //否则为集合的长度
for (StuStudentExamWithBLOBs stuStudentExamWithBLOB : stuStudentExamWithBLOBs) { //不为就求分数 for (StuStudentExamWithBLOBs stuStudentExamWithBLOB : stuStudentExamWithBLOBs) { //不为就求分数
if (stuStudentExamWithBLOB.getTotalScore()==null){ if (stuStudentExamWithBLOB.getTotalScore() == null) {
continue; continue;
} }
BigDecimal score = stuStudentExamWithBLOB.getTotalScore(); BigDecimal score = stuStudentExamWithBLOB.getTotalScore();
int passThreshold = 60; // 60是及格分数 int passThreshold = 60; // 60是及格分数
int totalStudents = stuStudentExamWithBLOBs.size(); int totalStudents = stuStudentExamWithBLOBs.size();
int totalScore = 0; int totalScore = 0;
totalScore += score.intValue(); totalScore += score.intValue();
if (score.intValue() >= passThreshold) { if (score.intValue() >= passThreshold) {
passNum++; passNum++;
} }
// 更新最高分和最低分 // 更新最高分和最低分
if (score.intValue() > topScore) { if (score.intValue() > topScore) {
topScore = score.intValue(); topScore = score.intValue();
} }
if (score.intValue() < lowScore) { if (score.intValue() < lowScore) {
lowScore = score.intValue(); lowScore = score.intValue();
} }
// 更新不同成绩等级的学生人数 // 更新不同成绩等级的学生人数
if (score.intValue() >= 90) { if (score.intValue() >= 90) {
excellentNum++; excellentNum++;
} else if (score.intValue() >= 80) { } else if (score.intValue() >= 80) {
goodNum++; goodNum++;
} else if (score.intValue() >= 60) { } else if (score.intValue() >= 60) {
generalNum++; generalNum++;
} else { } else {
failNumber++; failNumber++;
} }
// 计算平均分 // 计算平均分
if (totalStudents > 0) { if (totalStudents > 0) {
avgScore = totalScore / totalStudents; avgScore = totalScore / totalStudents;
} }
// 将计算出的值设置到 TeaExaminationDetailsDto 对象中 // 将计算出的值设置到 TeaExaminationDetailsDto 对象中
teaExaminationDetailsDto.setExamPassNum(passNum); teaExaminationDetailsDto.setExamPassNum(passNum);
teaExaminationDetailsDto.setTopScore(topScore); teaExaminationDetailsDto.setTopScore(topScore);
teaExaminationDetailsDto.setLossScore(lowScore); teaExaminationDetailsDto.setLossScore(lowScore);
teaExaminationDetailsDto.setAverageScore(avgScore); teaExaminationDetailsDto.setAverageScore(avgScore);
teaExaminationDetailsDto.setExcellentNumber(excellentNum); teaExaminationDetailsDto.setExcellentNumber(excellentNum);
teaExaminationDetailsDto.setGoodNumber(goodNum); teaExaminationDetailsDto.setGoodNumber(goodNum);
teaExaminationDetailsDto.setGeneralNum(generalNum); teaExaminationDetailsDto.setGeneralNum(generalNum);
teaExaminationDetailsDto.setFailingNumber(failNumber); teaExaminationDetailsDto.setFailingNumber(failNumber);
teaExaminationDetailsDto.setCaseName(""); //todo 错误率最高的三个案例名称 补充 暂时没有 teaExaminationDetailsDto.setCaseName(""); //todo 错误率最高的三个案例名称 补充 暂时没有
// 返回填充好数值的 teaExaminationDetailsDto 对象 // 返回填充好数值的 teaExaminationDetailsDto 对象
}
} }
}
return teaExaminationDetailsDto; return teaExaminationDetailsDto;
} }
@ -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) {
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; return list;
} }

Loading…
Cancel
Save