Skip to content

Commit

Permalink
解决在线用户功能点击开来报错
Browse files Browse the repository at this point in the history
  class com.alibaba.fastjson2.JSONObject cannot be cast to class com.laigeoffer.pmhub.base.core.core.domain.model.LoginUser
  • Loading branch information
huangliang committed Aug 2, 2024
1 parent 1736f60 commit f555202
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.laigeoffer.pmhub.system.controller;

import com.alibaba.fastjson2.JSONObject;
import com.laigeoffer.pmhub.base.core.annotation.Log;
import com.laigeoffer.pmhub.base.core.config.redis.RedisService;
import com.laigeoffer.pmhub.base.core.constant.CacheConstants;
Expand Down Expand Up @@ -40,7 +41,8 @@ public TableDataInfo list(String ipaddr, String userName) {
Collection<String> keys = redisService.keys(CacheConstants.LOGIN_TOKEN_KEY + "*");
List<SysUserOnline> userOnlineList = new ArrayList<SysUserOnline>();
for (String key : keys) {
LoginUser user = redisService.getCacheObject(key);
JSONObject jsonObject = redisService.getCacheObject(key);
LoginUser user = jsonObject.toJavaObject(LoginUser.class);
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));
Expand Down

0 comments on commit f555202

Please sign in to comment.