|
@@ -9,6 +9,7 @@ import com.keao.edu.common.dal.BaseDAO;
|
|
import com.keao.edu.common.enums.MessageTypeEnum;
|
|
import com.keao.edu.common.enums.MessageTypeEnum;
|
|
import com.keao.edu.common.exception.BizException;
|
|
import com.keao.edu.common.exception.BizException;
|
|
import com.keao.edu.common.page.PageInfo;
|
|
import com.keao.edu.common.page.PageInfo;
|
|
|
|
+import com.keao.edu.common.service.IdGeneratorService;
|
|
import com.keao.edu.common.service.SysMessageService;
|
|
import com.keao.edu.common.service.SysMessageService;
|
|
import com.keao.edu.common.service.impl.BaseServiceImpl;
|
|
import com.keao.edu.common.service.impl.BaseServiceImpl;
|
|
import com.keao.edu.common.tenant.TenantContextHolder;
|
|
import com.keao.edu.common.tenant.TenantContextHolder;
|
|
@@ -83,6 +84,8 @@ public class ExamRoomServiceImpl extends BaseServiceImpl<Long, ExamRoom> impleme
|
|
private ExamCertificationDao examCertificationDao;
|
|
private ExamCertificationDao examCertificationDao;
|
|
@Autowired
|
|
@Autowired
|
|
private ExamLocationDao examLocationDao;
|
|
private ExamLocationDao examLocationDao;
|
|
|
|
+ @Autowired
|
|
|
|
+ private IdGeneratorService idGeneratorService;
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public BaseDAO<Long, ExamRoom> getDAO() {
|
|
public BaseDAO<Long, ExamRoom> getDAO() {
|
|
@@ -266,6 +269,10 @@ public class ExamRoomServiceImpl extends BaseServiceImpl<Long, ExamRoom> impleme
|
|
throw new BizException("考场不存在");
|
|
throw new BizException("考场不存在");
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ if(existExamRoom.getExamPlanPushFlag()==1){
|
|
|
|
+ throw new BizException("无法修改");
|
|
|
|
+ }
|
|
|
|
+
|
|
ExaminationBasic examinationBasic = examinationBasicDao.get(examRoom.getExaminationBasicId().longValue());
|
|
ExaminationBasic examinationBasic = examinationBasicDao.get(examRoom.getExaminationBasicId().longValue());
|
|
if(Objects.isNull(examinationBasic)){
|
|
if(Objects.isNull(examinationBasic)){
|
|
throw new BizException("考级项目不存在");
|
|
throw new BizException("考级项目不存在");
|
|
@@ -363,6 +370,10 @@ public class ExamRoomServiceImpl extends BaseServiceImpl<Long, ExamRoom> impleme
|
|
|
|
|
|
ExamRoom examRoom = examRoomDao.get(examRoomIds.get(0));
|
|
ExamRoom examRoom = examRoomDao.get(examRoomIds.get(0));
|
|
|
|
|
|
|
|
+ if(examRoom.getExamPlanPushFlag()==1){
|
|
|
|
+ throw new BizException("无法删除");
|
|
|
|
+ }
|
|
|
|
+
|
|
ExaminationBasic examinationBasic = examinationBasicDao.get(examRoom.getExaminationBasicId().longValue());
|
|
ExaminationBasic examinationBasic = examinationBasicDao.get(examRoom.getExaminationBasicId().longValue());
|
|
if(Objects.isNull(examinationBasic)){
|
|
if(Objects.isNull(examinationBasic)){
|
|
throw new BizException("考级项目不存在");
|
|
throw new BizException("考级项目不存在");
|
|
@@ -421,17 +432,27 @@ public class ExamRoomServiceImpl extends BaseServiceImpl<Long, ExamRoom> impleme
|
|
examLifecycleLogDao.insert(new ExamLifecycleLog(examId, "确认考试安排", operatorId));
|
|
examLifecycleLogDao.insert(new ExamLifecycleLog(examId, "确认考试安排", operatorId));
|
|
List<ExamRoomStudentRelation> examRoomStudentWithOrgans = examRoomStudentRelationDao.getNoSendExamPlanRooms(examId.longValue(), null);
|
|
List<ExamRoomStudentRelation> examRoomStudentWithOrgans = examRoomStudentRelationDao.getNoSendExamPlanRooms(examId.longValue(), null);
|
|
|
|
|
|
|
|
+ if(CollectionUtils.isEmpty(examRoomStudentWithOrgans)){
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
Set<Integer> locationIds = examRoomStudentWithOrgans.stream().filter(e -> Objects.nonNull(e.getExamLocationId())).map(ExamRoomStudentRelation::getExamLocationId).collect(Collectors.toSet());
|
|
Set<Integer> locationIds = examRoomStudentWithOrgans.stream().filter(e -> Objects.nonNull(e.getExamLocationId())).map(ExamRoomStudentRelation::getExamLocationId).collect(Collectors.toSet());
|
|
Map<Integer, String> idLocationMap = this.getMap("exam_location", "id_", "name_", new ArrayList(locationIds), Integer.class, String.class);
|
|
Map<Integer, String> idLocationMap = this.getMap("exam_location", "id_", "name_", new ArrayList(locationIds), Integer.class, String.class);
|
|
|
|
|
|
Set<Integer> allStudentIds = examRoomStudentWithOrgans.stream().map(ExamRoomStudentRelation::getStudentId).collect(Collectors.toSet());
|
|
Set<Integer> allStudentIds = examRoomStudentWithOrgans.stream().map(ExamRoomStudentRelation::getStudentId).collect(Collectors.toSet());
|
|
Map<Integer, String> idPhoneMap = this.getMap("sys_user", "id_", "phone_", new ArrayList(allStudentIds), Integer.class, String.class);
|
|
Map<Integer, String> idPhoneMap = this.getMap("sys_user", "id_", "phone_", new ArrayList(allStudentIds), Integer.class, String.class);
|
|
|
|
|
|
|
|
+ Set<Long> registIds = examRoomStudentWithOrgans.stream().map(ExamRoomStudentRelation::getExamRegistrationId).collect(Collectors.toSet());
|
|
|
|
+ List<ExamRegistration> examRegistrations = examRegistrationDao.getRegists(new ArrayList<>(registIds));
|
|
|
|
+ Map<Integer, ExamRegistration> studentRegistMap = examRegistrations.stream().collect(Collectors.toMap(ExamRegistration::getId, e -> e));
|
|
|
|
+
|
|
Map<Long, List<ExamRoomStudentRelation>> examRoomStudentMap = examRoomStudentWithOrgans.stream().collect(Collectors.groupingBy(ExamRoomStudentRelation::getExamRoomId));
|
|
Map<Long, List<ExamRoomStudentRelation>> examRoomStudentMap = examRoomStudentWithOrgans.stream().collect(Collectors.groupingBy(ExamRoomStudentRelation::getExamRoomId));
|
|
|
|
|
|
Map<Integer, List<ExamRoom>> teacherExamRoomsMap = new HashMap<>();
|
|
Map<Integer, List<ExamRoom>> teacherExamRoomsMap = new HashMap<>();
|
|
|
|
|
|
List<ExamRoom> needUpdateExamRooms = new ArrayList<>();
|
|
List<ExamRoom> needUpdateExamRooms = new ArrayList<>();
|
|
|
|
+ List<ExamRegistration> updateRegistrations = new ArrayList<>();
|
|
|
|
+ List<ExamCertification> examCertifications=new ArrayList<>();
|
|
|
|
|
|
String baseUrl = "2?examRegistrationId=";
|
|
String baseUrl = "2?examRegistrationId=";
|
|
|
|
|
|
@@ -444,6 +465,30 @@ public class ExamRoomServiceImpl extends BaseServiceImpl<Long, ExamRoom> impleme
|
|
ExamRoom examRoom=students.get(0);
|
|
ExamRoom examRoom=students.get(0);
|
|
examRoom.setId(students.get(0).getExamRoomId());
|
|
examRoom.setId(students.get(0).getExamRoomId());
|
|
|
|
|
|
|
|
+ for (ExamRoomStudentRelation student : students) {
|
|
|
|
+ ExamRegistration examRegistration = studentRegistMap.get(Integer.valueOf(student.getExamRegistrationId().toString()));
|
|
|
|
+ if(Objects.isNull(examRegistration)){
|
|
|
|
+ throw new BizException("学员信息错误");
|
|
|
|
+ }
|
|
|
|
+ ExamCertification ec=new ExamCertification();
|
|
|
|
+ ec.setExamRegistrationId(student.getExamRegistrationId());
|
|
|
|
+ ec.setExaminationBasicId(student.getExaminationBasicId());
|
|
|
|
+ ec.setStudentId(student.getStudentId());
|
|
|
|
+ ec.setCardNo(String.valueOf(idGeneratorService.generatorId()));
|
|
|
|
+ ec.setSubjectId(examRegistration.getSubjectId());
|
|
|
|
+ ec.setLevel(examRegistration.getLevel());
|
|
|
|
+ ec.setExamStartTime(examRoom.getExamStartTime());
|
|
|
|
+ ec.setExamEndTime(examRoom.getExamEndTime());
|
|
|
|
+ if(ExamModeEnum.OFFLINE.equals(examRoom.getExamMode())){
|
|
|
|
+ ec.setExamAddress(idLocationMap.get(student.getExamLocationId()));
|
|
|
|
+ }
|
|
|
|
+ ec.setTenantId(TenantContextHolder.getTenantId());
|
|
|
|
+ examCertifications.add(ec);
|
|
|
|
+
|
|
|
|
+ examRegistration.setCardNo(ec.getCardNo());
|
|
|
|
+ updateRegistrations.add(examRegistration);
|
|
|
|
+ }
|
|
|
|
+
|
|
needUpdateExamRooms.add(new ExamRoom(examRoom.getId(), 1));
|
|
needUpdateExamRooms.add(new ExamRoom(examRoom.getId(), 1));
|
|
|
|
|
|
if(!teacherExamRoomsMap.containsKey(examRoom.getMainTeacherUserId())){
|
|
if(!teacherExamRoomsMap.containsKey(examRoom.getMainTeacherUserId())){
|
|
@@ -504,6 +549,12 @@ public class ExamRoomServiceImpl extends BaseServiceImpl<Long, ExamRoom> impleme
|
|
if(!CollectionUtils.isEmpty(needUpdateExamRooms)){
|
|
if(!CollectionUtils.isEmpty(needUpdateExamRooms)){
|
|
examRoomDao.batchUpdate(needUpdateExamRooms);
|
|
examRoomDao.batchUpdate(needUpdateExamRooms);
|
|
}
|
|
}
|
|
|
|
+ if(!CollectionUtils.isEmpty(examCertifications)){
|
|
|
|
+ examCertificationService.batchInsert(examCertifications);
|
|
|
|
+ }
|
|
|
|
+ if(!CollectionUtils.isEmpty(updateRegistrations)){
|
|
|
|
+ examRegistrationDao.batchUpdate(updateRegistrations);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|