class SysUserOnlineController extends BaseController
{
    @Autowired
    private ISysUserOnlineService userOnlineService;

    @Autowired
    private RedisCache redisCache;

    @PreAuthorize("@ss.hasPermi('monitor:online:list')")
    @GetMapping("/list")
    public TableDataInfo list(String ipaddr, String userName)
    {<FILL_FUNCTION_BODY>}

    /**
     * 强退用户
     */
    @PreAuthorize("@ss.hasPermi('monitor:online:forceLogout')")
    @Log(title = "在线用户", businessType = BusinessType.FORCE)
    @DeleteMapping("/{tokenId}")
    public AjaxResult forceLogout(@PathVariable String tokenId)
    {
        redisCache.deleteObject(CacheConstants.LOGIN_TOKEN_KEY + tokenId);
        return success();
    }
}

        Collection<String> keys = redisCache.keys(CacheConstants.LOGIN_TOKEN_KEY + "*");
        List<SysUserOnline> userOnlineList = new ArrayList<SysUserOnline>();
        for (String key : keys)
        {
            LoginUser user = redisCache.getCacheObject(key);
            if (StringUtils.isNotEmpty(ipaddr) && StringUtils.isNotEmpty(userName))
            {
                userOnlineList.add(userOnlineService.selectOnlineByInfo(ipaddr, userName, user));
            }
            else if (StringUtils.isNotEmpty(ipaddr))
            {
                userOnlineList.add(userOnlineService.selectOnlineByIpaddr(ipaddr, user));
            }
            else if (StringUtils.isNotEmpty(userName) && StringUtils.isNotNull(user.getUser()))
            {
                userOnlineList.add(userOnlineService.selectOnlineByUserName(userName, user));
            }
            else
            {
                userOnlineList.add(userOnlineService.loginUserToUserOnline(user));
            }
        }
        Collections.reverse(userOnlineList);
        userOnlineList.removeAll(Collections.singleton(null));
        return getDataTable(userOnlineList);
    
<methods>public non-sealed void <init>() ,public com.ruoyi.common.core.domain.AjaxResult error() ,public com.ruoyi.common.core.domain.AjaxResult error(java.lang.String) ,public java.lang.Long getDeptId() ,public com.ruoyi.common.core.domain.model.LoginUser getLoginUser() ,public java.lang.Long getUserId() ,public java.lang.String getUsername() ,public void initBinder(org.springframework.web.bind.WebDataBinder) ,public java.lang.String redirect(java.lang.String) ,public com.ruoyi.common.core.domain.AjaxResult success() ,public com.ruoyi.common.core.domain.AjaxResult success(java.lang.String) ,public com.ruoyi.common.core.domain.AjaxResult success(java.lang.Object) ,public com.ruoyi.common.core.domain.AjaxResult warn(java.lang.String) <variables>protected final org.slf4j.Logger logger