|
|
|
@ -2083,27 +2083,28 @@ public Map<String,List<Map<String, Object>>> getStudentMonthlyScores(LaborDto la
|
|
|
|
|
lastScore = new BigDecimal(lastScore).setScale(2, RoundingMode.HALF_UP).doubleValue();
|
|
|
|
|
blockData.put("classLastScore", lastScore);
|
|
|
|
|
|
|
|
|
|
// 知识点出现总次数
|
|
|
|
|
((Map<String, Integer>)current.get("knowledgeCounts")).entrySet().stream()
|
|
|
|
|
.filter(e -> isBelongToBlock(e.getKey(), block, finalAppraise))
|
|
|
|
|
.forEach(e -> blockData.put(e.getKey(), e.getValue()));
|
|
|
|
|
|
|
|
|
|
// 处理知识点次数
|
|
|
|
|
// 获取当前知识块下的所有知识点
|
|
|
|
|
Set<String> blockKnowledgePoints = getKnowledgePointsForBlock(block, finalAppraise);
|
|
|
|
|
// 获取次数统计(空值安全)
|
|
|
|
|
Map<String, Integer> counts = current != null && current.containsKey("knowledgeCounts")
|
|
|
|
|
? (Map<String, Integer>) current.get("knowledgeCounts")
|
|
|
|
|
: Collections.emptyMap();
|
|
|
|
|
|
|
|
|
|
/* // 知识点出现总次数(兼容旧逻辑)
|
|
|
|
|
blockKnowledgePoints.forEach(point ->
|
|
|
|
|
blockData.put(point, counts.getOrDefault(point, 0))
|
|
|
|
|
);*/
|
|
|
|
|
|
|
|
|
|
// 构建知识点明细列表
|
|
|
|
|
List<Map<String, Object>> knowledgePoints = new ArrayList<>();
|
|
|
|
|
if (current.containsKey("knowledgeCounts")) {
|
|
|
|
|
Map<String, Integer> counts = (Map<String, Integer>) current.get("knowledgeCounts");
|
|
|
|
|
counts.entrySet().stream()
|
|
|
|
|
.filter(e -> isBelongToBlock(e.getKey(), block, finalAppraise))
|
|
|
|
|
.forEach(e -> {
|
|
|
|
|
Map<String, Object> point = new HashMap<>();
|
|
|
|
|
point.put("name", e.getKey());
|
|
|
|
|
point.put("count", e.getValue() != null ? e.getValue() : 0);
|
|
|
|
|
knowledgePoints.add(point);
|
|
|
|
|
blockKnowledgePoints.forEach(point -> {
|
|
|
|
|
Map<String, Object> pointData = new HashMap<>();
|
|
|
|
|
pointData.put("name", point);
|
|
|
|
|
pointData.put("count", counts.getOrDefault(point, 0));
|
|
|
|
|
knowledgePoints.add(pointData);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
blockData.put("knowledgePoints", knowledgePoints);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return blockData;
|
|
|
|
|
}).collect(Collectors.toList());
|
|
|
|
|
}
|
|
|
|
@ -2345,21 +2346,22 @@ public Map<String,List<Map<String, Object>>> getStudentMonthlyScores(LaborDto la
|
|
|
|
|
|
|
|
|
|
// 处理知识点次数
|
|
|
|
|
List<Map<String, Object>> knowledgePoints = new ArrayList<>();
|
|
|
|
|
if (currentData.containsKey("knowledgeCounts")) {
|
|
|
|
|
Map<String, Integer> counts = (Map<String, Integer>) currentData.get("knowledgeCounts");
|
|
|
|
|
Appraise finalAppraise = appraise;
|
|
|
|
|
counts.entrySet().stream()
|
|
|
|
|
.filter(e -> isBelongToBlock(e.getKey(), block, finalAppraise))
|
|
|
|
|
.forEach(e -> {
|
|
|
|
|
// 获取当前知识块下的所有知识点
|
|
|
|
|
Set<String> blockKnowledgePoints = getKnowledgePointsForBlock(block, appraise);
|
|
|
|
|
// 获取次数统计,若不存在则使用空Map
|
|
|
|
|
Map<String, Integer> counts = currentData.containsKey("knowledgeCounts")
|
|
|
|
|
? (Map<String, Integer>) currentData.get("knowledgeCounts")
|
|
|
|
|
: Collections.emptyMap();
|
|
|
|
|
|
|
|
|
|
// 遍历所有知识点,设置次数
|
|
|
|
|
for (String pointName : blockKnowledgePoints) {
|
|
|
|
|
Map<String, Object> point = new HashMap<>();
|
|
|
|
|
point.put("name", e.getKey());
|
|
|
|
|
point.put("count", e.getValue() != null ? e.getValue() : 0);
|
|
|
|
|
point.put("name", pointName);
|
|
|
|
|
point.put("count", counts.getOrDefault(pointName, 0));
|
|
|
|
|
knowledgePoints.add(point);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
blockData.put("knowledgePoints", knowledgePoints);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
scores.add(blockData);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -2367,6 +2369,26 @@ public Map<String,List<Map<String, Object>>> getStudentMonthlyScores(LaborDto la
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 新增方法:根据知识块名称获取所有知识点
|
|
|
|
|
private Set<String> getKnowledgePointsForBlock(String block, Appraise appraise) {
|
|
|
|
|
Set<String> points = new LinkedHashSet<>();
|
|
|
|
|
// 遍历appraise的子节点(知识块),找到匹配的块后收集其子节点(知识点)
|
|
|
|
|
for (AppraiseTreeNode child : appraise.getNodes()) {
|
|
|
|
|
if ("德育".equals(child.getName())) {
|
|
|
|
|
for (AppraiseTreeNode pointOne : child.getChildren()) {
|
|
|
|
|
if (block.equals(pointOne.getName())) {
|
|
|
|
|
for (AppraiseTreeNode pointTwo : pointOne.getChildren()) {
|
|
|
|
|
points.add(pointTwo.getName());
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return points;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private Set<String> loadKnowledgeBlocks(Appraise appraise) {
|
|
|
|
|
// 从appraise配置获取所有德育知识块
|
|
|
|
|