소스 검색

face logic修改

wangliang 4 년 전
부모
커밋
147cb24a49

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

@@ -17,14 +17,14 @@
             <if test="userId != null and userId != ''">
                 and EXISTS(
                 select
-                DISTINCT tees.exam_id
+                DISTINCT tbeiu.exam_id
                 from
                 t_b_exam_invigilate_user tbeiu
                 left join t_e_exam_student tees on
                 tees.room_code = tbeiu.room_code
                 where
                 tbeiu.user_id = #{userId}
-                and t.id = tees.exam_id)
+                and t.id = tbeiu.exam_id)
             </if>
         </where>
     </select>
@@ -75,14 +75,14 @@
                 and t.enable = 1
                 and EXISTS(
                 select
-                DISTINCT tees.exam_id
+                DISTINCT tbeiu.exam_id
                 from
                 t_b_exam_invigilate_user tbeiu
                 left join t_e_exam_student tees on
                 tees.room_code = tbeiu.room_code
                 where
                 tbeiu.user_id = #{userId}
-                and t.id = tees.exam_id)
+                and t.id = tbeiu.exam_id)
             </if>
             <if test="orgId != null and orgId != ''">
                 and t.org_id = #{orgId}
@@ -153,7 +153,7 @@
         where
             EXISTS(
             select
-                DISTINCT tees.exam_id
+                DISTINCT tbeiu.exam_id
             from
                 t_b_exam_invigilate_user tbeiu
             left join t_e_exam_student tees on
@@ -162,7 +162,7 @@
                 <if test="userId != null and userId != ''">
                     and tbeiu.user_id = #{userId}
                 </if>
-                and tee.id = tees.exam_id
+                and tee.id = tbeiu.exam_id
             </where>
                 )
             order by tee.create_time desc

+ 34 - 71
themis-mq/src/main/java/com/qmth/themis/mq/service/impl/MqLogicServiceImpl.java

@@ -1,21 +1,6 @@
 package com.qmth.themis.mq.service.impl;
 
-import java.io.IOException;
-import java.lang.reflect.Method;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-
-import javax.annotation.Resource;
-
-import org.apache.rocketmq.client.consumer.listener.ConsumeConcurrentlyContext;
-import org.apache.rocketmq.client.consumer.listener.ConsumeConcurrentlyStatus;
-import org.apache.rocketmq.common.message.MessageExt;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-
+import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
@@ -29,57 +14,32 @@ import com.qmth.themis.business.constant.SpringContextHolder;
 import com.qmth.themis.business.constant.SystemConstant;
 import com.qmth.themis.business.dto.MqDto;
 import com.qmth.themis.business.dto.WarningDto;
-import com.qmth.themis.business.entity.TBSession;
-import com.qmth.themis.business.entity.TEExamStudentLog;
-import com.qmth.themis.business.entity.TEUserLog;
-import com.qmth.themis.business.entity.TIeExamInvigilateCall;
-import com.qmth.themis.business.entity.TIeExamInvigilateCallLog;
-import com.qmth.themis.business.entity.TIeInvigilateExceptionInfo;
-import com.qmth.themis.business.entity.TMRocketMessage;
-import com.qmth.themis.business.entity.TOeExamBreakHistory;
-import com.qmth.themis.business.entity.TOeExamRecord;
-import com.qmth.themis.business.enums.ExamRecordFieldEnum;
-import com.qmth.themis.business.enums.ExamRecordStatusEnum;
-import com.qmth.themis.business.enums.ExamTypeEnum;
-import com.qmth.themis.business.enums.ExceptionEnum;
-import com.qmth.themis.business.enums.FinishTypeEnum;
-import com.qmth.themis.business.enums.LivenessTypeEnum;
-import com.qmth.themis.business.enums.MqExecTypeEnum;
-import com.qmth.themis.business.enums.MqTagEnum;
-import com.qmth.themis.business.enums.MqTopicEnum;
-import com.qmth.themis.business.enums.PhotoTypeEnum;
-import com.qmth.themis.business.enums.SystemOperationEnum;
-import com.qmth.themis.business.enums.VerifyExceptionEnum;
-import com.qmth.themis.business.enums.WebsocketStatusEnum;
-import com.qmth.themis.business.service.CommonService;
-import com.qmth.themis.business.service.MqDtoService;
-import com.qmth.themis.business.service.TBSessionService;
-import com.qmth.themis.business.service.TEExamService;
-import com.qmth.themis.business.service.TEExamStudentLogService;
-import com.qmth.themis.business.service.TEExamStudentService;
-import com.qmth.themis.business.service.TEUserLogService;
-import com.qmth.themis.business.service.TIeExamInvigilateCallLogService;
-import com.qmth.themis.business.service.TIeExamInvigilateCallService;
-import com.qmth.themis.business.service.TIeInvigilateExceptionInfoService;
-import com.qmth.themis.business.service.TMRocketMessageService;
-import com.qmth.themis.business.service.TOeExamBreakHistoryService;
-import com.qmth.themis.business.service.TOeExamRecordService;
-import com.qmth.themis.business.service.TOeFaceVerifyHistoryService;
-import com.qmth.themis.business.service.TOeLivenessVerifyHistoryService;
-import com.qmth.themis.business.service.WarningService;
+import com.qmth.themis.business.entity.*;
+import com.qmth.themis.business.enums.*;
+import com.qmth.themis.business.service.*;
 import com.qmth.themis.business.templete.TaskExportTemplete;
 import com.qmth.themis.business.templete.TaskImportTemplete;
-import com.qmth.themis.business.templete.impl.TaskExamPaperImportTemplete;
-import com.qmth.themis.business.templete.impl.TaskExamStudentExportTemplete;
-import com.qmth.themis.business.templete.impl.TaskExamStudentImportTemplete;
-import com.qmth.themis.business.templete.impl.TaskRoomCodeExportTemplete;
-import com.qmth.themis.business.templete.impl.TaskRoomCodeImportTemplete;
+import com.qmth.themis.business.templete.impl.*;
 import com.qmth.themis.business.threadPool.MyThreadPool;
 import com.qmth.themis.business.util.JacksonUtil;
 import com.qmth.themis.business.util.RedisUtil;
 import com.qmth.themis.common.contanst.Constants;
 import com.qmth.themis.common.util.SimpleBeanUtil;
 import com.qmth.themis.mq.service.MqLogicService;
+import org.apache.rocketmq.client.consumer.listener.ConsumeConcurrentlyContext;
+import org.apache.rocketmq.client.consumer.listener.ConsumeConcurrentlyStatus;
+import org.apache.rocketmq.common.message.MessageExt;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.annotation.Resource;
+import java.io.IOException;
+import java.lang.reflect.Method;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
 
 /**
  * @Description: mq执行逻辑 impl
@@ -243,7 +203,7 @@ public class MqLogicServiceImpl implements MqLogicService {
                 TaskExportTemplete taskExportTemplete = null;
                 if (Objects.equals(MqTagEnum.ROOM_CODE_EXPORT.name(), tag)) {
                     taskExportTemplete = SpringContextHolder.getBean(TaskRoomCodeExportTemplete.class);
-                }else if (Objects.equals(MqTagEnum.EXAM_STUDENT_EXPORT.name(), tag)) {
+                } else if (Objects.equals(MqTagEnum.EXAM_STUDENT_EXPORT.name(), tag)) {
                     taskExportTemplete = SpringContextHolder.getBean(TaskExamStudentExportTemplete.class);
                 }
                 try {
@@ -423,19 +383,22 @@ public class MqLogicServiceImpl implements MqLogicService {
         String exception = (String) param.get("exception");
         livenessVerifyHistoryService.save(id, recordId, type, actions, retry, startTime, finishTime, exception);
         VerifyExceptionEnum warningEnum = VerifyExceptionEnum.valueOf(exception);
-        JSONObject jsonObject = JSONObject.parseObject(actions);
+        JSONArray jsonArray = JSONArray.parseArray(actions);
         Long examStudentId = ExamRecordCacheUtil.getExamStudentId(recordId);
         ExamStudentCacheBean examStudentCacheBean = teExamStudentService.getExamStudentCacheBean(examStudentId);
-        if (Objects.equals(VerifyExceptionEnum.NONE, warningEnum)) {//无异常,往考生日志表里插一条
-            JSONObject object = new JSONObject();
-            object.put(PhotoTypeEnum.LIVENESS_VERIFY_PHOTO.name(), String.valueOf(jsonObject.get("photoUrl")));
-            TEExamStudentLog teExamStudentLog = new TEExamStudentLog(type, LivenessTypeEnum.valueOf(type).getTitle(), object.toJSONString(), examStudentCacheBean.getStudentId(), examStudentCacheBean.getId(), recordId);
-            teExamStudentLogService.saveOrUpdate(teExamStudentLog);
-        } else {
-            if (Objects.equals(VerifyExceptionEnum.FACE_COUNT_ERROR, warningEnum)) {//人脸数量异常
-                warningService.faceCountError(new WarningDto(warningEnum, Integer.parseInt(String.valueOf(jsonObject.get("faceCount"))), null, recordId, String.valueOf(jsonObject.get("photoUrl"))));
-            } else if (Objects.equals(VerifyExceptionEnum.FACE_COMPARE_ERROR, warningEnum)) {//人脸比对异常
-                warningService.faceCompareError(new WarningDto(warningEnum, null, null, recordId, String.valueOf(jsonObject.get("photoUrl"))));
+        for (int i = 0; i < jsonArray.size(); i++) {
+            JSONObject jsonObject = jsonArray.getJSONObject(i);
+            if (Objects.equals(VerifyExceptionEnum.NONE, warningEnum)) {//无异常,往考生日志表里插一条
+                JSONObject object = new JSONObject();
+                object.put(PhotoTypeEnum.LIVENESS_VERIFY_PHOTO.name(), String.valueOf(jsonObject.get("photoUrl")));
+                TEExamStudentLog teExamStudentLog = new TEExamStudentLog(type, LivenessTypeEnum.valueOf(type).getTitle(), object.toJSONString(), examStudentCacheBean.getStudentId(), examStudentCacheBean.getId(), recordId);
+                teExamStudentLogService.saveOrUpdate(teExamStudentLog);
+            } else {
+                if (Objects.equals(VerifyExceptionEnum.FACE_COUNT_ERROR, warningEnum)) {//人脸数量异常
+                    warningService.faceCountError(new WarningDto(warningEnum, Integer.parseInt(String.valueOf(jsonObject.get("faceCount"))), null, recordId, String.valueOf(jsonObject.get("photoUrl"))));
+                } else if (Objects.equals(VerifyExceptionEnum.FACE_COMPARE_ERROR, warningEnum)) {//人脸比对异常
+                    warningService.faceCompareError(new WarningDto(warningEnum, null, null, recordId, String.valueOf(jsonObject.get("photoUrl"))));
+                }
             }
         }
         mqDto.setAck(SystemConstant.STANDARD_ACK_TYPE);