Files
notes/work/移动杭研/问题处理/2023-02/0201-cache+账户无法查看名下子帐号-朱鹏昊.md
T
2026-03-01 01:43:46 +08:00

3.1 KiB
Raw Blame History

cache+ 账户无法查看名下子帐号

截图

排查思路

1、首先明确客户是可以看到账户管理界面的,说明有对应的权限。

2、定位到查询的位置

com.cmcc.cdn.platform.selfservice.controller.EnterpriseSubAccountController#getSubUserInfoList

代码主体流程为 获取用户id企业信息 主要涉及表 userenterprise_user

然后通过 enterprise_subuseruser 表联查得到其名下所有的用户。将每个用户的 Children 设为空后进行返回。

整体流程并没有过滤。从库中查询的话是有 5 条数据,有一条是昨天新增的,首先考虑是数据引起的,因为没有日志暂时无法具体的定位,进行日志的补充。在最近的版本进行了上线,日志显示已经全部查询完成。但是还是栈内存溢出。

二次定位到有可能是 fastjson 序列化引起的。考虑到要保留原查询框架及实体,目前方案为拷贝对象到新的实体中,解除 Controller 中返回的。

log.info("用户查询完成,开始拷贝对象");  
ArrayList<UserForAccountManagement> userForAccountManagements = new ArrayList<>();  
for (User user : users) {  
    UserForAccountManagement userForAccountManagement = new UserForAccountManagement();  
    BeanUtils.copyProperties(user, userForAccountManagement);  
    userForAccountManagements.add(userForAccountManagement);  
}

问题排查记录

利用对象的计算工具进行监控:

查询1当前页的所有人员ID为:[1682, 1675, 1648, 1641]

查询2所有人员ID为:[1682, 1675, 1648, 1641]

出表后内存占用318.4 MB

查询3从User表中取到的用户ID集合:[1682, 1675, 1648, 1641]

开始处理用户权限

用户查询完成,开始拷贝对象

转换后内存1.3 KB

return前对象内存占用1.5 KB

工具

地址

查看对象大小

System.out.println("转换后内存"+ RamUsageEstimator.humanSizeOf(userForAccountManagements));
//坐标
		<dependency>
            <groupId>org.apache.lucene</groupId>
            <artifactId>lucene-core</artifactId>
            <version>4.0.0</version>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <version>3.12.0</version>
        </dependency>

指定项目 json 转换工具

com.cmcc.cdn.platform.CustomWebAppConfigurer

前端沟通

NORMAL_ESOP_MANAGE(企业)

TYMH_YYZHGL

有这两个权限之一的有账户管理模块

1、对于集团业务管理员,是/businessManage/managerList 接口,它只需要看用户,不需要用户的查看,编辑,删除权限的东西,操作栏中的东西是一次就查完了。

1、对于企业客户接口/selfService/enterprisesubuser/getCpSubUserInfoList。页面操作是单独发起的。