|
|
|
@ -52,7 +52,11 @@ public class PostToGenerateQuestionDomainServiceImpl implements PostToGenerateQu |
|
|
|
questionDTO.setKpIdList(dtoList.stream().map(TaskKnowledgePointDTO::getId).collect(Collectors.toList())); |
|
|
|
questionDTO.setQuestionType(questionType.getValue()); |
|
|
|
QuestionDTO.QuestionDetailDTO detailDTO = new QuestionDTO.QuestionDetailDTO(); |
|
|
|
|
|
|
|
questionDTO.setQuestionDetailDTO(detailDTO); |
|
|
|
questionDTO.setClusterId(Optional.of(dtoList.stream().findFirst()) |
|
|
|
.get().orElse(new TaskKnowledgePointDTO()).getClusterId()); |
|
|
|
questionDTO.setTaskId(Optional.of(dtoList.stream().findFirst()) |
|
|
|
.get().orElse(new TaskKnowledgePointDTO()).getTaskId()); |
|
|
|
detailDTO.setQuestionContent(String.format("这是一道%s" , questionType.getDescription())); |
|
|
|
detailDTO.setType(questionType.getValue()); |
|
|
|
if (QuestionTypeEnum.SINGLE_CHOICE.equals(questionType)) { |
|
|
|
@ -79,6 +83,8 @@ public class PostToGenerateQuestionDomainServiceImpl implements PostToGenerateQu |
|
|
|
detailDTO.setRightAnswer(String.join("," , rightAnswerList)); |
|
|
|
detailDTO.setAnalysis(String.format("这道题选%s" , detailDTO.getRightAnswer())); |
|
|
|
} |
|
|
|
detailDTO.setOptions(optionList); |
|
|
|
|
|
|
|
} else { |
|
|
|
int rightAnswerNo = RandomUtil.randomInt(0, 2); |
|
|
|
TreeMap<String , String> optionList = new TreeMap<>(); |
|
|
|
@ -89,6 +95,7 @@ public class PostToGenerateQuestionDomainServiceImpl implements PostToGenerateQu |
|
|
|
detailDTO.setAnalysis(String.format("这道题选%s" , trueFalseListStr[j])); |
|
|
|
} |
|
|
|
} |
|
|
|
detailDTO.setOptions(optionList); |
|
|
|
} |
|
|
|
saveQuestionDomainService.save(questionDTO); |
|
|
|
} |
|
|
|
|