|
@@ -12,6 +12,7 @@ import com.keao.edu.user.dao.ExamRegistrationDao;
|
|
|
import com.keao.edu.user.dao.ExamRoomDao;
|
|
|
import com.keao.edu.user.dao.ExamRoomStudentRelationDao;
|
|
|
import com.keao.edu.user.dto.ExamRoomDto;
|
|
|
+import com.keao.edu.user.dto.ExamRoomStatisticsDto;
|
|
|
import com.keao.edu.user.enums.ExamModeEnum;
|
|
|
import com.keao.edu.user.page.ExamRoomQueryInfo;
|
|
|
import com.keao.edu.user.service.ExamRoomService;
|
|
@@ -21,6 +22,7 @@ import com.keao.edu.util.collection.MapUtil;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.util.CollectionUtils;
|
|
|
|
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
@@ -48,8 +50,8 @@ public class ExamRoomServiceImpl extends BaseServiceImpl<Long, ExamRoom> impleme
|
|
|
Map<String, Object> params = new HashMap<>();
|
|
|
MapUtil.populateMap(params, queryInfo);
|
|
|
|
|
|
- List<Integer> nextLevelOrganIds = organizationService.getNextLevelOrganIds(queryInfo.getOrganId(), true);
|
|
|
- params.put("organIds", nextLevelOrganIds);
|
|
|
+ List<Integer> childOrganIds = organizationService.getChildOrganIds(queryInfo.getOrganId(), true);
|
|
|
+ params.put("organIds", childOrganIds);
|
|
|
|
|
|
List<ExamRoomDto> dataList = null;
|
|
|
int count = examRoomDao.countExamRoomPage(params);
|
|
@@ -113,6 +115,34 @@ public class ExamRoomServiceImpl extends BaseServiceImpl<Long, ExamRoom> impleme
|
|
|
if(withoutExamRoomStudentNum>0){
|
|
|
throw new BizException("存在未安排教室的学员");
|
|
|
}
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public ExamRoomStatisticsDto getExamRoomStatisticsInfo(Integer organId, Integer examId) {
|
|
|
+ ExamRoomStatisticsDto examRoomStatisticsInfo=new ExamRoomStatisticsDto();
|
|
|
+
|
|
|
+ List<Integer> childOrganIds = organizationService.getChildOrganIds(organId, true);
|
|
|
+
|
|
|
+ examRoomStatisticsInfo.setTotalRegistrationStudentNum(examRegistrationDao.countTotalRegistrationStudentNumWithExam(childOrganIds, examId));
|
|
|
+ examRoomStatisticsInfo.setInRoomStudentNum(examRegistrationDao.countInExamRoomStudentNum(childOrganIds, examId));
|
|
|
+
|
|
|
+ List<ExamRoom> examRooms = examRoomDao.getWithExam(childOrganIds, examId);
|
|
|
+ if(!CollectionUtils.isEmpty(examRooms)){
|
|
|
+ examRoomStatisticsInfo.setExamRoomNum(examRooms.size());
|
|
|
+ examRoomStatisticsInfo.setFirstExamTime(examRooms.stream().min(Comparator.comparing(ExamRoom::getExamTime)).get().getExamTime());
|
|
|
+ examRoomStatisticsInfo.setLastExamTime(examRooms.stream().max(Comparator.comparing(ExamRoom::getExamTime)).get().getExamTime());
|
|
|
+ int teacherNum=0;
|
|
|
+ for (ExamRoom examRoom : examRooms) {
|
|
|
+ if(Objects.nonNull(examRoom.getMainTeacherUserId())){
|
|
|
+ teacherNum+=1;
|
|
|
+ }
|
|
|
+ if(StringUtils.isNotBlank(examRoom.getAssistantTeacherUserIdList())){
|
|
|
+ teacherNum = teacherNum + StringUtils.countMatches(examRoom.getAssistantTeacherUserIdList(), ",") + 1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ examRoomStatisticsInfo.setExamRoomTeacherNum(teacherNum);
|
|
|
+ }
|
|
|
|
|
|
+ return examRoomStatisticsInfo;
|
|
|
}
|
|
|
}
|