wangliang 4 ani în urmă
părinte
comite
4029963968

+ 1 - 11
themis-backend/src/main/java/com/qmth/themis/backend/api/TEExamController.java

@@ -11,7 +11,6 @@ import com.qmth.themis.business.constant.SystemConstant;
 import com.qmth.themis.business.dto.AuthDto;
 import com.qmth.themis.business.dto.ExamPropCountDto;
 import com.qmth.themis.business.dto.MqDto;
-import com.qmth.themis.business.dto.cache.TEStudentCacheDto;
 import com.qmth.themis.business.dto.request.TEExamDto;
 import com.qmth.themis.business.dto.response.TEExamQueryDto;
 import com.qmth.themis.business.entity.*;
@@ -367,7 +366,6 @@ public class TEExamController {
         Set<String> studentSet = null;
         Set<Long> examActivityIdSet = null;
         Integer allCount = 0;
-        Integer loginCount = 0;
         AtomicReference<Integer> prepareCount = new AtomicReference<>(0);
         AtomicReference<Integer> examCount = new AtomicReference<>(0);
         AtomicReference<Integer> clientWebsocketStatusCount = new AtomicReference<>(0);
@@ -386,14 +384,6 @@ public class TEExamController {
             allCount = studentSet.size();
         }
 
-        if (Objects.nonNull(studentSet)) {
-            //获取已登录学生
-            List<TEStudentCacheDto> teStudentCacheDtoList = (List<TEStudentCacheDto>) redisUtil.multiGet(studentSet);
-            if (Objects.nonNull(teStudentCacheDtoList) && teStudentCacheDtoList.size() > 0) {
-                loginCount = teStudentCacheDtoList.stream().filter(s -> Objects.nonNull(s)).collect(Collectors.toList()).size();
-            }
-        }
-
         if (Objects.nonNull(examActivityIdSet)) {
             //获取已待考、考试中、已完成学生
             examActivityIdSet.forEach(s -> {
@@ -442,7 +432,7 @@ public class TEExamController {
         }
         notComplete = allCount - alreadyComplete.get();
         BigDecimal completionRate = new BigDecimal(alreadyComplete.get()).divide(new BigDecimal(allCount)).setScale(2, BigDecimal.ROUND_HALF_UP);
-        ExamPropCountDto examPropCountDto = new ExamPropCountDto(examId, allCount, loginCount, prepareCount.get(), examCount.get(), clientWebsocketStatusCount.get(), monitorStatusSourceCount.get(), alreadyComplete.get(), notComplete, completionRate);
+        ExamPropCountDto examPropCountDto = new ExamPropCountDto(examId, allCount, prepareCount.get(), examCount.get(), clientWebsocketStatusCount.get(), monitorStatusSourceCount.get(), alreadyComplete.get(), notComplete, completionRate);
         return ResultUtil.ok(examPropCountDto);
     }
 }

+ 11 - 0
themis-business/src/main/java/com/qmth/themis/business/bean/backend/InvigilateListBean.java

@@ -76,6 +76,17 @@ public class InvigilateListBean implements Serializable {
     @ApiModelProperty(name = "剩余时间")
     private String remainTime;
 
+    @ApiModelProperty(name = "新增预警")
+    private Integer warningNew;
+
+    public Integer getWarningNew() {
+        return warningNew;
+    }
+
+    public void setWarningNew(Integer warningNew) {
+        this.warningNew = warningNew;
+    }
+
     public String getRemainTime() {
         return remainTime;
     }

+ 2 - 15
themis-business/src/main/java/com/qmth/themis/business/dto/ExamPropCountDto.java

@@ -23,9 +23,6 @@ public class ExamPropCountDto implements Serializable {
     @ApiModelProperty(name = "应考人数")
     private Integer allCount;//应考人数
 
-    @ApiModelProperty(name = "已登录")
-    private Integer loginCount;//已登录
-
     @ApiModelProperty(name = "已待考")
     private Integer prepareCount;//已待考
 
@@ -69,10 +66,9 @@ public class ExamPropCountDto implements Serializable {
 
     }
 
-    public ExamPropCountDto(Long examId, Integer allCount, Integer loginCount, Integer prepareCount, Integer examCount, Integer clientWebsocketStatusCount, Integer monitorStatusSourceCount, Integer alreadyComplete, Integer notComplete, Set<String> roomCodes, BigDecimal completionRate) {
+    public ExamPropCountDto(Long examId, Integer allCount, Integer prepareCount, Integer examCount, Integer clientWebsocketStatusCount, Integer monitorStatusSourceCount, Integer alreadyComplete, Integer notComplete, Set<String> roomCodes, BigDecimal completionRate) {
         this.examId = examId;
         this.allCount = allCount;
-        this.loginCount = loginCount;
         this.prepareCount = prepareCount;
         this.examCount = examCount;
         this.clientWebsocketStatusCount = clientWebsocketStatusCount;
@@ -83,10 +79,9 @@ public class ExamPropCountDto implements Serializable {
         this.completionRate = completionRate;
     }
 
-    public ExamPropCountDto(Long examId, Integer allCount, Integer loginCount, Integer prepareCount, Integer examCount, Integer clientWebsocketStatusCount, Integer monitorStatusSourceCount, Integer alreadyComplete, Integer notComplete, BigDecimal completionRate) {
+    public ExamPropCountDto(Long examId, Integer allCount, Integer prepareCount, Integer examCount, Integer clientWebsocketStatusCount, Integer monitorStatusSourceCount, Integer alreadyComplete, Integer notComplete, BigDecimal completionRate) {
         this.examId = examId;
         this.allCount = allCount;
-        this.loginCount = loginCount;
         this.prepareCount = prepareCount;
         this.examCount = examCount;
         this.clientWebsocketStatusCount = clientWebsocketStatusCount;
@@ -168,14 +163,6 @@ public class ExamPropCountDto implements Serializable {
         this.allCount = allCount;
     }
 
-    public Integer getLoginCount() {
-        return loginCount;
-    }
-
-    public void setLoginCount(Integer loginCount) {
-        this.loginCount = loginCount;
-    }
-
     public Integer getPrepareCount() {
         return prepareCount;
     }

+ 0 - 13
themis-business/src/main/java/com/qmth/themis/business/entity/TEExamStudent.java

@@ -2,7 +2,6 @@ package com.qmth.themis.business.entity;
 
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.qmth.themis.business.base.BaseEntity;
-import com.qmth.themis.business.enums.LoginStatusEnum;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 
@@ -80,18 +79,6 @@ public class TEExamStudent extends BaseEntity {
     @TableField(value = "course_name")
     private String courseName;
 
-    @ApiModelProperty(value = "登录状态")
-    @TableField(value = "login_status")
-    private LoginStatusEnum loginStatus;
-
-    public LoginStatusEnum getLoginStatus() {
-        return loginStatus;
-    }
-
-    public void setLoginStatus(LoginStatusEnum loginStatus) {
-        this.loginStatus = loginStatus;
-    }
-
     public String getCourseName() {
         return courseName;
     }

+ 0 - 25
themis-business/src/main/java/com/qmth/themis/business/enums/LoginStatusEnum.java

@@ -1,25 +0,0 @@
-package com.qmth.themis.business.enums;
-
-/**
-* @Description: 登录状态
-* @Param:
-* @return:
-* @Author: wangliang
-* @Date: 2020/9/7
-*/
-public enum LoginStatusEnum {
-
-    LOGIN("已登录"),
-
-    NO_LOGIN("未登录");
-
-    private String code;
-
-    private LoginStatusEnum(String code){
-        this.code = code;
-    }
-
-    public String getCode() {
-        return code;
-    }
-}

+ 3 - 0
themis-business/src/main/java/com/qmth/themis/business/service/impl/TEExamActivityServiceImpl.java

@@ -11,6 +11,7 @@ import com.qmth.themis.business.service.TEExamActivityService;
 import org.springframework.cache.annotation.CacheEvict;
 import org.springframework.cache.annotation.CachePut;
 import org.springframework.cache.annotation.Cacheable;
+import org.springframework.scheduling.annotation.Async;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
@@ -125,6 +126,7 @@ public class TEExamActivityServiceImpl extends ServiceImpl<TEExamActivityMapper,
      * @param examActivityId
      * @return
      */
+    @Async
     @Override
     @CachePut(value = "exam_activity", key = "#examActivityId", condition = "#result != null")
     public ExamActivityCacheBean updateExamActivityCacheBean(Long examActivityId) {
@@ -136,6 +138,7 @@ public class TEExamActivityServiceImpl extends ServiceImpl<TEExamActivityMapper,
      *
      * @param examActivityId
      */
+    @Async
     @Override
     @CacheEvict(value = "exam_activity", key = "#examActivityId")
     public void deleteExamActivityCacheBean(Long examActivityId) {

+ 3 - 0
themis-business/src/main/java/com/qmth/themis/business/service/impl/TEExamCourseServiceImpl.java

@@ -14,6 +14,7 @@ import org.apache.commons.lang3.StringUtils;
 import org.springframework.cache.annotation.CacheEvict;
 import org.springframework.cache.annotation.CachePut;
 import org.springframework.cache.annotation.Cacheable;
+import org.springframework.scheduling.annotation.Async;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
@@ -79,6 +80,7 @@ public class TEExamCourseServiceImpl extends ServiceImpl<TEExamCourseMapper, TEE
      * @param courseCode
      * @return
      */
+    @Async
     @Override
     @CachePut(value = "exam_course", key = "#examId+'_'+#courseCode", condition = "#result != null")
     public ExamCourseCacheBean updateExamCourseCacheBean(Long examId, String courseCode) {
@@ -91,6 +93,7 @@ public class TEExamCourseServiceImpl extends ServiceImpl<TEExamCourseMapper, TEE
      * @param examId
      * @param courseCode
      */
+    @Async
     @Override
     @CacheEvict(value = "exam_course", key = "#examId+'_'+#courseCode")
     public void deleteExamCourseCacheBean(Long examId, String courseCode) {

+ 3 - 0
themis-business/src/main/java/com/qmth/themis/business/service/impl/TEExamPaperServiceImpl.java

@@ -17,6 +17,7 @@ import org.apache.commons.lang3.StringUtils;
 import org.springframework.cache.annotation.CacheEvict;
 import org.springframework.cache.annotation.CachePut;
 import org.springframework.cache.annotation.Cacheable;
+import org.springframework.scheduling.annotation.Async;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
@@ -68,6 +69,7 @@ public class TEExamPaperServiceImpl extends ServiceImpl<TEExamPaperMapper, TEExa
      * @param paperId
      * @return
      */
+    @Async
     @Override
     @CachePut(value = "exam_paper", key = "#paperId", condition = "#result != null")
     public ExamPaperCacheBean updateExamPaperCacheBean(Long paperId) {
@@ -79,6 +81,7 @@ public class TEExamPaperServiceImpl extends ServiceImpl<TEExamPaperMapper, TEExa
      *
      * @param paperId
      */
+    @Async
     @Override
     @CacheEvict(value = "exam_paper", key = "#paperId")
     public void deleteExamPaperCacheBean(Long paperId) {

+ 3 - 0
themis-business/src/main/java/com/qmth/themis/business/service/impl/TEExamStudentServiceImpl.java

@@ -10,6 +10,7 @@ import com.qmth.themis.business.service.TEExamStudentService;
 import org.springframework.cache.annotation.CacheEvict;
 import org.springframework.cache.annotation.CachePut;
 import org.springframework.cache.annotation.Cacheable;
+import org.springframework.scheduling.annotation.Async;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
@@ -60,6 +61,7 @@ public class TEExamStudentServiceImpl extends ServiceImpl<TEExamStudentMapper, T
      * @param examStudentId
      * @return
      */
+    @Async
     @Override
     @CachePut(value = "exam_student", key = "#examStudentId", condition = "#result != null")
     public ExamStudentCacheBean updateExamStudentCacheBean(Long examStudentId) {
@@ -71,6 +73,7 @@ public class TEExamStudentServiceImpl extends ServiceImpl<TEExamStudentMapper, T
      *
      * @param examStudentId
      */
+    @Async
     @Override
     @CacheEvict(value = "exam_student", key = "#examStudentId")
     public void deleteExamStudentCacheBean(Long examStudentId) {

+ 4 - 2
themis-business/src/main/resources/mapper/TOeExamRecordMapper.xml

@@ -154,6 +154,7 @@
 
     <select id="invigilatePageList" resultType="com.qmth.themis.business.bean.backend.InvigilateListBean">
         <include refid="invigilatePageHead" />
+        ,(select count(1) from t_ie_invigilate_warn_info tiiwi where tiiwi.exam_record_id = t.id and tiiwi.approve_status = 0) as warningNew
         ,date_format(date_sub(date_add(teea.start_time, interval IFNULL(teea.max_duration_seconds, tee.max_duration_seconds) second), interval teea.max_duration_seconds / 60 - t.duration_seconds minute),'%H:%i:%s') as remainTime
         <include refid="invigilatePageMiddle" />
         <include refid="invigilatePageFoot" />
@@ -214,8 +215,9 @@
            tees.course_code as courseCode,
            tees.course_name as courseName,
            toer.status as statusCode,
-           toer.warning_count as warningCount,
-           toer.breach_status as breachStatus,
+           IFNULL(toer.warning_count,0) as warningCount,
+           IFNULL(toer.breach_status,1) as breachStatus,
+           toer.client_last_sync_time as updateTime
            tiiwi.approve_status as approveStatus
            ,(select count(1) from t_ie_invigilate_warn_info tiiwi where tiiwi.exam_record_id = toer.id and tiiwi.`type` =
             'FACE_COUNT_ERROR' and tiiwi.`level` = 'D8') as multipleFaceCount

+ 6 - 0
themis-exam/src/main/java/com/qmth/themis/exam/api/TEStudentController.java

@@ -1,6 +1,7 @@
 package com.qmth.themis.exam.api;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.google.gson.Gson;
 import com.qmth.themis.business.annotation.ApiJsonObject;
 import com.qmth.themis.business.annotation.ApiJsonProperty;
@@ -20,6 +21,7 @@ import com.qmth.themis.business.dto.response.TEExamDto;
 import com.qmth.themis.business.dto.response.TEExamResultDto;
 import com.qmth.themis.business.entity.TBSession;
 import com.qmth.themis.business.entity.TEConfig;
+import com.qmth.themis.business.entity.TEExamStudent;
 import com.qmth.themis.business.entity.TEStudent;
 import com.qmth.themis.business.enums.*;
 import com.qmth.themis.business.service.*;
@@ -264,6 +266,10 @@ public class TEStudentController {
         if (Objects.isNull(tbSession)) {
             throw new BusinessException(ExceptionResultEnum.LOGIN_NO);
         }
+        Long recordId = Objects.isNull(teStudent.getExamingRecordId()) ? teStudent.getUnFinishedRecordId() : teStudent.getExamingRecordId();
+        Map<String, Object> objectMap = redisUtil.getHashEntries(RedisKeyHelper.examRecordCacheKey(recordId));
+        Long examStudentId = Long.parseLong(String.valueOf(objectMap.get("examStudentId")));
+        ExamStudentCacheBean examStudentCacheBean = teExamStudentService.getExamStudentCacheBean(examStudentId);
         AuthDto authDto = (AuthDto) redisUtil.get(SystemConstant.studentOauth + "::" + teStudent.getId());
         redisUtil.deleteUserSession(tbSession.getId());
         //循环检查该用户下其他平台是否存在session,不存在则删除用户缓存和鉴权缓存

+ 11 - 0
themis-mq/src/main/java/com/qmth/themis/mq/service/impl/MqLogicServiceImpl.java

@@ -2,6 +2,7 @@ package com.qmth.themis.mq.service.impl;
 
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.google.gson.Gson;
 import com.qmth.themis.business.cache.ExamRecordCacheUtil;
 import com.qmth.themis.business.cache.RedisKeyHelper;
@@ -484,7 +485,17 @@ public class MqLogicServiceImpl implements MqLogicService {
                 objectMap.put("lastBreakTime", new Date());
                 objectMap.put("leftBreakResumeCount", leftBreakResumeCount);
                 objectMap.put("lastStartTime", new Date());
+                objectMap.put("exceptionStatus", exceptionEnum);
                 redisUtil.setForHash(RedisKeyHelper.examRecordCacheKey(recordId), objectMap);
+                UpdateWrapper<TOeExamRecord> tOeExamRecordUpdateWrapper = new UpdateWrapper<>();
+                tOeExamRecordUpdateWrapper.lambda().set(TOeExamRecord::getLastBreakId, tOeExamBreakHistory.getId())
+                        .set(TOeExamRecord::getStatus, ExamRecordStatusEnum.RESUME_PREPARE)
+                        .set(TOeExamRecord::getLastBreakTime, objectMap.get("lastBreakTime"))
+                        .set(TOeExamRecord::getLeftBreakResumeCount, leftBreakResumeCount)
+                        .set(TOeExamRecord::getLastStartTime, objectMap.get("lastStartTime"))
+                        .set(TOeExamRecord::getExceptionStatus, exceptionEnum)
+                        .eq(TOeExamRecord::getId, recordId);
+                examRecordService.update(tOeExamRecordUpdateWrapper);
                 teExamStudentLogService.saveStudentLogInfo(SystemOperationEnum.RESUME_PREPARE.name(), SystemOperationEnum.RESUME_PREPARE.getCode(), SystemOperationEnum.RESUME_PREPARE.getCode(), examStudentCacheBean.getStudentId(), examStudentId, recordId);
             }