Ver código fonte

Merge remote-tracking branch 'origin/dev_v3.4.5' into dev_v3.4.5

wangliang 2 meses atrás
pai
commit
0f8b710145

+ 1 - 3
distributed-print/src/main/java/com/qmth/distributed/print/api/mark/MarkAiQuestionParamController.java

@@ -221,10 +221,8 @@ public class MarkAiQuestionParamController {
 
             if (markAiQuestionParamService.existMarkAiQuestionPointOrLevel(markAiQuestionParam.getExamId(), markAiQuestionParam.getPaperNumber(), markAiQuestionParam.getQuestionId())
                     && markTaskService.countByExamIdAndPaperNumberAndQuestionIdAndTaskNumberAndAiMarkedAndStatusNotIn(markAiQuestionParam.getExamId(), markAiQuestionParam.getPaperNumber(), markAiQuestionParam.getQuestionId(), 1, false, null) > 0) {
-                markService.deleteMarkTask(markQuestion, true);
+                markService.deleteMarkTask(markQuestion, true, true);
                 markService.checkStudentSubjectiveScore(markAiQuestionParam.getExamId(), markPaper.getCoursePaperId());
-                markService.updateMarkedCount(markAiQuestionParam.getExamId(), markAiQuestionParam.getPaperNumber(), markAiQuestionParam.getQuestionId());
-                markService.updateMarkTaskCount(markAiQuestionParam.getExamId(), markAiQuestionParam.getPaperNumber(), markAiQuestionParam.getQuestionId());
             }
         } catch (Exception e) {
             log.error(SystemConstant.LOG_ERROR, e);

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

@@ -1,10 +1,8 @@
 package com.qmth.teachcloud.mark.service;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.qmth.teachcloud.common.entity.BasicSchool;
 import com.qmth.teachcloud.common.entity.MarkQuestion;
 import com.qmth.teachcloud.common.entity.SysUser;
-import com.qmth.teachcloud.mark.dto.ai.SheetImageDto;
 import com.qmth.teachcloud.mark.dto.mark.manage.Task;
 import com.qmth.teachcloud.mark.dto.mark.mark.MarkSettingDto;
 import com.qmth.teachcloud.mark.dto.mark.mark.MarkStatusDto;
@@ -17,7 +15,6 @@ import com.qmth.teachcloud.mark.params.MarkResultQuestion;
 import io.lettuce.core.GeoArgs.Sort;
 
 import java.util.List;
-import java.util.Map;
 import java.util.Set;
 
 /**
@@ -101,7 +98,7 @@ public interface MarkService {
 
     boolean rejectMarkTask(MarkTask markTask, Long userId, String reason);
 
-    void deleteMarkTask(MarkQuestion markQuestion, boolean b);
+    void deleteMarkTask(MarkQuestion markQuestion, boolean doubleToSingle, boolean toggle);
 
     /**
      * /** 释放整修科目的锁定任务

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

@@ -17,7 +17,7 @@ public interface MarkSyncService {
     void updateQuality(List<MarkUserQuestion> markUserGroups, String lockKey);
 
     void calcObjectiveScore(MarkPaper markPaper);
-    void deleteMarkedByQuestion(MarkQuestion markQuestion, boolean b);
+    void deleteMarkedByQuestion(MarkQuestion markQuestion, boolean doubleToSingle, boolean toggle);
 
     void aiTaskResetSync(MarkQuestion markQuestion, Long questionId);
 

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

@@ -773,11 +773,14 @@ public class MarkQuestionServiceImpl extends ServiceImpl<MarkQuestionMapper, Mar
         }
 
         MarkPaper markPaper = markPaperService.getByExamIdAndPaperNumber(examId, paperNumber);
-        if(oldDoubleRate > 0 && doubleRate == 0 && MarkPaperAiMark.MAN_MACHINE.equals(markPaper.getAiMark())){
+        if (oldDoubleRate == 0 && doubleRate > 0 && MarkPaperAiMark.AI_ONLY.equals(markPaper.getAiMark())) {
+            throw ExceptionResultEnum.ERROR.exception("仅AI评卷模式,不允许单评改双评");
+        }
+        if (oldDoubleRate > 0 && doubleRate == 0 && MarkPaperAiMark.MAN_MACHINE.equals(markPaper.getAiMark())) {
             throw ExceptionResultEnum.ERROR.exception("人机双评模式,不允许双评改单评");
         }
 
-        if (doubleRate == 100 && doubleMarkParam.getArbitrateThreshold() > 0 && doubleMarkParam.getArbitrateThreshold() > markQuestion.getTotalScore()) {
+        if (doubleRate > 0 && doubleMarkParam.getArbitrateThreshold() > 0 && doubleMarkParam.getArbitrateThreshold() > markQuestion.getTotalScore()) {
             throw ExceptionResultEnum.ERROR.exception("仲裁阈值不能大于小题满分");
         }
 
@@ -789,12 +792,10 @@ public class MarkQuestionServiceImpl extends ServiceImpl<MarkQuestionMapper, Mar
         this.update(updateWrapper);
 
         // 单、双评切换修改,不删除任务,补发二评任务
-        this.updateMarkedCount(questionId, 0);
-        this.updateTaskCount(questionId, 0);
         if (lockService.trylock(LockType.QUESTION_UPDATE, questionId)) {
             // 考生主观题重新统分
             markService.checkStudentSubjectiveScore(examId, markPaper.getCoursePaperId());
-            markSyncService.deleteMarkedByQuestion(markQuestion, oldDoubleRate > 0 && doubleRate == 0);
+            markSyncService.deleteMarkedByQuestion(markQuestion, oldDoubleRate > 0 && doubleRate == 0, !oldDoubleRate.equals(doubleRate));
         }
     }
 

+ 15 - 9
teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/service/impl/MarkServiceImpl.java

@@ -1186,7 +1186,7 @@ public class MarkServiceImpl implements MarkService {
                         Map<Long, List<MarkTask>> map = markTaskList.stream().collect(Collectors.groupingBy(MarkTask::getQuestionId));
                         List<MarkTask> markTasks = new ArrayList<>();
                         for (MarkUserQuestion markUserQuestion : markUserQuestions) {
-                            if(!map.containsKey(markUserQuestion.getQuestionId())){
+                            if (!map.containsKey(markUserQuestion.getQuestionId())) {
                                 continue;
                             }
                             List<MarkTask> markTasks1 = map.get(markUserQuestion.getQuestionId());
@@ -1507,19 +1507,25 @@ public class MarkServiceImpl implements MarkService {
     }
 
     @Override
-    public void deleteMarkTask(MarkQuestion markQuestion, boolean b) {
+    public void deleteMarkTask(MarkQuestion markQuestion, boolean doubleToSingle, boolean toggle) {
         // 正评相关数据
-        if (b) {
+        if (doubleToSingle) {
             markArbitrateHistoryService.deleteByExamIdAndPaperNumberAndQuestionId(markQuestion.getExamId(), markQuestion.getPaperNumber(), markQuestion.getId());
             markProblemHistoryService.deleteByExamIdAndPaperNumberAndQuestionId(markQuestion.getExamId(), markQuestion.getPaperNumber(), markQuestion.getId());
             markTaskService.deleteByExamIdAndPaperNumberAndQuestionId(markQuestion.getExamId(), markQuestion.getPaperNumber(), markQuestion.getId());
             markRejectHistoryService.deleteByExamIdAndPaperNumberAndQuestionId(markQuestion.getExamId(), markQuestion.getPaperNumber(), markQuestion.getId());
         }
-        markSubjectiveScoreService.deleteByExamIdAndPaperNumberAndQuestionId(markQuestion.getExamId(), markQuestion.getPaperNumber(), markQuestion.getId());
-        // 释放本小题所有评卷员的任务
-        List<MarkUserQuestion> markUserQuestions = markUserQuestionService.listByExamIdAndPaperNumberAndQuestionId(markQuestion.getExamId(), markQuestion.getPaperNumber(), markQuestion.getId());
-        for (MarkUserQuestion markUserQuestion : markUserQuestions) {
-            releaseByMarkUserGroup(markUserQuestion);
+        if (toggle) {
+            markSubjectiveScoreService.deleteByExamIdAndPaperNumberAndQuestionId(markQuestion.getExamId(), markQuestion.getPaperNumber(), markQuestion.getId());
+            // 释放本小题所有评卷员的任务
+            List<MarkUserQuestion> markUserQuestions = markUserQuestionService.listByExamIdAndPaperNumberAndQuestionId(markQuestion.getExamId(), markQuestion.getPaperNumber(), markQuestion.getId());
+            for (MarkUserQuestion markUserQuestion : markUserQuestions) {
+                releaseByMarkUserGroup(markUserQuestion);
+            }
+
+            // 更新任务数量
+            this.updateMarkedCount(markQuestion.getExamId(), markQuestion.getPaperNumber(), markQuestion.getId());
+            this.updateMarkTaskCount(markQuestion.getExamId(), markQuestion.getPaperNumber(), markQuestion.getId());
         }
     }
 
@@ -1671,7 +1677,7 @@ public class MarkServiceImpl implements MarkService {
             boolean pointOrLevel = markAiQuestionParamService.existMarkAiQuestionPointOrLevel(examId, paperNumber, questionId);
             // 未设置AI智能评卷参数,删除所有任务
             if (!pointOrLevel) {
-                this.deleteMarkTask(markQuestion, true);
+                this.deleteMarkTask(markQuestion, true, true);
                 this.checkStudentSubjectiveScore(examId, markPaper.getCoursePaperId());
             } else {
                 // 遍历相关评卷任务的模式

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

@@ -2,7 +2,6 @@ package com.qmth.teachcloud.mark.service.impl;
 
 import com.qmth.teachcloud.common.entity.MarkQuestion;
 import com.qmth.teachcloud.mark.entity.MarkPaper;
-import com.qmth.teachcloud.mark.entity.MarkTask;
 import com.qmth.teachcloud.mark.entity.MarkUserQuestion;
 import com.qmth.teachcloud.mark.enums.LockType;
 import com.qmth.teachcloud.mark.lock.LockService;
@@ -81,14 +80,14 @@ public class MarkSyncServiceImpl implements MarkSyncService {
 
     @Async
     @Override
-    public void deleteMarkedByQuestion(MarkQuestion markQuestion, boolean b) {
+    public void deleteMarkedByQuestion(MarkQuestion markQuestion, boolean doubleToSingle, boolean toggle) {
         if (markQuestion == null) {
             return;
         }
         try {
             lockService.waitlock(LockType.EXAM_SUBJECT, markQuestion.getExamId(), markQuestion.getPaperNumber());
             lockService.waitlock(LockType.QUESTION, markQuestion.getId());
-            markService.deleteMarkTask(markQuestion, b);
+            markService.deleteMarkTask(markQuestion, doubleToSingle, toggle);
         } catch (Exception e) {
             log.error("delete group error", e);
         } finally {