Browse Source

考试任务调用知识点簇聚类

master
luoweijian 1 month ago
parent
commit
80864518a7
  1. 9
      src/main/java/com/project/interaction/domain/service/impl/PostToGenerateQuestionDomainServiceImpl.java
  2. 4
      src/main/java/com/project/question/domain/dto/QuestionDTO.java
  3. 5
      src/main/java/com/project/question/domain/dto/TaskKnowledgePointDTO.java
  4. 3
      src/main/java/com/project/question/domain/service/impl/SaveQuestionDomainServiceImpl.java

9
src/main/java/com/project/interaction/domain/service/impl/PostToGenerateQuestionDomainServiceImpl.java

@ -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);
}

4
src/main/java/com/project/question/domain/dto/QuestionDTO.java

@ -26,6 +26,10 @@ public class QuestionDTO extends BaseDTO {
private QuestionDetailDTO questionDetailDTO;
private Long clusterId;
private Long taskId;
@Data
public static class QuestionDetailDTO {

5
src/main/java/com/project/question/domain/dto/TaskKnowledgePointDTO.java

@ -6,5 +6,10 @@ import lombok.Data;
@Data
public class TaskKnowledgePointDTO extends BaseDTO {
private Long id;
private Long taskId;
private Long clusterId;
private Long atomId;
private String content;
}

3
src/main/java/com/project/question/domain/service/impl/SaveQuestionDomainServiceImpl.java

@ -45,6 +45,9 @@ public class SaveQuestionDomainServiceImpl implements SaveQuestionDomainService
QuestionKpRelEntity rel = new QuestionKpRelEntity();
rel.setQuestionId(entity.getId());
rel.setKpId(kpId);
rel.setClusterId(dto.getClusterId());
rel.setQuestionType(dto.getQuestionType());
rel.setTaskId(dto.getTaskId());
return rel;
}).collect(Collectors.toList());
questionKpRelBaseService.saveBatch(relEntities);

Loading…
Cancel
Save