| | |
| | | } |
| | | // 2. 拼接数据 |
| | | Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap( |
| | | convertSet(pageResult.getList(), statusType -> Long.parseLong(statusType.getCreator()))); |
| | | convertSet(pageResult.getList(), statusType -> NumberUtils.parseLong(statusType.getCreator()))); |
| | | Map<Long, DeptRespDTO> deptMap = deptApi.getDeptMap( |
| | | convertSetByFlatMap(pageResult.getList(), CrmBusinessStatusTypeDO::getDeptIds, Collection::stream)); |
| | | return success(BeanUtils.toBean(pageResult, CrmBusinessStatusRespVO.class, statusTypeVO -> { |
| | | statusTypeVO.setCreator(userMap.get(NumberUtils.parseLong(statusTypeVO.getCreator())).getNickname()); |
| | | // 创建人可能已删除(如离职账号),显示“已删除用户”而不是抛 NPE 导致整页查询失败 |
| | | AdminUserRespDTO creator = userMap.get(NumberUtils.parseLong(statusTypeVO.getCreator())); |
| | | statusTypeVO.setCreator(creator != null ? creator.getNickname() : "已删除用户"); |
| | | statusTypeVO.setDeptNames(convertList(statusTypeVO.getDeptIds(), |
| | | deptId -> deptMap.containsKey(deptId) ? deptMap.get(deptId).getName() : null)); |
| | | })); |