wangliang преди 4 години
родител
ревизия
11b0947242

+ 27 - 5
themis-backend/src/main/java/com/qmth/themis/backend/api/TIeInvigilateController.java

@@ -31,6 +31,7 @@ import org.springframework.web.bind.annotation.*;
 
 import javax.annotation.Resource;
 import java.util.*;
+import java.util.stream.Collectors;
 
 /**
  * @Description: 监考信息 前端控制器
@@ -69,6 +70,9 @@ public class TIeInvigilateController {
     @Resource
     TEExamStudentLogService teExamStudentLogService;
 
+    @Resource
+    TBExamInvigilateUserService tbExamInvigilateUserService;
+
     @ApiOperation(value = "实时监控台列表接口")
     @RequestMapping(value = "/list", method = RequestMethod.POST)
     @ApiResponses({@ApiResponse(code = 200, message = "监考监控信息", response = InvigilateListBean.class)})
@@ -426,11 +430,29 @@ public class TIeInvigilateController {
     @ApiOperation(value = "结束监考接口")
     @RequestMapping(value = "/exam/finish", method = RequestMethod.POST)
     @ApiResponses({@ApiResponse(code = 200, message = "{\"success\":true}", response = Result.class)})
-    public Result examFinish(@ApiJsonObject(name = "invigilateExamFinish", value = {
-            @ApiJsonProperty(key = "examId", type = "long", example = "1", description = "考试批次id", required = true),
-            @ApiJsonProperty(key = "examActivityId", type = "long", example = "1", description = "考试场次id", required = true),
-            @ApiJsonProperty(key = "roomCode", description = "虚拟考场代码", required = true)
-    }) @ApiParam(value = "考试记录信息", required = true) @RequestBody Map<String, Object> mapParameter) {
+    public Result examFinish(@ApiParam(value = "考试id", required = true) @RequestParam Long examId) {
+        if (Objects.isNull(examId) || Objects.equals(examId, "")) {
+            throw new BusinessException(ExceptionResultEnum.EXAM_ID_IS_NULL);
+        }
+        TBUser tbUser = (TBUser) ServletUtil.getRequestAccount();
+        TBSession tbSession = (TBSession) ServletUtil.getRequestSession();
+        if (Objects.isNull(tbSession)) {
+            throw new BusinessException(ExceptionResultEnum.LOGIN_NO);
+        }
+        QueryWrapper<TBExamInvigilateUser> examInvigilateUserQueryWrapper = new QueryWrapper<>();
+        //如果有监考员角色,只能查看自己所监考的考场,巡考员和管理员则可以查看全部考场
+        examInvigilateUserQueryWrapper.lambda().eq(TBExamInvigilateUser::getOrgId, tbUser.getOrgId())
+                .eq(TBExamInvigilateUser::getUserId, tbUser.getId());
+        List<TBExamInvigilateUser> tbExamInvigilateUserList = tbExamInvigilateUserService.list(examInvigilateUserQueryWrapper);
+        Set<String> roomCodeSet = null;
+        if (Objects.nonNull(tbExamInvigilateUserList) && tbExamInvigilateUserList.size() > 0) {
+            roomCodeSet = tbExamInvigilateUserList.stream().map(s -> s.getRoomCode()).collect(Collectors.toSet());
+        }
+        //根据roomCode获取当前老师所要监考的全部应考学生数
+        QueryWrapper<TEExamStudent> teExamStudentQueryWrapper = new QueryWrapper<>();
+        teExamStudentQueryWrapper.lambda().in(TEExamStudent::getRoomCode, roomCodeSet);
+        List<TEExamStudent> teExamStudentList = teExamStudentService.list(teExamStudentQueryWrapper);
+
         return ResultUtil.ok(Collections.singletonMap("success", true));
     }
 }

+ 27 - 0
themis-business/src/main/java/com/qmth/themis/business/dto/ExamPropCountDto.java

@@ -24,6 +24,9 @@ public class ExamPropCountDto implements Serializable {
     private Integer notComplete;//未完成
     private Set<String> roomCodes;//虚拟考场代码
     private BigDecimal completionRate;//完成率
+    private Integer reexamCount;//重考审核
+    private Long maxDurationSeconds;//最大考试时长
+    private Long finishTime;//强制交卷时间
 
     public ExamPropCountDto() {
 
@@ -56,6 +59,30 @@ public class ExamPropCountDto implements Serializable {
         this.completionRate = completionRate;
     }
 
+    public Integer getReexamCount() {
+        return reexamCount;
+    }
+
+    public void setReexamCount(Integer reexamCount) {
+        this.reexamCount = reexamCount;
+    }
+
+    public Long getMaxDurationSeconds() {
+        return maxDurationSeconds;
+    }
+
+    public void setMaxDurationSeconds(Long maxDurationSeconds) {
+        this.maxDurationSeconds = maxDurationSeconds;
+    }
+
+    public Long getFinishTime() {
+        return finishTime;
+    }
+
+    public void setFinishTime(Long finishTime) {
+        this.finishTime = finishTime;
+    }
+
     public BigDecimal getCompletionRate() {
         return completionRate;
     }

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

@@ -2,6 +2,7 @@ package com.qmth.themis.business.entity;
 
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
+import com.qmth.themis.business.enums.InvigilateMonitorStatusEnum;
 import com.qmth.themis.common.contanst.Constants;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
@@ -39,6 +40,10 @@ public class TBExamInvigilateUser implements Serializable {
     @TableField("room_name")
     private String roomName;
 
+    @ApiModelProperty(value = "监考状态,NOT_START:未开始,START:监考中,FINISHED:已结束")
+    @TableField("monitor_status")
+    private InvigilateMonitorStatusEnum monitorStatus;
+
     public TBExamInvigilateUser() {
 
     }
@@ -101,4 +106,12 @@ public class TBExamInvigilateUser implements Serializable {
     public void setRoomName(String roomName) {
         this.roomName = roomName;
     }
+
+    public InvigilateMonitorStatusEnum getMonitorStatus() {
+        return monitorStatus;
+    }
+
+    public void setMonitorStatus(InvigilateMonitorStatusEnum monitorStatus) {
+        this.monitorStatus = monitorStatus;
+    }
 }

+ 12 - 0
themis-business/src/main/java/com/qmth/themis/business/entity/TEExam.java

@@ -181,6 +181,10 @@ public class TEExam extends BaseEntity {
     @TableField(value = "invigilate_verify")
     private InvigilateVerifyEnum invigilateVerify;
 
+    @ApiModelProperty(value = "监考状态,NOT_START:未开始,START:监考中,FINISHED:已结束")
+    @TableField("monitor_status")
+    private InvigilateMonitorStatusEnum monitorStatus;
+
     public TEExam() {
 
     }
@@ -247,6 +251,14 @@ public class TEExam extends BaseEntity {
         this.invigilateVerify = teExamDto.getInvigilateVerify();
     }
 
+    public InvigilateMonitorStatusEnum getMonitorStatus() {
+        return monitorStatus;
+    }
+
+    public void setMonitorStatus(InvigilateMonitorStatusEnum monitorStatus) {
+        this.monitorStatus = monitorStatus;
+    }
+
     public InvigilateVerifyEnum getInvigilateVerify() {
         return invigilateVerify;
     }

+ 27 - 0
themis-business/src/main/java/com/qmth/themis/business/enums/InvigilateMonitorStatusEnum.java

@@ -0,0 +1,27 @@
+package com.qmth.themis.business.enums;
+
+/** 
+* @Description: 监考端监考状态 enum
+* @Param:  
+* @return:  
+* @Author: wangliang
+* @Date: 2020/8/27 
+*/ 
+public enum InvigilateMonitorStatusEnum {
+
+    NOT_START("未开始"),
+
+    FINISHED("已结束"),
+
+    START("监考中");
+
+    private String code;
+
+    private InvigilateMonitorStatusEnum(String code){
+        this.code = code;
+    }
+
+    public String getCode() {
+        return code;
+    }
+}

+ 6 - 13
themis-exam/src/main/java/com/qmth/themis/exam/api/TIeInvigilateCallMobileController.java

@@ -26,6 +26,7 @@ import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RestController;
 
 import javax.annotation.Resource;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Objects;
@@ -96,9 +97,7 @@ public class TIeInvigilateCallMobileController {
                 throw new RuntimeException(e);
             }
         }
-        Map map = new HashMap();
-        map.put("updateTime", System.currentTimeMillis());
-        return ResultUtil.ok(map);
+        return ResultUtil.ok(Collections.singletonMap("updateTime", System.currentTimeMillis()));
     }
 
     @ApiOperation(value = "发送通话申请接口")
@@ -131,9 +130,7 @@ public class TIeInvigilateCallMobileController {
         MqDto mqDto = new MqDto(MqTopicEnum.themisTopic.getCode(), MqTagEnum.MONITOR_LOG.name(), tIeExamInvigilateCallLog, MqTagEnum.MONITOR_LOG, String.valueOf(tIeExamInvigilateCallLog.getId()), source.name());
         mqDtoService.assembleSendOneWayMsg(mqDto);
         //监考监控通话信息 发送mq end
-        Map map = new HashMap();
-        map.put("updateTime", System.currentTimeMillis());
-        return ResultUtil.ok(map);
+        return ResultUtil.ok(Collections.singletonMap("updateTime", System.currentTimeMillis()));
     }
 
     @ApiOperation(value = "监控状态更新接口")
@@ -164,10 +161,8 @@ public class TIeInvigilateCallMobileController {
         //获取考试记录缓存
         Map<String, Object> objectMap = redisUtil.getHashEntries(RedisKeyHelper.examRecordCacheKey(recordId));
         String liveUrl = null;
-        if (Objects.nonNull(objectMap.get(SystemConstant.MONITOR_LIVE_URL_ + MonitorVideoSourceEnum.MOBILE_FIRST.name()))) {
-            liveUrl = String.valueOf(objectMap.get(SystemConstant.MONITOR_LIVE_URL_ + MonitorVideoSourceEnum.MOBILE_FIRST.name()));
-        } else if (Objects.nonNull(objectMap.get(SystemConstant.MONITOR_LIVE_URL_ + MonitorVideoSourceEnum.MOBILE_SECOND.name()))) {
-            liveUrl = String.valueOf(objectMap.get(SystemConstant.MONITOR_LIVE_URL_ + MonitorVideoSourceEnum.MOBILE_SECOND.name()));
+        if (Objects.nonNull(objectMap.get(SystemConstant.MONITOR_LIVE_URL_ + source.name()))) {
+            liveUrl = String.valueOf(objectMap.get(SystemConstant.MONITOR_LIVE_URL_ + source.name()));
         }
         objectMap.put(SystemConstant.MONITOR_STATUS_ + source.name(), status);
         TIeExamInvigilateCallLog tIeExamInvigilateCallLog = new TIeExamInvigilateCallLog(recordId, source, liveUrl, MonitorStatusSourceEnum.START);
@@ -232,8 +227,6 @@ public class TIeInvigilateCallMobileController {
         MqDto mqDto = new MqDto(MqTopicEnum.themisTopic.getCode(), MqTagEnum.MONITOR_LOG.name(), tIeExamInvigilateCallLog, MqTagEnum.MONITOR_LOG, String.valueOf(tIeExamInvigilateCallLog.getId()), source.name());
         mqDtoService.assembleSendOneWayMsg(mqDto);
         //监考监控通话信息 发送mq end
-        Map map = new HashMap();
-        map.put("updateTime", System.currentTimeMillis());
-        return ResultUtil.ok(map);
+        return ResultUtil.ok(Collections.singletonMap("updateTime", System.currentTimeMillis()));
     }
 }

+ 6 - 13
themis-exam/src/main/java/com/qmth/themis/exam/api/TIeInvigilateCallOeController.java

@@ -24,6 +24,7 @@ import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RestController;
 
 import javax.annotation.Resource;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Objects;
@@ -93,9 +94,7 @@ public class TIeInvigilateCallOeController {
                 throw new RuntimeException(e);
             }
         }
-        Map map = new HashMap();
-        map.put("updateTime", System.currentTimeMillis());
-        return ResultUtil.ok(map);
+        return ResultUtil.ok(Collections.singletonMap("updateTime", System.currentTimeMillis()));
     }
 
     @ApiOperation(value = "监控状态更新接口")
@@ -126,10 +125,8 @@ public class TIeInvigilateCallOeController {
         //获取考试记录缓存
         Map<String, Object> objectMap = redisUtil.getHashEntries(RedisKeyHelper.examRecordCacheKey(recordId));
         String liveUrl = null;
-        if (Objects.nonNull(objectMap.get(SystemConstant.MONITOR_LIVE_URL_ + MonitorVideoSourceEnum.CLIENT_CAMERA.name()))) {
-            liveUrl = String.valueOf(objectMap.get(SystemConstant.MONITOR_LIVE_URL_ + MonitorVideoSourceEnum.CLIENT_CAMERA.name()));
-        } else if (Objects.nonNull(objectMap.get(SystemConstant.MONITOR_LIVE_URL_ + MonitorVideoSourceEnum.CLIENT_SCREEN.name()))) {
-            liveUrl = String.valueOf(objectMap.get(SystemConstant.MONITOR_LIVE_URL_ + MonitorVideoSourceEnum.CLIENT_SCREEN.name()));
+        if (Objects.nonNull(objectMap.get(SystemConstant.MONITOR_LIVE_URL_ + source.name()))) {
+            liveUrl = String.valueOf(objectMap.get(SystemConstant.MONITOR_LIVE_URL_ + source.name()));
         }
         objectMap.put(SystemConstant.MONITOR_STATUS_ + source.name(), status);
         TIeExamInvigilateCallLog tIeExamInvigilateCallLog = new TIeExamInvigilateCallLog(recordId, source, liveUrl, MonitorStatusSourceEnum.START);
@@ -178,9 +175,7 @@ public class TIeInvigilateCallOeController {
         MqDto mqDto = new MqDto(MqTopicEnum.themisTopic.getCode(), MqTagEnum.MONITOR_LOG.name(), tIeExamInvigilateCallLog, MqTagEnum.MONITOR_LOG, String.valueOf(tIeExamInvigilateCallLog.getId()), source.name());
         mqDtoService.assembleSendOneWayMsg(mqDto);
         //监考监控通话信息 发送mq end
-        Map map = new HashMap();
-        map.put("updateTime", System.currentTimeMillis());
-        return ResultUtil.ok(map);
+        return ResultUtil.ok(Collections.singletonMap("updateTime", System.currentTimeMillis()));
     }
 
     @ApiOperation(value = "撤销通话申请接口")
@@ -212,8 +207,6 @@ public class TIeInvigilateCallOeController {
         MqDto mqDto = new MqDto(MqTopicEnum.themisTopic.getCode(), MqTagEnum.MONITOR_LOG.name(), tIeExamInvigilateCallLog, MqTagEnum.MONITOR_LOG, String.valueOf(tIeExamInvigilateCallLog.getId()), source.name());
         mqDtoService.assembleSendOneWayMsg(mqDto);
         //监考监控通话信息 发送mq end
-        Map map = new HashMap();
-        map.put("updateTime", System.currentTimeMillis());
-        return ResultUtil.ok(map);
+        return ResultUtil.ok(Collections.singletonMap("updateTime", System.currentTimeMillis()));
     }
 }