Joburgess пре 4 година
родитељ
комит
3b9dc6cdbc

+ 0 - 7
edu-user/edu-user-biz/src/main/java/com/keao/edu/user/service/impl/ExamRoomStudentRelationServiceImpl.java

@@ -135,7 +135,6 @@ public class ExamRoomStudentRelationServiceImpl extends BaseServiceImpl<Long, Ex
 
 		List<ExamRoomStudentRelation> studentsWithExamRoom = examRoomStudentRelationDao.findStudentsWithExamRoom(examRoomId);
 		Set<Long> existRegistIds = studentsWithExamRoom.stream().map(ExamRoomStudentRelation::getExamRegistrationId).collect(Collectors.toSet());
-		Set<Integer> existStudentIds = studentsWithExamRoom.stream().map(ExamRoomStudentRelation::getStudentId).collect(Collectors.toSet());
 
 		String[] registIds = registIdsStr.split(",");
 
@@ -143,9 +142,6 @@ public class ExamRoomStudentRelationServiceImpl extends BaseServiceImpl<Long, Ex
 		Map<Integer, ExamRegistration> studentRegistMap = examRegistrations.stream().collect(Collectors.toMap(ExamRegistration::getId, e -> e));
 
 		Set<Integer> studentIds = examRegistrations.stream().map(ExamRegistration::getStudentId).collect(Collectors.toSet());
-		if(studentIds.size()!=registIds.length){
-			throw new BizException("学员重复");
-		}
 
 		List<ExamRoomStudentRelation> examRoomStudentRelations=new ArrayList<>();
 		List<ExamCertification> examCertifications=new ArrayList<>();
@@ -158,9 +154,6 @@ public class ExamRoomStudentRelationServiceImpl extends BaseServiceImpl<Long, Ex
 			if(Objects.isNull(examRegistration)){
 				throw new BizException("学员信息错误");
 			}
-			if(existStudentIds.contains(examRegistration.getStudentId())){
-				throw new BizException("学员重复");
-			}
 
 			ExamRoomStudentRelation e=new ExamRoomStudentRelation();
 			e.setExamRegistrationId(Long.valueOf(registId));

+ 16 - 0
edu-user/edu-user-server/src/main/java/com/keao/edu/user/controller/ExamRoomStudentRelationController.java

@@ -129,6 +129,22 @@ public class ExamRoomStudentRelationController extends BaseController {
         return succeed();
     }
 
+    @ApiOperation("自动分配学员到考场")
+    @PostMapping(value = "/autoSplitStudentToRoom")
+    public HttpResponseResult autoSplitStudentToRoom(Long examRoomId){
+        SysUser sysUser = sysUserFeignService.queryUserInfo();
+        Integer organId=null;
+        if(!sysUser.getIsSuperAdmin()){
+            Employee employee = employeeService.get(sysUser.getId());
+            if(Objects.isNull(employee)){
+                return failed("用户信息异常");
+            }
+            organId=employee.getOrganId();
+        }
+        examRoomStudentRelationService.autoSplitStudentToRoom(examRoomId, organId);
+        return succeed();
+    }
+
     @ApiOperation("更换学员考场")
     @PostMapping(value = "/changeStudentExamRoom")
     public HttpResponseResult changeStudentExamRoom(Long registId, Long examRoomId){