wangliang 4 rokov pred
rodič
commit
a6f837baf2

+ 50 - 0
themis-business/src/main/java/com/qmth/themis/business/bean/exam/ExamActivityUnFinishBean.java

@@ -0,0 +1,50 @@
+package com.qmth.themis.business.bean.exam;
+
+import com.qmth.themis.business.cache.bean.ExamCacheBean;
+
+/**
+ * @Description: 未完成的考试activity
+ * @Param:
+ * @return:
+ * @Author: wangliang
+ * @Date: 2020/8/8
+ */
+public class ExamActivityUnFinishBean extends ExamCacheBean {
+
+    private Long recordId;
+    private String courseCode;
+    private String courseName;
+    private Long examStudentId;
+
+    public Long getRecordId() {
+        return recordId;
+    }
+
+    public void setRecordId(Long recordId) {
+        this.recordId = recordId;
+    }
+
+    public String getCourseCode() {
+        return courseCode;
+    }
+
+    public void setCourseCode(String courseCode) {
+        this.courseCode = courseCode;
+    }
+
+    public String getCourseName() {
+        return courseName;
+    }
+
+    public void setCourseName(String courseName) {
+        this.courseName = courseName;
+    }
+
+    public Long getExamStudentId() {
+        return examStudentId;
+    }
+
+    public void setExamStudentId(Long examStudentId) {
+        this.examStudentId = examStudentId;
+    }
+}

+ 73 - 0
themis-business/src/main/java/com/qmth/themis/business/bean/exam/ExamUnFinishBean.java

@@ -0,0 +1,73 @@
+package com.qmth.themis.business.bean.exam;
+
+import java.io.Serializable;
+
+/**
+ * @Description: 未完成的考试
+ * @Param:
+ * @return:
+ * @Author: wangliang
+ * @Date: 2020/8/8
+ */
+public class ExamUnFinishBean implements Serializable {
+
+    private Long id;
+    private String name;
+    private String preNotice;
+    private Integer preNoticeStaySeconds;
+    private String postNotice;
+    private ExamActivityUnFinishBean activity;
+
+    public ExamUnFinishBean() {
+
+    }
+
+    public ExamUnFinishBean(Long id, String name, String preNotice, Integer preNoticeStaySeconds, String postNotice,ExamActivityUnFinishBean activity) {
+        this.id = id;
+        this.name = name;
+        this.preNotice = preNotice;
+        this.preNoticeStaySeconds = preNoticeStaySeconds;
+        this.postNotice = postNotice;
+        this.activity = activity;
+    }
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getPreNotice() {
+        return preNotice;
+    }
+
+    public void setPreNotice(String preNotice) {
+        this.preNotice = preNotice;
+    }
+
+    public Integer getPreNoticeStaySeconds() {
+        return preNoticeStaySeconds;
+    }
+
+    public void setPreNoticeStaySeconds(Integer preNoticeStaySeconds) {
+        this.preNoticeStaySeconds = preNoticeStaySeconds;
+    }
+
+    public String getPostNotice() {
+        return postNotice;
+    }
+
+    public void setPostNotice(String postNotice) {
+        this.postNotice = postNotice;
+    }
+}

+ 18 - 9
themis-exam/src/main/java/com/qmth/themis/exam/api/TEStudentController.java

@@ -4,9 +4,12 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.google.gson.Gson;
 import com.qmth.themis.business.annotation.ApiJsonObject;
 import com.qmth.themis.business.annotation.ApiJsonProperty;
+import com.qmth.themis.business.bean.exam.ExamActivityUnFinishBean;
+import com.qmth.themis.business.bean.exam.ExamUnFinishBean;
 import com.qmth.themis.business.cache.ExamRecordCacheUtil;
 import com.qmth.themis.business.cache.RedisKeyHelper;
 import com.qmth.themis.business.cache.bean.ExamCacheBean;
+import com.qmth.themis.business.cache.bean.ExamStudentCacheBean;
 import com.qmth.themis.business.constant.SystemConstant;
 import com.qmth.themis.business.dto.AuthDto;
 import com.qmth.themis.business.dto.cache.TEStudentCacheDto;
@@ -16,10 +19,7 @@ import com.qmth.themis.business.entity.TBSession;
 import com.qmth.themis.business.entity.TEConfig;
 import com.qmth.themis.business.entity.TEStudent;
 import com.qmth.themis.business.enums.*;
-import com.qmth.themis.business.service.CacheService;
-import com.qmth.themis.business.service.TEConfigService;
-import com.qmth.themis.business.service.TEExamService;
-import com.qmth.themis.business.service.TEStudentService;
+import com.qmth.themis.business.service.*;
 import com.qmth.themis.business.util.JacksonUtil;
 import com.qmth.themis.business.util.RedisUtil;
 import com.qmth.themis.business.util.ServletUtil;
@@ -79,6 +79,9 @@ public class TEStudentController {
     @Resource
     TEExamService teExamService;
 
+    @Resource
+    TEExamStudentService teExamStudentService;
+
     @ApiOperation(value = "学生登录接口")
     @RequestMapping(value = "/login", method = RequestMethod.POST)
     @ApiResponses({@ApiResponse(code = 200, message = "学生信息", response = TEExamResultDto.class)})
@@ -188,13 +191,15 @@ public class TEStudentController {
             //获取考试记录缓存
             Map<String, Object> objectMap = redisUtil.getHashEntries(RedisKeyHelper.examRecordCacheKey(recordId));
             Long examIdMap = Long.parseLong(String.valueOf(objectMap.get("examId")));
+            Long examStudentId = Long.parseLong(String.valueOf(objectMap.get("examStudentId")));
             Integer durationSeconds = null;
             if (Objects.isNull(objectMap.get("durationSeconds"))) {
                 durationSeconds = 0;
             } else {
                 durationSeconds = Integer.parseInt(String.valueOf(objectMap.get("durationSeconds")));
             }
-            ExamCacheBean ec = teExamService.getExamCacheBean(examIdMap);
+            ExamCacheBean ec = teExamService.getExamCacheBean(examIdMap);//考试缓存
+            ExamStudentCacheBean examStudentCacheBean = teExamStudentService.getExamStudnetCacheBean(examStudentId);
 
             //获取最近同步时间
             Date clientLastSyncTime = ExamRecordCacheUtil.getClientLastSyncTime(recordId);
@@ -227,10 +232,14 @@ public class TEStudentController {
                     //发送mq,增加断点次数记录
                     MqDto mqDto = new MqDto(MqTopicEnum.themisTopic.getCode(), MqTagEnum.examBreakHistory.name(), JacksonUtil.parseJson(objectMap), MqEnum.EXAM_BREAK, String.valueOf(recordId), "增加断点记录");
                     mqDtoService.assembleSendOneWayMsg(mqDto);
-                    Map finalMap = new HashMap();
-                    finalMap.put("waiting", ec);
-                    finalMap.put("activity", objectMap);
-                    map.put("unFinished", finalMap);
+                    Gson gson = new Gson();
+                    ExamActivityUnFinishBean examActivityUnFinishBean = gson.fromJson(gson.toJson(ec), ExamActivityUnFinishBean.class);
+                    examActivityUnFinishBean.setRecordId(recordId);
+                    examActivityUnFinishBean.setCourseCode(examStudentCacheBean.getCourseCode());
+                    examActivityUnFinishBean.setCourseName(examStudentCacheBean.getCourseName());
+                    examActivityUnFinishBean.setExamStudentId(examStudentId);
+                    ExamUnFinishBean examUnFinishBean = new ExamUnFinishBean(ec.getId(), ec.getName(), ec.getPreNotice(), ec.getPreNoticeStaySeconds(), ec.getPostNotice(), examActivityUnFinishBean);
+                    map.put("unFinished", examUnFinishBean);
                 }
             }
         }