From 4ea15c3e2a3f0434df79a1b49fe4e90f7337b025 Mon Sep 17 00:00:00 2001 From: luodangjia <luodangjia> Date: 星期四, 06 二月 2025 18:16:40 +0800 Subject: [PATCH] 修改物流信息导入模板 --- ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserController.java | 61 ++++++++++++++++++++++++++++-- 1 files changed, 56 insertions(+), 5 deletions(-) diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserController.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserController.java index 8c18942..e354037 100644 --- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserController.java +++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserController.java @@ -15,11 +15,13 @@ import com.ruoyi.account.util.weChat.EnvVersion; import com.ruoyi.account.util.weChat.WeChatUtil; import com.ruoyi.account.vo.*; +import com.ruoyi.common.core.constant.CacheConstants; import com.ruoyi.common.core.domain.R; import com.ruoyi.common.core.utils.StringUtils; import com.ruoyi.common.core.utils.bean.BeanUtils; import com.ruoyi.common.core.web.controller.BaseController; import com.ruoyi.common.core.web.page.PageInfo; +import com.ruoyi.common.redis.service.RedisService; import com.ruoyi.common.security.service.TokenService; import com.ruoyi.order.feignClient.OrderClient; import com.ruoyi.order.feignClient.RemoteOrderGoodsClient; @@ -33,6 +35,7 @@ import com.ruoyi.other.api.feignClient.VipSettingClient; import com.ruoyi.system.api.domain.SysUser; import com.ruoyi.system.api.feignClient.SysUserClient; +import com.ruoyi.system.api.model.LoginUser; import io.swagger.annotations.*; import org.springframework.beans.factory.annotation.Value; import org.springframework.util.CollectionUtils; @@ -98,7 +101,9 @@ private BalanceChangeRecordService balanceChangeRecordService; @Resource private UserChangeLogService userChangeLogService; - + @Resource + private RedisService redisService; + @Resource private WeChatUtil weChatUtil; @@ -670,7 +675,21 @@ AppUser byId = appUserService.getById(id); byId.setStatus(status); appUserService.updateById(byId); + loginout(id); return R.ok(); + } + + private void loginout(Long userId) { + Collection<String> keys = redisService.keys(CacheConstants.LOGIN_TOKEN_KEY + "*"); + if (!CollectionUtils.isEmpty(keys)) { + for (String key : keys) { + LoginUser user = redisService.getCacheObject(key); + if (user.getUserid().equals(userId)) { + redisService.deleteObject(key); + break; + } + } + } } @GetMapping("/select") @@ -776,6 +795,20 @@ return R.ok(byId); } + /** + * 获取指定用户的下级用户 + */ + @GetMapping("/bottom/list") + @ApiOperation(value = "用户列表-下级用户", tags = {"管理后台"}) + public R<Page<AppUser>> bottom(Integer pageNum, Integer pageSize, Long userId){ + Page<AppUser> page = appUserService.page(Page.of(pageNum, pageSize), new LambdaQueryWrapper<AppUser>() + .eq(AppUser::getInviteUserId, userId)); + return R.ok(page); + } + + + + @GetMapping("/change/vip") @@ -797,7 +830,6 @@ byId.setVipId(vipId); appUserService.updateById(byId); return R.ok(); - } @GetMapping("/bottom") @@ -811,7 +843,7 @@ @GetMapping("/orders") @ApiOperation(value = "用户列表-订单列表", tags = {"管理后台"}) - public R<List<Order>> orders(Long id) { + public R<JSONObject> orders(Long id,Integer pageNum, Integer pageSize) { Long userid = tokenService.getLoginUser().getUserid(); SysUser sysUser = sysUserClient.getSysUser(userid).getData(); Integer shopId = -1; @@ -819,8 +851,27 @@ shopId = sysUser.getObjectId(); } R<List<Order>> listR = remoteOrderGoodsClient.byUserId(id,shopId); - return R.ok(listR.getData()); - + List<Order> data = listR.getData(); + Integer total = data.size(); + // 手动分页 + if (data != null && data.size() > 0) { + if (pageNum == null || pageNum == 0) { + pageNum = 1; + } + if (pageSize == null || pageSize == 0) { + pageSize = 10; + } + data = data.stream() + .skip((pageNum - 1) * pageSize) + .limit(pageSize) + .collect(Collectors.toList()); + } + JSONObject jsonObject = new JSONObject(); + jsonObject.put("records", data); + jsonObject.put("total", total); + jsonObject.put("size", pageSize); + jsonObject.put("current", pageNum); + return R.ok(jsonObject); } -- Gitblit v1.7.1