去除login 的获取用户信息

This commit is contained in:
2026-08-17 10:39:01 +08:00
parent 7d843d8c1b
commit cf33feb7d0
4 changed files with 35 additions and 28 deletions
@@ -179,22 +179,38 @@ public class ComSchTreeService implements IComSchTreeService {
}
}
// public List<BoaGroup> getGroupTree() {
// return YschBaseOpenApi.getGroupTree();
// String cacheKey = "bsch.classmanage.group_tree";
// // 直接从Redis获取JSON字符串
// String json = redisUtil.get(cacheKey, String.class);
// // 解析为树结构
// List<BoaGroup> treeList = OtherUtil.jsonParseArrayTree(json, BoaGroup.class);
// // 过滤并处理:type=2的节点停止递归
// return filterTreeByType(treeList, NodeType.SCHOOL.getId());
//}
public List<BoaGroup> getGroupTree() {
BoaGroup group = YschBaseOpenApi.getGroupTree();
return Collections.singletonList(group);
List<BoaGroup> treeList = getCacheSysGroupTree();
// 过滤并处理:type=2的节点停止递归
return filterTreeByType(treeList, NodeType.SCHOOL.getId());
}
public List<BoaGroup> getCacheSysGroupTree() {
String cacheKey= RedisConstants.SYSTEM_GROUP_TREE;
List<BoaGroup> cached = redisUtil.getList(cacheKey, BoaGroup.class);
if (cached != null && !cached.isEmpty()) {
return cached;
}
// 2. 加锁防止缓存击穿 + 双重检查
synchronized (this) {
cached = redisUtil.getList(cacheKey, BoaGroup.class);
if (cached != null && !cached.isEmpty()) {
return cached;
}
// 3. 从数据库查询
BoaGroup group = YschBaseOpenApi.getGroupTree();
List<BoaGroup> list=Collections.singletonList(group);
// 4. 仅缓存非空结果;空结果不缓存,防止空缓存污染(穿透风险可忽略)
if (!list.isEmpty()) {
redisUtil.set(cacheKey, list, RedisConstants.CACHE_EXPIRE_1M);
}
return list;
}
}
public List<SelectIntVO> getSchoolList() {