zouxuan 5 years ago
parent
commit
ad55737591

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

@@ -51,8 +51,8 @@ public class ExamRoomStudentRelationController extends BaseController {
 
     @ApiOperation("下一位")
     @PostMapping(value = "/nextBit")
-    public HttpResponseResult nextBit(Long nextExamRoomStudentRelationId,Long examRoomStudentRelationId,Integer examStatus) {
-        examRoomStudentRelationService.nextBit(nextExamRoomStudentRelationId,examRoomStudentRelationId,examStatus);
+    public HttpResponseResult nextBit(Long nextExamRoomStudentRelationId,Long examRoomStudentRelationId,Integer examStatus,Long roomId) {
+        examRoomStudentRelationService.nextBit(nextExamRoomStudentRelationId,examRoomStudentRelationId,examStatus,roomId);
         return succeed();
     }
 

+ 1 - 1
edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/ExamRoomStudentRelationService.java

@@ -74,7 +74,7 @@ public interface ExamRoomStudentRelationService extends BaseService<Long, ExamRo
      * @param examRoomStudentRelationId 学员考场关联
      * @param examStatus 是否完成考试1是0否
      */
-    void nextBit(Long nextExamRoomStudentRelationId, Long examRoomStudentRelationId, Integer examStatus);
+    void nextBit(Long nextExamRoomStudentRelationId, Long examRoomStudentRelationId, Integer examStatus,Long roomId);
 
     /**
      * 获取房间学员队列

+ 16 - 3
edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/impl/ExamRoomStudentRelationServiceImpl.java

@@ -1,5 +1,8 @@
 package com.keao.edu.user.service.impl;
 
+import com.alibaba.fastjson.JSONObject;
+import com.keao.edu.auth.api.client.SysMessageFeignService;
+import com.keao.edu.auth.api.client.SysUserFeignService;
 import com.keao.edu.auth.api.entity.SysUser;
 import com.keao.edu.common.dal.BaseDAO;
 import com.keao.edu.common.enums.YesOrNoEnum;
@@ -57,6 +60,10 @@ public class ExamRoomStudentRelationServiceImpl extends BaseServiceImpl<Long, Ex
 	private ExamTeacherSalaryService examTeacherSalaryService;
 	@Autowired
 	private ImFeignService imFeignService;
+	@Autowired
+	private SysUserFeignService sysUserFeignService;
+	@Autowired
+	private SysMessageFeignService sysMessageFeignService;
 
 	@Override
 	public BaseDAO<Long, ExamRoomStudentRelation> getDAO() {
@@ -265,7 +272,8 @@ public class ExamRoomStudentRelationServiceImpl extends BaseServiceImpl<Long, Ex
 	}
 
 	@Override
-	public void nextBit(Long nextExamRoomStudentRelationId, Long currentExamRoomStudentRelationId, Integer examStatus) {
+	public void nextBit(Long nextExamRoomStudentRelationId, Long currentExamRoomStudentRelationId, Integer examStatus,Long examRoomId) {
+
 		if(currentExamRoomStudentRelationId != null){
 			ExamRoomStudentRelation examRoomStudentRelation = examRoomStudentRelationDao.get(currentExamRoomStudentRelationId);
 			Long roomId = examRoomStudentRelation.getExamRoomId();
@@ -291,7 +299,9 @@ public class ExamRoomStudentRelationServiceImpl extends BaseServiceImpl<Long, Ex
 
 		}
 		try {
-			WebSocketServer.sendInfo(null,null);
+			SysUser sysUser = sysUserFeignService.queryUserInfo();
+			String message = JSONObject.toJSONString(this.queryNeedCheckingList(examRoomId));
+			WebSocketServer.sendInfo(message,sysUser.getId().toString());
 		} catch (IOException e) {
 			e.printStackTrace();
 		}
@@ -315,8 +325,11 @@ public class ExamRoomStudentRelationServiceImpl extends BaseServiceImpl<Long, Ex
 
 	@Override
 	@Transactional(rollbackFor = Exception.class)
-	public void signIn(Long examRegistrationId) {
+	public synchronized void signIn(Long examRegistrationId) {
 		ExamRoomStudentRelation studentExamRoom = examRoomStudentRelationDao.getStudentExamRoom(examRegistrationId);
+		if(studentExamRoom.getSignInTime() != null){
+			throw new BizException("您已签到,请勿重复操作!");
+		}
 		studentExamRoom.setSignInTime(new Date());
 		examRoomStudentRelationDao.update(studentExamRoom);
 	}