|
@@ -107,14 +107,17 @@ public class MarkAiQuestionParamController {
|
|
if (markAiQuestionParam.getMinScore() == 0) {
|
|
if (markAiQuestionParam.getMinScore() == 0) {
|
|
throw ExceptionResultEnum.ERROR.exception("最小分必须大于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("最小分不能超过得分点的最小分值");
|
|
|
|
- }
|
|
|
|
- // 各知识点得分总和校验
|
|
|
|
- Double sumScore = markAiQuestionParam.getPointList().stream().filter(m -> m.getScore() != null).collect(Collectors.summingDouble(MarkAiQuestionPoint::getScore));
|
|
|
|
- if (sumScore.doubleValue() - markQuestion.getTotalScore().doubleValue() != 0) {
|
|
|
|
- throw ExceptionResultEnum.ERROR.exception("各知识点得分总和必须等于小题满分[" + markQuestion.getTotalScore() + "]分");
|
|
|
|
|
|
+
|
|
|
|
+ if (CollectionUtils.isNotEmpty(markAiQuestionParam.getPointList())) {
|
|
|
|
+ MarkAiQuestionPoint markAiQuestionPoint = markAiQuestionParam.getPointList().stream().min(Comparator.comparingDouble(MarkAiQuestionPoint::getScore)).get();
|
|
|
|
+ if (markAiQuestionParam.getMinScore() > markAiQuestionPoint.getScore()) {
|
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("最小分不能超过得分点的最小分值");
|
|
|
|
+ }
|
|
|
|
+ // 各知识点得分总和校验
|
|
|
|
+ Double sumScore = markAiQuestionParam.getPointList().stream().filter(m -> m.getScore() != null).collect(Collectors.summingDouble(MarkAiQuestionPoint::getScore));
|
|
|
|
+ if (sumScore.doubleValue() - markQuestion.getTotalScore().doubleValue() != 0) {
|
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("各知识点得分总和必须等于小题满分[" + markQuestion.getTotalScore() + "]分");
|
|
|
|
+ }
|
|
}
|
|
}
|
|
if (Objects.isNull(markAiQuestionParam.getId())) {//新增
|
|
if (Objects.isNull(markAiQuestionParam.getId())) {//新增
|
|
markAiQuestionParam.insertInfo(sysUser.getId());
|
|
markAiQuestionParam.insertInfo(sysUser.getId());
|
|
@@ -153,9 +156,6 @@ public class MarkAiQuestionParamController {
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
case LEVEL://按档次
|
|
case LEVEL://按档次
|
|
-// if (CollectionUtils.isEmpty(markAiQuestionParam.getLevelList())) {
|
|
|
|
-// throw ExceptionResultEnum.ERROR.exception("档次信息为空");
|
|
|
|
-// }
|
|
|
|
// 最小分校验
|
|
// 最小分校验
|
|
if (markAiQuestionParam.getMinScore() == 0) {
|
|
if (markAiQuestionParam.getMinScore() == 0) {
|
|
throw ExceptionResultEnum.ERROR.exception("最小分必须大于0");
|
|
throw ExceptionResultEnum.ERROR.exception("最小分必须大于0");
|
|
@@ -170,10 +170,12 @@ public class MarkAiQuestionParamController {
|
|
minRangeScore = aiQuestionLevel.getMaxScore();
|
|
minRangeScore = aiQuestionLevel.getMaxScore();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- // 档位最大分校验
|
|
|
|
- Double maxScore = markAiQuestionParam.getLevelList().stream().filter(m -> m.getMaxScore() != null).max(Comparator.comparingDouble(MarkAiQuestionLevel::getMaxScore)).get().getMaxScore();
|
|
|
|
- if (maxScore.doubleValue() - markQuestion.getTotalScore().doubleValue() != 0) {
|
|
|
|
- throw ExceptionResultEnum.ERROR.exception("档位最大分必须等于小题满分[" + markQuestion.getTotalScore() + "]分");
|
|
|
|
|
|
+ if (CollectionUtils.isNotEmpty(markAiQuestionParam.getLevelList())) {
|
|
|
|
+ // 档位最大分校验
|
|
|
|
+ Double maxScore = markAiQuestionParam.getLevelList().stream().filter(m -> m.getMaxScore() != null).max(Comparator.comparingDouble(MarkAiQuestionLevel::getMaxScore)).get().getMaxScore();
|
|
|
|
+ if (maxScore.doubleValue() - markQuestion.getTotalScore().doubleValue() != 0) {
|
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("档位最大分必须等于小题满分[" + markQuestion.getTotalScore() + "]分");
|
|
|
|
+ }
|
|
}
|
|
}
|
|
if (Objects.isNull(markAiQuestionParam.getId())) {//新增
|
|
if (Objects.isNull(markAiQuestionParam.getId())) {//新增
|
|
markAiQuestionParam.insertInfo(sysUser.getId());
|
|
markAiQuestionParam.insertInfo(sysUser.getId());
|
|
@@ -221,7 +223,7 @@ public class MarkAiQuestionParamController {
|
|
markQuestionService.updateAiMark(markAiQuestionParam.getExamId(), markAiQuestionParam.getPaperNumber(), markAiQuestionParam.getQuestionId());
|
|
markQuestionService.updateAiMark(markAiQuestionParam.getExamId(), markAiQuestionParam.getPaperNumber(), markAiQuestionParam.getQuestionId());
|
|
|
|
|
|
boolean existMarkAiQuestionPointOrLevel = markAiQuestionParamService.existMarkAiQuestionPointOrLevel(markAiQuestionParam.getExamId(), markAiQuestionParam.getPaperNumber(), markAiQuestionParam.getQuestionId());
|
|
boolean existMarkAiQuestionPointOrLevel = markAiQuestionParamService.existMarkAiQuestionPointOrLevel(markAiQuestionParam.getExamId(), markAiQuestionParam.getPaperNumber(), markAiQuestionParam.getQuestionId());
|
|
- int aiMarkedCount = markTaskService.countByExamIdAndPaperNumberAndQuestionIdAndTaskNumberAndAiMarkedAndStatusNotIn(markAiQuestionParam.getExamId(), markAiQuestionParam.getPaperNumber(), markAiQuestionParam.getQuestionId(), 1, true, Arrays.asList(MarkTaskStatus.MARKED));
|
|
|
|
|
|
+ int aiMarkedCount = markTaskService.countByExamIdAndPaperNumberAndQuestionIdAndTaskNumberAndAiMarkedAndStatusNotIn(markAiQuestionParam.getExamId(), markAiQuestionParam.getPaperNumber(), markAiQuestionParam.getQuestionId(), 1, true, Arrays.asList(MarkTaskStatus.WAITING));
|
|
if (!existMarkAiQuestionPointOrLevel && aiMarkedCount > 0) {
|
|
if (!existMarkAiQuestionPointOrLevel && aiMarkedCount > 0) {
|
|
throw ExceptionResultEnum.ERROR.exception("已开始AI评卷,不能删除" + (AiQuestionParamModeStatus.POINT.equals(markAiQuestionParam.getMode()) ? "标答" : AiQuestionParamModeStatus.LEVEL.equals(markAiQuestionParam.getMode()) ? "档次" : ""));
|
|
throw ExceptionResultEnum.ERROR.exception("已开始AI评卷,不能删除" + (AiQuestionParamModeStatus.POINT.equals(markAiQuestionParam.getMode()) ? "标答" : AiQuestionParamModeStatus.LEVEL.equals(markAiQuestionParam.getMode()) ? "档次" : ""));
|
|
}
|
|
}
|