| | |
| | | package com.ruoyi.account.controller; |
| | | |
| | | |
| | | import cn.hutool.core.collection.CollectionUtil; |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | import java.util.stream.Stream; |
| | | |
| | | import static com.ruoyi.common.core.constant.SecurityConstants.USER_APPLET_KEY; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | } |
| | | |
| | | private void loginout(Long userId) { |
| | | // 获取所有符合模式的缓存键 |
| | | Collection<String> keys = redisService.keys(CacheConstants.LOGIN_TOKEN_KEY + "*"); |
| | | if (!CollectionUtils.isEmpty(keys)) { |
| | | if (CollectionUtils.isEmpty(keys)) { |
| | | return; // 如果没有匹配的键,直接返回 |
| | | } |
| | | |
| | | // 遍历所有键并删除与指定用户ID相关的登录信息 |
| | | for (String key : keys) { |
| | | LoginUser user = redisService.getCacheObject(key); |
| | | if (user == null || user.getUserid() == null) { |
| | | continue; |
| | | } |
| | | if (user.getUserid().equals(userId)) { |
| | | if (user != null && userId.equals(user.getUserid())) { |
| | | redisService.deleteObject(key); |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | userId = orderClient.getAppUserByShoppingShop(shopId).getData(); |
| | | } |
| | | UserStatistics userStatistics = appUserMapper.getUserStatistics(shopId, userId); |
| | | List<Shop> shopList = shopClient.getAllShop().getData(); |
| | | if (CollectionUtil.isNotEmpty(shopList)){ |
| | | long count = shopList.stream().map(Shop::getAppUserId).distinct().count(); |
| | | userStatistics.setShopUser((int) count); |
| | | }else { |
| | | userStatistics.setShopUser(0); |
| | | } |
| | | return R.ok(userStatistics); |
| | | } |
| | | |