Browse Source

3.4.5 update-20250416,新功能开发

xiaofei 3 months ago
parent
commit
3fbc5608b9

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

@@ -103,6 +103,9 @@ public class MarkAiQuestionParamController {
                         throw ExceptionResultEnum.ERROR.exception("得分点信息为空");
                     }
                     // 最小分校验
+                    if (markAiQuestionParam.getMinScore() == 0) {
+                        throw ExceptionResultEnum.ERROR.exception("最小分必须大于0");
+                    }
                     MarkAiQuestionPoint markAiQuestionPoint = markAiQuestionParam.getPointList().stream().min(Comparator.comparingDouble(MarkAiQuestionPoint::getScore)).get();
                     if (markAiQuestionParam.getMinScore() > markAiQuestionPoint.getScore()) {
                         throw ExceptionResultEnum.ERROR.exception("最小分不能超过得分点的最小分值");
@@ -153,9 +156,18 @@ public class MarkAiQuestionParamController {
                         throw ExceptionResultEnum.ERROR.exception("档次信息为空");
                     }
                     // 最小分校验
-                    MarkAiQuestionLevel markAiQuestionLevel = markAiQuestionParam.getLevelList().stream().min(Comparator.comparingDouble(MarkAiQuestionLevel::getMinScore)).get();
-                    if (markAiQuestionParam.getMinScore() > markAiQuestionLevel.getMinScore()) {
-                        throw ExceptionResultEnum.ERROR.exception("最小分不能超过档次的最小分值");
+                    if (markAiQuestionParam.getMinScore() == 0) {
+                        throw ExceptionResultEnum.ERROR.exception("最小分必须大于0");
+                    }
+                    List<MarkAiQuestionLevel> levelList = markAiQuestionParam.getLevelList();
+                    levelList.sort(Comparator.comparing(MarkAiQuestionLevel::getMinScore));
+                    Double minRangeScore = 0D;
+                    for (MarkAiQuestionLevel aiQuestionLevel : levelList) {
+                        if(minRangeScore.doubleValue() - aiQuestionLevel.getMinScore().doubleValue() != 0){
+                            throw ExceptionResultEnum.ERROR.exception("区间分数必须从0开始,且区间分数段连续");
+                        } else {
+                            minRangeScore = aiQuestionLevel.getMaxScore();
+                        }
                     }
                     // 档位最大分校验
                     Double maxScore = markAiQuestionParam.getLevelList().stream().filter(m -> m.getMaxScore() != null).max(Comparator.comparingDouble(MarkAiQuestionLevel::getMaxScore)).get().getMaxScore();