|
@@ -86,7 +86,7 @@ public class BasicExamStudentServiceImpl extends ServiceImpl<BasicExamStudentMap
|
|
|
private ExamTaskDetailService examTaskDetailService;
|
|
|
|
|
|
@Override
|
|
|
- public IPage<BasicExamStudentResult> page(Long semesterId, Long examId, Long courseId,String paperNumber,
|
|
|
+ public IPage<BasicExamStudentResult> page(Long semesterId, Long examId, Long courseId, String paperNumber,
|
|
|
String teacher, String college, String major, String teachClassName, String className, String examStudentInfo, int pageNumber,
|
|
|
int pageSize) {
|
|
|
SysUser requestUser = (SysUser) ServletUtil.getRequestUser();
|
|
@@ -277,6 +277,23 @@ public class BasicExamStudentServiceImpl extends ServiceImpl<BasicExamStudentMap
|
|
|
basicExamStudent.setSchoolId(schoolId);
|
|
|
basicExamStudent.setTeacherId(teacherId);
|
|
|
|
|
|
+ // 同一课程+教学班下只能有一位任课老师
|
|
|
+ List<BasicExamStudent> basicExamStudentList = this.listByExamIdAndCourseIdAndTeachClassName(basicExamStudent.getExamId(), basicExamStudent.getCourseId(), basicExamStudent.getTeachClassName());
|
|
|
+ if(CollectionUtils.isNotEmpty(basicExamStudentList)){
|
|
|
+ List<Long> teacherIds = basicExamStudentList.stream().map(BasicExamStudent::getTeacherId).distinct().collect(Collectors.toList());
|
|
|
+ if(teacherIds.size() >1){
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("课程下同一教学班,只允许有一个任课老师");
|
|
|
+ } else{
|
|
|
+ if(basicExamStudent.getTeacherId() != null && teacherIds.get(0) == null){
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("教学班其它学生任课老师为空,本次不填任课老师信息");
|
|
|
+ } else if (basicExamStudent.getTeacherId() == null && teacherIds.get(0) != null){
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("教学班其它学生任课老师不为空,任课老师必填");
|
|
|
+ } else if (basicExamStudent.getTeacherId() != null && teacherIds.get(0) != null && basicExamStudent.getTeacherId().equals(teacherIds.get(0))){
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("任课老师与教学班其它学生任课老师不一致");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
if (SystemConstant.longNotNull(basicExamStudent.getId())) {
|
|
|
// 编辑 (学号不可更改)
|
|
|
BasicExamStudent dbBasicExamStudent = this.getById(basicExamStudent.getId());
|
|
@@ -464,13 +481,19 @@ public class BasicExamStudentServiceImpl extends ServiceImpl<BasicExamStudentMap
|
|
|
BasicCourse basicCourse = basicCourseService.getById(basicExamStudent.getCourseId());
|
|
|
SysOrg sysOrg = sysOrgService.getById(basicCourse != null ? basicCourse.getTeachingRoomId() : null);
|
|
|
List<MarkStudent> markStudentList = markStudentService.listByStudentId(basicExamStudent.getId());
|
|
|
- if (CollectionUtils.isNotEmpty(markStudentList)) {
|
|
|
- for (MarkStudent markStudent : markStudentList) {
|
|
|
- DeleteBasicExamStudentStatusDto deleteBasicExamStudentStatusDto = new DeleteBasicExamStudentStatusDto(basicExamStudent.getStudentName(), basicExamStudent.getStudentCode(), basicCourse != null ? basicCourse.getCode() : null, basicCourse != null ? basicCourse.getName() : null, sysOrg != null ? sysOrg.getName() : null);
|
|
|
- deleteBasicExamStudentStatusDto.setScanStatus(markStudent.getUpload() != null ? markStudent.getUpload() : false);
|
|
|
- deleteBasicExamStudentStatusDto.setMarkTaskStatus(markTaskService.countByStudentId(markStudent.getId()) > 0);
|
|
|
- list.add(deleteBasicExamStudentStatusDto);
|
|
|
+ Map<Long, List<MarkStudent>> map = markStudentList.stream().collect(Collectors.groupingBy(MarkStudent::getBasicStudentId));
|
|
|
+ for (Map.Entry<Long, List<MarkStudent>> entry : map.entrySet()) {
|
|
|
+ DeleteBasicExamStudentStatusDto deleteBasicExamStudentStatusDto = new DeleteBasicExamStudentStatusDto(basicExamStudent.getStudentName(), basicExamStudent.getStudentCode(), basicCourse != null ? basicCourse.getCode() : null, basicCourse != null ? basicCourse.getName() : null, sysOrg != null ? sysOrg.getName() : null);
|
|
|
+ deleteBasicExamStudentStatusDto.setScanStatus(entry.getValue().stream().filter(m -> m.getUpload() != null && m.getUpload()).count() > 0);
|
|
|
+ int taskCount = 0;
|
|
|
+ for (MarkStudent markStudent : entry.getValue()) {
|
|
|
+ if (taskCount > 0) {
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ taskCount += markTaskService.countByStudentId(markStudent.getId());
|
|
|
}
|
|
|
+ deleteBasicExamStudentStatusDto.setMarkTaskStatus(taskCount > 0);
|
|
|
+ list.add(deleteBasicExamStudentStatusDto);
|
|
|
}
|
|
|
}
|
|
|
return list;
|
|
@@ -488,4 +511,13 @@ public class BasicExamStudentServiceImpl extends ServiceImpl<BasicExamStudentMap
|
|
|
public ExamStudentDto queryExamStudent(Long examId, Long courseId, String paperNumber) {
|
|
|
return this.baseMapper.queryExamStudent(examId, courseId, paperNumber);
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<BasicExamStudent> listByExamIdAndCourseIdAndTeachClassName(Long examId, Long courseId, String teachClassName) {
|
|
|
+ QueryWrapper<BasicExamStudent> queryWrapper = new QueryWrapper<>();
|
|
|
+ queryWrapper.lambda().eq(BasicExamStudent::getExamId, examId)
|
|
|
+ .eq(BasicExamStudent::getCourseId, courseId)
|
|
|
+ .eq(BasicExamStudent::getTeachClassName, teachClassName);
|
|
|
+ return this.list(queryWrapper);
|
|
|
+ }
|
|
|
}
|