自动生成配置文件和mapper xml

newBigdata
xiaoCJ 11 months ago
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,7 +114,7 @@ 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();
@ -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;
} }

Loading…
Cancel
Save