| | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.doumee.biz.system.SystemDictDataBiz; |
| | | import com.doumee.core.model.LoginUserInfo; |
| | | import com.doumee.service.business.third.model.LoginUserInfo; |
| | | import com.doumee.core.utils.Constants; |
| | | import com.doumee.core.utils.HttpsUtil; |
| | | import com.doumee.dao.system.SystemUserMapper; |
| | |
| | | LoginUserInfo loginUserInfo = this.getUserInfoByToken(token); |
| | | //删除老的token |
| | | redisTemplate.delete(Constants.REDIS_TOKEN_KEY+token); |
| | | systemUserMapper.update(null,new UpdateWrapper<SystemUser>().lambda().set(SystemUser::getOpenid,null).eq(SystemUser::getId,loginUserInfo.getId())); |
| | | systemUserMapper.update(null,new UpdateWrapper<SystemUser>().lambda().set(SystemUser::getOpenid,null) |
| | | .eq(SystemUser::getId,loginUserInfo.getId())); |
| | | |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | |
| | | try { |
| | | String userInfo = (String) redisTemplate.opsForValue().get(Constants.REDIS_TOKEN_KEY+token); |
| | | claims = JSONObject.toJavaObject(JSONObject.parseObject(userInfo),LoginUserInfo.class); |
| | | refreshToken(token); |
| | | } catch (Exception e) { |
| | | claims = null; |
| | | } |
| | | return claims; |
| | | } |
| | | |
| | | /** |
| | | * 向后延伸有效期保持会话继续 |
| | | * @param token |
| | | */ |
| | | public void refreshTokenTime(String token ) { |
| | | log.error("===============开始刷新登录token"+token); |
| | | redisTemplate.expire(Constants.REDIS_TOKEN_KEY+token,jwtProperties.getExpiration(), TimeUnit.MILLISECONDS); |
| | | log.error("===============结束刷新登录token"+token); |
| | | // redisTemplate.opsForValue().set(Constants.REDIS_TOKEN_KEY+token,usrerInfo,jwtProperties.getExpiration(), TimeUnit.MILLISECONDS); |
| | | } |
| | | } |