From 91e9c006a2ce431a5916b137974bd004622eb9fa Mon Sep 17 00:00:00 2001 From: huliguo <2023611923@qq.com> Date: 星期三, 09 四月 2025 20:15:45 +0800 Subject: [PATCH] 用户端代码调整测试 --- ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserController.java | 143 +++++------------------------------------------ 1 files changed, 17 insertions(+), 126 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 acd5967..9d7fac9 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 @@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.ruoyi.account.api.model.*; +import com.ruoyi.account.dto.ApplyForAdmissionDTO; import com.ruoyi.account.dto.ChangeAppUserInfo; import com.ruoyi.account.mapper.AppUserMapper; import com.ruoyi.account.service.*; @@ -189,64 +190,22 @@ } - @ResponseBody - @GetMapping("/recommend") - @ApiOperation(value = "推广中心", tags = {"小程序-推广中心"}) - public R<AppUser> recommend() { - Long userId = tokenService.getLoginUserApplet().getUserid(); - //获取绑定门店 - AppUser user = appUserService.getById(userId); - return R.ok(user); - } + @GetMapping("/index") - @ApiOperation(value = "个人中心首页", tags = {"小程序-个人中心首页"}) + @ApiOperation(value = "个人信息", tags = {"小程序-个人中心首页"}) public R<AppUser> index() { - Long userId = tokenService.getLoginUserApplet().getUserid(); - //当前用户信息 - AppUser user = appUserService.getById(userId); - return R.ok(user); + return R.ok(appUserService.index()); } - /** - * 获取门店作为服务商的所有用户 - * @param shopId - * @return - */ - public Set<Long> getShopServerUser(Integer shopId){ - Shop shop = shopClient.getShopById(shopId).getData(); - List<Shop> shopList = shopClient.getAllShop().getData(); - List<Long> appUserIds = shopList.stream().map(Shop::getAppUserId).collect(Collectors.toList()); - Long appUserId = shop.getAppUserId(); - //所有未开店的用户 - List<AppUser> list = appUserService.list(new LambdaQueryWrapper<AppUser>().eq(AppUser::getDelFlag, 0) - .ne(AppUser::getStatus, 3).notIn(AppUser::getId, appUserIds)); - Set<Long> ids = new HashSet<>(); - getShopServerUser(appUserId, list, ids); - return ids; - } + - - public void getShopServerUser(Long appUserId, List<AppUser> appUserList, Set<Long> ids){ - List<AppUser> collect = appUserList.stream().filter(s->s.getInviteUserId().equals(appUserId)).collect(Collectors.toList()); - if(collect.size() == 0){ - return; - } - Set<Long> appUserSet = collect.stream().map(AppUser::getId).collect(Collectors.toSet()); - if(ids.containsAll(appUserSet)){ - return; - } - ids.addAll(appUserSet); - for (AppUser appUser : collect) { - getShopServerUser(appUser.getId(), appUserList, ids); - } - } @@ -266,34 +225,6 @@ return R.ok(); } - /** - * 获取用户的祖籍列表 - */ - @GetMapping("/getUserAncestorList") - public R<List<AppUser>> getUserAncestorList(Long id) { - List<AppUser> list = appUserService.getUserAncestorList(id, null); - return R.ok(list); - } - - /** - * 获取用户的直帮上级用户 - */ - @ResponseBody - @PostMapping("/getSuperiorLeader") - @ApiOperation(value = "获取用户的直帮上级用户") - public R<AppUser> getSuperiorLeader(@RequestParam("id") Long id) { - AppUser superiorLeader = appUserService.getSuperiorLeader(id); - return R.ok(superiorLeader); - } - - - @ResponseBody - @PostMapping("/onlineRecord") - @ApiOperation(value = "10分钟定时任务调用,记录用户在线时长", tags = {"小程序-个人中心首页"}) - public R onlineRecord() { - appUserService.onlineRecord(); - return R.ok(); - } /** @@ -357,8 +288,8 @@ List<Order> orders = orderClient.getRedeemedOrdersByShop(shopId).getData(); List<Long> userIds = orders.stream().map(Order::getAppUserId).collect(Collectors.toList()); //门店作为服务商的用户 - Set<Long> shopServerUser = getShopServerUser(shopId); - userIds.addAll(shopServerUser); + /* Set<Long> shopServerUser = getShopServerUser(shopId); + userIds.addAll(shopServerUser);*/ queryWrapper.in(!CollectionUtils.isEmpty(userIds), "id", userIds) .like(StringUtils.isNotEmpty( appUser.getName()),"name", appUser.getName()); } @@ -391,12 +322,6 @@ appUser.setExcludeStatus(3); IPage<AppUser> appuserPage = appUserService.getAppuserPage(pageNum, pageSize, appUser, shopId, userId); for (AppUser record : appuserPage.getRecords()) { - if (record.getInviteUserId() != null) { - AppUser byId1 = appUserService.getById(record.getInviteUserId()); - if (byId1!=null) { - record.setInviteUserName(byId1.getName()); - } - } Shop shop1 = shopClient.getServiceProvider(record.getId()).getData(); if(null != shop1){ record.setShopName(shop1.getName()); @@ -425,12 +350,12 @@ } IPage<AppUser> appuserPage = appUserService.getAppuserPage(pageNum, pageSize, appUser, shopId, userId); for (AppUser record : appuserPage.getRecords()) { - if (record.getInviteUserId() != null) { + /* if (record.getInviteUserId() != null) { AppUser byId1 = appUserService.getById(record.getInviteUserId()); if (byId1!=null) { record.setInviteUserName(byId1.getName()); } - } + }*/ if (record.getShopId()!=null){ R<Shop> shopById = shopClient.getShopById(record.getShopId()); if (shopById.getData()!=null){ @@ -461,8 +386,8 @@ for (Order datum : listR.getData()) { userIds.add(datum.getAppUserId()); } - Set<Long> shopServerUser = getShopServerUser(objectId); - userIds.addAll(shopServerUser); + /* Set<Long> shopServerUser = getShopServerUser(objectId); + userIds.addAll(shopServerUser);*/ } IPage<AppUser> appuserPage = appUserService.getAppuserPage1(pageCurr, pageSize, appUser, userIds); return R.ok(appuserPage); @@ -530,19 +455,19 @@ byId.setShopNames(shopName); } //推广人 - if (byId.getInviteUserId() != null) { + /*if (byId.getInviteUserId() != null) { AppUser appUser = appUserService.getById(byId.getInviteUserId()); if(null != appUser){ byId.setInviteUserName(appUser.getName()); } - } + }*/ //最后下单时间 R<Order> lastOrder = remoteOrderGoodsClient.getLastOrder(id); if (lastOrder.getData() != null) { byId.setLastOrderTime(lastOrder.getData().getCreateTime()); } - List<AppUser> list = appUserService.lambdaQuery().eq(AppUser::getInviteUserId, id).list(); - byId.setBottomUsers(list); + /*List<AppUser> list = appUserService.lambdaQuery().eq(AppUser::getInviteUserId, id).list(); + byId.setBottomUsers(list);*/ //消费总金额 if(null == shopId || 1 == sysUser.getRoleType()){ shopId = -1; @@ -561,31 +486,7 @@ 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("/bottom") - @ApiOperation(value = "用户列表-绑定下级列表", tags = {"管理后台"}) - public R<Page<AppUser>> bottom(Long id, Integer pageNum, Integer pageSize) { - //绑定下级 - Page<AppUser> page = appUserService.lambdaQuery() - .eq(AppUser::getInviteUserId, id) - .eq(AppUser::getDelFlag, 0) - .eq(AppUser::getStatus, 1) - .page(Page.of(pageNum, pageSize)); - return R.ok(page); - - } @GetMapping("/orders") @ApiOperation(value = "用户列表-订单列表", tags = {"管理后台"}) @@ -639,16 +540,6 @@ } - /** - * 设置指定用户的下级用户绑定门店 - */ - @PostMapping("/setLowerUserShop") - public R<Void> setLowerUserShop(@RequestParam("userId") Long userId,@RequestParam("shopId") Integer shopId) { - appUserService.update(new LambdaUpdateWrapper<AppUser>() - .set(AppUser::getShopId,shopId) - .eq(AppUser::getInviteUserId, userId)); - return R.ok(); - } /** @@ -718,8 +609,8 @@ shopId = data.getObjectId(); if(null == userId){ userIds = orderClient.getAppUserByShoppingShop(shopId).getData(); - Set<Long> shopServerUser = getShopServerUser(shopId); - userIds.addAll(shopServerUser); + /* Set<Long> shopServerUser = getShopServerUser(shopId); + userIds.addAll(shopServerUser);*/ }else{ userIds = new HashSet<>(); userIds.add(userId); -- Gitblit v1.7.1