Prechádzať zdrojové kódy

Merge branch 'dev' into release
111

wangliang 4 rokov pred
rodič
commit
43aad73db7

+ 4 - 4
themis-backend/src/main/java/com/qmth/themis/backend/api/TBUserController.java

@@ -582,11 +582,11 @@ public class TBUserController {
             Gson gson = new Gson();
             TBUser tbUser = gson.fromJson(gson.toJson(mapParameter), TBUser.class);
             List<String> roleList = (List<String>) mapParameter.get("roleCode");
-            Set<String> roleSet = null;
-            if (Objects.nonNull(roleList) && roleList.size() > 0) {
-                roleSet = new HashSet<>(roleList);
+            if (Objects.isNull(roleList) || roleList.size() == 0) {
+                throw new BusinessException("请选择角色");
             }
-            if (Objects.nonNull(roleSet) && roleSet.size() > 1) {
+            Set<String> roleSet = new HashSet<>(roleList);
+            if (roleSet.size() > 1) {
                 throw new BusinessException("暂不支持多个角色");
             }
             if (Objects.isNull(tbUser.getId())) {

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

@@ -359,6 +359,17 @@ public class InvigilateListDetailBean implements Serializable {
         @ApiModelProperty(value = "创建时间")
         private Date createTime;
 
+        @ApiModelProperty(value = "处理时差,单位秒")
+        private Integer difference;
+
+        public Integer getDifference() {
+            return difference;
+        }
+
+        public void setDifference(Integer difference) {
+            this.difference = difference;
+        }
+
         public String getInfo() {
             return info;
         }

+ 14 - 2
themis-business/src/main/java/com/qmth/themis/business/entity/TIeInvigilateExceptionInfo.java

@@ -63,11 +63,15 @@ public class TIeInvigilateExceptionInfo implements Serializable {
     @TableField(value = "update_time", fill = FieldFill.UPDATE)
     private Date updateTime;
 
+    @ApiModelProperty(value = "处理时差,单位秒")
+    @TableField(value = "difference")
+    private Integer difference;
+
     public TIeInvigilateExceptionInfo() {
 
     }
 
-    public TIeInvigilateExceptionInfo(Long examId, Long examActivityId, Long examRecordId, Long examStudentId, String info, ExceptionEnum type,String remark) {
+    public TIeInvigilateExceptionInfo(Long examId, Long examActivityId, Long examRecordId, Long examStudentId, String info, ExceptionEnum type,Integer difference) {
         this.id = Constants.idGen.next();
         this.examId = examId;
         this.examActivityId = examActivityId;
@@ -75,7 +79,15 @@ public class TIeInvigilateExceptionInfo implements Serializable {
         this.examStudentId = examStudentId;
         this.info = info;
         this.type = type;
-        this.remark = remark;
+        this.difference = difference;
+    }
+
+    public Integer getDifference() {
+        return difference;
+    }
+
+    public void setDifference(Integer difference) {
+        this.difference = difference;
     }
 
     public static long getSerialVersionUID() {

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

@@ -172,18 +172,6 @@ public class TOeExamRecord implements Serializable {
     @TableField(value = "score_status")
     private ScoreStatusEnum scoreStatus;
 
-    @ApiModelProperty(value = "异常状态")
-    @TableField(value = "exception_status")
-    private ExceptionEnum exceptionStatus;
-
-    public ExceptionEnum getExceptionStatus() {
-        return exceptionStatus;
-    }
-
-    public void setExceptionStatus(ExceptionEnum exceptionStatus) {
-        this.exceptionStatus = exceptionStatus;
-    }
-
     public ScoreStatusEnum getScoreStatus() {
         return scoreStatus;
     }

+ 11 - 0
themis-business/src/main/java/com/qmth/themis/business/templete/service/impl/TempleteLogicServiceImpl.java

@@ -2,6 +2,7 @@ package com.qmth.themis.business.templete.service.impl;
 
 import cn.hutool.core.date.DateUtil;
 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.config.SystemConfig;
 import com.qmth.themis.business.constant.SystemConstant;
@@ -149,6 +150,11 @@ public class TempleteLogicServiceImpl implements TempleteLogicService {
                             teStudent = new TEStudent(orgId, examStudentImportDto.getIdentity(), examStudentImportDto.getName(), createId);
                             teStudentService.save(teStudent);
                             teStudentList.add(teStudent);
+                        }else{
+                            UpdateWrapper<TEStudent> teStudentUpdateWrapper = new UpdateWrapper<>();
+                            teStudentUpdateWrapper.lambda().set(TEStudent::getName, examStudentImportDto.getName())
+                                    .eq(TEStudent::getIdentity, examStudentImportDto.getIdentity());
+                            teStudentService.update(teStudentUpdateWrapper);
                         }
                         teExamStudent = gson.fromJson(gson.toJson(examStudentImportDto), TEExamStudent.class);
                         teExamStudent.setExamId(examId);
@@ -170,6 +176,11 @@ public class TempleteLogicServiceImpl implements TempleteLogicService {
                         teExamStudent.setCourseName(examStudentImportDto.getCourseName());
                         teExamStudent.setExamActivityId(teExamActivity.getId());
                         teExamStudent.setLeftExamCount(examCount);
+
+                        UpdateWrapper<TEStudent> teStudentUpdateWrapper = new UpdateWrapper<>();
+                        teStudentUpdateWrapper.lambda().set(TEStudent::getName, examStudentImportDto.getName())
+                                .eq(TEStudent::getIdentity, examStudentImportDto.getIdentity());
+                        teStudentService.update(teStudentUpdateWrapper);
                     }
                     teExamStudentService.saveOrUpdate(teExamStudent);
                     roomCodeAndNameSet.add(teExamStudent.getRoomCode() + ":" + teExamStudent.getRoomName());

+ 1 - 1
themis-business/src/main/resources/db/init.sql

@@ -1295,6 +1295,7 @@ CREATE TABLE `t_ie_invigilate_exception_info` (
   `remark` mediumtext COMMENT '备注',
   `create_time` datetime DEFAULT NULL COMMENT '创建时间',
   `update_time` datetime DEFAULT NULL COMMENT '更新时间',
+  `difference` int(11) DEFAULT NULL COMMENT '处理时差,单位秒',
   PRIMARY KEY (`id`)
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='监考异常信息';
 
@@ -1471,7 +1472,6 @@ CREATE TABLE `t_oe_exam_record` (
   `monitor_status_source` varchar(30) DEFAULT NULL COMMENT '监控状态,stop:停止,start:正常',
   `monitor_live_url` varchar(100) DEFAULT NULL COMMENT '监控观看地址',
   `score_status` varchar(30) DEFAULT NULL COMMENT '算分状态,never:从未算分,calculating:正在算分,finish:算分完成',
-  `exception_status` varchar(30) DEFAULT NULL COMMENT '异常状态',
   PRIMARY KEY (`id`)
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='考试记录';
 

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

@@ -12,8 +12,8 @@
 		tees.name,
 		tees.`identity`,
 		teea.code,
-		teec.course_code as courseCode,
-		teec.course_name as courseName,
+		tees.course_code as courseCode,
+		tees.course_name as courseName,
 		tees.enable,
 		tees.room_code as roomCode,
 		tees.room_name as roomName,
@@ -27,8 +27,6 @@
 		tees.exam_id = tee.id
 		left join t_e_exam_activity teea on
 		tees.exam_activity_id = teea.id
-		left join t_e_exam_course teec on
-		tees.course_code = teec.course_code
 		<where>
 			<if test="examId != null and examId != ''">
 				and tees.exam_id = #{examId}

+ 23 - 12
themis-business/src/main/resources/mapper/TEStudentMapper.xml

@@ -4,20 +4,30 @@
 
     <select id="studentQuery" resultType="com.qmth.themis.business.dto.response.TEStudentDto">
         select
-            tes.id,
-            tes.name,
-            tes.`identity`,
-            tbo.name as orgName,
-            tes.enable,
-            tes.base_photo_path as basePhotoPath,
-            (select tbu.name from t_b_user tbu where tbu.id = tes.create_id) as createName,
-            (select tbu.name from t_b_user tbu where tbu.id = tes.update_id) as updateName,
-            tes.create_time as createTime,
-            tes.update_time as updateTime
+        t.id,
+        t.name,
+        t.identity,
+        t.orgName,
+        t.enable,
+        t.basePhotoPath,
+        if(t.updateName is not null, t.updateName, t.createName) as updateName,
+        if(t.updateTime is not null, t.updateTime, t.createTime) as updateTime
         from
-            t_e_student tes
+        (select
+        tes.id,
+        tes.name,
+        tes.`identity`,
+        tbo.name as orgName,
+        tes.enable,
+        tes.base_photo_path as basePhotoPath,
+        (select tbu.name from t_b_user tbu where tbu.id = tes.create_id) as createName,
+        (select tbu.name from t_b_user tbu where tbu.id = tes.update_id) as updateName,
+        tes.create_time as createTime,
+        tes.update_time as updateTime
+        from
+        t_e_student tes
         left join t_b_org tbo on
-            tbo.id = tes.org_id
+        tbo.id = tes.org_id
         <where>
             <if test="identity != null and identity != ''">
                 and tes.identity like concat('%', #{identity}, '%')
@@ -29,6 +39,7 @@
                 and tes.enable = #{enable}
             </if>
         </where>
+        ) t order by t.name
     </select>
 
     <select id="studentExamRecordQuery" resultType="com.qmth.themis.business.dto.response.TEStudentExamRecordDto">

+ 3 - 6
themis-business/src/main/resources/mapper/TOeExamRecordMapper.xml

@@ -131,12 +131,6 @@
             </if>
             <if test="status != null and status != ''">
                 <choose>
-                    <when test="status == EXCEPTION">
-                        and (t.exception_status is not null or t.status = 'BREAK_OFF')
-                    </when>
-                    <when test="status == PREPARE">
-                        and t.status = 'FIRST_PREPARE'
-                    </when>
                     <when test="status == EXAMING">
                         and (t.status = 'ANSWERING' or t.status = 'RESUME_PREPARE')
                     </when>
@@ -164,6 +158,9 @@
                 and t.monitor_status_source = #{monitorStatusSource}
             </if>
                 and s.enable = 1
+                and tee.enable = 1
+                and teea.enable = 1
+                and teea.finish_time > now()
         </where>
     </sql>
 

+ 4 - 6
themis-mq/src/main/java/com/qmth/themis/mq/service/impl/MqLogicServiceImpl.java

@@ -222,7 +222,7 @@ public class MqLogicServiceImpl implements MqLogicService {
         if (Objects.nonNull(objectMap)) {
             Integer diff = 0;
             if (Objects.nonNull(clientLastSyncTime)) {//大于等于当前时间,说明未重连或重登录
-                Long l = (System.currentTimeMillis() - clientLastSyncTime.getTime()) / 1000 / 60;
+                Long l = (System.currentTimeMillis() - clientLastSyncTime.getTime()) / 1000;
                 if (l >= 2 && !Objects.equals(objectMap.get("status"), ExamRecordStatusEnum.FINISHED)) {
                     diff = l.intValue();
                     //是否增加断点记录或者交卷处理统一放登录逻辑里处理,这里只更新考试记录状态为中断
@@ -234,7 +234,7 @@ public class MqLogicServiceImpl implements MqLogicService {
             Long examId = Long.parseLong(String.valueOf(objectMap.get("examId")));
             Long examActivityId = Long.parseLong(String.valueOf(objectMap.get("examActivityId")));
             Long examStudentId = Long.parseLong(String.valueOf(objectMap.get("examStudentId")));
-            TIeInvigilateExceptionInfo tIeInvigilateExceptionInfo = new TIeInvigilateExceptionInfo(examId, examActivityId, recordId, examStudentId, ExceptionEnum.NET_TIME_OUT.getCode(), ExceptionEnum.NET_TIME_OUT, String.valueOf(diff));
+            TIeInvigilateExceptionInfo tIeInvigilateExceptionInfo = new TIeInvigilateExceptionInfo(examId, examActivityId, recordId, examStudentId, ExceptionEnum.NET_TIME_OUT.getCode(), ExceptionEnum.NET_TIME_OUT, diff);
             tIeInvigilateExceptionInfoService.saveOrUpdate(tIeInvigilateExceptionInfo);
         }
         TMRocketMessage tmRocketMessage = gson.fromJson(gson.toJson(mqDto), TMRocketMessage.class);
@@ -447,7 +447,7 @@ public class MqLogicServiceImpl implements MqLogicService {
             Date clientLastSyncTime = ExamRecordCacheUtil.getClientLastSyncTime(recordId);
             Integer diff = 0;
             if (Objects.nonNull(clientLastSyncTime)) {
-                Long l = ((System.currentTimeMillis() - clientLastSyncTime.getTime()) / 1000 / 60);
+                Long l = ((System.currentTimeMillis() - clientLastSyncTime.getTime()) / 1000);
                 diff = l.intValue();
             }
 
@@ -485,7 +485,6 @@ 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())
@@ -493,7 +492,6 @@ public class MqLogicServiceImpl implements MqLogicService {
                         .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);
@@ -502,7 +500,7 @@ public class MqLogicServiceImpl implements MqLogicService {
             //增加异常日志
             Long examId = Long.parseLong(String.valueOf(objectMap.get("examId")));
             Long examActivityId = Long.parseLong(String.valueOf(objectMap.get("examActivityId")));
-            TIeInvigilateExceptionInfo tIeInvigilateExceptionInfo = new TIeInvigilateExceptionInfo(examId, examActivityId, recordId, examStudentId, String.valueOf(jsonObject.getJSONObject("reason").get("reason")), exceptionEnum, String.valueOf(diff));
+            TIeInvigilateExceptionInfo tIeInvigilateExceptionInfo = new TIeInvigilateExceptionInfo(examId, examActivityId, recordId, examStudentId, String.valueOf(jsonObject.getJSONObject("reason").get("reason")), exceptionEnum, diff);
             tIeInvigilateExceptionInfoService.saveOrUpdate(tIeInvigilateExceptionInfo);
         } else if (tag.contains(MqTagEnum.WARNING_LOG.name())) {//考试预警日志