|
@@ -129,8 +129,14 @@ public class MarkQuestionServiceImpl extends ServiceImpl<MarkQuestionMapper, Mar
|
|
|
Optional<MarkQuestion> questionOptional = markQuestionList.stream().filter(m -> m.getId().equals(question.getId())).findFirst();
|
|
|
if (questionOptional.isPresent()) {
|
|
|
MarkQuestion markQuestion = questionOptional.get();
|
|
|
- if (markQuestion.getGroupNumber() != null && markQuestion.getGroupNumber().intValue() > 0 && markQuestion.getTotalScore().doubleValue() - question.getTotalScore().doubleValue() != 0) {
|
|
|
- throw ExceptionResultEnum.ERROR.exception("大题号" + markQuestion.getMainNumber() + "小题号" + markQuestion.getSubNumber() + "已分组,不能修改小题满分");
|
|
|
+ if (markQuestion.getGroupNumber() != null && markQuestion.getGroupNumber().intValue() > 0) {
|
|
|
+ if (markQuestion.getTotalScore().doubleValue() - question.getTotalScore().doubleValue() != 0) {
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("大题号" + markQuestion.getMainNumber() + "小题号" + markQuestion.getSubNumber() + "已分组,不能修改小题满分");
|
|
|
+ }
|
|
|
+ // 主观题改客观题
|
|
|
+ if(!markQuestion.getObjective() && question.getObjective()){
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("大题号" + markQuestion.getMainNumber() + "小题号" + markQuestion.getSubNumber() + "已分组,不能修改为客观题题型");
|
|
|
+ }
|
|
|
}
|
|
|
if (question.getTotalScore() <= 0) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("小题满分必须大于0");
|
|
@@ -138,11 +144,38 @@ public class MarkQuestionServiceImpl extends ServiceImpl<MarkQuestionMapper, Mar
|
|
|
if (!QuestionType.findByValue(question.getQuestionType()).getObjective() && question.getIntervalScore() <= 0) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("间隔分必须大于0");
|
|
|
}
|
|
|
+ // 客观题变主观题
|
|
|
+ if(markQuestion.getObjective() && !question.getObjective()){
|
|
|
+ // 清除判分策略
|
|
|
+ markQuestion.setObjectivePolicy(null);
|
|
|
+ markQuestion.setObjectivePolicyScore(null);
|
|
|
+ markQuestion.setAnswer(null);
|
|
|
+ markQuestion.setOptionCount(0);
|
|
|
+ }
|
|
|
+ // 客观题
|
|
|
+ if(question.getObjective()){
|
|
|
+ markQuestion.setOptionCount(question.getOptionCount());
|
|
|
+ if(!markQuestion.getQuestionType().equals(question.getQuestionType())){
|
|
|
+ // 清除判分策略
|
|
|
+ markQuestion.setObjectivePolicy(null);
|
|
|
+ markQuestion.setObjectivePolicyScore(null);
|
|
|
+ markQuestion.setAnswer(null);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 大题号
|
|
|
+ markQuestion.setMainNumber(question.getMainNumber());
|
|
|
+ // 小题号
|
|
|
+ markQuestion.setSubNumber(question.getSubNumber());
|
|
|
+ // 大题名称
|
|
|
+ markQuestion.setMainTitle(question.getMainTitle());
|
|
|
+ // 题型
|
|
|
+ markQuestion.setQuestionType(question.getQuestionType());
|
|
|
+ markQuestion.setObjective(question.getObjective());
|
|
|
markQuestion.setTotalScore(question.getTotalScore());
|
|
|
markQuestion.setIntervalScore(question.getIntervalScore());
|
|
|
// 用来判断是否保存过
|
|
|
- question.setUpdateId(sysUser.getId());
|
|
|
- question.setUpdateTime(System.currentTimeMillis());
|
|
|
+ markQuestion.setUpdateId(sysUser.getId());
|
|
|
+ markQuestion.setUpdateTime(System.currentTimeMillis());
|
|
|
saveOrUpdateList.add(markQuestion);
|
|
|
markQuestionList.remove(markQuestion);
|
|
|
} else {
|
|
@@ -156,7 +189,6 @@ public class MarkQuestionServiceImpl extends ServiceImpl<MarkQuestionMapper, Mar
|
|
|
question.setUpdateId(sysUser.getId());
|
|
|
question.setUpdateTime(System.currentTimeMillis());
|
|
|
saveOrUpdateList.add(question);
|
|
|
-// throw ExceptionResultEnum.ERROR.exception("数据异常,请刷新页面后重新操作");
|
|
|
}
|
|
|
}
|
|
|
}
|