Преглед на файлове

3.4.4 update-20250312,自测bug修复

xiaofei преди 3 месеца
родител
ревизия
f889f31f63

+ 1 - 1
teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/mapper/MarkTaskMapper.java

@@ -42,7 +42,7 @@ public interface MarkTaskMapper extends BaseMapper<MarkTask> {
     List<MarkTask> listByExamIdAndPaperNumberAndQuestionIdAndUserIdAndClassName(@Param("examId") Long examId, @Param("paperNumber") String paperNumber, @Param("questionId") Long questionId, @Param("userId") Long userId, @Param("className") String className);
 
     int countByExamIdAndPaperNumberAndQuestionIdAndAndClassNameStatusIn(@Param("examId") Long examId, @Param("paperNumber") String paperNumber, @Param("questionId") Long questionId, @Param("classNames") List<String> classNames, @Param("statusList") MarkTaskStatus[] statusList);
-    int countByExamIdAndPaperNumberAndUserIdAndAndClassNameAndQuestionIdIn(@Param("examId") Long examId, @Param("paperNumber") String paperNumber, @Param("userId") Long userId, @Param("classNames") List<String> classNames, @Param("questionIds") List<Long> questionIds, @Param("statusList") MarkTaskStatus[] statusList);
+    int countByExamIdAndPaperNumberAndUserIdAndAndClassNameAndQuestionIdIn(@Param("examId") Long examId, @Param("paperNumber") String paperNumber, @Param("userId") Long userId, @Param("classNames") List<String> classNames, @Param("questionIds") List<Long> questionIds, @Param("statusList") MarkTaskStatus[] statusList, @Param("questionSize") Integer questionSize);
 
     IPage<MarkTaskDto> pageMarkTask(@Param("page") Page<Object> page, @Param("examId") Long examId, @Param("paperNumber") String paperNumber, @Param("questionId") Long questionId, @Param("loginName") String loginName, @Param("status") MarkTaskStatus status, @Param("studentCode") String studentCode, @Param("secretNumber") String secretNumber, @Param("teachClassName") String teachClassName, @Param("subScore") Double subScore);
 

+ 5 - 4
teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/service/impl/MarkQuestionServiceImpl.java

@@ -755,6 +755,7 @@ public class MarkQuestionServiceImpl extends ServiceImpl<MarkQuestionMapper, Mar
         Long examId = doubleMarkParam.getExamId();
         String paperNumber = doubleMarkParam.getPaperNumber();
         Long questionId = doubleMarkParam.getQuestionId();
+        Double doubleRate = doubleMarkParam.getDoubleRate() != null ? doubleMarkParam.getDoubleRate() : 0;
         List<MarkTaskStatus> markTaskStatuses = Arrays.asList(MarkTaskStatus.MARKED, MarkTaskStatus.WAIT_ARBITRATE, MarkTaskStatus.PROBLEM, MarkTaskStatus.REJECTED, MarkTaskStatus.ARBITRATED);
         if (markTaskService.countByExamIdAndPaperNumberAndQuestionIdAndStatusIn(examId, paperNumber, questionId, markTaskStatuses) > 0) {
             throw ExceptionResultEnum.ERROR.exception("该题已开始评卷,不允许修改");
@@ -763,14 +764,14 @@ public class MarkQuestionServiceImpl extends ServiceImpl<MarkQuestionMapper, Mar
         MarkQuestion markQuestion = this.getById(questionId);
 
         UpdateWrapper<MarkQuestion> updateWrapper = new UpdateWrapper<>();
-        updateWrapper.lambda().set(MarkQuestion::getDoubleRate, doubleMarkParam.getDoubleRate())
-                .set(MarkQuestion::getArbitrateThreshold, doubleMarkParam.getArbitrateThreshold())
-                .set(MarkQuestion::getScorePolicy, doubleMarkParam.getScorePolicy())
+        updateWrapper.lambda().set(MarkQuestion::getDoubleRate, doubleRate)
+                .set(MarkQuestion::getArbitrateThreshold, doubleRate > 0 ? doubleMarkParam.getArbitrateThreshold() : null)
+                .set(MarkQuestion::getScorePolicy, doubleRate > 0 ? doubleMarkParam.getScorePolicy() : null)
                 .eq(MarkQuestion::getId, doubleMarkParam.getQuestionId());
         this.update(updateWrapper);
 
         // 单、又评切换、双评比例修改,删除任务
-        if (!markQuestion.getDoubleRate().equals(doubleMarkParam.getDoubleRate())) {
+        if (!markQuestion.getDoubleRate().equals(doubleRate)) {
             this.updateMarkedCount(questionId, 0);
             this.updateTaskCount(questionId, 0);
             if (lockService.trylock(LockType.QUESTION_UPDATE, questionId)) {

+ 6 - 2
teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/service/impl/MarkServiceImpl.java

@@ -173,8 +173,7 @@ public class MarkServiceImpl implements MarkService {
         }
         if (markPaper.getStatus() == MarkPaperStatus.FORMAL) {
             // 遍历相关评卷任务的模式
-            List<MarkTaskStatus> statusList = Arrays.asList(MarkTaskStatus.ARBITRATED, MarkTaskStatus.WAIT_ARBITRATE,
-                    MarkTaskStatus.PROBLEM);
+            List<MarkTaskStatus> statusList = Arrays.asList(MarkTaskStatus.WAITING);
             List<MarkTask> markTaskList = markTaskService.listByExamIdAndPaperNumberAndQuestionIdAndUserIdAndStatusNotIn(examId, paperNumber, questionId, userId, statusList);
             for (MarkTask markTask : markTaskList) {
                 Long studentId = markTask.getStudentId();
@@ -921,6 +920,11 @@ public class MarkServiceImpl implements MarkService {
                                 markTasks.add(markTask);
                             }
                         }
+                        // 所有题目都已评,跳过
+                        if (markTasks.stream().filter(m -> m.getUserId() == null).count() == 0) {
+                            releaseStudent(examId, paperNumber, studentId, userId);
+                            continue;
+                        }
                         markTasks.sort(Comparator.comparing(MarkTask::getMainNumber).thenComparing(MarkTask::getSubNumber));
                         task = taskService.build(userId, markTasks);
                         break;

+ 3 - 2
teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/service/impl/MarkTaskServiceImpl.java

@@ -25,12 +25,13 @@ import com.qmth.teachcloud.mark.mapper.MarkTaskMapper;
 import com.qmth.teachcloud.mark.params.MarkResultQuestion;
 import com.qmth.teachcloud.mark.service.*;
 import com.qmth.teachcloud.mark.utils.Calculator;
+import org.apache.commons.collections4.CollectionUtils;
 import org.springframework.stereotype.Service;
-import org.springframework.util.CollectionUtils;
 
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletResponse;
 import java.util.Arrays;
+import java.util.Collections;
 import java.util.List;
 import java.util.Set;
 
@@ -239,7 +240,7 @@ public class MarkTaskServiceImpl extends ServiceImpl<MarkTaskMapper, MarkTask> i
 
     @Override
     public int countByExamIdAndPaperNumberAndUserIdAndAndClassNameAndQuestionIdIn(Long examId, String paperNumber, Long userId, List<String> className, List<Long> questionIds, MarkTaskStatus... status) {
-        return this.baseMapper.countByExamIdAndPaperNumberAndUserIdAndAndClassNameAndQuestionIdIn(examId, paperNumber, userId, className, questionIds, status);
+        return this.baseMapper.countByExamIdAndPaperNumberAndUserIdAndAndClassNameAndQuestionIdIn(examId, paperNumber, userId, className, questionIds, status, CollectionUtils.size(questionIds));
     }
 
     @Override

+ 3 - 3
teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/utils/TaskLock.java

@@ -35,9 +35,9 @@ public class TaskLock {
                     return false;
                 }
                 // id只能被一个owner领取一个number
-//                else if (node.isId(id) && node.isOwner(owner)) {
-//                    return false;
-//                }
+                else if (node.isId(id) && !node.isOwner(owner)) {
+                    return false;
+                }
                 // 跳到下一个node
                 else if (node.hasNext()) {
                     node = node.next;

+ 4 - 4
teachcloud-mark/src/main/resources/mapper/MarkArbitrateHistoryMapper.xml

@@ -103,10 +103,10 @@
           <if test="classNames != null and classNames.size() > 0">
               AND EXISTS( SELECT 1
                           FROM
-                              mark_student
-                          where exam_id = #{examId}
-                            AND paper_number = #{paperNumber}
-                            AND teach_class_name in
+                              mark_student ms
+                          where ms.exam_id = #{examId}
+                            AND ms.paper_number = #{paperNumber}
+                            AND ms.teach_class_name in
                           <foreach collection="classNames" item="className" separator="," open="(" close=")">
                               #{className}
                           </foreach>

+ 4 - 4
teachcloud-mark/src/main/resources/mapper/MarkProblemHistoryMapper.xml

@@ -66,10 +66,10 @@
         <if test="classNames != null and classNames.size() > 0">
             AND EXISTS( SELECT 1
             FROM
-            mark_student
-            where exam_id = #{examId}
-            AND paper_number = #{paperNumber}
-            AND teach_class_name in
+            mark_student ms
+            where ms.exam_id = #{examId}
+            AND ms.paper_number = #{paperNumber}
+            AND ms.teach_class_name in
             <foreach collection="classNames" item="className" separator="," open="(" close=")">
                 #{className}
             </foreach>

+ 3 - 0
teachcloud-mark/src/main/resources/mapper/MarkTaskMapper.xml

@@ -300,6 +300,9 @@
                             </foreach>
                         </if>
                         AND ms.id = mt.student_id
+                       <if test="userId != null">
+                       group by mt.student_id having count(1) = #{questionSize}
+                       </if>
                       )
         <if test="classNames != null and classNames.size() > 0">
             AND ms.teach_class_name IN

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

@@ -34,6 +34,7 @@
             mark_question mq ON muq.exam_id = mq.exam_id
                 AND muq.paper_number = mq.paper_number
                 AND muq.question_id = mq.id
+                AND muq.enable = true
                 LEFT JOIN
             basic_course bc ON mq.course_id = bc.id
                 LEFT JOIN