Przeglądaj źródła

face logic修改

wangliang 4 lat temu
rodzic
commit
dc9f93a07b

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

@@ -17,14 +17,14 @@
             <if test="userId != null and userId != ''">
                 and EXISTS(
                 select
-                DISTINCT tbeiu.exam_id
+                DISTINCT tees.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 = tbeiu.exam_id)
+                and t.id = tees.exam_id)
             </if>
         </where>
     </select>
@@ -75,14 +75,14 @@
                 and t.enable = 1
                 and EXISTS(
                 select
-                DISTINCT tbeiu.exam_id
+                DISTINCT tees.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 = tbeiu.exam_id)
+                and t.id = tees.exam_id)
             </if>
             <if test="orgId != null and orgId != ''">
                 and t.org_id = #{orgId}
@@ -110,11 +110,11 @@
         t.*
         from
         (
-            select
-            distinct tee.id, teea.id as examActivityId,tee.name, tee.mode, tee.pre_notice as preNotice, tee.pre_notice_stay_seconds as
-            preNoticeStaySeconds, tee.post_notice as postNotice,
-            datediff(teea.finish_time,teea.start_time) as diffSum,
-            datediff(teea.finish_time,teea.start_time) - datediff(now(),teea.start_time) as reallyTime
+        select
+        distinct tee.id, teea.id as examActivityId,tee.name, tee.mode, tee.pre_notice as preNotice, tee.pre_notice_stay_seconds as
+        preNoticeStaySeconds, tee.post_notice as postNotice,
+        datediff(teea.finish_time,teea.start_time) as diffSum,
+        datediff(teea.finish_time,teea.start_time) - datediff(now(),teea.start_time) as reallyTime
         from
         t_e_exam_student tees
         left join t_e_exam tee on
@@ -125,19 +125,19 @@
             <if test="studentId != null and studentId != ''">
                 and tees.student_id = #{studentId}
             </if>
-                and tee.enable = 1
-                and teea.enable = 1
-                and tees.enable = 1
-                <if test="orgId != null and orgId != ''">
-                    and tee.org_id = #{orgId}
-                </if>
-                <if test="examId != null and examId != ''">
-                    and tee.id = #{examId}
-                </if>
-                <!--and IF(tee.mode = 'TOGETHER', teea.start_time >= date_sub(now(),
-                interval IFNULL(teea.opening_seconds, tee.opening_seconds) second),1 = 1 )-->
+            and tee.enable = 1
+            and teea.enable = 1
+            and tees.enable = 1
+            <if test="orgId != null and orgId != ''">
+                and tee.org_id = #{orgId}
+            </if>
+            <if test="examId != null and examId != ''">
+                and tee.id = #{examId}
+            </if>
+            <!--and IF(tee.mode = 'TOGETHER', teea.start_time >= date_sub(now(),
+            interval IFNULL(teea.opening_seconds, tee.opening_seconds) second),1 = 1 )-->
         </where>
-            ) t
+        ) t
         <where>
             t.reallyTime <![CDATA[ <= ]]> diffSum + 15
             and t.reallyTime <![CDATA[ >= ]]> 0
@@ -146,24 +146,24 @@
 
     <select id="examPrivilegeQuery" resultType="com.qmth.themis.business.entity.TEExam">
         select
-            *
+        *
         from
-            t_e_exam tee
+        t_e_exam tee
         where
-            EXISTS(
-            select
-                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> 1 = 1
-                <if test="userId != null and userId != ''">
-                    and tbeiu.user_id = #{userId}
-                </if>
-                and tee.id = tbeiu.exam_id
-            </where>
-                )
-            order by tee.create_time desc
-        </select>
+        EXISTS(
+        select
+        DISTINCT tees.exam_id
+        from
+        t_b_exam_invigilate_user tbeiu
+        left join t_e_exam_student tees on
+        tees.room_code = tbeiu.room_code
+        <where> 1 = 1
+            <if test="userId != null and userId != ''">
+                and tbeiu.user_id = #{userId}
+            </if>
+            and tee.id = tees.exam_id
+        </where>
+        )
+        order by tee.create_time desc
+    </select>
 </mapper>

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

@@ -1,6 +1,5 @@
 package com.qmth.themis.mq.service.impl;
 
-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;
@@ -385,25 +384,21 @@ 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);
-        JSONArray jsonArray = JSONArray.parseArray(actions);
+        JSONObject jsonObject = JSONObject.parseObject(actions);
         Long examStudentId = ExamRecordCacheUtil.getExamStudentId(recordId);
         ExamStudentCacheBean examStudentCacheBean = teExamStudentService.getExamStudentCacheBean(examStudentId);
-        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"))));
-                }
+        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);
         TMRocketMessage tmRocketMessage = gson.fromJson(gson.toJson(mqDto), TMRocketMessage.class);
         tmRocketMessage.setBody(JacksonUtil.parseJson(tmRocketMessage.getBody()));