Browse Source

申述列表新增题目类型

master
luogw 2 months ago
parent
commit
c57c08c910
  1. 2
      src/main/java/com/project/appeal/domain/dto/AppealDTO.java
  2. 2
      src/main/java/com/project/appeal/domain/service/Impl/SearchAppealDomainServiceImpl.java
  3. 22
      src/main/java/com/project/classicpaper/application/impl/ClassicCategoryApplicationServiceImpl.java

2
src/main/java/com/project/appeal/domain/dto/AppealDTO.java

@ -20,6 +20,8 @@ public class AppealDTO extends BaseDTO {
private Long questionId;
private String questionContent; //题干
private Integer questionSort; //题号
private String questionTypeText; //题型
private Integer questionType;//题型
private String kpContentsStr; //知识点文本
private List<Long> kpIdList;
private String rightAnswer;//正确答案

2
src/main/java/com/project/appeal/domain/service/Impl/SearchAppealDomainServiceImpl.java

@ -127,6 +127,8 @@ public class SearchAppealDomainServiceImpl implements SearchAppealDomainService
appealDTO.setScoreStr(scoreStr);
appealDTO.setQuestionContent(questionDetail.getQuestionContent());
appealDTO.setQuestionType(questionDetail.getType());
appealDTO.setQuestionTypeText(Objects.requireNonNull(QuestionTypeEnum.findByValue(questionDetail.getType())).getDescription());
appealDTO.setKpIdList(questionEntity.getKpIdList());
kpIdSet.addAll(questionEntity.getKpIdList());

22
src/main/java/com/project/classicpaper/application/impl/ClassicCategoryApplicationServiceImpl.java

@ -41,30 +41,26 @@ public class ClassicCategoryApplicationServiceImpl implements ClassicCategoryApp
ClassicCategoryDTO::getParentId,
ClassicCategoryDTO::setChildrenList);
// 3. 查询所有套题组(只查必要字段),同时用于统计数量和填充列表
// 3. 查询套题组,统计数量和分组
List<ClassicPaperSetEntity> allPaperSets = classicPaperSetBaseService.lambdaQuery()
.select(ClassicPaperSetEntity::getClassicCategoryId, ClassicPaperSetEntity::getId, ClassicPaperSetEntity::getName)
.orderByDesc(ClassicPaperSetEntity::getId)
.list();
.orderByDesc(ClassicPaperSetEntity::getId).list();
Map<Long, Integer> countMap = new HashMap<>();
Map<Long, List<ClassicPaperSetDTO>> paperSetMap = Boolean.TRUE.equals(withPaperSet) ? new HashMap<>() : null;
for (ClassicPaperSetEntity set : allPaperSets) {
Long catId = set.getClassicCategoryId();
if (catId != null) {
if (catId == null) continue;
countMap.merge(catId, 1, Integer::sum);
if (paperSetMap != null) {
//按分类ID分组套题组
paperSetMap.computeIfAbsent(catId, k -> new ArrayList<>()).add(set.toDTO(ClassicPaperSetDTO::new));
}
}
// 4. 注入 paperSetCount 到树节点
injectPaperSetCount(tree, countMap);
if (Boolean.TRUE.equals(withPaperSet)) {
// 5. 按分类ID分组套题组
Map<Long, List<ClassicPaperSetDTO>> paperSetMap = allPaperSets.stream()
.filter(s -> s.getClassicCategoryId() != null)
.map(s -> s.toDTO(ClassicPaperSetDTO::new))
.collect(Collectors.groupingBy(ClassicPaperSetDTO::getClassicCategoryId));
// 6. 注入套题组到二级分类
if (paperSetMap != null){
// 5. 注入套题组到二级分类
injectPaperList(tree, paperSetMap);
}

Loading…
Cancel
Save