wangliang 4 år sedan
förälder
incheckning
3dd3b70589

+ 20 - 18
themis-exam/src/main/java/com/qmth/themis/exam/listener/service/impl/MqOeLogicServiceImpl.java

@@ -116,24 +116,26 @@ public class MqOeLogicServiceImpl implements MqOeLogicService {
                     teExamStudentLogService.save(teExamStudentLog);
                 }
             });
-        } else if (Objects.equals(MqTagEnum.OE_HARD_FINISH.name(), tag)) {//手动交卷
-            Set examRecordId = JacksonUtil.readJson(String.valueOf(mqDto.getBody()), Set.class);
-            examRecordId.forEach(s -> {
-                Long recordId = Long.parseLong(String.valueOf(s));
-                if (Objects.nonNull(webSocketMap.get(recordId))) {
-                    Long examStudentId = ExamRecordCacheUtil.getExamStudentId(recordId);
-                    ExamStudentCacheBean examStudentCacheBean = teExamStudentService.getExamStudentCacheBean(examStudentId);
-                    WebSocketOeServer webSocketOeServer = webSocketMap.get(recordId);
-                    Map map = new HashMap<>();
-                    map.put(SystemConstant.RECORD_ID, recordId);
-                    map.put(SystemConstant.MESSAGE, FinishTypeEnum.valueOf(String.valueOf(mqDto.getProperties().get("type"))).getCode());
-                    WebsocketDto websocketDto = new WebsocketDto(WebsocketTypeEnum.HAND_STOP_EXAM.name(), map);
-                    webSocketOeServer.sendMessage(websocketDto);
-                    TEExamStudentLog teExamStudentLog = new TEExamStudentLog(mqDto.getType().name(), mqDto.getType().getCode(), mqDto.getType().getCode(), examStudentCacheBean.getStudentId(), examStudentId, recordId);
-                    teExamStudentLogService.save(teExamStudentLog);
-                }
-            });
-        } else if (Objects.equals(MqTagEnum.OE_WARNING_FINISH.name(), tag)) {//预警交卷
+        }
+//        else if (Objects.equals(MqTagEnum.OE_HARD_FINISH.name(), tag)) {//手动交卷
+//            Set examRecordId = JacksonUtil.readJson(String.valueOf(mqDto.getBody()), Set.class);
+//            examRecordId.forEach(s -> {
+//                Long recordId = Long.parseLong(String.valueOf(s));
+//                if (Objects.nonNull(webSocketMap.get(recordId))) {
+//                    Long examStudentId = ExamRecordCacheUtil.getExamStudentId(recordId);
+//                    ExamStudentCacheBean examStudentCacheBean = teExamStudentService.getExamStudentCacheBean(examStudentId);
+//                    WebSocketOeServer webSocketOeServer = webSocketMap.get(recordId);
+//                    Map map = new HashMap<>();
+//                    map.put(SystemConstant.RECORD_ID, recordId);
+//                    map.put(SystemConstant.MESSAGE, FinishTypeEnum.valueOf(String.valueOf(mqDto.getProperties().get("type"))).getCode());
+//                    WebsocketDto websocketDto = new WebsocketDto(WebsocketTypeEnum.HAND_STOP_EXAM.name(), map);
+//                    webSocketOeServer.sendMessage(websocketDto);
+//                    TEExamStudentLog teExamStudentLog = new TEExamStudentLog(mqDto.getType().name(), mqDto.getType().getCode(), mqDto.getType().getCode(), examStudentCacheBean.getStudentId(), examStudentId, recordId);
+//                    teExamStudentLogService.save(teExamStudentLog);
+//                }
+//            });
+//        }
+        else if (Objects.equals(MqTagEnum.OE_WARNING_FINISH.name(), tag)) {//预警交卷
             Set examRecordId = JacksonUtil.readJson(String.valueOf(mqDto.getBody()), Set.class);
             examRecordId.forEach(s -> {
                 Long recordId = Long.parseLong(String.valueOf(s));

+ 2 - 2
themis-task/src/main/java/com/qmth/themis/task/quartz/service/impl/QuartzLogicServiceImpl.java

@@ -68,7 +68,7 @@ public class QuartzLogicServiceImpl implements QuartzLogicService {
                         if (Objects.nonNull(examRecordStatusEnum) && !Objects.equals(ExamRecordStatusEnum.FINISHED, examRecordStatusEnum) && !Objects.equals(ExamRecordStatusEnum.PERSISTED, examRecordStatusEnum)) {
                             Long recordId = Long.parseLong(k);
                             Long recordEndTime = ExamRecordCacheUtil.getEndTime(recordId);
-                            if (examActivityCacheBean.getFinishTime().longValue() == recordEndTime.longValue()) {
+                            if (Objects.nonNull(examActivityCacheBean.getFinishTime()) && Objects.nonNull(recordEndTime) && examActivityCacheBean.getFinishTime().longValue() == recordEndTime.longValue()) {
                                 Integer durationSeconds = ExamRecordCacheUtil.getDurationSeconds(recordId);
                                 Long examStudentId = ExamRecordCacheUtil.getExamStudentId(recordId);
                                 ExamStudentCacheBean examStudentCacheBean = teExamStudentService.getExamStudentCacheBean(examStudentId);
@@ -88,7 +88,7 @@ public class QuartzLogicServiceImpl implements QuartzLogicService {
                         if (Objects.nonNull(examRecordStatusEnum) && !Objects.equals(ExamRecordStatusEnum.FINISHED, examRecordStatusEnum) && !Objects.equals(ExamRecordStatusEnum.PERSISTED, examRecordStatusEnum) && !Objects.equals(ExamRecordStatusEnum.ANSWERING, examRecordStatusEnum)) {
                             Long recordId = Long.parseLong(k);
                             Long recordEndTime = ExamRecordCacheUtil.getEndTime(recordId);
-                            if (examActivityCacheBean.getFinishTime() == recordEndTime) {
+                            if (Objects.nonNull(examActivityCacheBean.getFinishTime()) && Objects.nonNull(recordEndTime) && examActivityCacheBean.getFinishTime().longValue() == recordEndTime.longValue()) {
                                 Integer durationSeconds = ExamRecordCacheUtil.getDurationSeconds(recordId);
                                 Long examStudentId = ExamRecordCacheUtil.getExamStudentId(recordId);
                                 ExamStudentCacheBean examStudentCacheBean = teExamStudentService.getExamStudentCacheBean(examStudentId);