去除login 的获取用户信息
This commit is contained in:
@@ -21,18 +21,6 @@ import java.util.List;
|
||||
@CrossOrigin(originPatterns = {"*"}, allowCredentials = "true")
|
||||
public class LoginUserController {
|
||||
|
||||
|
||||
@GetMapping("GetUserMod")
|
||||
public List<BoaModule> getUserMod() {
|
||||
return YschBaseOpenApi.getUserModule(UserContext.getUserId(),UserContext.getSchId());
|
||||
}
|
||||
|
||||
@GetMapping("GetUserInfo")
|
||||
public UserContext.UserInfo getUserInfo() {
|
||||
return UserContext.getCurrentUser();
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("Logout")
|
||||
protected void logout(HttpServletRequest request) {
|
||||
HttpSession session = request.getSession();
|
||||
|
||||
@@ -21,7 +21,6 @@ import java.util.List;
|
||||
@CrossOrigin(originPatterns = {"*"}, allowCredentials = "true")
|
||||
public class UserController {
|
||||
|
||||
|
||||
@GetMapping("getUserMod")
|
||||
public List<BoaModule> getUserMod() {
|
||||
return YschBaseOpenApi.getUserModule(UserContext.getUserId(),UserContext.getSchId());
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -6,6 +6,8 @@ public class RedisConstants {
|
||||
|
||||
//-----------------------------过期时间--------------------------
|
||||
|
||||
public static final long CACHE_EXPIRE_1M = 60 * 1000;
|
||||
|
||||
public static final long CACHE_EXPIRE_5M = 5 * 60 * 1000;
|
||||
|
||||
public static final long CACHE_EXPIRE_10M = 10 * 60 * 1000;
|
||||
@@ -22,6 +24,8 @@ public class RedisConstants {
|
||||
|
||||
//-------------------------------系统---------------------------------------
|
||||
|
||||
public static final String SYSTEM_GROUP_TREE = CachePrefix+ ".system_group_tree";
|
||||
|
||||
//系统年级
|
||||
public static final String SYSTEM_GRAGE =CachePrefix+ ".system_grdae";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user