| | |
| | | import java.util.Collection;
|
| | | import java.util.Collections;
|
| | | import java.util.List;
|
| | |
|
| | | import lombok.AllArgsConstructor;
|
| | | import org.springframework.beans.factory.annotation.Autowired;
|
| | | import org.springframework.security.access.prepost.PreAuthorize;
|
| | | import org.springframework.web.bind.annotation.DeleteMapping;
|
| | |
| | | */
|
| | | @RestController
|
| | | @RequestMapping("/monitor/online")
|
| | | @AllArgsConstructor
|
| | | public class SysUserOnlineController extends BaseController
|
| | | {
|
| | | @Autowired
|
| | | private ISysUserOnlineService userOnlineService;
|
| | |
|
| | | @Autowired
|
| | | private RedisCache redisCache;
|
| | |
|
| | | @PreAuthorize("@ss.hasPermi('monitor:online:list')")
|
| | |
| | | LoginUser user = redisCache.getCacheObject(key);
|
| | | if (StringUtils.isNotEmpty(ipaddr) && StringUtils.isNotEmpty(userName))
|
| | | {
|
| | | if (StringUtils.equals(ipaddr, user.getIpaddr()) && StringUtils.equals(userName, user.getUsername()))
|
| | | {
|
| | | userOnlineList.add(userOnlineService.selectOnlineByInfo(ipaddr, userName, user));
|
| | | }
|
| | | userOnlineList.add(userOnlineService.selectOnlineByInfo(ipaddr, userName, user));
|
| | | }
|
| | | else if (StringUtils.isNotEmpty(ipaddr))
|
| | | {
|
| | | if (StringUtils.equals(ipaddr, user.getIpaddr()))
|
| | | {
|
| | | userOnlineList.add(userOnlineService.selectOnlineByIpaddr(ipaddr, user));
|
| | | }
|
| | | userOnlineList.add(userOnlineService.selectOnlineByIpaddr(ipaddr, user));
|
| | | }
|
| | | else if (StringUtils.isNotEmpty(userName) && StringUtils.isNotNull(user.getUser()))
|
| | | {
|
| | | if (StringUtils.equals(userName, user.getUsername()))
|
| | | {
|
| | | userOnlineList.add(userOnlineService.selectOnlineByUserName(userName, user));
|
| | | }
|
| | | userOnlineList.add(userOnlineService.selectOnlineByUserName(userName, user));
|
| | | }
|
| | | else
|
| | | {
|
| | |
| | | public AjaxResult forceLogout(@PathVariable String tokenId)
|
| | | {
|
| | | redisCache.deleteObject(CacheConstants.LOGIN_TOKEN_KEY + tokenId);
|
| | | return AjaxResult.success();
|
| | | return success();
|
| | | }
|
| | | }
|