xuhy
2025-01-15 c27c1f2beb4ca89a94eaa854fce6b4553db8f2f8
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserController.java
@@ -374,7 +374,7 @@
                .eq(AppUser::getDelFlag, 0));
        ArrayList<Long> userIds = new ArrayList<>();
        userIds.add(userId);
        getUserAncestorList(user,userIds, appUserList);
        getUserAncestorList(user,userIds,new ArrayList<>(),appUserList);
//        Long count1 = appUserService.lambdaQuery().ne(AppUser::getStatus,3).eq(AppUser::getVipId, 1).eq(AppUser::getInviteUserId, userId).or().eq(AppUser::getTopInviteId,userId).count();
//        Long count2 = appUserService.lambdaQuery().ne(AppUser::getStatus,3).eq(AppUser::getVipId, 2).eq(AppUser::getInviteUserId, userId).or().eq(AppUser::getTopInviteId,userId).count();
//        Long count3 = appUserService.lambdaQuery().ne(AppUser::getStatus,3).eq(AppUser::getVipId, 3).eq(AppUser::getInviteUserId, userId).or().eq(AppUser::getTopInviteId,userId).count();
@@ -399,8 +399,8 @@
        }
        return R.ok(user);
    }
    public void getUserAncestorList(AppUser user,List<Long> userIds, List<AppUser> list) {
        List<AppUser> children = list.stream().filter(u -> userIds.contains(u.getInviteUserId()) || userIds.contains(u.getTopInviteId())).collect(Collectors.toList());
    public void getUserAncestorList(AppUser user,List<Long> userIds, List<AppUser> children,List<AppUser> list) {
        children = list.stream().filter(u -> userIds.contains(u.getInviteUserId()) || userIds.contains(u.getTopInviteId())).collect(Collectors.toList());
        if(!CollectionUtils.isEmpty(children)){
            user.setCount1((user.getCount1() == null ? 0L : user.getCount1()) + children.stream().filter(e->e.getVipId() == 1).count());
            user.setCount2((user.getCount2() == null ? 0L : user.getCount2()) + children.stream().filter(e->e.getVipId() == 2).count());
@@ -410,7 +410,7 @@
            user.setCount6((user.getCount6() == null ? 0L : user.getCount6()) + children.stream().filter(e->e.getVipId() == 6).count());
            user.setCount7((user.getCount7() == null ? 0L : user.getCount7()) + children.stream().filter(e->e.getVipId() == 7).count());
            List<Long> userIdList = children.stream().map(AppUser::getId).collect(Collectors.toList());
            getUserAncestorList(user,userIdList, children);
            getUserAncestorList(user,userIdList, children,list);
        }
    }
@@ -724,7 +724,10 @@
    @GetMapping("/orders")
    @ApiOperation(value = "用户列表-订单列表", tags = {"管理后台"})
    public R<List<Order>> orders(Long id) {
        R<List<Order>> listR = remoteOrderGoodsClient.byUserId(id);
        Long userid = tokenService.getLoginUser().getUserid();
        SysUser sysUser = sysUserClient.getSysUser(userid).getData();
        Long shopId = Long.valueOf(sysUser.getObjectId());
        R<List<Order>> listR = remoteOrderGoodsClient.byUserId(id,shopId);
        return R.ok(listR.getData());
    }
@@ -995,6 +998,17 @@
    
    
    /**
     * 检查会员降级
     * @param appUserId
     */
    @PostMapping("/app-user/vipDemotion")
    public void vipDemotion(@RequestParam("appUserId") Long appUserId){
        appUserService.vipDemotion(appUserId);
    }
    /**
     * 用户降级检测
     */
    @PostMapping("/demotionDetection")