Kaynağa Gözat

成绩查询取分策略修改

wangliang 4 yıl önce
ebeveyn
işleme
cda41ab529

+ 20 - 1
themis-backend/src/main/java/com/qmth/themis/backend/api/TEExamStudentController.java

@@ -79,6 +79,9 @@ public class TEExamStudentController {
     @Resource
     TEExamCourseService teExamCourseService;
 
+    @Resource
+    TOeExamRecordService tOeExamRecordService;
+
     @ApiOperation(value = "考生导出")
     @RequestMapping(value = "/export", method = RequestMethod.POST)
     public Result export(@ApiParam(value = "考试批次id", required = true) @RequestParam Long examId,
@@ -355,7 +358,23 @@ public class TEExamStudentController {
             throw new BusinessException(ExceptionResultEnum.EXAM_ID_IS_NULL);
         }
         commonMarkResult(examId);
-        return ResultUtil.ok(teExamStudentService.markResultQuery(new Page<>(pageNumber, pageSize), examId, activityId, identity, name, courseCode));
+        IPage<MarkResultDto> markResultDtoIPage = teExamStudentService.markResultQuery(new Page<>(pageNumber, pageSize), examId, activityId, identity, name, courseCode);
+        if (Objects.nonNull(markResultDtoIPage)) {
+            List<MarkResultDto> markResultDtoList = markResultDtoIPage.getRecords();
+            if (Objects.nonNull(markResultDtoList) && markResultDtoList.size() > 0) {
+                for (MarkResultDto markResultDto : markResultDtoList) {
+                    if (Objects.nonNull(markResultDto.getExamId())) {
+                        ExamCacheBean examCacheBean = teExamService.getExamCacheBean(markResultDto.getExamId());
+                        TOeExamRecord tOeExamRecord = tOeExamRecordService.findMarkResult(markResultDto, examCacheBean.getRecordSelectStrategy());
+                        if (Objects.nonNull(tOeExamRecord)) {
+                            markResultDto.setObjectiveScore(Objects.isNull(tOeExamRecord.getObjectiveScore()) ? 0 : tOeExamRecord.getObjectiveScore());
+                            markResultDto.setRecordId(tOeExamRecord.getId());
+                        }
+                    }
+                }
+            }
+        }
+        return ResultUtil.ok(markResultDtoIPage);
     }
 
     @ApiOperation(value = "成绩查询简版导出接口")

+ 14 - 5
themis-business/src/main/java/com/qmth/themis/business/dao/TOeExamRecordMapper.java

@@ -305,10 +305,10 @@ public interface TOeExamRecordMapper extends BaseMapper<TOeExamRecord> {
                                                                       @Param("userId") Long userId,
                                                                       @Param("orgId") Long orgId);
 
-    public List<Map<String, Object>> getDoneCount(@Param("orgId")Long orgId,@Param("examId") Long examId, @Param("activityId") Long activityId,
+    public List<Map<String, Object>> getDoneCount(@Param("orgId") Long orgId, @Param("examId") Long examId, @Param("activityId") Long activityId,
                                                   @Param("roomCode") String roomCode, @Param("courseCode") String courseCode);
 
-    public List<Map<String, Object>> getDoneCountByDay(@Param("orgId")Long orgId,@Param("examId") Long examId, @Param("activityId") Long activityId,
+    public List<Map<String, Object>> getDoneCountByDay(@Param("orgId") Long orgId, @Param("examId") Long examId, @Param("activityId") Long activityId,
                                                        @Param("roomCode") String roomCode, @Param("courseCode") String courseCode);
 
     public Long getCountByExamId(@Param("examId") Long examId);
@@ -326,7 +326,7 @@ public interface TOeExamRecordMapper extends BaseMapper<TOeExamRecord> {
      * @param userId
      * @return
      */
-    public List<InvigilateListPatrolReportBean> patrolReport(@Param("orgId") Long orgId,@Param("examId") Long examId, @Param("userId") Long userId);
+    public List<InvigilateListPatrolReportBean> patrolReport(@Param("orgId") Long orgId, @Param("examId") Long examId, @Param("userId") Long userId);
 
     public TOeExamRecord findOneByExamId(@Param("examId") Long examId, @Param("status") String status);
 
@@ -344,9 +344,18 @@ public interface TOeExamRecordMapper extends BaseMapper<TOeExamRecord> {
 
     public List<Map<String, Object>> getTypeDistribution(@Param("orgId") Long orgId);
 
-    public List<ExaminationMonitorHourWarnCountBean> getWarnTrend(@Param("orgId") Long orgId,@Param("startTime") Long startTime);
+    public List<ExaminationMonitorHourWarnCountBean> getWarnTrend(@Param("orgId") Long orgId, @Param("startTime") Long startTime);
 
     public void updateHasAnswerFile(@Param("recordId") Long recordId, @Param("hasAnswerFile") Integer hasAnswerFile);
 
-    public List<OpenRecordNeedMarkBean> findExamRecordNeedMark(@Param("examId") Long examId,@Param("examStudentIds") List<Long> examStudentIds);
+    public List<OpenRecordNeedMarkBean> findExamRecordNeedMark(@Param("examId") Long examId, @Param("examStudentIds") List<Long> examStudentIds);
+
+    /**
+     * 寻找客观分最高
+     *
+     * @param examId
+     * @param examStudentId
+     * @return
+     */
+    public List<TOeExamRecord> findMaxObjectiveScore(@Param("examId") Long examId, @Param("examStudentId") Long examStudentId);
 }

+ 12 - 0
themis-business/src/main/java/com/qmth/themis/business/dto/MarkResultSimpleExportDto.java

@@ -87,6 +87,18 @@ public class MarkResultSimpleExportDto implements Serializable {
     @ExcelNotExport
     private Long examStudentId;
 
+    @ApiModelProperty(value = "批次id")
+    @ExcelNotExport
+    private Long examId;
+
+    public Long getExamId() {
+        return examId;
+    }
+
+    public void setExamId(Long examId) {
+        this.examId = examId;
+    }
+
     public Long getExamStudentId() {
         return examStudentId;
     }

+ 4 - 0
themis-business/src/main/java/com/qmth/themis/business/dto/MarkResultStandardExportDto.java

@@ -92,6 +92,10 @@ public class MarkResultStandardExportDto implements Serializable{
     @ExcelNotExport
     private Long examStudentId;
 
+    @ApiModelProperty(value = "批次id")
+    @ExcelNotExport
+    private Long examId;
+
     public Map<Long, List<ExcelDto>> getAnswerExcetDto() {
         return answerExcetDto;
     }

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

@@ -99,14 +99,14 @@ public class MarkResultDto implements Serializable {
     public void setExamStudentId(Long examStudentId) {
         this.examStudentId = examStudentId;
     }
-
-    public Long getPaperId() {
-        return paperId;
-    }
-
-    public void setPaperId(Long paperId) {
-        this.paperId = paperId;
-    }
+//
+//    public Long getPaperId() {
+//        return paperId;
+//    }
+//
+//    public void setPaperId(Long paperId) {
+//        this.paperId = paperId;
+//    }
 
     public Long getExamId() {
         return examId;

+ 20 - 5
themis-business/src/main/java/com/qmth/themis/business/service/TOeExamRecordService.java

@@ -3,11 +3,9 @@ package com.qmth.themis.business.service;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.qmth.themis.business.bean.backend.*;
+import com.qmth.themis.business.dto.response.MarkResultDto;
 import com.qmth.themis.business.entity.TOeExamRecord;
-import com.qmth.themis.business.enums.ExamRecordStatusEnum;
-import com.qmth.themis.business.enums.ExamTypeEnum;
-import com.qmth.themis.business.enums.LivenessTypeEnum;
-import com.qmth.themis.business.enums.VerifyExceptionEnum;
+import com.qmth.themis.business.enums.*;
 
 import java.util.List;
 import java.util.Map;
@@ -386,5 +384,22 @@ public interface TOeExamRecordService extends IService<TOeExamRecord> {
 
     TOeExamRecord findOneByExamId(Long examId, ExamRecordStatusEnum status);
 
-    public List<OpenRecordNeedMarkBean> findExamRecordNeedMark(Long examId,  List<Long> examStudentIds);
+    public List<OpenRecordNeedMarkBean> findExamRecordNeedMark(Long examId, List<Long> examStudentIds);
+
+    /**
+     * 寻找客观分最高
+     *
+     * @param examId
+     * @param examStudentId
+     * @return
+     */
+    List<TOeExamRecord> findMaxObjectiveScore(Long examId, Long examStudentId);
+
+    /**
+     * 查询成绩
+     * @param markResultDto
+     * @param recordSelectStrategyEnum
+     * @return
+     */
+    TOeExamRecord findMarkResult(MarkResultDto markResultDto, RecordSelectStrategyEnum recordSelectStrategyEnum);
 }

+ 133 - 58
themis-business/src/main/java/com/qmth/themis/business/service/impl/TOeExamRecordServiceImpl.java

@@ -1,71 +1,41 @@
 package com.qmth.themis.business.service.impl;
 
-import java.io.File;
-import java.math.BigDecimal;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-import java.util.UUID;
-
-import javax.annotation.Resource;
-
-import org.apache.commons.lang3.StringUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.BeanUtils;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-
 import com.alibaba.fastjson.JSONArray;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.qmth.themis.business.bean.backend.InvigilateListBean;
-import com.qmth.themis.business.bean.backend.InvigilateListHistoryBean;
-import com.qmth.themis.business.bean.backend.InvigilateListPatrolBean;
-import com.qmth.themis.business.bean.backend.InvigilateListProgressBean;
-import com.qmth.themis.business.bean.backend.InvigilateListProgressExcelBean;
-import com.qmth.themis.business.bean.backend.InvigilateListVideoBean;
-import com.qmth.themis.business.bean.backend.InvigilateListWarningBean;
-import com.qmth.themis.business.bean.backend.OpenRecordNeedMarkBean;
+import com.qmth.themis.business.bean.backend.*;
 import com.qmth.themis.business.cache.ExamRecordCacheUtil;
 import com.qmth.themis.business.cache.RedisKeyHelper;
-import com.qmth.themis.business.cache.bean.ExamActivityCacheBean;
-import com.qmth.themis.business.cache.bean.ExamCacheBean;
-import com.qmth.themis.business.cache.bean.ExamPaperCacheBean;
-import com.qmth.themis.business.cache.bean.ExamStudentAnswerCacheBean;
-import com.qmth.themis.business.cache.bean.ExamStudentPaperStructCacheBean;
-import com.qmth.themis.business.cache.bean.ObjectiveAnswerCacheBean;
+import com.qmth.themis.business.cache.bean.*;
 import com.qmth.themis.business.config.SystemConfig;
 import com.qmth.themis.business.constant.SpringContextHolder;
 import com.qmth.themis.business.constant.SystemConstant;
 import com.qmth.themis.business.dao.TOeExamRecordMapper;
 import com.qmth.themis.business.dto.MqDto;
+import com.qmth.themis.business.dto.response.MarkResultDto;
 import com.qmth.themis.business.dto.response.TEExamUnFinishDto;
 import com.qmth.themis.business.entity.TOeExamAnswer;
 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.LivenessTypeEnum;
-import com.qmth.themis.business.enums.MqTagEnum;
-import com.qmth.themis.business.enums.MqTopicEnum;
-import com.qmth.themis.business.enums.ObjectiveScorePolicyEnum;
-import com.qmth.themis.business.enums.VerifyExceptionEnum;
-import com.qmth.themis.business.service.MqDtoService;
-import com.qmth.themis.business.service.TEExamActivityService;
-import com.qmth.themis.business.service.TEExamPaperService;
-import com.qmth.themis.business.service.TEExamService;
-import com.qmth.themis.business.service.TOeExamAnswerService;
-import com.qmth.themis.business.service.TOeExamRecordService;
+import com.qmth.themis.business.enums.*;
+import com.qmth.themis.business.service.*;
 import com.qmth.themis.business.util.OssUtil;
 import com.qmth.themis.business.util.RedisUtil;
 import com.qmth.themis.common.contanst.Constants;
 import com.qmth.themis.common.util.FileUtil;
 import com.qmth.themis.common.util.SimpleBeanUtil;
+import org.apache.commons.lang3.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.BeanUtils;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.annotation.Resource;
+import java.io.File;
+import java.math.BigDecimal;
+import java.text.SimpleDateFormat;
+import java.util.*;
 
 /**
  * @Description: 考试记录 服务实现类
@@ -264,16 +234,16 @@ public class TOeExamRecordServiceImpl extends ServiceImpl<TOeExamRecordMapper, T
             }
         }
         if (cb.getStructType().intValue() == 3) {
-        	if(StringUtils.isNotBlank(answer.getAnswer())) {
-        		String answerStr=answer.getAnswer().replaceAll("\n", "");
-        		if(StringUtils.isNotBlank(answerStr)) {
-		            if (Boolean.parseBoolean(answerStr) == cb.getBoolAnswer().booleanValue()) {
-		                answer.setScore(cb.getScore());
-		            } else {
-		                answer.setScore(0.0);
-		            }
-        		}
-        	}
+            if (StringUtils.isNotBlank(answer.getAnswer())) {
+                String answerStr = answer.getAnswer().replaceAll("\n", "");
+                if (StringUtils.isNotBlank(answerStr)) {
+                    if (Boolean.parseBoolean(answerStr) == cb.getBoolAnswer().booleanValue()) {
+                        answer.setScore(cb.getScore());
+                    } else {
+                        answer.setScore(0.0);
+                    }
+                }
+            }
         }
 
         if (answer.getScore() == null) {
@@ -859,6 +829,111 @@ public class TOeExamRecordServiceImpl extends ServiceImpl<TOeExamRecordMapper, T
 
     @Override
     public List<OpenRecordNeedMarkBean> findExamRecordNeedMark(Long examId, List<Long> examStudentIds) {
-        return tOeExamRecordMapper.findExamRecordNeedMark(examId,examStudentIds);
+        return tOeExamRecordMapper.findExamRecordNeedMark(examId, examStudentIds);
+    }
+
+    /**
+     * 寻找客观分最高
+     *
+     * @param examId
+     * @param examStudentId
+     * @return
+     */
+    @Override
+    public List<TOeExamRecord> findMaxObjectiveScore(Long examId, Long examStudentId) {
+        return tOeExamRecordMapper.findMaxObjectiveScore(examId, examStudentId);
+    }
+
+    /**
+     * 查询成绩
+     *
+     * @param markResultDto
+     * @param recordSelectStrategyEnum
+     * @return
+     */
+    @Override
+    public TOeExamRecord findMarkResult(MarkResultDto markResultDto, RecordSelectStrategyEnum recordSelectStrategyEnum) {
+        TOeExamRecord tOeExamRecord = null;
+        Double sumScore = null;
+        //客观分最高
+        if (Objects.nonNull(recordSelectStrategyEnum) && Objects.equals(recordSelectStrategyEnum, RecordSelectStrategyEnum.HIGHEST_OBJECTIVE_SCORE)) {
+            List<TOeExamRecord> tOeExamRecordList = this.findMaxObjectiveScore(markResultDto.getExamId(), markResultDto.getExamStudentId());
+            if (Objects.nonNull(tOeExamRecordList) && tOeExamRecordList.size() > 0) {
+                Long paperId = tOeExamRecordList.get(0).getPaperId();
+                ExamPaperCacheBean paperCacheBean = examPaperService.getExamPaperCacheBean(paperId);
+                boolean isHasSubjective = true;
+                if (paperCacheBean.getTotalSubjectiveScore().intValue() == 0) {
+                    isHasSubjective = false;
+                }
+                //是否有主观题
+                if (!isHasSubjective) {
+                    for (TOeExamRecord t : tOeExamRecordList) {
+                        if (Objects.isNull(tOeExamRecord)) {
+                            tOeExamRecord = t;
+                        } else {
+                            if (Objects.nonNull(t.getObjectiveScore()) && Objects.nonNull(tOeExamRecord.getObjectiveScore())
+                                    && t.getObjectiveScore().doubleValue() >= tOeExamRecord.getObjectiveScore().doubleValue()
+                                    && Objects.nonNull(t.getFinishTime()) && Objects.nonNull(tOeExamRecord.getFinishTime())
+                                    && t.getFinishTime().longValue() > tOeExamRecord.getFinishTime().longValue()) {
+                                tOeExamRecord = t;
+                            }
+                        }
+                    }
+                } else {
+                    //总分最高选取
+                    tOeExamRecord = getMaxSumScore(tOeExamRecord, sumScore, markResultDto);
+                }
+            }
+        }
+        //最后一次提交
+        else if (Objects.nonNull(recordSelectStrategyEnum) && Objects.equals(recordSelectStrategyEnum, RecordSelectStrategyEnum.LATEST)) {
+            List<TOeExamRecord> tOeExamRecordList = this.findMaxObjectiveScore(markResultDto.getExamId(), markResultDto.getExamStudentId());
+            for (TOeExamRecord t : tOeExamRecordList) {
+                if (Objects.isNull(tOeExamRecord)) {
+                    tOeExamRecord = t;
+                } else {
+                    if (Objects.nonNull(t.getFinishTime()) && Objects.nonNull(tOeExamRecord.getFinishTime())
+                            && t.getFinishTime().longValue() > tOeExamRecord.getFinishTime().longValue()) {
+                        tOeExamRecord = t;
+                    }
+                }
+            }
+        }
+        //全部阅卷后取最高分
+        else if (Objects.nonNull(recordSelectStrategyEnum) && Objects.equals(recordSelectStrategyEnum, RecordSelectStrategyEnum.HIGHEST_TOTAL_SCORE)) {
+            tOeExamRecord = getMaxSumScore(tOeExamRecord, sumScore, markResultDto);
+        }
+        return tOeExamRecord;
+    }
+
+    /**
+     * 取最高分
+     *
+     * @param tOeExamRecord
+     * @param sumScore
+     * @param markResultDto
+     * @return
+     */
+    private TOeExamRecord getMaxSumScore(TOeExamRecord tOeExamRecord, Double sumScore, MarkResultDto markResultDto) {
+        Long examId = null, examStudentId = null;
+        if (Objects.isNull(sumScore)) {
+            sumScore = markResultDto.getSumScore();
+            examId = markResultDto.getExamId();
+            examStudentId = markResultDto.getExamStudentId();
+        } else {
+            if (Objects.nonNull(markResultDto.getSumScore())
+                    && markResultDto.getSumScore().doubleValue() >= sumScore.doubleValue()) {
+                sumScore = markResultDto.getSumScore();
+                examId = markResultDto.getExamId();
+                examStudentId = markResultDto.getExamStudentId();
+            }
+        }
+        if (Objects.nonNull(sumScore)) {
+            List<TOeExamRecord> tOeExamRecordList = this.findMaxObjectiveScore(examId, examStudentId);
+            if (Objects.nonNull(tOeExamRecordList) && tOeExamRecordList.size() > 0) {
+                tOeExamRecord = tOeExamRecordList.get(0);
+            }
+        }
+        return tOeExamRecord;
     }
 }

+ 32 - 10
themis-business/src/main/java/com/qmth/themis/business/templete/impl/TaskMarkResultStandardExportTemplete.java

@@ -7,17 +7,17 @@ import com.google.gson.Gson;
 import com.qmth.themis.business.annotation.ExcelDynamicExport;
 import com.qmth.themis.business.annotation.ExcelNotExport;
 import com.qmth.themis.business.annotation.ExcelNote;
-import com.qmth.themis.business.cache.bean.ObjectiveAnswerCacheBean;
+import com.qmth.themis.business.cache.bean.ExamCacheBean;
 import com.qmth.themis.business.constant.SystemConstant;
 import com.qmth.themis.business.dto.ExcelDto;
 import com.qmth.themis.business.dto.MarkResultSimpleExportDto;
 import com.qmth.themis.business.dto.MarkResultStandardExportDto;
+import com.qmth.themis.business.dto.response.MarkResultDto;
 import com.qmth.themis.business.entity.TOeExamAnswer;
+import com.qmth.themis.business.entity.TOeExamRecord;
 import com.qmth.themis.business.enums.AnswerTypeEnum;
 import com.qmth.themis.business.enums.QuestionTypeEnum;
-import com.qmth.themis.business.service.TEExamPaperService;
-import com.qmth.themis.business.service.TEExamStudentService;
-import com.qmth.themis.business.service.TOeExamAnswerService;
+import com.qmth.themis.business.service.*;
 import com.qmth.themis.business.templete.TaskExportCommon;
 import com.qmth.themis.business.templete.TaskExportTemplete;
 import com.qmth.themis.business.templete.service.TempleteLogicService;
@@ -62,6 +62,12 @@ public class TaskMarkResultStandardExportTemplete implements TaskExportTemplete
     @Resource
     TEExamPaperService teExamPaperService;
 
+    @Resource
+    TEExamService teExamService;
+
+    @Resource
+    TOeExamRecordService tOeExamRecordService;
+
     /**
      * 考场导出模版
      *
@@ -87,8 +93,22 @@ public class TaskMarkResultStandardExportTemplete implements TaskExportTemplete
             String identity = (String) map.get("identity");
             String name = (String) map.get("name");
             String courseCode = (String) map.get("courseCode");
-            List<MarkResultSimpleExportDto> markResultSimpleExportDtoList = teExamStudentService.markResultQueryExport(examId, activityId, identity, name, courseCode);
             Gson gson = new Gson();
+            List<MarkResultSimpleExportDto> markResultSimpleExportDtoList = teExamStudentService.markResultQueryExport(examId, activityId, identity, name, courseCode);
+            if (Objects.nonNull(markResultSimpleExportDtoList) && markResultSimpleExportDtoList.size() > 0) {
+                for (MarkResultSimpleExportDto markResultSimpleExportDto : markResultSimpleExportDtoList) {
+                    MarkResultDto markResultDto = gson.fromJson(gson.toJson(markResultSimpleExportDto), MarkResultDto.class);
+                    if (Objects.nonNull(markResultDto.getExamId())) {
+                        ExamCacheBean examCacheBean = teExamService.getExamCacheBean(markResultDto.getExamId());
+                        TOeExamRecord tOeExamRecord = tOeExamRecordService.findMarkResult(markResultDto, examCacheBean.getRecordSelectStrategy());
+                        if (Objects.nonNull(tOeExamRecord)) {
+                            markResultSimpleExportDto.setObjectiveScore(Objects.isNull(tOeExamRecord.getObjectiveScore()) ? "0" : String.valueOf(tOeExamRecord.getObjectiveScore()));
+                            markResultSimpleExportDto.setRecordId(tOeExamRecord.getId());
+                            markResultSimpleExportDto.setPaperId(tOeExamRecord.getPaperId());
+                        }
+                    }
+                }
+            }
             List<MarkResultStandardExportDto> markResultStandardExportDtoList = gson.fromJson(gson.toJson(markResultSimpleExportDtoList), new TypeToken<List<MarkResultStandardExportDto>>() {
             }.getType());
             Map<Long, List<ExcelDto>> excelDtoMap = null;
@@ -107,11 +127,13 @@ public class TaskMarkResultStandardExportTemplete implements TaskExportTemplete
                         }
                         if (dynamicExcelHead.size() == 0) {
                             objectiveAnswerCacheBeanMap.forEach((k, v) -> {
-                                String title = QuestionTypeEnum.convertToTitle(v) + k;
-                                ExcelDto excelAnswerDto = new ExcelDto(title + "作答");
-                                ExcelDto excelScoreDto = new ExcelDto(title + "得分");
-                                dynamicExcelHead.add(excelAnswerDto);
-                                dynamicExcelHead.add(excelScoreDto);
+                                if (v != 6) {//套题暂不展现
+                                    String title = QuestionTypeEnum.convertToTitle(v) + k;
+                                    ExcelDto excelAnswerDto = new ExcelDto(title + "作答");
+                                    ExcelDto excelScoreDto = new ExcelDto(title + "得分");
+                                    dynamicExcelHead.add(excelAnswerDto);
+                                    dynamicExcelHead.add(excelScoreDto);
+                                }
                             });
                         }
                     } else {

+ 5 - 15
themis-business/src/main/resources/mapper/TEExamStudentMapper.xml

@@ -309,9 +309,9 @@
 		ifnull(t.objectiveScore,0) as sumScore,
 		t.examId,
 		t.examActivityId,
-		t.recordId,
-		t.paperId,
-		0 as subjectiveScore,
+		t.objectiveScore,
+		t.subjectiveScore,
+		(t.objectiveScore + t.subjectiveScore) as sumScore,
 		t.examStudentId
 		from
 		(
@@ -324,22 +324,12 @@
 		toer.exam_student_id = tees.id) 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,
-		temp.objective_score as objectiveScore,
-		temp.id as recordId,
-		temp.paper_id as paperId
+		0 as objectiveScore,
+		0 as subjectiveScore
 		from
 		t_e_student tes
 		left join t_e_exam_student tees on
 		tees.student_id = tes.id
-		left join (select
-			max(toer.objective_score) as objective_score,max(toer.id) as id,toer.exam_student_id,toer.paper_id
-			from
-			t_oe_exam_record toer
-			where
-			(toer.breach_status = 1
-			or breach_status is null)
-			and (toer.status = 'FINISHED'
-			or toer.status = 'PERSISTED') group by toer.paper_id,toer.exam_student_id) temp on temp.exam_student_id = tees.id
 		left join t_e_exam tee on
 		tee.id = tees.exam_id
 		left join t_e_exam_activity teea on

+ 22 - 0
themis-business/src/main/resources/mapper/TOeExamRecordMapper.xml

@@ -940,4 +940,26 @@
 			#{examStudentId}
 		</foreach>
 	</select>
+
+	<select id="findMaxObjectiveScore" resultType="com.qmth.themis.business.entity.TOeExamRecord">
+		select
+			max(toer.objective_score) as objectiveScore,
+			toer.id,toer.paper_id as paperId,toer.finish_time as finishTime
+		from
+			t_oe_exam_record toer
+		<where>
+			(toer.breach_status = 1
+			or breach_status is null)
+			and (toer.status = 'FINISHED'
+			or toer.status = 'PERSISTED')
+			<if test="examId != null and examId != ''">
+				and toer.exam_id = #{examId}
+			</if>
+			<if test="examStudentId != null and examStudentId != ''">
+				and toer.exam_student_id = #{examStudentId}
+			</if>
+		</where>
+		group by
+			toer.id,toer.paper_id,toer.finish_time order by toer.objective_score desc,toer.finish_time desc
+	</select>
 </mapper>