فهرست منبع

管理员菜单优化

wangliang 2 سال پیش
والد
کامیت
c357d61df3

+ 15 - 17
themis-business/src/main/java/com/qmth/themis/business/constant/SystemConstant.java

@@ -1032,18 +1032,7 @@ public class SystemConstant {
         TEExamPaperService teExamPaperService = SpringContextHolder.getBean(TEExamPaperService.class);
         if (!CollectionUtils.isEmpty(answersTemp)) {
             List<OpenRecordAnswerBean> answers = new ArrayList<>(answersTemp.size());
-            List<OpenRecordAnswerBean> finalAnswers = answers;
             answersTemp.forEach(s -> {
-                OpenRecordAnswerBean openRecordAnswerBean = new OpenRecordAnswerBean(s.getMainNumber(), s.getSubNumber(), s.getSubIndex());
-                try {
-                    openRecordAnswerBean.setAnswer(GsonUtil.fromJson(s.getAnswer(), new TypeToken<List<OpenRecordAnswerStructBean>>() {
-                    }.getType()));
-                } catch (Exception e) {
-                    log.error("错误答案:{}", s.getAnswer(), e);
-                }
-                finalAnswers.add(openRecordAnswerBean);
-            });
-            openRecordNeedMarkBean.setAnswers(answers.stream().filter(answer -> {
                 Map<String, Integer> struct = paperStructMap.get(openRecordNeedMarkBean.getPaperId());
                 if (struct == null) {
                     struct = teExamPaperService.getPaperStructCacheBean(openRecordNeedMarkBean.getPaperId());
@@ -1051,15 +1040,24 @@ public class SystemConstant {
                         paperStructMap.put(openRecordNeedMarkBean.getPaperId(), struct);
                     } else {
                         log.error("找不到对应的试卷结构,paperId=" + openRecordNeedMarkBean.getPaperId());
-                        return false;
+                        return;
                     }
                 }
                 Integer type = struct.get(RedisKeyHelper
-                        .examAnswerHashKey(answer.getMainNumber(), answer.getSubNumber(),
-                                answer.getSubIndex()));
-                //过滤单选、多选、判断题
-                return type != null && type != 1 && type != 2 && type != 3;
-            }).collect(Collectors.toList()));
+                        .examAnswerHashKey(s.getMainNumber(), s.getSubNumber(),
+                                s.getSubIndex()));
+                if (Objects.nonNull(type) && type.intValue() != 1 && type.intValue() != 2 && type.intValue() != 3) {
+                    OpenRecordAnswerBean openRecordAnswerBean = new OpenRecordAnswerBean(s.getMainNumber(), s.getSubNumber(), s.getSubIndex());
+                    try {
+                        openRecordAnswerBean.setAnswer(GsonUtil.fromJson(s.getAnswer(), new TypeToken<List<OpenRecordAnswerStructBean>>() {
+                        }.getType()));
+                    } catch (Exception e) {
+                        log.error("错误答案:{}", s.getAnswer(), e);
+                    }
+                    answers.add(openRecordAnswerBean);
+                }
+            });
+            openRecordNeedMarkBean.setAnswers(answers);
         }
         //考生未答题或未答主观题
         if (CollectionUtils.isEmpty(openRecordNeedMarkBean.getAnswers()) || CollectionUtils.isEmpty(answersTemp)) {

+ 3 - 3
themis-business/src/main/java/com/qmth/themis/business/dto/response/MarkResultDto.java

@@ -53,13 +53,13 @@ public class MarkResultDto implements Serializable {
     private Integer examCount;
 
     @ApiModelProperty(value = "客观分")
-    private Double objectiveScore;
+    private Double objectiveScore = 0D;
 
     @ApiModelProperty(value = "主观分")
-    private Double subjectiveScore;
+    private Double subjectiveScore = 0D;
 
     @ApiModelProperty(value = "总分")
-    private Double sumScore;
+    private Double sumScore = 0D;
 
     @JsonSerialize(using = ToStringSerializer.class)
     @ApiModelProperty(value = "批次id")

+ 1 - 1
themis-business/src/main/resources/mapper/TBTaskHistoryMapper.xml

@@ -9,7 +9,7 @@
             tbth.entity_id as entityId,
             tbth.status,
             tbth.summary,
-            TRUNCATE(tbth.progress,2),
+            TRUNCATE(tbth.progress,2) as progress,
             if(ISNULL(tbth.result_file_path),0,1) as hasResultFile,
             if(ISNULL(tbth.report_file_path),0,1) as hasReportFile,
             tbth.create_time as createTime,

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

@@ -383,46 +383,29 @@
 
     <sql id="markResultCommon">
         select
-        t.examActivityCode,
-        t.name,
-        t.identity,
-        t.courseCode,
-        t.courseName,
-        t.roomCode,
-        t.roomName,
-        t.grade,
-        t.classNo,
-        if(t.examCount <![CDATA[ <= ]]> 0,'是','否') as examAbsent,
-        t.examCount,
-        t.examName,
-        if(t.breachCount is null,0,t.breachCount) as breachCount,
-        ifnull(t.objectiveScore,0) as objectiveScore,
-        t.examId,
-        t.examActivityId,
-        t.subjectiveScore,
-        (t.objectiveScore + t.subjectiveScore) as sumScore,
-        t.examStudentId
-        from
-        (
-        select tees.id as examStudentId,tee.id as examId,tee.name as examName,teea.id as examActivityId, teea.code as examActivityCode, tes.name, tes.`identity`, tees.course_code as courseCode, tees.course_name as courseName, tees.room_code as roomCode, tees.room_name as roomName, tees.grade, tees.class_no as classNo, (
-        select
-        count(1)
-        from
-        t_oe_exam_record toer
-        where
-        toer.exam_student_id = tees.id and toer.first_start_time is not null) as examCount,
-        (select count(toer.id) from t_oe_exam_record toer
-        where toer.exam_student_id = tees.id and toer.breach_status = 0) as breachCount,
-        0 as objectiveScore,
-        0 as subjectiveScore
+        tees.id as examStudentId,
+        tee.id as examId,
+        tee.name as examName,
+        teea.id as examActivityId,
+        teea.code as examActivityCode,
+        tes.name,
+        tes.`identity`,
+        tees.course_code as courseCode,
+        tees.course_name as courseName,
+        tees.room_code as roomCode,
+        tees.room_name as roomName,
+        tees.grade,
+        tees.class_no as classNo,
+        count(toer1.id) as examCount,
+        count(toer2.id) as breachCount,
+        if(count(toer1.id) <![CDATA[ <= ]]> 0,'是','否') as examAbsent
         from
         t_e_student tes
-        left join t_e_exam_student tees on
-        tees.student_id = tes.id
-        left join t_e_exam tee on
-        tee.id = tees.exam_id
-        left join t_e_exam_activity teea on
-        teea.id = tees.exam_activity_id
+        left join t_e_exam_student tees on tees.student_id = tes.id
+        left join t_e_exam tee on tee.id = tees.exam_id
+        left join t_e_exam_activity teea on teea.id = tees.exam_activity_id
+        left join t_oe_exam_record toer1 on toer1.exam_student_id = tees.id and toer1.first_start_time is not null
+        left join t_oe_exam_record toer2 on toer2.exam_student_id = tees.id and toer2.breach_status = 0
         <where>
             <if test="examId != null and examId != ''">
                 and tee.id = #{examId}
@@ -439,7 +422,22 @@
             <if test="courseCode != null and courseCode != ''">
                 and tees.course_code = #{courseCode}
             </if>
-        </where> ) t order by t.examStudentId
+        </where>
+        group by
+        tees.id,
+        tee.id,
+        tee.name,
+        teea.id,
+        teea.code,
+        tes.name,
+        tes.`identity`,
+        tees.course_code,
+        tees.course_name,
+        tees.room_code,
+        tees.room_name,
+        tees.grade,
+        tees.class_no
+        order by tees.id
     </sql>
 
     <select id="markResultQuery" resultType="com.qmth.themis.business.dto.response.MarkResultDto">

+ 28 - 18
themis-business/src/main/resources/mapper/TEStudentMapper.xml

@@ -11,15 +11,16 @@
         tes.enable,
         tes.base_photo_path as basePhotoPath,
         IF(tes.base_photo_path is null,0,1) as photo,
-        (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,
+        tbu1.name as createName,
+        tbu2.name as updateName,
         tes.create_time as createTime,
         tes.update_time as updateTime,
         tes.mobile_number as mobileNumber
         from
         t_e_student tes
-        left join t_b_org tbo on
-        tbo.id = tes.org_id
+        left join t_b_org tbo on tbo.id = tes.org_id
+        left join t_b_user tbu1 on tes.create_id = tbu1.id
+        left join t_b_user tbu2 on tes.update_id = tbu2.id
         <where>
             <if test="identity != null and identity != ''">
                 and tes.identity like concat('%', #{identity}, '%')
@@ -61,25 +62,18 @@
             toer.status,
             toer.first_start_time as firstStartTime,
             toer.finish_time as finishTime,
-            IFNULL(IF(toer.tencent_video_url is not null, 1, null),(
-            select
-            count(1)
-            from
-            t_m_tencent_video_message t
-            where
-            t.exam_record_id = toer.id)) as videoCount,
+            IFNULL(IF(toer.tencent_video_url is not null, 1, null),count(t1.id)) as videoCount,
             toer.monitor_record as monitorRecord,
-            (select GROUP_CONCAT(t.video_source) from t_m_tencent_video_message t where t.exam_record_id = toer.id) as videoSource,
+            GROUP_CONCAT(t2.video_source) as videoSource,
             toer.tencent_video_url as tencentVideoUrl,
             toer.video_status as videoStatus
         from
             t_e_exam_student tees
-        join t_e_exam tee on
-            tee.id = tees.exam_id
-        join t_oe_exam_record toer on
-            toer.exam_student_id = tees.id and toer.exam_id = tee.id
-        join t_e_student tes on
-            tes.id = tees.student_id
+        join t_e_exam tee on tee.id = tees.exam_id
+        join t_oe_exam_record toer on toer.exam_student_id = tees.id
+        join t_e_student tes on tes.id = tees.student_id
+        left join t_m_tencent_video_message t1 on t1.exam_record_id = toer.id
+        left join t_m_tencent_video_message t2 on t2.exam_record_id = toer.id
             <where>
                 <if test="studentId != null and studentId != ''">
                     and tes.id = #{studentId}
@@ -88,6 +82,22 @@
                     and tee.id = #{examId}
                 </if>
             </where>
+        group by
+            tee.id,
+            tee.name,
+            tees.id,
+            toer.id,
+            tees.course_code,
+            tees.course_name ,
+            tees.`identity`,
+            tees.name,
+            toer.objective_score,
+            toer.status,
+            toer.first_start_time,
+            toer.finish_time,
+            toer.monitor_record,
+            toer.tencent_video_url,
+            toer.video_status
         order by toer.first_start_time desc
     </select>