|
@@ -7,6 +7,7 @@ import cn.com.qmth.examcloud.question.commons.core.question.DefaultQuestionStruc
|
|
|
import cn.com.qmth.examcloud.question.commons.core.question.DefaultQuestionUnit;
|
|
|
import cn.com.qmth.examcloud.support.handler.richtext2.RichTextConverter;
|
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
|
+import org.apache.commons.lang3.ArrayUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
|
import java.util.List;
|
|
@@ -35,15 +36,23 @@ public class QuestionBodyHandler {
|
|
|
}
|
|
|
|
|
|
for (DefaultQuestionUnit questionUnit : questionUnits) {
|
|
|
+ // 处理题干
|
|
|
questionUnit.setBody(jsonMapper.toJson(RichTextConverter.parse(questionUnit.getBody())));
|
|
|
|
|
|
List<DefaultQuestionOption> questionOptions = questionUnit.getQuestionOptionList();
|
|
|
- if (CollectionUtils.isEmpty(questionOptions)) {
|
|
|
- continue;
|
|
|
+ if (CollectionUtils.isNotEmpty(questionOptions)) {
|
|
|
+ for (DefaultQuestionOption questionOption : questionOptions) {
|
|
|
+ // 处理选项
|
|
|
+ questionOption.setBody(jsonMapper.toJson(RichTextConverter.parse(questionOption.getBody())));
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
- for (DefaultQuestionOption questionOption : questionOptions) {
|
|
|
- questionOption.setBody(jsonMapper.toJson(RichTextConverter.parse(questionOption.getBody())));
|
|
|
+ String[] rightAnswers = questionUnit.getRightAnswer();
|
|
|
+ if (ArrayUtils.isNotEmpty(rightAnswers)) {
|
|
|
+ for (int n = 0; n < rightAnswers.length; n++) {
|
|
|
+ // 处理正确答案
|
|
|
+ rightAnswers[n] = jsonMapper.toJson(RichTextConverter.parse(rightAnswers[n]));
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|