|
|
|
@ -37,6 +37,8 @@ import java.io.IOException;
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
import java.util.function.Function;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @Author xcj
|
|
|
|
@ -319,44 +321,89 @@ public class TeaGradeManageController {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// private List<TeaExamAndUserDto> getTeaExamAndUserDtos(String schoolId, String keyWord, String classId, String examManageId) {
|
|
|
|
|
// List<TeaExamAndUserDto> list = new ArrayList<>();
|
|
|
|
|
// List<StuUser> stuUsers = userMapper.selectTeaExamAndUserDtos(schoolId, keyWord, classId, examManageId);
|
|
|
|
|
// //先拿到用户信息,再用userid查学生分数
|
|
|
|
|
// for (StuUser stuUser : stuUsers) {
|
|
|
|
|
// TeaExamAndUserDto teaExamAndUserDto = new TeaExamAndUserDto();
|
|
|
|
|
// String userid = stuUser.getUserid();
|
|
|
|
|
// StuStudentExamExample studentExamExample = new StuStudentExamExample();
|
|
|
|
|
// StuStudentExamExample.Criteria studentExamCriteria = studentExamExample.createCriteria();
|
|
|
|
|
// studentExamCriteria.andUseridEqualTo(userid);
|
|
|
|
|
// teaExamAndUserDto.setName(stuUser.getName());
|
|
|
|
|
// teaExamAndUserDto.setStudentId(stuUser.getStudentId());
|
|
|
|
|
// StuClass stuClass = stuClassMapper.selectByPrimaryKey(stuUser.getClassId());
|
|
|
|
|
// teaExamAndUserDto.setClassName(stuClass.getClassName());
|
|
|
|
|
// if (StringUtils.isNotBlank(examManageId)) {
|
|
|
|
|
// studentExamCriteria.andExamManageIdEqualTo(examManageId);
|
|
|
|
|
// }
|
|
|
|
|
// List<StuStudentExamWithBLOBs> stuStudentExams = studentExamMapper.selectByExampleWithBLOBs(studentExamExample);
|
|
|
|
|
// if (!stuStudentExams.isEmpty()) {
|
|
|
|
|
// StuStudentExamWithBLOBs stuStudentExam = stuStudentExams.get(0);
|
|
|
|
|
// if (stuStudentExam != null) {
|
|
|
|
|
// if (stuStudentExam.getObjectiveScore() != null) {
|
|
|
|
|
// teaExamAndUserDto.setObjectiveScore(stuStudentExam.getObjectiveScore());
|
|
|
|
|
// }
|
|
|
|
|
// if (stuStudentExam.getCaseScore() != null) {
|
|
|
|
|
// teaExamAndUserDto.setCaseScore(stuStudentExam.getCaseScore());
|
|
|
|
|
// }
|
|
|
|
|
// if (stuStudentExam.getTotalScore() != null) {
|
|
|
|
|
// teaExamAndUserDto.setTotalScore(stuStudentExam.getTotalScore());
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// list.add(teaExamAndUserDto);
|
|
|
|
|
// }
|
|
|
|
|
// return list;
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private List<TeaExamAndUserDto> getTeaExamAndUserDtos(String schoolId, String keyWord, String classId, String examManageId) {
|
|
|
|
|
StuUserExample stuUserExample = new StuUserExample();
|
|
|
|
|
StuUserExample.Criteria stuUserCriteria = stuUserExample.createCriteria();
|
|
|
|
|
StuUserExample.Criteria stuUserCriteria1 = stuUserExample.createCriteria();
|
|
|
|
|
stuUserCriteria.andSchoolIdEqualTo(schoolId);
|
|
|
|
|
stuUserCriteria.andRoleIdEqualTo(4);
|
|
|
|
|
stuUserCriteria1.andRoleIdEqualTo(4);
|
|
|
|
|
stuUserCriteria1.andSchoolIdEqualTo(schoolId);
|
|
|
|
|
List<TeaExamAndUserDto> list = new ArrayList();
|
|
|
|
|
if (StringUtils.isNotBlank(keyWord)) {
|
|
|
|
|
stuUserCriteria.andStudentIdEqualTo(keyWord);
|
|
|
|
|
stuUserCriteria1.andNameEqualTo(keyWord);
|
|
|
|
|
}
|
|
|
|
|
if (StringUtils.isNotBlank(classId)) {
|
|
|
|
|
stuUserCriteria.andClassIdEqualTo(classId);
|
|
|
|
|
stuUserCriteria1.andClassIdEqualTo(classId);
|
|
|
|
|
}
|
|
|
|
|
stuUserExample.or(stuUserCriteria1);
|
|
|
|
|
List<StuUser> stuUsers = userMapper.selectByExample(stuUserExample);
|
|
|
|
|
//先拿到用户信息,再用userid查学生分数
|
|
|
|
|
List<TeaExamAndUserDto> list = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
// 批量查询用户信息
|
|
|
|
|
List<StuUser> stuUsers = userMapper.selectTeaExamAndUserDtos(schoolId, keyWord, classId, examManageId);
|
|
|
|
|
|
|
|
|
|
// 构建用户id列表
|
|
|
|
|
List<String> userIds = stuUsers.stream()
|
|
|
|
|
.map(StuUser::getUserid)
|
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
|
// 构建班级ID列表
|
|
|
|
|
List<String> classIds = stuUsers.stream()
|
|
|
|
|
.map(StuUser::getClassId)
|
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
|
// 批量查询学生分数
|
|
|
|
|
StuStudentExamExample studentExamExample = new StuStudentExamExample();
|
|
|
|
|
studentExamExample.createCriteria()
|
|
|
|
|
.andUseridIn(userIds)
|
|
|
|
|
.andExamManageIdEqualTo(examManageId);
|
|
|
|
|
|
|
|
|
|
List<StuStudentExamWithBLOBs> stuStudentExams = studentExamMapper.selectByExampleWithBLOBs(studentExamExample);
|
|
|
|
|
|
|
|
|
|
// 构建用户id和对应的学生分数的映射关系
|
|
|
|
|
Map<String, StuStudentExamWithBLOBs> userExamMap = stuStudentExams.stream()
|
|
|
|
|
.collect(Collectors.toMap(StuStudentExamWithBLOBs::getUserid, Function.identity()));
|
|
|
|
|
|
|
|
|
|
List<StuClass> stuClass = stuClassMapper.getByPrimaryKeys(classIds);
|
|
|
|
|
|
|
|
|
|
// 构建班级ID与班级对象的映射关系
|
|
|
|
|
Map<String, StuClass> classMap = stuClass.stream()
|
|
|
|
|
.collect(Collectors.toMap(StuClass::getClassId, Function.identity()));
|
|
|
|
|
|
|
|
|
|
// 构建结果列表
|
|
|
|
|
for (StuUser stuUser : stuUsers) {
|
|
|
|
|
TeaExamAndUserDto teaExamAndUserDto = new TeaExamAndUserDto();
|
|
|
|
|
String userid = stuUser.getUserid();
|
|
|
|
|
StuStudentExamExample studentExamExample = new StuStudentExamExample();
|
|
|
|
|
StuStudentExamExample.Criteria studentExamCriteria = studentExamExample.createCriteria();
|
|
|
|
|
studentExamCriteria.andUseridEqualTo(userid);
|
|
|
|
|
teaExamAndUserDto.setName(stuUser.getName());
|
|
|
|
|
teaExamAndUserDto.setStudentId(stuUser.getStudentId());
|
|
|
|
|
StuClass stuClass = stuClassMapper.selectByPrimaryKey(stuUser.getClassId());
|
|
|
|
|
teaExamAndUserDto.setClassName(stuClass.getClassName());
|
|
|
|
|
if (StringUtils.isNotBlank(examManageId)) {
|
|
|
|
|
studentExamCriteria.andExamManageIdEqualTo(examManageId);
|
|
|
|
|
}
|
|
|
|
|
StuStudentExamExample example = new StuStudentExamExample();
|
|
|
|
|
example.createCriteria().andUseridEqualTo(userid).andExamManageIdEqualTo(examManageId);
|
|
|
|
|
List<StuStudentExamWithBLOBs> stuStudentExams = studentExamMapper.selectByExampleWithBLOBs(example);
|
|
|
|
|
if (!stuStudentExams.isEmpty()) {
|
|
|
|
|
StuStudentExamWithBLOBs stuStudentExam = stuStudentExams.get(0);
|
|
|
|
|
|
|
|
|
|
// 从映射关系中获取班级对象
|
|
|
|
|
StuClass classdata = classMap.get(stuUser.getClassId());
|
|
|
|
|
teaExamAndUserDto.setClassName(classdata.getClassName());
|
|
|
|
|
|
|
|
|
|
StuStudentExamWithBLOBs stuStudentExam = userExamMap.get(stuUser.getUserid());
|
|
|
|
|
if (stuStudentExam != null) {
|
|
|
|
|
if (stuStudentExam.getObjectiveScore() != null) {
|
|
|
|
|
teaExamAndUserDto.setObjectiveScore(stuStudentExam.getObjectiveScore());
|
|
|
|
@ -368,12 +415,14 @@ public class TeaGradeManageController {
|
|
|
|
|
teaExamAndUserDto.setTotalScore(stuStudentExam.getTotalScore());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
list.add(teaExamAndUserDto);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return list;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@AnonymousAccess
|
|
|
|
|
@PostMapping("/getTrainingInfo")
|
|
|
|
|
@ApiOperation("练习模式--页面展示")
|
|
|
|
|