| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- package cn.seecoder.judgement.vo.question;
- import cn.seecoder.bok.common.QuestionType;
- import cn.seecoder.bok.common.vo.QuestionVO;
- import lombok.Data;
- import lombok.NonNull;
- import java.util.Date;
- import java.util.List;
- import java.util.Map;
- /**
- * @author XuShengTao
- * <p>
- * updated by cst
- */
- @Data
- public abstract class BaseQuestionVO {
- protected String id;
- protected QuestionType type;
- protected Map<String, String> options;
- protected String stem;
- protected String analysis;
- protected String keyPoints;
- protected List<String> tags;
- protected List<String> knowledgeId;
- protected Date lastModified;
- public static BaseQuestionVO convertBokQuestionToVO(@NonNull QuestionVO questionVO, boolean withAnswer) {
- switch (questionVO.getType()) {
- case CHOICE:
- return new ChoiceQuestionVO(questionVO, withAnswer);
- case TRUE_FALSE:
- return new TrueOrFalseQuestionVO(questionVO, withAnswer);
- case BLANK:
- return new BlankQuestionVO(questionVO, withAnswer);
- case MULTIPLE_CHOICE:
- return new MultipleChoiceQuestionVO(questionVO, withAnswer);
- default:
- return null;
- }
- }
- protected BaseQuestionVO(QuestionVO questionVO) {
- this.id = questionVO.getId();
- this.type = questionVO.getType();
- this.options = questionVO.getOptions();
- this.stem = questionVO.getStem();
- this.keyPoints = questionVO.getKeyPoints();
- this.tags = questionVO.getTags();
- this.knowledgeId = questionVO.getKnowledgeId();
- this.lastModified = Date.from(questionVO.getLastModifiedTime());
- }
- /**
- * 检查答案是否正确
- *
- * @param answer 答案
- * @return 是否正确
- */
- public abstract boolean pass(Object answer);
- }
|