错题列表
parent
2d529ec4b8
commit
70f899ca5f
|
@ -105,6 +105,7 @@ public class TdQuestionServiceImpl extends ServiceImpl<TdQuestionMapper, TdQuest
|
|||
List<TdSysConfigList> categoryList = configListService.querySysConfigList(Constants.QUESTION_CATEGORY, Constants.DEFAULT_CARTYPE_ID);
|
||||
Map<String, String> categoryMap = categoryList.stream().collect(Collectors.toMap(TdSysConfigList::getConfigItemCode, TdSysConfigList::getConfigItemName, (v1, v2) -> v1));
|
||||
Map<String,Integer> totalMap = new HashMap<>();
|
||||
Map<String,List<Long>> errorQuestionIdMap = new HashMap<>();
|
||||
|
||||
for (QuestionVo tdQuestionVo : tdQuestionVos) {
|
||||
String category = tdQuestionVo.getCategory();
|
||||
|
@ -116,8 +117,13 @@ public class TdQuestionServiceImpl extends ServiceImpl<TdQuestionMapper, TdQuest
|
|||
if (totalMap.containsKey(s)) { //判断Map集合中是否有该字符
|
||||
Integer value = totalMap.get(s); //通过key找出集合中的value
|
||||
totalMap.put(s, value + 1); //将值的数据加1,然后添加到集合中去
|
||||
List<Long> errorQuestionIdList = errorQuestionIdMap.get(s);
|
||||
errorQuestionIdList.add(tdQuestionVo.getQuestionId());
|
||||
} else {
|
||||
totalMap.put(s,1); //此时集合中没有该Key,所以将该字符作为键加入到集合中
|
||||
List<Long> errorQuestionIdList = new ArrayList<>();
|
||||
errorQuestionIdList.add(tdQuestionVo.getQuestionId());
|
||||
errorQuestionIdMap.put(s,errorQuestionIdList);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -125,6 +131,7 @@ public class TdQuestionServiceImpl extends ServiceImpl<TdQuestionMapper, TdQuest
|
|||
for (String category : totalMap.keySet()) {
|
||||
QusetionCategoryVo categoryVo = new QusetionCategoryVo()
|
||||
.setCategory(category)
|
||||
.setErrorQuestionIdList(errorQuestionIdMap.get(category))
|
||||
.setCategoryName(categoryMap.getOrDefault(category,"其他类型"))
|
||||
.setNum(totalMap.get(category));
|
||||
resultList.add(categoryVo);
|
||||
|
|
|
@ -5,6 +5,8 @@ import io.swagger.annotations.ApiModelProperty;
|
|||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author 曹林
|
||||
* @description 题型分类
|
||||
|
@ -35,4 +37,10 @@ public class QusetionCategoryVo {
|
|||
@ApiModelProperty("类型数量")
|
||||
private Integer num;
|
||||
|
||||
/**
|
||||
* 错题ID列表
|
||||
*/
|
||||
@ApiModelProperty("错题ID列表")
|
||||
private List<Long> errorQuestionIdList;
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue