|
|
|
@ -1,19 +1,24 @@
|
|
|
|
|
package com.sztzjy.financial_bigdata.service.tea.impl;
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
|
|
import cn.hutool.core.util.IdUtil;
|
|
|
|
|
import com.github.pagehelper.PageHelper;
|
|
|
|
|
import com.github.pagehelper.PageInfo;
|
|
|
|
|
import com.sztzjy.financial_bigdata.entity.*;
|
|
|
|
|
import com.sztzjy.financial_bigdata.entity.resource_entity.SysThreeCatalog;
|
|
|
|
|
import com.sztzjy.financial_bigdata.entity.stu_dto.StuTrainingDto;
|
|
|
|
|
import com.sztzjy.financial_bigdata.entity.stu_dto.StuUserDto;
|
|
|
|
|
import com.sztzjy.financial_bigdata.entity.tea_dto.*;
|
|
|
|
|
import com.sztzjy.financial_bigdata.entity.tea_dto.StuTheoryRecordDto;
|
|
|
|
|
import com.sztzjy.financial_bigdata.entity.tea_dto.TeaExamAndUserDto;
|
|
|
|
|
import com.sztzjy.financial_bigdata.entity.tea_dto.TeaExaminationDetailsDto;
|
|
|
|
|
import com.sztzjy.financial_bigdata.entity.tea_dto.TeaTrainingInfoDTO;
|
|
|
|
|
import com.sztzjy.financial_bigdata.mapper.*;
|
|
|
|
|
import com.sztzjy.financial_bigdata.resourceCenterAPI.CourseAPI;
|
|
|
|
|
import com.sztzjy.financial_bigdata.service.stu.StuScoreService;
|
|
|
|
|
import com.sztzjy.financial_bigdata.service.tea.ITeaGradeManageService;
|
|
|
|
|
import com.sztzjy.financial_bigdata.util.PageUtil;
|
|
|
|
|
import com.sztzjy.financial_bigdata.util.excel.FilePortUtil;
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
@ -48,19 +53,25 @@ public class TeaGradeManageServiceImpl implements ITeaGradeManageService {
|
|
|
|
|
private StuTheoryRecordMapper stuTheoryRecordMapper;
|
|
|
|
|
@Autowired
|
|
|
|
|
private StuTrainingMapper stuTrainingMapper;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private StuScoreService stuScoreService;
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public PageInfo<TeaTrainingInfoDTO> getTrainingInfo(Integer index, Integer size, String schoolId, String keyWord, String classId, String systemOwner) {
|
|
|
|
|
List<TeaTrainingInfoDTO> list = getTrainingInfoDTOS(schoolId, keyWord, classId, systemOwner);
|
|
|
|
|
return PageUtil.pageHelper(list, index, size);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private List<TeaTrainingInfoDTO> getTrainingInfoDTOS(String schoolId, String keyWord, String classId, String systemOwner) {
|
|
|
|
|
List<TeaTrainingInfoDTO> list = getTeaTrainingInfoDTOS(schoolId, keyWord, classId, systemOwner);
|
|
|
|
|
assert !list.isEmpty();
|
|
|
|
|
assert !Objects.requireNonNull(list).isEmpty();
|
|
|
|
|
list.sort(new TotalScoreComparator());
|
|
|
|
|
int i = 0;
|
|
|
|
|
for (TeaTrainingInfoDTO teaTrainingInfoDTO : list) {
|
|
|
|
|
i++;
|
|
|
|
|
teaTrainingInfoDTO.setRank(i);
|
|
|
|
|
}
|
|
|
|
|
return PageUtil.pageHelper(list, index, size);
|
|
|
|
|
return list;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -72,7 +83,8 @@ public class TeaGradeManageServiceImpl implements ITeaGradeManageService {
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public void exportTrainingInfo(HttpServletResponse response, String schoolId, String keyWord, String classId, String systemOwner) {
|
|
|
|
|
List<TeaTrainingInfoDTO> list = getTeaTrainingInfoDTOS(schoolId, keyWord, classId, systemOwner);
|
|
|
|
|
List<TeaTrainingInfoDTO> list = getTrainingInfoDTOS(schoolId, keyWord, classId, systemOwner);
|
|
|
|
|
|
|
|
|
|
//导出的表名
|
|
|
|
|
String title = IdUtil.simpleUUID();
|
|
|
|
|
//表中第一行表头字段
|
|
|
|
@ -168,29 +180,58 @@ public class TeaGradeManageServiceImpl implements ITeaGradeManageService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// @Override
|
|
|
|
|
// public List<TeaTrainingDto> getTrainingDetailsInfo(String userId) throws IOException {
|
|
|
|
|
// StuTrainingExample trainingExample = new StuTrainingExample();
|
|
|
|
|
// trainingExample.createCriteria().andUserIdEqualTo(userId);
|
|
|
|
|
// List<StuTrainingWithBLOBs> stuTrainingWithBLOBs = trainingMapper.selectByExampleWithBLOBs(trainingExample);
|
|
|
|
|
// List<TeaTrainingDto> list = new ArrayList<>();
|
|
|
|
|
// for (StuTrainingWithBLOBs stuTrainingWithBLOB : stuTrainingWithBLOBs) {
|
|
|
|
|
// BigDecimal moduleScore = getModuleScore(stuTrainingWithBLOB);
|
|
|
|
|
// SysThreeCatalog sysCourseChapter = CourseAPI.selectChapterByChapterId(stuTrainingWithBLOB.getChapterId());
|
|
|
|
|
// TeaTrainingDto newData = new TeaTrainingDto();
|
|
|
|
|
// BeanUtils.copyProperties(stuTrainingWithBLOB, newData);
|
|
|
|
|
// if (sysCourseChapter != null) {
|
|
|
|
|
// newData.setTaskModule(sysCourseChapter.getThreeName());
|
|
|
|
|
// }
|
|
|
|
|
// if (StringUtils.isNotBlank(stuTrainingWithBLOB.getReportId())) {
|
|
|
|
|
// String reportId = stuTrainingWithBLOB.getReportId();
|
|
|
|
|
// TrainingReport trainingReport = trainingReportMapper.selectByPrimaryKey(reportId);
|
|
|
|
|
// newData.setReportScore(trainingReport.getTeacherScore());
|
|
|
|
|
// }
|
|
|
|
|
// newData.setModuleScore(moduleScore);
|
|
|
|
|
// list.add(newData);
|
|
|
|
|
// }
|
|
|
|
|
// return list;
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<TeaTrainingDto> getTrainingDetailsInfo(String userId) throws IOException {
|
|
|
|
|
StuTrainingExample trainingExample = new StuTrainingExample();
|
|
|
|
|
trainingExample.createCriteria().andUserIdEqualTo(userId);
|
|
|
|
|
List<StuTrainingWithBLOBs> stuTrainingWithBLOBs = trainingMapper.selectByExampleWithBLOBs(trainingExample);
|
|
|
|
|
List<TeaTrainingDto> list = new ArrayList<>();
|
|
|
|
|
for (StuTrainingWithBLOBs stuTrainingWithBLOB : stuTrainingWithBLOBs) {
|
|
|
|
|
BigDecimal moduleScore = getModuleScore(stuTrainingWithBLOB);
|
|
|
|
|
SysThreeCatalog sysCourseChapter = CourseAPI.selectChapterByChapterId(stuTrainingWithBLOB.getChapterId());
|
|
|
|
|
TeaTrainingDto newData = new TeaTrainingDto();
|
|
|
|
|
BeanUtils.copyProperties(stuTrainingWithBLOB, newData);
|
|
|
|
|
if (sysCourseChapter != null) {
|
|
|
|
|
newData.setTaskModule(sysCourseChapter.getThreeName());
|
|
|
|
|
}
|
|
|
|
|
if (StringUtils.isNotBlank(stuTrainingWithBLOB.getReportId())) {
|
|
|
|
|
String reportId = stuTrainingWithBLOB.getReportId();
|
|
|
|
|
TrainingReport trainingReport = trainingReportMapper.selectByPrimaryKey(reportId);
|
|
|
|
|
newData.setReportScore(trainingReport.getTeacherScore());
|
|
|
|
|
public List<StuTrainingDto> getTrainingDetailsInfo(String userId, String schoolId, String systemOwner) {
|
|
|
|
|
List<StuTrainingDto> list = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
StuTrainingExample stuTrainingExample = new StuTrainingExample();
|
|
|
|
|
stuTrainingExample.createCriteria().andUserIdEqualTo(userId);
|
|
|
|
|
List<StuTrainingWithBLOBs> stuTrainings = stuTrainingMapper.selectByExampleWithBLOBs(stuTrainingExample);
|
|
|
|
|
|
|
|
|
|
Map<String, SysThreeCatalog> chapterMap = new HashMap<>();
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
for (StuTrainingWithBLOBs stuTraining : stuTrainings) {
|
|
|
|
|
String chapterId = stuTraining.getChapterId();
|
|
|
|
|
SysThreeCatalog sysCourseChapter = chapterMap.get(chapterId);
|
|
|
|
|
if (sysCourseChapter == null) {
|
|
|
|
|
sysCourseChapter = CourseAPI.selectChapterByChapterId(chapterId);
|
|
|
|
|
chapterMap.put(chapterId, sysCourseChapter);
|
|
|
|
|
}
|
|
|
|
|
StuTrainingDto stuTrainingDto = new StuTrainingDto();
|
|
|
|
|
stuTrainingDto.setTaskModule(sysCourseChapter.getThreeName());
|
|
|
|
|
list.add(stuScoreService.getScoreByChapterId(schoolId, systemOwner, stuTraining, stuTrainingDto, sysCourseChapter));
|
|
|
|
|
}
|
|
|
|
|
newData.setModuleScore(moduleScore);
|
|
|
|
|
list.add(newData);
|
|
|
|
|
return list;
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
return list;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//计算模块得分
|
|
|
|
@ -203,15 +244,15 @@ public class TeaGradeManageServiceImpl implements ITeaGradeManageService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void exportTrainingDetailsInfo(HttpServletResponse response, String userId) throws IOException {
|
|
|
|
|
List<TeaTrainingDto> list = getTrainingDetailsInfo(userId);
|
|
|
|
|
public void exportTrainingDetailsInfo(HttpServletResponse response, String userId, String schoolId, String systemOwner) throws IOException {
|
|
|
|
|
List<StuTrainingDto> list = getTrainingDetailsInfo(userId, schoolId, systemOwner);
|
|
|
|
|
//导出的表名
|
|
|
|
|
String title = IdUtil.simpleUUID();
|
|
|
|
|
//表中第一行表头字段
|
|
|
|
|
String[] headers = {"任务模块", "模块得分", "知识概要得分", "资源学习得分", "学习测评得分", "实验实训得分", "实验报告得分"};
|
|
|
|
|
|
|
|
|
|
//具体需要写入excel需要哪些字段,这些字段取自UserReward类,也就是上面的实际数据结果集的泛型
|
|
|
|
|
List<String> listColumn = Arrays.asList("taskModule", "moduleScore", "knowledgeSummaryScore", "resourceLearningScore", "learningEvalScore", "expTrainingScore", "reportScore");
|
|
|
|
|
List<String> listColumn = Arrays.asList("taskModule", "moduleScore", "knowledgeSummaryScore", "resourceLearningScore", "learningEvalScore", "caseStuScore", "reportScore");
|
|
|
|
|
try {
|
|
|
|
|
FilePortUtil.exportExcel(response, title, headers, list, listColumn);
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
@ -268,7 +309,12 @@ public class TeaGradeManageServiceImpl implements ITeaGradeManageService {
|
|
|
|
|
s.setOrderByClause("average_score ASC");
|
|
|
|
|
List<StuTheoryRecord> list = stuTheoryRecordMapper.selectByExample(s);
|
|
|
|
|
List<StuTheoryRecordDto> dtoList = new ArrayList<>();
|
|
|
|
|
BeanUtils.copyProperties(list, dtoList);
|
|
|
|
|
// BeanUtils.copyProperties(list, dtoList);
|
|
|
|
|
for (StuTheoryRecord stuTheoryRecord : list) {
|
|
|
|
|
StuTheoryRecordDto stuTheoryRecordDto = new StuTheoryRecordDto();
|
|
|
|
|
BeanUtil.copyProperties(stuTheoryRecord, stuTheoryRecordDto);
|
|
|
|
|
dtoList.add(stuTheoryRecordDto);
|
|
|
|
|
}
|
|
|
|
|
int i = 0;
|
|
|
|
|
for (StuTheoryRecordDto stuTheoryRecordDto : dtoList) {
|
|
|
|
|
stuTheoryRecordDto.setRank(i++);
|
|
|
|
@ -279,7 +325,7 @@ public class TeaGradeManageServiceImpl implements ITeaGradeManageService {
|
|
|
|
|
String[] headers = {"排名", "姓名", "学号", "考试次数", "考试最高分", "考试最低分", "考试合计时长"};
|
|
|
|
|
|
|
|
|
|
//具体需要写入excel需要哪些字段,这些字段取自UserReward类,也就是上面的实际数据结果集的泛型
|
|
|
|
|
List<String> listColumn = Arrays.asList("rank", "name", "studentId", "examCount", "highestScore", "lowestScore", "averageScore");
|
|
|
|
|
List<String> listColumn = Arrays.asList("rank", "name", "studentId", "examCount", "highestScore", "lowestScore", "totalDuration");
|
|
|
|
|
try {
|
|
|
|
|
FilePortUtil.exportExcel(response, title, headers, dtoList, listColumn);
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|