wangliang 2 месяцев назад
Родитель
Сommit
735e62c1cd

+ 14 - 2
distributed-print/src/main/java/com/qmth/distributed/print/api/mark/MarkAiQuestionParamController.java

@@ -76,6 +76,7 @@ public class MarkAiQuestionParamController {
         if (!lock) {
             throw ExceptionResultEnum.ERROR.exception("正在设置AI评卷参数,请稍候再试!");
         }
+        boolean update = false;
         try {
             switch (markAiQuestionParam.getMode()) {
                 case POINT://按得分点
@@ -92,12 +93,17 @@ public class MarkAiQuestionParamController {
                     } else {//修改
                         List<MarkAiQuestionPoint> markAiQuestionPointDbList = markAiQuestionPointService.listByAiQuestionId(markAiQuestionParam.getId());
                         List<MarkAiQuestionLevel> markAiQuestionLevelDbList = markAiQuestionLevelService.listByAiQuestionId(markAiQuestionParam.getId());
+
                         //删除档次的数据
                         if (CollectionUtils.isNotEmpty(markAiQuestionLevelDbList)) {
+                            update = true;
                             markAiQuestionLevelService.removeByIds(markAiQuestionLevelDbList.stream().map(MarkAiQuestionLevel::getId).collect(Collectors.toList()));
                         }
                         //全删point数据全增
                         if (CollectionUtils.isNotEmpty(markAiQuestionPointDbList)) {
+                            if (!CollectionUtils.isEqualCollection(markAiQuestionPointDbList, markAiQuestionParam.getPointList())) {
+                                update = true;
+                            }
                             markAiQuestionPointService.removeByIds(markAiQuestionPointDbList.stream().map(MarkAiQuestionPoint::getId).collect(Collectors.toList()));
                         }
                         markAiQuestionPointService.saveBatch(markAiQuestionParam.getPointList());
@@ -118,12 +124,17 @@ public class MarkAiQuestionParamController {
                     } else {
                         List<MarkAiQuestionPoint> markAiQuestionPointDbList = markAiQuestionPointService.listByAiQuestionId(markAiQuestionParam.getId());
                         List<MarkAiQuestionLevel> markAiQuestionLevelDbList = markAiQuestionLevelService.listByAiQuestionId(markAiQuestionParam.getId());
+
                         //删除得分点的数据
                         if (CollectionUtils.isNotEmpty(markAiQuestionPointDbList)) {
+                            update = true;
                             markAiQuestionPointService.removeByIds(markAiQuestionPointDbList.stream().map(MarkAiQuestionPoint::getId).collect(Collectors.toList()));
                         }
                         //全删level数据全增
                         if (CollectionUtils.isNotEmpty(markAiQuestionLevelDbList)) {
+                            if (!CollectionUtils.isEqualCollection(markAiQuestionLevelDbList, markAiQuestionParam.getLevelList())) {
+                                update = true;
+                            }
                             markAiQuestionLevelService.removeByIds(markAiQuestionLevelDbList.stream().map(MarkAiQuestionLevel::getId).collect(Collectors.toList()));
                         }
                         markAiQuestionLevelService.saveBatch(markAiQuestionParam.getLevelList());
@@ -133,8 +144,9 @@ public class MarkAiQuestionParamController {
                 default:
                     break;
             }
-            // todo 知识点或者档位变动,更新
-//            markQuestionService.updateClearOcrResult(markAiQuestionParam.getQuestionId(), true);
+            if (update) {
+                markQuestionService.updateClearOcrResult(markAiQuestionParam.getQuestionId(), true);
+            }
             markAiQuestionParamService.saveOrUpdate(markAiQuestionParam);
         } catch (Exception e) {
             log.error(SystemConstant.LOG_ERROR, e);

+ 29 - 0
teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/entity/MarkAiQuestionLevel.java

@@ -7,6 +7,7 @@ import io.swagger.annotations.ApiModelProperty;
 
 import javax.validation.constraints.NotNull;
 import java.io.Serializable;
+import java.util.Objects;
 
 /**
  * <p>
@@ -41,6 +42,17 @@ public class MarkAiQuestionLevel implements Serializable {
     @NotNull(message = "标答不能为空")
     private String answer;
 
+    public MarkAiQuestionLevel() {
+
+    }
+
+    public MarkAiQuestionLevel(Long aiQuestionId, Double minScore, Double maxScore, String answer) {
+        this.aiQuestionId = aiQuestionId;
+        this.minScore = minScore;
+        this.maxScore = maxScore;
+        this.answer = answer;
+    }
+
     public Long getId() {
         return id;
     }
@@ -80,4 +92,21 @@ public class MarkAiQuestionLevel implements Serializable {
     public void setAnswer(String answer) {
         this.answer = answer;
     }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) {
+            return true;
+        }
+        if (o == null || getClass() != o.getClass()) {
+            return false;
+        }
+        MarkAiQuestionLevel that = (MarkAiQuestionLevel) o;
+        return Objects.equals(aiQuestionId, that.aiQuestionId) && minScore.equals(that.minScore) && maxScore.equals(that.maxScore) && answer.equals(that.answer);
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(aiQuestionId, minScore, maxScore, answer);
+    }
 }

+ 28 - 0
teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/entity/MarkAiQuestionPoint.java

@@ -7,6 +7,7 @@ import io.swagger.annotations.ApiModelProperty;
 
 import javax.validation.constraints.NotNull;
 import java.io.Serializable;
+import java.util.Objects;
 
 /**
  * <p>
@@ -37,6 +38,16 @@ public class MarkAiQuestionPoint implements Serializable {
     @NotNull(message = "标答不能为空")
     private String answer;
 
+    public MarkAiQuestionPoint() {
+
+    }
+
+    public MarkAiQuestionPoint(Long aiQuestionId, Double score, String answer) {
+        this.aiQuestionId = aiQuestionId;
+        this.score = score;
+        this.answer = answer;
+    }
+
     public Long getId() {
         return id;
     }
@@ -68,4 +79,21 @@ public class MarkAiQuestionPoint implements Serializable {
     public void setAnswer(String answer) {
         this.answer = answer;
     }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) {
+            return true;
+        }
+        if (o == null || getClass() != o.getClass()) {
+            return false;
+        }
+        MarkAiQuestionPoint that = (MarkAiQuestionPoint) o;
+        return Objects.equals(aiQuestionId, that.aiQuestionId) && score.equals(that.score) && answer.equals(that.answer);
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(aiQuestionId, score, answer);
+    }
 }