浏览代码

3.4.4 update-20250305,联调bug修复2

xiaofei 3 月之前
父节点
当前提交
1838bf7e9d

+ 4 - 0
teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/dto/mark/manage/MarkGroupClassProgressDto.java

@@ -1,5 +1,8 @@
 package com.qmth.teachcloud.mark.dto.mark.manage;
 
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
+
 public class MarkGroupClassProgressDto {
 
     private String className;
@@ -10,6 +13,7 @@ public class MarkGroupClassProgressDto {
     private Integer currentCount;
     private String percent;
     private Integer arbitrateCount;
+    @JsonSerialize(using = ToStringSerializer.class)
     private Long questionId;
     private String questionNumber;
 

+ 4 - 0
teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/dto/mark/manage/MarkGroupProgressDto.java

@@ -1,7 +1,11 @@
 package com.qmth.teachcloud.mark.dto.mark.manage;
 
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
+
 public class MarkGroupProgressDto {
 
+    @JsonSerialize(using = ToStringSerializer.class)
     private Long questionId;
     private Double totalScore;
     private Integer markerCount;

+ 2 - 0
teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/mapper/MarkQuestionMapper.java

@@ -20,4 +20,6 @@ public interface MarkQuestionMapper extends BaseMapper<MarkQuestion> {
     String assembleQuestionsByExamIdAndPaperNumberAndNumber(@Param("examId") Long examId, @Param("paperNumber") String paperNumber, @Param("groupNumber") Integer groupNumber);
 
     List<MarkQuestionAnswerVo> listQuestionAnswerByExamIdAndPaperNumberAndPaperType(@Param("examId") Long examId, @Param("paperNumber") String paperNumber, @Param("paperType") String paperType, @Param("objective") Boolean objective);
+
+    long countByExamIdAndPaperNumberAndObjective(@Param("examId") Long examId, @Param("paperNumber") String paperNumber, @Param("objective") boolean objective);
 }

+ 0 - 1
teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/params/MarkHeaderResult.java

@@ -7,7 +7,6 @@ import java.util.List;
  */
 public class MarkHeaderResult {
 
-    public static final String SPLIT = ",";
 
     private Long studentId;
 

+ 2 - 0
teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/service/MarkQuestionService.java

@@ -123,4 +123,6 @@ public interface MarkQuestionService extends IService<MarkQuestion> {
     MarkQuestionSubjectiveStepStatusDto stepStatus(Long examId, String paperNumber);
 
     void updatePic(String content, List<MarkQuestion> markQuestions);
+
+    long countByExamIdAndPaperNumberAndObjective(Long examId, String paperNumber, boolean objective);
 }

+ 1 - 1
teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/service/MarkService.java

@@ -48,7 +48,7 @@ public interface MarkService {
 
     void processArbitrate(MarkHeaderGroupResult markResult, Long userId);
 
-    void checkStudentSubjective(Long studentId, long unGroupQuestionCount);
+    void checkStudentSubjective(Long studentId, Long unGroupQuestionCount, String paperNumber);
 
     void buildMarkTask(MarkPaper markPaper);
 

+ 2 - 1
teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/service/MarkSubjectiveScoreService.java

@@ -17,7 +17,6 @@ import com.qmth.teachcloud.mark.entity.MarkSubjectiveScore;
  */
 public interface MarkSubjectiveScoreService extends IMppService<MarkSubjectiveScore> {
 
-    List<MarkSubjectiveScore> listByStudentIdAndQuestionId(Long studentId, Long questionId);
     MarkSubjectiveScore getByStudentIdAndQuestionId(Long studentId, Long questionId);
 
     Set<Integer> listMainNumberByStudentIdAndUncalculate(Long studentId, boolean uncalculate);
@@ -31,4 +30,6 @@ public interface MarkSubjectiveScoreService extends IMppService<MarkSubjectiveSc
 	  List<MarkSubjectiveScore> listByStudentId(Long studentId);
 
     void updateRejected(Long studentId, Long questionId, boolean rejectd);
+
+    long countByStudentId(Long studentId);
 }

+ 8 - 3
teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/service/impl/MarkQuestionServiceImpl.java

@@ -245,9 +245,9 @@ public class MarkQuestionServiceImpl extends ServiceImpl<MarkQuestionMapper, Mar
         List<MarkQuestion> subjectiveMarkQuestionList = markQuestionList.stream().filter(m -> m.getObjective()).collect(Collectors.toList());
         if (!CollectionUtils.isEqualCollection(subjectiveQuestions, subjectiveMarkQuestionList)) {
             // 未分组的题目
-            long unGroupQuestionCount = this.countByExamIdAndPaperNumberAndObjectiveAndGroupNumberIsNull(examId, paperNumber, false);
-            // 考生主观题重新统分
-            markService.checkStudentSubjectiveScore(examId, markPaper.getCoursePaperId(), unGroupQuestionCount);
+//            long unGroupQuestionCount = this.countByExamIdAndPaperNumberAndObjectiveAndGroupNumberIsNull(examId, paperNumber, false);
+//            // 考生主观题重新统分
+//            markService.checkStudentSubjectiveScore(examId, markPaper.getCoursePaperId(), unGroupQuestionCount);
         }
 
         // 更新分组状态
@@ -818,4 +818,9 @@ public class MarkQuestionServiceImpl extends ServiceImpl<MarkQuestionMapper, Mar
         }
         this.updateBatchById(markQuestions);
     }
+
+    @Override
+    public long countByExamIdAndPaperNumberAndObjective(Long examId, String paperNumber, boolean objective) {
+        return this.baseMapper.countByExamIdAndPaperNumberAndObjective(examId, paperNumber, objective);
+    }
 }

+ 43 - 38
teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/service/impl/MarkServiceImpl.java

@@ -1,23 +1,20 @@
 package com.qmth.teachcloud.mark.service.impl;
 
+import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.metadata.OrderItem;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.qmth.boot.api.exception.ApiException;
 import com.qmth.teachcloud.common.contant.SystemConstant;
 import com.qmth.teachcloud.common.entity.BasicCourse;
-import com.qmth.teachcloud.common.entity.BasicOperationLog;
 import com.qmth.teachcloud.common.entity.MarkQuestion;
 import com.qmth.teachcloud.common.entity.SysUser;
 import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
-import com.qmth.teachcloud.common.enums.log.OperationTypeEnum;
 import com.qmth.teachcloud.common.enums.mark.*;
 import com.qmth.teachcloud.common.service.BasicCourseService;
 import com.qmth.teachcloud.common.service.BasicOperationLogService;
 import com.qmth.teachcloud.common.service.SysUserService;
-import com.qmth.teachcloud.common.service.TeachcloudCommonService;
 import com.qmth.teachcloud.common.util.ServletUtil;
-import com.qmth.teachcloud.mark.dto.mark.MarkStudentVo;
 import com.qmth.teachcloud.mark.dto.mark.ScoreItem;
 import com.qmth.teachcloud.mark.dto.mark.manage.Task;
 import com.qmth.teachcloud.mark.dto.mark.mark.MarkSettingDto;
@@ -93,7 +90,7 @@ public class MarkServiceImpl implements MarkService {
     TaskService taskService;
 
     @Resource
-    TeachcloudCommonService teachcloudCommonService;
+    private MarkHeaderHistoryService markHeaderHistoryService;
     @Resource
     private SysUserService sysUserService;
     @Resource
@@ -149,7 +146,7 @@ public class MarkServiceImpl implements MarkService {
     @Override
     public void releaseByMarkUserGroup(MarkUserQuestion markUserGroup) {
         TaskLock taskLock = TaskLockUtil.getFormalTask(getGroupKey(markUserGroup));
-        taskLock.clear(markUserGroup.getId());
+        taskLock.clear(markUserGroup.getUserId());
     }
 
     @Override
@@ -340,15 +337,14 @@ public class MarkServiceImpl implements MarkService {
                 markArbitrateHistory.getUpdateUserId(), markResult.getScore(), markResult.getTrackList(), markResult.getSpecialTagList(), markArbitrateHistory.getUpdateTime(), MarkTaskStatus.ARBITRATED);
         updateMarkedCount(markArbitrateHistory.getExamId(), markArbitrateHistory.getPaperNumber(),
                 markArbitrateHistory.getQuestionId());
-        checkStudentGroup(markArbitrateHistory.getStudentId(), markQuestionService.getById(markArbitrateHistory.getQuestionId()), null);
+        checkStudentQuestion(markArbitrateHistory.getStudentId(), markQuestionService.getById(markArbitrateHistory.getQuestionId()), null);
         // 评卷质量重新统计
         List<MarkUserQuestion> markUserGroups = markUserQuestionService.listByExamIdAndPaperNumberAndQuestionId(markArbitrateHistory.getExamId(), markArbitrateHistory.getPaperNumber(), markArbitrateHistory.getQuestionId());
         markUserGroups.forEach(m -> this.updateQuality(m));
     }
 
     private String getGroupKey(MarkUserQuestion markUserGroup) {
-//        return markUserGroup.getExamId() + "_" + markUserGroup.getPaperNumber() + "_" + markUserGroup.getId();
-        return String.valueOf(markUserGroup.getId());
+        return markUserGroup.getExamId() + "_" + markUserGroup.getPaperNumber();
     }
 
     /**
@@ -358,23 +354,23 @@ public class MarkServiceImpl implements MarkService {
      * @param markQuestion
      * @param result
      */
-    private void checkStudentGroup(Long studentId, MarkQuestion markQuestion, MarkResultQuestion result) {
+    private void checkStudentQuestion(Long studentId, MarkQuestion markQuestion, MarkResultQuestion result) {
         if (calculateQuestionId(markQuestion, studentId)) {
             //更新考生分组分数
             updateStudentQuestionScore(studentId, markQuestion, result);
-            //未分组的题目
-            long unGroupQuestionCount = markQuestionService.countByExamIdAndPaperNumberAndObjectiveAndGroupNumberIsNull(
-                    markQuestion.getExamId(), markQuestion.getPaperNumber(), false);
-            checkStudentSubjective(studentId, unGroupQuestionCount);
+            checkStudentSubjective(studentId, markQuestion.getExamId(), markQuestion.getPaperNumber());
         } else {
             markStudentService.updateSubjectiveStatusAndScore(studentId, SubjectiveStatus.UNMARK, null, null);
         }
     }
 
     @Override
-    public void checkStudentSubjective(Long studentId, long unGroupQuestionCount) {
-        // todo 所有任务是否已完成
-        if (unGroupQuestionCount == 0) {
+    public void checkStudentSubjective(Long studentId, Long examId, String paperNumber) {
+        long unBindMarkerQuestionCount = markQuestionService.countByExamIdAndPaperNumberAndObjective(examId, paperNumber, false);
+        long questionCount = markQuestionService.countByExamIdAndPaperNumberAndObjective(examId, paperNumber, false);
+        long subjectiveScoreCount = markSubjectiveScoreService.countByStudentId(studentId);
+        // 主观题数大于0,主观题全部绑定了评卷员,考生小题分数数量等于主观题数量
+        if (questionCount > 0 && unBindMarkerQuestionCount == 0 && questionCount == subjectiveScoreCount) {
             scoreCalculate(studentId);
         } else {//否则更新该学生主观题状态为未阅卷
             markStudentService.updateSubjectiveStatusAndScore(studentId, SubjectiveStatus.UNMARK, null, null);
@@ -547,7 +543,6 @@ public class MarkServiceImpl implements MarkService {
     }
 
     private boolean calculateQuestionId(MarkQuestion markQuestion, Long studentId) {
-        // 未设置算分策略的情况下,默认取平均分
         List<MarkTask> list = markTaskService.listByExamIdAndPaperNumberAndQuestionIdAndStudentId(markQuestion.getExamId(),
                 markQuestion.getPaperNumber(), markQuestion.getId(), studentId);
         if (list.isEmpty()) {
@@ -584,7 +579,7 @@ public class MarkServiceImpl implements MarkService {
         Map<Integer, Double> scoreMap = new HashMap<>();
 
         // 循环所有主观得分明细
-        List<MarkSubjectiveScore> list = markSubjectiveScoreService.listByStudentIdAndQuestionId(studentId, null);
+        List<MarkSubjectiveScore> list = markSubjectiveScoreService.listByStudentId(studentId);
         // list.sort(null);
         for (MarkSubjectiveScore ss : list) {
             List<MarkSubjectiveScore> mainScoreList = mainScoreMap.get(ss.getMainNumber());
@@ -730,12 +725,12 @@ public class MarkServiceImpl implements MarkService {
             try {
                 lockService.watch(LockType.QUESTION, groupResult.getQuestionId());
                 Long currentTime = System.currentTimeMillis();
-                updateMarkSubjectScore(markStudent, groupResult);
+                updateMarkSubjectScore(markStudent, groupResult, userId);
                 markTaskService.updateHeaderResult(markStudent.getExamId(), markStudent.getPaperNumber(),
                         groupResult.getQuestionId(), groupResult.getStudentId(), userId, groupResult.getScore(), groupResult.getTrackList(), groupResult.getSpecialTagList(), currentTime, MarkTaskStatus.MARKED);
                 updateMarkedCount(markStudent.getExamId(), markStudent.getPaperNumber(), groupResult.getQuestionId());
                 markStudentService.updateCheckInfo(markStudent.getId(), userId);
-                checkStudentGroup(groupResult.getStudentId(), markQuestionService.getById(groupResult.getQuestionId()), null);
+                checkStudentQuestion(groupResult.getStudentId(), markQuestionService.getById(groupResult.getQuestionId()), null);
             } catch (ApiException e) {
                 throw ExceptionResultEnum.ERROR.exception(e.getMessage());
             } finally {
@@ -744,32 +739,42 @@ public class MarkServiceImpl implements MarkService {
         }
 
         // 未分组的题目
-        long unGroupQuestionCount = markQuestionService.countByExamIdAndPaperNumberAndObjectiveAndGroupNumberIsNull(
-                markStudent.getExamId(), markStudent.getPaperNumber(), false);
-        checkStudentSubjective(markStudent.getId(), unGroupQuestionCount);
+//        checkStudentSubjective(markStudent.getId(), markStudent.getExamId(), markStudent.getPaperNumber());
     }
 
-    private void updateMarkSubjectScore(MarkStudent markStudent, MarkHeaderGroupResult groupResult) {
-        List<MarkSubjectiveScore> markSubjectiveScoreList = markSubjectiveScoreService.listByStudentIdAndQuestionId(markStudent.getId(), groupResult.getQuestionId());
-        markSubjectiveScoreList.sort(Comparator.comparing(MarkSubjectiveScore::getMainNumber)
-                .thenComparingInt(MarkSubjectiveScore::getSubNumber));
+    private void updateMarkSubjectScore(MarkStudent markStudent, MarkHeaderGroupResult groupResult, Long userId) {
         // 记录修改日志(按小题)
-        List<BasicOperationLog> basicOperationLogs = new ArrayList<>();
-        MarkSubjectiveScore markSubjectiveScore = markSubjectiveScoreList.get(0);
+//        List<BasicOperationLog> basicOperationLogs = new ArrayList<>();
+        MarkSubjectiveScore markSubjectiveScore = markSubjectiveScoreService.getByStudentIdAndQuestionId(markStudent.getId(), groupResult.getQuestionId());
         double score = markSubjectiveScore.getScore();
         // 分数有变动,记录日志
         if (groupResult.getScore() != score) {
-            MarkStudentVo markStudentVo = markStudentService.getDetailById(markStudent.getId());
-            String detail = String.format("%s(%s)课程%s试卷编号下,将%s(%s)的%s题从%s分修改为%s分", markStudentVo.getCourseName(), markStudentVo.getCourseCode(), markStudentVo.getPaperNumber(), markStudentVo.getStudentName(), markStudentVo.getStudentCode(), markSubjectiveScore.getMainNumber() + "-" + markSubjectiveScore.getSubNumber(), markSubjectiveScore.getScore(), score);
-            basicOperationLogs.add(new BasicOperationLog(Long.valueOf(ServletUtil.getRequestHeaderSchoolId().toString()), ServletUtil.getCurrentPrivilegeId(), OperationTypeEnum.SUBJECTIVE, OperationTypeEnum.SUBJECTIVE.getName(), ServletUtil.getRequest().getServletPath(), detail, String.valueOf(groupResult.getScore()), "成功", ServletUtil.getRequestUserId()));
+//            MarkStudentVo markStudentVo = markStudentService.getDetailById(markStudent.getId());
+//            String detail = String.format("%s(%s)课程%s试卷编号下,将%s(%s)的%s题从%s分修改为%s分", markStudentVo.getCourseName(), markStudentVo.getCourseCode(), markStudentVo.getPaperNumber(), markStudentVo.getStudentName(), markStudentVo.getStudentCode(), markSubjectiveScore.getMainNumber() + "-" + markSubjectiveScore.getSubNumber(), markSubjectiveScore.getScore(), score);
+//            basicOperationLogs.add(new BasicOperationLog(Long.valueOf(ServletUtil.getRequestHeaderSchoolId().toString()), ServletUtil.getCurrentPrivilegeId(), OperationTypeEnum.SUBJECTIVE, OperationTypeEnum.SUBJECTIVE.getName(), ServletUtil.getRequest().getServletPath(), detail, String.valueOf(groupResult.getScore()), "成功", ServletUtil.getRequestUserId()));
+            MarkHeaderHistory headerHistory = new MarkHeaderHistory();
+            headerHistory.setId(SystemConstant.getDbUuid());
+            headerHistory.setExamId(markStudent.getExamId());
+            headerHistory.setPaperNumber(markStudent.getPaperNumber());
+            headerHistory.setStudentId(markStudent.getId());
+            headerHistory.setQuestionId(markSubjectiveScore.getQuestionId());
+            headerHistory.setMainNumber(markSubjectiveScore.getMainNumber());
+            headerHistory.setSubNumber(markSubjectiveScore.getSubNumber());
+            headerHistory.setUserId(userId);
+            headerHistory.setScore(score);
+            headerHistory.setTrackList(JSON.toJSONString(groupResult.getTrackList()));
+            headerHistory.setOriginalScore(markSubjectiveScore.getScore());
+//            headerHistory.setOriginalTrackList();
+            headerHistory.setCreateTime(System.currentTimeMillis());
+            markHeaderHistoryService.save(headerHistory);
         }
         markSubjectiveScore.setScore(score);
         markSubjectiveScoreService.saveOrUpdateByMultiId(markSubjectiveScore);
 
         // 记录日志
-        if (CollectionUtils.isNotEmpty(basicOperationLogs)) {
-            basicOperationLogService.saveBatch(basicOperationLogs);
-        }
+//        if (CollectionUtils.isNotEmpty(basicOperationLogs)) {
+//            basicOperationLogService.saveBatch(basicOperationLogs);
+//        }
     }
 
     private String getKey(MarkStudent student) {
@@ -1079,7 +1084,7 @@ public class MarkServiceImpl implements MarkService {
             resetStudentGroup(task.getStudentId());
         } else {
             // 判断当前分组是否已完成评卷
-            checkStudentGroup(task.getStudentId(), markQuestion, result);
+            checkStudentQuestion(task.getStudentId(), markQuestion, result);
         }
         return true;
     }
@@ -1110,7 +1115,7 @@ public class MarkServiceImpl implements MarkService {
     public void checkStudentSubjectiveScore(Long examId, String coursePaperId, long unGroupQuestionCount) {
         List<MarkStudent> markStudentList = markStudentService.listByExamIdAndCoursePaperId(examId, coursePaperId);
         for (MarkStudent markStudent : markStudentList) {
-            checkStudentSubjective(markStudent.getId(), unGroupQuestionCount);
+//            checkStudentSubjective(markStudent.getId(), unGroupQuestionCount, markQuestion.getPaperNumber());
         }
     }
 

+ 10 - 41
teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/service/impl/MarkSubjectiveScoreServiceImpl.java

@@ -24,22 +24,6 @@ import java.util.Set;
  */
 @Service
 public class MarkSubjectiveScoreServiceImpl extends MppServiceImpl<MarkSubjectiveScoreMapper, MarkSubjectiveScore> implements MarkSubjectiveScoreService {
-
-    @Override
-    public List<MarkSubjectiveScore> listByStudentIdAndQuestionId(Long studentId, Long questionId) {
-        QueryWrapper<MarkSubjectiveScore> queryWrapper = new QueryWrapper<>();
-        queryWrapper.lambda().eq(MarkSubjectiveScore::getStudentId, studentId)
-                .orderByAsc(MarkSubjectiveScore::getMainNumber)
-                .orderByAsc(MarkSubjectiveScore::getSubNumber);
-        if (questionId != null) {
-            queryWrapper.lambda().eq(MarkSubjectiveScore::getQuestionId, questionId);
-        }
-
-        List<MarkSubjectiveScore> list = this.list(queryWrapper);
-//        sort(list);
-        return list;
-    }
-
     @Override
     public MarkSubjectiveScore getByStudentIdAndQuestionId(Long studentId, Long questionId) {
         QueryWrapper<MarkSubjectiveScore> queryWrapper = new QueryWrapper<>();
@@ -74,27 +58,6 @@ public class MarkSubjectiveScoreServiceImpl extends MppServiceImpl<MarkSubjectiv
         this.remove(updateWrapper);
     }
 
-//    private void sort(List<MarkSubjectiveScore> list) {
-//        list.sort((o1, o2) -> {
-//            int i = o1.getMainNumber() - o2.getMainNumber();
-//            if (i == 0) {
-//                if (o1.getSubNumber().contains("-")) {
-//                    String[] o1s = o1.getSubNumber().split("-");
-//                    String[] o2s = o2.getSubNumber().split("-");
-//                    int j = Integer.parseUnsignedInt(o1s[0]) - Integer.parseUnsignedInt(o2s[0]);
-//                    if (j == 0) {
-//                        return Integer.parseUnsignedInt(o1s[1]) - Integer.parseUnsignedInt(o2s[1]);
-//                    } else {
-//                        return j;
-//                    }
-//                } else {
-//                    return Integer.parseUnsignedInt(o1.getSubNumber()) - Integer.parseUnsignedInt(o2.getSubNumber());
-//                }
-//            }
-//            return i;
-//        });
-//    }
-
     @Override
     public List<QuestionVo> getSubjectiveVo(List<Long> studentIds) {
         if (CollectionUtils.isEmpty(studentIds)) {
@@ -106,11 +69,10 @@ public class MarkSubjectiveScoreServiceImpl extends MppServiceImpl<MarkSubjectiv
     @Override
     public List<MarkSubjectiveScore> listByStudentId(Long studentId) {
         QueryWrapper<MarkSubjectiveScore> queryWrapper = new QueryWrapper<>();
-        queryWrapper.lambda().eq(MarkSubjectiveScore::getStudentId, studentId).orderByAsc(MarkSubjectiveScore::getMainNumber)
+        queryWrapper.lambda().eq(MarkSubjectiveScore::getStudentId, studentId)
+                .orderByAsc(MarkSubjectiveScore::getMainNumber)
                 .orderByAsc(MarkSubjectiveScore::getSubNumber);
-        ;
-        List<MarkSubjectiveScore> list = this.list(queryWrapper);
-        return list;
+        return this.list(queryWrapper);
     }
 
     @Override
@@ -122,4 +84,11 @@ public class MarkSubjectiveScoreServiceImpl extends MppServiceImpl<MarkSubjectiv
         this.update(updateWrapper);
     }
 
+    @Override
+    public long countByStudentId(Long studentId) {
+        QueryWrapper<MarkSubjectiveScore> queryWrapper = new QueryWrapper<>();
+        queryWrapper.lambda().eq(MarkSubjectiveScore::getStudentId, studentId);
+        return this.count(queryWrapper);
+    }
+
 }

+ 15 - 0
teachcloud-mark/src/main/resources/mapper/MarkQuestionMapper.xml

@@ -59,5 +59,20 @@
                 AND mq.sub_number = mqa.sub_number
         order by mq.main_number, mq.sub_number
     </select>
+    <select id="countByExamIdAndPaperNumberAndObjective" resultType="java.lang.Long">
+        SELECT
+            count(1)
+        FROM
+            mark_question mq
+        WHERE
+            mq.exam_id = #{examId} AND mq.paper_number = #{paperNumber}
+          AND mq.objective = #{objective}
+          AND NOT EXISTS( SELECT
+                              1
+                          FROM
+                              mark_user_question muq
+                          WHERE
+                              mq.id = muq.question_id)
+    </select>
 
 </mapper>

+ 2 - 1
teachcloud-mark/src/main/resources/mapper/MarkUserQuestionMapper.xml

@@ -241,7 +241,8 @@
                           mq.exam_id = muq.exam_id
                         AND mq.paper_number = muq.paper_number
                         AND mq.id = muq.question_id
-                        AND muq.user_id = #{userId})
+                        AND muq.user_id = #{userId}
+                        AND muq.enable = true)
         ORDER BY mq.main_number, mq.sub_number
     </select>
     <update id="updateRejectCountByExamIdAndPaperNumberAndQuestionIdAndUserId">