|
|
|
@ -47,10 +47,9 @@ public class TeaGradeManageServiceImpl implements ITeaGradeManageService {
|
|
|
|
|
private StuTrainingMapper stuTrainingMapper;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public PageInfo<TeaTrainingInfoDTO> getTrainingInfo(Integer index, Integer size, String schoolId, String keyWord, String classId,String userId) {
|
|
|
|
|
List<TeaTrainingInfoDTO> list = getTeaTrainingInfoDTOS(schoolId, keyWord, classId,userId);
|
|
|
|
|
public PageInfo<TeaTrainingInfoDTO> getTrainingInfo(Integer index, Integer size, String schoolId, String keyWord, String classId, String userId) {
|
|
|
|
|
List<TeaTrainingInfoDTO> list = getTeaTrainingInfoDTOS(schoolId, keyWord, classId, userId);
|
|
|
|
|
list.sort(new TotalScoreComparator());
|
|
|
|
|
int i = 0;
|
|
|
|
|
for (TeaTrainingInfoDTO teaTrainingInfoDTO : list) {
|
|
|
|
@ -68,8 +67,8 @@ public class TeaGradeManageServiceImpl implements ITeaGradeManageService {
|
|
|
|
|
* @Date 2024/3/19
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public void exportTrainingInfo(HttpServletResponse response, String schoolId, String keyWord, String classId,String userId) {
|
|
|
|
|
List<TeaTrainingInfoDTO> list = getTeaTrainingInfoDTOS(schoolId, keyWord, classId,userId);
|
|
|
|
|
public void exportTrainingInfo(HttpServletResponse response, String schoolId, String keyWord, String classId, String userId) {
|
|
|
|
|
List<TeaTrainingInfoDTO> list = getTeaTrainingInfoDTOS(schoolId, keyWord, classId, userId);
|
|
|
|
|
//导出的表名
|
|
|
|
|
String title = IdUtil.simpleUUID();
|
|
|
|
|
//表中第一行表头字段
|
|
|
|
@ -175,7 +174,9 @@ public class TeaGradeManageServiceImpl implements ITeaGradeManageService {
|
|
|
|
|
SysCourseChapter sysCourseChapter = sysCourseChapterMapper.selectByPrimaryKey(stuTrainingWithBLOB.getChapterId());
|
|
|
|
|
TeaTrainingDto newData = new TeaTrainingDto();
|
|
|
|
|
BeanUtils.copyProperties(stuTrainingWithBLOBs, newData);
|
|
|
|
|
newData.setTaskModule(sysCourseChapter.getChapterName());
|
|
|
|
|
if (sysCourseChapter != null) {
|
|
|
|
|
newData.setTaskModule(sysCourseChapter.getChapterName());
|
|
|
|
|
}
|
|
|
|
|
if (StringUtils.isNotBlank(stuTrainingWithBLOB.getReportId())) {
|
|
|
|
|
String reportId = stuTrainingWithBLOB.getReportId();
|
|
|
|
|
TrainingReport trainingReport = trainingReportMapper.selectByPrimaryKey(reportId);
|
|
|
|
@ -282,7 +283,7 @@ public class TeaGradeManageServiceImpl implements ITeaGradeManageService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private List<TeaTrainingInfoDTO> getTeaTrainingInfoDTOS(String schoolId, String keyWord, String classId,String userId) {
|
|
|
|
|
private List<TeaTrainingInfoDTO> getTeaTrainingInfoDTOS(String schoolId, String keyWord, String classId, String userId) {
|
|
|
|
|
StuUserExample userExample = new StuUserExample();
|
|
|
|
|
StuUserExample.Criteria criteria = userExample.createCriteria();
|
|
|
|
|
criteria.andSchoolIdEqualTo(schoolId);
|
|
|
|
@ -300,7 +301,7 @@ public class TeaGradeManageServiceImpl implements ITeaGradeManageService {
|
|
|
|
|
if (stuUsers.isEmpty()) {
|
|
|
|
|
return null;
|
|
|
|
|
} else {
|
|
|
|
|
for (StuUser stuUser : stuUsers) {
|
|
|
|
|
for (StuUser stuUser : stuUsers) { //先查出学校下所有的用户ID,再根据USERid去实训表中查实训记录,实训记录为空就跳过,有数据就封装
|
|
|
|
|
TeaTrainingInfoDTO teaTrainingInfoDTO = new TeaTrainingInfoDTO();
|
|
|
|
|
StuClass stuClass = classMapper.selectByPrimaryKey(stuUser.getClassId());
|
|
|
|
|
//封装user表的数据
|
|
|
|
@ -308,32 +309,28 @@ public class TeaGradeManageServiceImpl implements ITeaGradeManageService {
|
|
|
|
|
teaTrainingInfoDTO.setStudentId(stuUser.getStudentId());
|
|
|
|
|
teaTrainingInfoDTO.setName(stuUser.getName());
|
|
|
|
|
teaTrainingInfoDTO.setUserId(stuUser.getUserid());
|
|
|
|
|
//求实训进度
|
|
|
|
|
|
|
|
|
|
//看用户在实训表有没有记录
|
|
|
|
|
StuTrainingExample stuTrainingExample = new StuTrainingExample();
|
|
|
|
|
stuTrainingExample.createCriteria().andProgressEqualTo(BigDecimal.valueOf(6)).andUserIdEqualTo(stuUser.getUserid()); //进度为6代表这个章节完成了
|
|
|
|
|
stuTrainingExample.createCriteria().andUserIdEqualTo(stuUser.getUserid());
|
|
|
|
|
List<StuTrainingWithBLOBs> stuTrainings = trainingMapper.selectByExampleWithBLOBs(stuTrainingExample);
|
|
|
|
|
|
|
|
|
|
int trainingSize = stuTrainingMapper.selectProgressFinish(userId); //已学任务数量
|
|
|
|
|
if (stuTrainings.isEmpty()) {
|
|
|
|
|
teaTrainingInfoDTO.setProgress(BigDecimal.ZERO); //实训表为0设置为0
|
|
|
|
|
teaTrainingInfoDTO.setTotalScore(BigDecimal.ZERO);
|
|
|
|
|
list.add(teaTrainingInfoDTO);
|
|
|
|
|
}
|
|
|
|
|
if (trainingSize != 0 && chapterNum != 0) {
|
|
|
|
|
int i = chapterNum / trainingSize; //综合进度
|
|
|
|
|
teaTrainingInfoDTO.setProgress(BigDecimal.valueOf(i));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//求综合得分 拿到每个已完成的章节分数
|
|
|
|
|
BigDecimal totalScore = BigDecimal.valueOf(0);
|
|
|
|
|
if (stuTrainings.isEmpty()) {
|
|
|
|
|
list.add(teaTrainingInfoDTO);
|
|
|
|
|
int trainingSize = stuTrainingMapper.selectProgressFinish(stuUser.getUserid()); //已学任务数量
|
|
|
|
|
if (stuTrainings.isEmpty()) { //实训为空跳过这个用户
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
for (StuTrainingWithBLOBs stuTrainingWithBLOB : stuTrainings) {
|
|
|
|
|
if (trainingSize != 0 && chapterNum != 0) {
|
|
|
|
|
int i = trainingSize / chapterNum; //综合进度
|
|
|
|
|
teaTrainingInfoDTO.setProgress(BigDecimal.valueOf(i));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//求综合得分 拿到每个已完成的章节分数
|
|
|
|
|
BigDecimal totalScore = BigDecimal.valueOf(0);
|
|
|
|
|
teaTrainingInfoDTO.setTrainingId(stuTrainingWithBLOB.getTrainingId());
|
|
|
|
|
TrainingReport trainingReport = trainingReportMapper.selectByPrimaryKey(stuTrainingWithBLOB.getReportId());
|
|
|
|
|
BigDecimal reportScore = null;
|
|
|
|
|
if (trainingReport!=null){
|
|
|
|
|
if (trainingReport != null) {
|
|
|
|
|
reportScore = trainingReport.getTeacherScore();
|
|
|
|
|
}
|
|
|
|
|
BigDecimal expTrainingScore = stuTrainingWithBLOB.getExpTrainingScore();
|
|
|
|
@ -355,11 +352,11 @@ public class TeaGradeManageServiceImpl implements ITeaGradeManageService {
|
|
|
|
|
if (learningEvalScore != null && BigDecimal.ZERO.compareTo(learningEvalScore) == 0) {
|
|
|
|
|
totalScore = totalScore.add(learningEvalScore);
|
|
|
|
|
}
|
|
|
|
|
int score = totalScore.intValue() / chapterNum; //已完成的模块分数/总模块数量
|
|
|
|
|
teaTrainingInfoDTO.setTotalScore(BigDecimal.valueOf(score));
|
|
|
|
|
}
|
|
|
|
|
list.add(teaTrainingInfoDTO);
|
|
|
|
|
}
|
|
|
|
|
int score = totalScore.intValue() / chapterNum; //已完成的模块分数/总模块数量
|
|
|
|
|
teaTrainingInfoDTO.setTotalScore(BigDecimal.valueOf(score));
|
|
|
|
|
list.add(teaTrainingInfoDTO);
|
|
|
|
|
}
|
|
|
|
|
return list;
|
|
|
|
|
}
|
|
|
|
@ -368,11 +365,18 @@ public class TeaGradeManageServiceImpl implements ITeaGradeManageService {
|
|
|
|
|
public class TotalScoreComparator implements Comparator<TeaTrainingInfoDTO> {
|
|
|
|
|
@Override
|
|
|
|
|
public int compare(TeaTrainingInfoDTO o1, TeaTrainingInfoDTO o2) {
|
|
|
|
|
return Integer.compare(o2.getTotalScore().intValueExact(), o1.getTotalScore().intValueExact());
|
|
|
|
|
if (o2.getTotalScore() == null && o1.getTotalScore() == null) {
|
|
|
|
|
return 0;
|
|
|
|
|
} else if (o1 == null) {
|
|
|
|
|
return -1;
|
|
|
|
|
} else if (o2 == null) {
|
|
|
|
|
return 1;
|
|
|
|
|
} else {
|
|
|
|
|
return Integer.compare(o2.getTotalScore().intValueExact(), o1.getTotalScore().intValueExact());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* 按得分比较排序
|
|
|
|
|
* @author xcj
|
|
|
|
|
* @Date 2023/11/6
|
|
|
|
|