|
|
|
@ -5,22 +5,21 @@ import com.github.pagehelper.PageInfo;
|
|
|
|
|
import com.sztzjy.financial_bigdata.entity.*;
|
|
|
|
|
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.TeaTrainingDto;
|
|
|
|
|
import com.sztzjy.financial_bigdata.entity.tea_dto.TeaTrainingInfoDTO;
|
|
|
|
|
import com.sztzjy.financial_bigdata.mapper.*;
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
|
|
import java.math.RoundingMode;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.Arrays;
|
|
|
|
|
import java.util.Comparator;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @Author xcj
|
|
|
|
@ -41,10 +40,11 @@ public class TeaGradeManageServiceImpl implements ITeaGradeManageService {
|
|
|
|
|
@Autowired
|
|
|
|
|
private TeaExamManageMapper teaExamManageMapper;
|
|
|
|
|
@Autowired
|
|
|
|
|
private TeaAndStudentExamMapper teaAndStudentExamMapper;
|
|
|
|
|
private SysCourseChapterMapper sysCourseChapterMapper;
|
|
|
|
|
@Autowired
|
|
|
|
|
private StuStudentExamMapper studentExamMapper;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public PageInfo<TeaTrainingInfoDTO> getTrainingInfo(Integer index, Integer size, String schoolId, String keyWord, String classId) {
|
|
|
|
|
List<TeaTrainingInfoDTO> list = getTeaTrainingInfoDTOS(schoolId, keyWord, classId);
|
|
|
|
@ -83,7 +83,7 @@ public class TeaGradeManageServiceImpl implements ITeaGradeManageService {
|
|
|
|
|
|
|
|
|
|
//饼形图
|
|
|
|
|
@Override
|
|
|
|
|
public TeaExaminationDetailsDto getCountChart(String examManageId,String classId) {
|
|
|
|
|
public TeaExaminationDetailsDto getCountChart(String examManageId, String classId) {
|
|
|
|
|
int passNum = 0; //及格人数
|
|
|
|
|
int topScore = 0; //最高分
|
|
|
|
|
int lowScore = 0; //最低分
|
|
|
|
@ -93,7 +93,7 @@ public class TeaGradeManageServiceImpl implements ITeaGradeManageService {
|
|
|
|
|
int generalNum = 0; //一般人数 60-79
|
|
|
|
|
int failNumber = 0; //不及格人数
|
|
|
|
|
//根据考试ID查出所有user的数量
|
|
|
|
|
int sumUserCount = userMapper.getAllUsersByExamManageId(examManageId,classId); //获取老师指定的参加考试的人数
|
|
|
|
|
int sumUserCount = userMapper.getAllUsersByExamManageId(examManageId, classId); //获取老师指定的参加考试的人数
|
|
|
|
|
TeaExaminationDetailsDto teaExaminationDetailsDto = new TeaExaminationDetailsDto();
|
|
|
|
|
teaExaminationDetailsDto.setExamNum(sumUserCount);
|
|
|
|
|
TeaExamManageWithBLOBs teaExamManageWithBLOBs = teaExamManageMapper.selectByPrimaryKey(examManageId);
|
|
|
|
@ -102,7 +102,7 @@ public class TeaGradeManageServiceImpl implements ITeaGradeManageService {
|
|
|
|
|
StuStudentExamExample studentExamExample = new StuStudentExamExample();
|
|
|
|
|
StuStudentExamExample.Criteria criteria = studentExamExample.createCriteria();
|
|
|
|
|
criteria.andExamManageIdEqualTo(examManageId);
|
|
|
|
|
if (StringUtils.isNotBlank(classId)){
|
|
|
|
|
if (StringUtils.isNotBlank(classId)) {
|
|
|
|
|
criteria.andClassIdEqualTo(classId);
|
|
|
|
|
}
|
|
|
|
|
List<StuStudentExamWithBLOBs> stuStudentExamWithBLOBs = studentExamMapper.selectByExampleWithBLOBs(studentExamExample);
|
|
|
|
@ -161,6 +161,53 @@ public class TeaGradeManageServiceImpl implements ITeaGradeManageService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<TeaTrainingDto> getTrainingDetailsInfo(String userId) {
|
|
|
|
|
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);
|
|
|
|
|
SysCourseChapter sysCourseChapter = sysCourseChapterMapper.selectByPrimaryKey(stuTrainingWithBLOB.getChapterId());
|
|
|
|
|
TeaTrainingDto newData = new TeaTrainingDto();
|
|
|
|
|
BeanUtils.copyProperties(stuTrainingWithBLOBs, newData);
|
|
|
|
|
newData.setTaskModule(sysCourseChapter.getChapterName());
|
|
|
|
|
String reportId = stuTrainingWithBLOB.getReportId();
|
|
|
|
|
TrainingReport trainingReport = trainingReportMapper.selectByPrimaryKey(reportId);
|
|
|
|
|
newData.setReportScore(trainingReport.getReportScore());
|
|
|
|
|
newData.setModuleScore(moduleScore);
|
|
|
|
|
list.add(newData);
|
|
|
|
|
}
|
|
|
|
|
return list;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//计算模块得分
|
|
|
|
|
private BigDecimal getModuleScore(StuTrainingWithBLOBs stuTrainingWithBLOB) {
|
|
|
|
|
BigDecimal knowledgeSummaryScore = Optional.ofNullable(stuTrainingWithBLOB.getKnowledgeSummaryScore()).orElse(BigDecimal.ZERO);
|
|
|
|
|
BigDecimal resourceLearningScore = Optional.ofNullable(stuTrainingWithBLOB.getResourceLearningScore()).orElse(BigDecimal.ZERO);
|
|
|
|
|
BigDecimal learningEvalScore = Optional.ofNullable(stuTrainingWithBLOB.getLearningEvalScore()).orElse(BigDecimal.ZERO);
|
|
|
|
|
BigDecimal expTrainingScore = Optional.ofNullable(stuTrainingWithBLOB.getExpTrainingScore()).orElse(BigDecimal.ZERO);
|
|
|
|
|
return knowledgeSummaryScore.add(resourceLearningScore).add(learningEvalScore).add(expTrainingScore);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void exportTrainingDetailsInfo(HttpServletResponse response, String trainingId) {
|
|
|
|
|
List<TeaTrainingDto> list = getTrainingDetailsInfo(trainingId);
|
|
|
|
|
//导出的表名
|
|
|
|
|
String title = IdUtil.simpleUUID();
|
|
|
|
|
//表中第一行表头字段
|
|
|
|
|
String[] headers = {"任务模块", "模块得分", "知识概要得分", "资源学习得分", "学习测评得分", "实验实训得分","实验报告得分"};
|
|
|
|
|
|
|
|
|
|
//具体需要写入excel需要哪些字段,这些字段取自UserReward类,也就是上面的实际数据结果集的泛型
|
|
|
|
|
List<String> listColumn = Arrays.asList("taskModule", "moduleScore", "knowledgeSummaryScore", "resourceLearningScore", "learningEvalScore", "expTrainingScore","reportScore");
|
|
|
|
|
try {
|
|
|
|
|
FilePortUtil.exportExcel(response, title, headers, list, listColumn);
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private List<TeaTrainingInfoDTO> getTeaTrainingInfoDTOS(String schoolId, String keyWord, String classId) {
|
|
|
|
|
StuUserExample userExample = new StuUserExample();
|
|
|
|
@ -189,7 +236,7 @@ public class TeaGradeManageServiceImpl implements ITeaGradeManageService {
|
|
|
|
|
teaTrainingInfoDTO.setStudentId(stuUser.getStudentId());
|
|
|
|
|
teaTrainingInfoDTO.setName(stuUser.getName());
|
|
|
|
|
StuTrainingExample stuTrainingExample = new StuTrainingExample();
|
|
|
|
|
stuTrainingExample.createCriteria().andUserIdEqualTo(stuUser.getClassId());
|
|
|
|
|
stuTrainingExample.createCriteria().andUserIdEqualTo(stuUser.getUserid());
|
|
|
|
|
List<StuTrainingWithBLOBs> stuTrainingWithBLOBs = trainingMapper.selectByExampleWithBLOBs(stuTrainingExample);
|
|
|
|
|
for (StuTrainingWithBLOBs stuTrainingWithBLOB : stuTrainingWithBLOBs) {
|
|
|
|
|
if (StringUtils.isNotBlank(stuTrainingWithBLOB.getReportId())) { //之展示提交完报告的数据
|
|
|
|
@ -217,6 +264,7 @@ public class TeaGradeManageServiceImpl implements ITeaGradeManageService {
|
|
|
|
|
totalScore = totalScore.add(learningEvalScore.multiply(learningEvalWeight).setScale(2, RoundingMode.HALF_UP));
|
|
|
|
|
}
|
|
|
|
|
teaTrainingInfoDTO.setTotalScore(totalScore);
|
|
|
|
|
teaTrainingInfoDTO.setTrainingId(stuTrainingWithBLOB.getTrainingId());
|
|
|
|
|
list.add(teaTrainingInfoDTO);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|