fix(student): 修复学生状态查询逻辑
parent
15798a0704
commit
9ebd0efeed
|
|
@ -7,8 +7,6 @@ import com.alibaba.cola.dto.SingleResponse;
|
||||||
import com.zcloud.edu.command.convertor.study.ClassExamPaperCoConvertor;
|
import com.zcloud.edu.command.convertor.study.ClassExamPaperCoConvertor;
|
||||||
import com.zcloud.edu.dto.clientobject.resource.QuestionCO;
|
import com.zcloud.edu.dto.clientobject.resource.QuestionCO;
|
||||||
import com.zcloud.edu.dto.clientobject.study.ClassExamPaperCO;
|
import com.zcloud.edu.dto.clientobject.study.ClassExamPaperCO;
|
||||||
import com.zcloud.edu.dto.data.archives.ClassArchivesDTO;
|
|
||||||
import com.zcloud.edu.dto.study.ClassExamPaperExportCmd;
|
|
||||||
import com.zcloud.edu.dto.study.ClassExamPaperPageQry;
|
import com.zcloud.edu.dto.study.ClassExamPaperPageQry;
|
||||||
import com.zcloud.edu.persistence.dataobject.QuestionDO;
|
import com.zcloud.edu.persistence.dataobject.QuestionDO;
|
||||||
import com.zcloud.edu.persistence.dataobject.study.ClassDO;
|
import com.zcloud.edu.persistence.dataobject.study.ClassDO;
|
||||||
|
|
@ -16,6 +14,7 @@ import com.zcloud.edu.persistence.dataobject.study.ClassExamPaperDO;
|
||||||
import com.zcloud.edu.persistence.repository.resource.QuestionRepository;
|
import com.zcloud.edu.persistence.repository.resource.QuestionRepository;
|
||||||
import com.zcloud.edu.persistence.repository.study.ClassExamPaperRepository;
|
import com.zcloud.edu.persistence.repository.study.ClassExamPaperRepository;
|
||||||
import com.zcloud.edu.persistence.repository.study.ClassRepository;
|
import com.zcloud.edu.persistence.repository.study.ClassRepository;
|
||||||
|
import com.zcloud.edu.persistence.repository.study.StudentExamRecordRepository;
|
||||||
import com.zcloud.gbscommon.utils.PageQueryHelper;
|
import com.zcloud.gbscommon.utils.PageQueryHelper;
|
||||||
import com.zcloud.gbscommon.utils.Tools;
|
import com.zcloud.gbscommon.utils.Tools;
|
||||||
import com.zcloud.gbscommon.utils.WordToPdfUtil;
|
import com.zcloud.gbscommon.utils.WordToPdfUtil;
|
||||||
|
|
@ -47,6 +46,7 @@ public class ClassExamPaperQueryExe {
|
||||||
private final ClassExamPaperCoConvertor classExamPaperCoConvertor;
|
private final ClassExamPaperCoConvertor classExamPaperCoConvertor;
|
||||||
private final QuestionRepository questionRepository;
|
private final QuestionRepository questionRepository;
|
||||||
private final ClassRepository classRepository;
|
private final ClassRepository classRepository;
|
||||||
|
private final StudentExamRecordRepository studentExamRecordRepository;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页
|
* 分页
|
||||||
|
|
@ -84,6 +84,10 @@ public class ClassExamPaperQueryExe {
|
||||||
ClassExamPaperCO classExamPaperCO = new ClassExamPaperCO();
|
ClassExamPaperCO classExamPaperCO = new ClassExamPaperCO();
|
||||||
BeanUtils.copyProperties(classExamPaperDO, classExamPaperCO);
|
BeanUtils.copyProperties(classExamPaperDO, classExamPaperCO);
|
||||||
classExamPaperCO.setQuestionList(questionCOList);
|
classExamPaperCO.setQuestionList(questionCOList);
|
||||||
|
//考试人数
|
||||||
|
|
||||||
|
Long count = studentExamRecordRepository.getCountByClassExamPaperId(classExamPaperDO.getClassExamPaperId());
|
||||||
|
classExamPaperCO.setClassExamPaperStudentCount( count);
|
||||||
return SingleResponse.of(classExamPaperCO);
|
return SingleResponse.of(classExamPaperCO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,10 +14,13 @@ import com.zcloud.edu.dto.data.study.ClassCountDTO;
|
||||||
import com.zcloud.edu.dto.data.study.ClassQuestionDTO;
|
import com.zcloud.edu.dto.data.study.ClassQuestionDTO;
|
||||||
import com.zcloud.edu.dto.study.ClassCountQry;
|
import com.zcloud.edu.dto.study.ClassCountQry;
|
||||||
import com.zcloud.edu.dto.study.ClassPageQry;
|
import com.zcloud.edu.dto.study.ClassPageQry;
|
||||||
|
import com.zcloud.edu.persistence.dataobject.TeacherDO;
|
||||||
import com.zcloud.edu.persistence.dataobject.study.ClassDO;
|
import com.zcloud.edu.persistence.dataobject.study.ClassDO;
|
||||||
import com.zcloud.edu.persistence.dataobject.study.StudentDO;
|
import com.zcloud.edu.persistence.dataobject.study.StudentDO;
|
||||||
import com.zcloud.edu.persistence.mapper.po.study.ClassQuestionPO;
|
import com.zcloud.edu.persistence.mapper.po.study.ClassQuestionPO;
|
||||||
import com.zcloud.edu.persistence.mapper.po.study.StudentCountPO;
|
import com.zcloud.edu.persistence.mapper.po.study.StudentCountPO;
|
||||||
|
import com.zcloud.edu.persistence.repository.resource.CorpInfoRepository;
|
||||||
|
import com.zcloud.edu.persistence.repository.resource.TeacherRepository;
|
||||||
import com.zcloud.edu.persistence.repository.study.ClassRepository;
|
import com.zcloud.edu.persistence.repository.study.ClassRepository;
|
||||||
import com.zcloud.edu.persistence.repository.study.StudentRepository;
|
import com.zcloud.edu.persistence.repository.study.StudentRepository;
|
||||||
import com.zcloud.gbscommon.utils.PageQueryHelper;
|
import com.zcloud.gbscommon.utils.PageQueryHelper;
|
||||||
|
|
@ -44,6 +47,8 @@ public class ClassQueryExe {
|
||||||
private final ClassCoConvertor classCoConvertor;
|
private final ClassCoConvertor classCoConvertor;
|
||||||
private final StudentRepository studentRepository;
|
private final StudentRepository studentRepository;
|
||||||
private final StudentCoConvertor studentCoConvertor;
|
private final StudentCoConvertor studentCoConvertor;
|
||||||
|
private final TeacherRepository teacherRepository;
|
||||||
|
private final CorpInfoRepository corpInfoRepository;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页
|
* 分页
|
||||||
|
|
@ -63,6 +68,8 @@ public class ClassQueryExe {
|
||||||
if (pageResponse.getData() != null && pageResponse.getData().size() > 0){
|
if (pageResponse.getData() != null && pageResponse.getData().size() > 0){
|
||||||
List<String> classIds = pageResponse.getData().stream().map(ClassDO::getClassId).collect(Collectors.toList());
|
List<String> classIds = pageResponse.getData().stream().map(ClassDO::getClassId).collect(Collectors.toList());
|
||||||
List<ClassDO> stuCountList = studentRepository.countStudentByClass(classIds);
|
List<ClassDO> stuCountList = studentRepository.countStudentByClass(classIds);
|
||||||
|
//判断当前登录人是否是教师
|
||||||
|
|
||||||
if (stuCountList != null && stuCountList.size() > 0){
|
if (stuCountList != null && stuCountList.size() > 0){
|
||||||
Map<String, ClassDO> stuCountMap = stuCountList.stream().collect(Collectors.toMap(ClassDO::getClassId, classDO -> classDO));
|
Map<String, ClassDO> stuCountMap = stuCountList.stream().collect(Collectors.toMap(ClassDO::getClassId, classDO -> classDO));
|
||||||
pageResponse.getData().stream().forEach(classDO -> {
|
pageResponse.getData().stream().forEach(classDO -> {
|
||||||
|
|
@ -71,10 +78,20 @@ public class ClassQueryExe {
|
||||||
classDO.setSignCount(stuCountMap.get(classDO.getClassId()).getSignCount());
|
classDO.setSignCount(stuCountMap.get(classDO.getClassId()).getSignCount());
|
||||||
classDO.setFinishCount(stuCountMap.get(classDO.getClassId()).getFinishCount());
|
classDO.setFinishCount(stuCountMap.get(classDO.getClassId()).getFinishCount());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
List<ClassCO> examCenterCOS = classCoConvertor.converDOsToCOs(pageResponse.getData());
|
List<ClassCO> examCenterCOS = classCoConvertor.converDOsToCOs(pageResponse.getData());
|
||||||
|
TeacherDO teacherInfoByUserId = teacherRepository.getTeacherInfoByUserId(AuthContext.getUserId());
|
||||||
|
Boolean checkCorp = corpInfoRepository.checkCorp();
|
||||||
|
examCenterCOS.stream().forEach(classCO -> {
|
||||||
|
//如果是教师,只能维护本人创建的数据,
|
||||||
|
if(checkCorp || (teacherInfoByUserId != null && teacherInfoByUserId.getUserId().equals(classCO.getCreateId()))){
|
||||||
|
classCO.setIsUserCreate( true);
|
||||||
|
}
|
||||||
|
});
|
||||||
return PageResponse.of(examCenterCOS, pageResponse.getTotalCount(), pageResponse.getPageSize(), pageResponse.getPageIndex());
|
return PageResponse.of(examCenterCOS, pageResponse.getTotalCount(), pageResponse.getPageSize(), pageResponse.getPageIndex());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -94,7 +94,9 @@ public class StudentQueryExe {
|
||||||
StudentDO studentDO = studentRepository.getById(qry.getStuId());
|
StudentDO studentDO = studentRepository.getById(qry.getStuId());
|
||||||
StudentDO studentUrl = studentRepository.findFaceUrlByPhone(studentDO.getPhone());
|
StudentDO studentUrl = studentRepository.findFaceUrlByPhone(studentDO.getPhone());
|
||||||
StudentE studentE = new StudentE();
|
StudentE studentE = new StudentE();
|
||||||
studentE.setUserAvatarUrl(studentUrl.getUserAvatarUrl());
|
if(studentUrl!=null){
|
||||||
|
studentE.setUserAvatarUrl(studentUrl.getUserAvatarUrl());
|
||||||
|
}
|
||||||
BeanUtils.copyProperties(studentDO, studentE);
|
BeanUtils.copyProperties(studentDO, studentE);
|
||||||
// 班级信息
|
// 班级信息
|
||||||
ClassDO classDO = classRepository.getByClassId(studentDO.getClassId());
|
ClassDO classDO = classRepository.getByClassId(studentDO.getClassId());
|
||||||
|
|
|
||||||
|
|
@ -120,5 +120,7 @@ public class ClassCO extends ClientObject {
|
||||||
private Integer signCount = 0;
|
private Integer signCount = 0;
|
||||||
@ApiModelProperty(value = "考试通过人数")
|
@ApiModelProperty(value = "考试通过人数")
|
||||||
private Integer finishCount= 0;
|
private Integer finishCount= 0;
|
||||||
|
@ApiModelProperty(value = "是否是当前用户创建的数据")
|
||||||
|
private Boolean isUserCreate = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -91,5 +91,8 @@ public class ClassExamPaperCO extends ClientObject {
|
||||||
//环境
|
//环境
|
||||||
@ApiModelProperty(value = "环境")
|
@ApiModelProperty(value = "环境")
|
||||||
private String env;
|
private String env;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "班级考试人数")
|
||||||
|
private Long classExamPaperStudentCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -78,5 +78,12 @@ public class StudentExamRecordRepositoryImpl extends BaseRepositoryImpl<StudentE
|
||||||
public StudentExamRecordDO getInfoById(Long id) {
|
public StudentExamRecordDO getInfoById(Long id) {
|
||||||
return studentExamRecordMapper.getInfoById(id);
|
return studentExamRecordMapper.getInfoById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long getCountByClassExamPaperId(String classExamPaperId) {
|
||||||
|
QueryWrapper queryWrapper = new QueryWrapper<>();
|
||||||
|
queryWrapper.eq("class_exam_paper_id", classExamPaperId);
|
||||||
|
return studentExamRecordMapper.selectCount(queryWrapper);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,5 +27,7 @@ public interface StudentExamRecordRepository extends BaseRepository<StudentExamR
|
||||||
Integer countByStudentId(String studentId);
|
Integer countByStudentId(String studentId);
|
||||||
|
|
||||||
StudentExamRecordDO getInfoById(Long id);
|
StudentExamRecordDO getInfoById(Long id);
|
||||||
|
|
||||||
|
Long getCountByClassExamPaperId(String classExamPaperId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -93,7 +93,8 @@
|
||||||
c.valid_start_time,
|
c.valid_start_time,
|
||||||
c.valid_end_time,
|
c.valid_end_time,
|
||||||
c.examination,
|
c.examination,
|
||||||
c.numberofexams
|
c.numberofexams,
|
||||||
|
c.create_id
|
||||||
FROM
|
FROM
|
||||||
class c
|
class c
|
||||||
left join training_type t on t.training_type_id = c.train_type
|
left join training_type t on t.training_type_id = c.train_type
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue