Selaa lähdekoodia

增加轨迹消息记录

wangliang 1 vuosi sitten
vanhempi
commit
77022c3bfe

+ 4 - 4
themis-admin/src/main/java/com/qmth/themis/admin/api/TEExamController.java

@@ -478,13 +478,13 @@ public class TEExamController {
                 || roomCodeSet.size() == 0)) {
             throw new BusinessException("当前监考老师未设置任何监考考场");
         }
-        AtomicReference<ExamPropCountDto> examPropCountDto = new AtomicReference(new ExamPropCountDto(examId, 0, 0, 0, 0, 0, 0, 0, new BigDecimal(0)));
+        AtomicReference<ExamPropCountDto> examPropCountDto = new AtomicReference(new ExamPropCountDto(examId, 0, 0, 0, 0, 0, new BigDecimal(0)));
         if (Objects.nonNull(roomCodeSet) && roomCodeSet.size() > 0) {
             //根据roomCode获取当前老师所要监考的全部应考学生数
             List<CountStopBean> countStopBeanList = tOeExamRecordService.findByStopInfo(examId, roomCodeSet, examActivityId);
             if (Objects.nonNull(countStopBeanList) && countStopBeanList.size() > 0) {
-                examPropCountDto.get().setClientWebsocketStatusCount(countStopBeanList.get(0).getOffCount());
-                examPropCountDto.get().setMonitorStatusSourceCount(countStopBeanList.get(0).getStopCount());
+//                examPropCountDto.get().setClientWebsocketStatusCount(countStopBeanList.get(0).getOffCount());
+//                examPropCountDto.get().setMonitorStatusSourceCount(countStopBeanList.get(0).getStopCount());
                 examPropCountDto.get().setAllCount(countStopBeanList.get(0).getAllCount());
             }
             List<Integer> list = tOeExamRecordService.findByOnlineInfo(examId, roomCodeSet, examActivityId);
@@ -493,7 +493,7 @@ public class TEExamController {
                 examPropCountDto.get().setExamCount(list.get(1));
                 examPropCountDto.get().setAlreadyComplete(list.get(2));
 //                examPropCountDto.get().setNotComplete(list.get(3) + list.get(4));
-                examPropCountDto.get().setNotComplete(list.get(3));
+                examPropCountDto.get().setNotComplete(examPropCountDto.get().getAllCount().intValue() - examPropCountDto.get().getAlreadyComplete().intValue());
             }
             if (Objects.nonNull(examPropCountDto.get().getAllCount()) && examPropCountDto.get().getAllCount().intValue() > 0) {
                 BigDecimal completionRate = new BigDecimal(examPropCountDto.get().getAlreadyComplete())

+ 15 - 1
themis-admin/src/main/java/com/qmth/themis/admin/api/TIeInvigilateController.java

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.google.common.reflect.TypeToken;
 import com.qmth.themis.business.annotation.ApiJsonObject;
 import com.qmth.themis.business.annotation.ApiJsonProperty;
 import com.qmth.themis.business.annotation.RedisLimitAnnotation;
@@ -17,6 +18,7 @@ import com.qmth.themis.business.dto.AuthDto;
 import com.qmth.themis.business.dto.MqDto;
 import com.qmth.themis.business.dto.cache.TEStudentCacheDto;
 import com.qmth.themis.business.dto.response.TBExamInvigilateUserDto;
+import com.qmth.themis.business.dto.response.TEExamQueryDto;
 import com.qmth.themis.business.entity.*;
 import com.qmth.themis.business.enums.*;
 import com.qmth.themis.business.excel.ExportUtils;
@@ -27,6 +29,7 @@ import com.qmth.themis.business.util.OssUtil;
 import com.qmth.themis.business.util.ServletUtil;
 import com.qmth.themis.common.enums.ExceptionResultEnum;
 import com.qmth.themis.common.exception.BusinessException;
+import com.qmth.themis.common.util.GsonUtil;
 import com.qmth.themis.common.util.Result;
 import com.qmth.themis.common.util.ResultUtil;
 import io.swagger.annotations.*;
@@ -92,6 +95,9 @@ public class TIeInvigilateController {
     @Resource
     TBExamInvigilateUserService tbExamInvigilateUserService;
 
+    @Resource
+    TIeExamInvigilateNoticeService tIeExamInvigilateNoticeService;
+
     @ApiOperation(value = "实时监控台视频列表接口")
     @RequestMapping(value = "/list/video", method = RequestMethod.POST)
     @ApiResponses({@ApiResponse(code = 200, message = "监考监控信息", response = InvigilateListVideoBean.class)})
@@ -349,8 +355,16 @@ public class TIeInvigilateController {
         if (!CollectionUtils.isEmpty(teExamStudentLogList)) {
             teExamStudentLogList = teExamStudentLogList.get(0).ipChange(teExamStudentLogList);
         }
-        invigilateListDetailBean.setExamStudentLogList(teExamStudentLogList);
 
+        //加入文本和语音消息轨迹
+        List<TIeExamInvigilateNotice> tIeExamInvigilateNoticeList = tIeExamInvigilateNoticeService.queryNoticeByExamRecordId(examRecordId);
+        if (!CollectionUtils.isEmpty(tIeExamInvigilateNoticeList)) {
+            for (TIeExamInvigilateNotice t : tIeExamInvigilateNoticeList) {
+                teExamStudentLogList.add(new TEExamStudentLog(teStudent.getId(), examStudentId, t.getExamRecordId(), t.getType(), t.getContent(), t.getFormUserId(), t.getFormUserName(), t.getSendTime()));
+            }
+        }
+        Collections.sort(teExamStudentLogList);
+        invigilateListDetailBean.setExamStudentLogList(teExamStudentLogList);
         //预警、异常、人脸
         List<Integer> list = tIeInvigilateWarnInfoService.findWarnAndExceptionInfo(examRecordId, VerifyExceptionEnum.FACE_COUNT_ERROR, WarningLevelEnum.D8);
         if (Objects.nonNull(list) && list.size() > 0) {

+ 10 - 0
themis-business/src/main/java/com/qmth/themis/business/dao/TIeExamInvigilateNoticeMapper.java

@@ -3,6 +3,9 @@ package com.qmth.themis.business.dao;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.qmth.themis.business.entity.TIeExamInvigilateNotice;
 import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
 
 /**
  * @Description: 监考通知消息记录 Mapper 接口
@@ -14,4 +17,11 @@ import org.apache.ibatis.annotations.Mapper;
 @Mapper
 public interface TIeExamInvigilateNoticeMapper extends BaseMapper<TIeExamInvigilateNotice> {
 
+    /**
+     * 根据考试记录id查询文本和语音消息
+     *
+     * @param examRecordId
+     * @return
+     */
+    List<TIeExamInvigilateNotice> queryNoticeByExamRecordId(@Param("examRecordId") Long examRecordId);
 }

+ 29 - 25
themis-business/src/main/java/com/qmth/themis/business/dto/ExamPropCountDto.java

@@ -32,11 +32,11 @@ public class ExamPropCountDto implements Serializable {
     @ApiModelProperty(name = "考试中")
     private Integer examCount = 0;//考试中
 
-    @ApiModelProperty(name = "客户端通讯故障")
-    private Integer clientWebsocketStatusCount = 0;//客户端通讯故障
+//    @ApiModelProperty(name = "客户端通讯故障")
+//    private Integer clientWebsocketStatusCount = 0;//客户端通讯故障
 
-    @ApiModelProperty(name = "监控设备通讯故障")
-    private Integer monitorStatusSourceCount = 0;//监控设备通讯故障
+//    @ApiModelProperty(name = "监控设备通讯故障")
+//    private Integer monitorStatusSourceCount = 0;//监控设备通讯故障
 
     @ApiModelProperty(name = "已完成")
     private Integer alreadyComplete = 0;//已完成
@@ -69,26 +69,30 @@ public class ExamPropCountDto implements Serializable {
 
     }
 
-    public ExamPropCountDto(Long examId, Integer allCount, 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.prepareCount = prepareCount;
         this.examCount = examCount;
-        this.clientWebsocketStatusCount = clientWebsocketStatusCount;
-        this.monitorStatusSourceCount = monitorStatusSourceCount;
+//        this.clientWebsocketStatusCount = clientWebsocketStatusCount;
+//        this.monitorStatusSourceCount = monitorStatusSourceCount;
         this.alreadyComplete = alreadyComplete;
         this.notComplete = notComplete;
         this.roomCodes = roomCodes;
         this.completionRate = completionRate;
     }
 
-    public ExamPropCountDto(Long examId, Integer allCount, 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.prepareCount = prepareCount;
         this.examCount = examCount;
-        this.clientWebsocketStatusCount = clientWebsocketStatusCount;
-        this.monitorStatusSourceCount = monitorStatusSourceCount;
+//        this.clientWebsocketStatusCount = clientWebsocketStatusCount;
+//        this.monitorStatusSourceCount = monitorStatusSourceCount;
         this.alreadyComplete = alreadyComplete;
         this.notComplete = notComplete;
         this.completionRate = completionRate;
@@ -182,21 +186,21 @@ public class ExamPropCountDto implements Serializable {
         this.examCount = examCount;
     }
 
-    public Integer getClientWebsocketStatusCount() {
-        return clientWebsocketStatusCount;
-    }
-
-    public void setClientWebsocketStatusCount(Integer clientWebsocketStatusCount) {
-        this.clientWebsocketStatusCount = clientWebsocketStatusCount;
-    }
-
-    public Integer getMonitorStatusSourceCount() {
-        return monitorStatusSourceCount;
-    }
-
-    public void setMonitorStatusSourceCount(Integer monitorStatusSourceCount) {
-        this.monitorStatusSourceCount = monitorStatusSourceCount;
-    }
+//    public Integer getClientWebsocketStatusCount() {
+//        return clientWebsocketStatusCount;
+//    }
+//
+//    public void setClientWebsocketStatusCount(Integer clientWebsocketStatusCount) {
+//        this.clientWebsocketStatusCount = clientWebsocketStatusCount;
+//    }
+//
+//    public Integer getMonitorStatusSourceCount() {
+//        return monitorStatusSourceCount;
+//    }
+//
+//    public void setMonitorStatusSourceCount(Integer monitorStatusSourceCount) {
+//        this.monitorStatusSourceCount = monitorStatusSourceCount;
+//    }
 
     public Integer getAlreadyComplete() {
         return alreadyComplete;

+ 90 - 1
themis-business/src/main/java/com/qmth/themis/business/entity/TEExamStudentLog.java

@@ -6,9 +6,11 @@ import com.baomidou.mybatisplus.annotation.TableId;
 import com.fasterxml.jackson.databind.annotation.JsonSerialize;
 import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
 import com.qmth.themis.business.enums.ExamRecordStatusEnum;
+import com.qmth.themis.business.enums.MessageTypeEnum;
 import com.qmth.themis.business.util.UidUtil;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
+import org.jetbrains.annotations.NotNull;
 
 import java.io.Serializable;
 import java.util.List;
@@ -22,7 +24,7 @@ import java.util.Objects;
  * @Date: 2020/6/25
  */
 @ApiModel(value = "t_e_exam_student_log", description = "考生轨迹")
-public class TEExamStudentLog implements Serializable {
+public class TEExamStudentLog implements Serializable, Comparable<TEExamStudentLog> {
 
     private static final long serialVersionUID = 1L;
 
@@ -97,10 +99,42 @@ public class TEExamStudentLog implements Serializable {
     @TableField(exist = false)
     private Boolean ipChange;
 
+    @ApiModelProperty(value = "消息类型")
+    @TableField(exist = false)
+    private MessageTypeEnum msgType;
+
+    @ApiModelProperty(value = "消息类型")
+    @TableField(exist = false)
+    private String msgTypeStr;
+
+    @ApiModelProperty(value = "消息内容")
+    @TableField(exist = false)
+    private String content;
+
+    @JsonSerialize(using = ToStringSerializer.class)
+    @ApiModelProperty(value = "发送人id")
+    @TableField(exist = false)
+    private Long formUserId;
+
+    @ApiModelProperty(value = "发送人名称")
+    @TableField(exist = false)
+    private String formUserName;
+
     public TEExamStudentLog() {
 
     }
 
+    public TEExamStudentLog(Long studentId, Long examStudentId, Long examRecordId, MessageTypeEnum msgType, String content, Long formUserId, String formUserName, Long createTime) {
+        this.studentId = studentId;
+        this.examStudentId = examStudentId;
+        this.examRecordId = examRecordId;
+        this.msgType = msgType;
+        this.content = content;
+        this.formUserId = formUserId;
+        this.formUserName = formUserName;
+        this.createTime = createTime;
+    }
+
     public TEExamStudentLog(String type, String info, String remark, Long studentId, String ip,
                             String country, String region, String province, String city, String isp) {
         this.id = UidUtil.nextId();
@@ -155,6 +189,34 @@ public class TEExamStudentLog implements Serializable {
         this.isp = isp;
     }
 
+    public String getFormUserName() {
+        return formUserName;
+    }
+
+    public void setFormUserName(String formUserName) {
+        this.formUserName = formUserName;
+    }
+
+    public MessageTypeEnum getMsgType() {
+        return msgType;
+    }
+
+    public void setMsgType(MessageTypeEnum msgType) {
+        this.msgType = msgType;
+    }
+
+    public String getMsgTypeStr() {
+        if (Objects.nonNull(msgType)) {
+            return msgType.getCode();
+        } else {
+            return msgTypeStr;
+        }
+    }
+
+    public void setMsgTypeStr(String msgTypeStr) {
+        this.msgTypeStr = msgTypeStr;
+    }
+
     public List<TEExamStudentLog> ipChange(List<TEExamStudentLog> teExamStudentLogList) {
         String currentIp = teExamStudentLogList.get(0).getIp();
         for (int i = 1; i < teExamStudentLogList.size(); i++) {
@@ -173,6 +235,22 @@ public class TEExamStudentLog implements Serializable {
         return teExamStudentLogList;
     }
 
+    public String getContent() {
+        return content;
+    }
+
+    public void setContent(String content) {
+        this.content = content;
+    }
+
+    public Long getFormUserId() {
+        return formUserId;
+    }
+
+    public void setFormUserId(Long formUserId) {
+        this.formUserId = formUserId;
+    }
+
     public Boolean getIpChange() {
         return ipChange;
     }
@@ -320,4 +398,15 @@ public class TEExamStudentLog implements Serializable {
     public void setCreateTime(Long createTime) {
         this.createTime = createTime;
     }
+
+    @Override
+    public int compareTo(@NotNull TEExamStudentLog o) {
+        if (o.getCreateTime() < this.getCreateTime()) {
+            return 1;
+        } else if (o.getCreateTime() > this.getCreateTime()) {
+            return -1;
+        } else {
+            return 0;
+        }
+    }
 }

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

@@ -69,6 +69,10 @@ public class TIeExamInvigilateNotice implements Serializable {
     @TableField(value = "receive_time")
     private Long receiveTime;
 
+    @ApiModelProperty(value = "发送人名称")
+    @TableField(exist = false)
+    private String formUserName;
+
     public TIeExamInvigilateNotice() {
 
     }
@@ -85,6 +89,14 @@ public class TIeExamInvigilateNotice implements Serializable {
         this.sendTime = System.currentTimeMillis();
     }
 
+    public String getFormUserName() {
+        return formUserName;
+    }
+
+    public void setFormUserName(String formUserName) {
+        this.formUserName = formUserName;
+    }
+
     public static long getSerialVersionUID() {
         return serialVersionUID;
     }

+ 9 - 0
themis-business/src/main/java/com/qmth/themis/business/service/TIeExamInvigilateNoticeService.java

@@ -3,6 +3,8 @@ package com.qmth.themis.business.service;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.qmth.themis.business.entity.TIeExamInvigilateNotice;
 
+import java.util.List;
+
 /**
  * @Description: 监考通知消息记录 服务类
  * @Param:
@@ -12,4 +14,11 @@ import com.qmth.themis.business.entity.TIeExamInvigilateNotice;
  */
 public interface TIeExamInvigilateNoticeService extends IService<TIeExamInvigilateNotice> {
 
+    /**
+     * 根据考试记录id查询文本和语音消息
+     *
+     * @param examRecordId
+     * @return
+     */
+    List<TIeExamInvigilateNotice> queryNoticeByExamRecordId(Long examRecordId);
 }

+ 12 - 0
themis-business/src/main/java/com/qmth/themis/business/service/impl/TIeExamInvigilateNoticeServiceImpl.java

@@ -6,6 +6,8 @@ import com.qmth.themis.business.entity.TIeExamInvigilateNotice;
 import com.qmth.themis.business.service.TIeExamInvigilateNoticeService;
 import org.springframework.stereotype.Service;
 
+import java.util.List;
+
 /**
  * @Description: 监考通知消息记录 服务实现类
  * @Param:
@@ -16,4 +18,14 @@ import org.springframework.stereotype.Service;
 @Service
 public class TIeExamInvigilateNoticeServiceImpl extends ServiceImpl<TIeExamInvigilateNoticeMapper, TIeExamInvigilateNotice> implements TIeExamInvigilateNoticeService {
 
+    /**
+     * 根据考试记录id查询文本和语音消息
+     *
+     * @param examRecordId
+     * @return
+     */
+    @Override
+    public List<TIeExamInvigilateNotice> queryNoticeByExamRecordId(Long examRecordId) {
+        return this.baseMapper.queryNoticeByExamRecordId(examRecordId);
+    }
 }

+ 13 - 0
themis-business/src/main/resources/mapper/TIeExamInvigilateNoticeMapper.xml

@@ -2,4 +2,17 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.qmth.themis.business.dao.TIeExamInvigilateNoticeMapper">
 
+    <select id="queryNoticeByExamRecordId" resultType="com.qmth.themis.business.entity.TIeExamInvigilateNotice">
+        select t.exam_record_id as examRecordId,
+                  t.`type`,
+                  t.content,
+                  t.form_user_id as formUserId,
+                  tbu.name as formUserName,
+                  t.send_time as sendTime
+        from
+            t_ie_exam_invigilate_notice t
+            left join t_b_user tbu on tbu.id = t.form_user_id
+            left join t_b_user tbu1 on tbu1.id = t.receive_user_id
+        where t.exam_record_id = #{examRecordId}
+    </select>
 </mapper>

+ 5 - 21
themis-business/src/main/resources/mapper/TOeExamRecordMapper.xml

@@ -1147,7 +1147,7 @@
     </select>
 
     <select id="findByStopInfo" resultType="com.qmth.themis.business.bean.admin.CountStopBean">
-        select
+        <!--select
         sum(t.clientWebsocketStatusOffCount) as offCount,
         sum(t.cameraMonitorStatusStop + t.screenMonitorStatusStop + t.mobileFirstMonitorStatusStop +
         t.mobileSecondMonitorStatusStop) as stopCount,
@@ -1177,14 +1177,14 @@
             </if>
             and t.STATUS in ('FIRST_PREPARE','ANSWERING','BREAK_OFF','RESUME_PREPARE')
         </where>
-        UNION all
+        UNION all-->
         select
-        0 as clientWebsocketStatusOffCount,
+        <!--0 as clientWebsocketStatusOffCount,
         0 as clientWebsocketStatusOnCount,
         0 as cameraMonitorStatusStop,
         0 as screenMonitorStatusStop,
         0 as mobileFirstMonitorStatusStop,
-        0 as mobileSecondMonitorStatusStop,
+        0 as mobileSecondMonitorStatusStop,-->
         count(1) as allCount
         from
         t_e_exam_student t
@@ -1198,7 +1198,7 @@
                 and t.exam_activity_id = #{examActivityId}
             </if>
         </where>
-        ) t
+        <!--) t-->
     </select>
 
     <select id="findByOnlineInfo" resultType="java.lang.Integer">
@@ -1256,22 +1256,6 @@
             </if>
             and t.STATUS in ('FINISHED','PERSISTED') and t.first_start_time is not null
         </where>
-        union all
-        select
-        count(distinct t.id) as c
-        from
-        t_e_exam_student t
-        left join t_oe_exam_record toer on toer.exam_student_id = t.id
-        where 1 = 1
-        and t.exam_id = #{examId}
-        and t.room_code in
-        <foreach collection="roomCodeSet" item="roomCode" index="index" open="(" close=")" separator=",">
-            #{roomCode}
-        </foreach>
-        <if test="examActivityId != null and examActivityId != ''">
-            and t.exam_activity_id = #{examActivityId}
-        </if>
-        and toer.id is null;
     </select>
 
     <select id="findByViewAdmin" resultType="java.lang.Integer">