| | |
| | | .eq(AppUser::getDelFlag, 0)); |
| | | ArrayList<Long> userIds = new ArrayList<>(); |
| | | userIds.add(userId); |
| | | getUserAncestorList(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(); |
| | |
| | | // Long count5 = appUserService.lambdaQuery().ne(AppUser::getStatus,3).eq(AppUser::getVipId, 5).eq(AppUser::getInviteUserId, userId).or().eq(AppUser::getTopInviteId,userId).count(); |
| | | // Long count6 = appUserService.lambdaQuery().ne(AppUser::getStatus,3).eq(AppUser::getVipId, 6).eq(AppUser::getInviteUserId, userId).or().eq(AppUser::getTopInviteId,userId).count(); |
| | | // Long count7 = appUserService.lambdaQuery().ne(AppUser::getStatus,3).eq(AppUser::getVipId, 7).eq(AppUser::getInviteUserId, userId).or().eq(AppUser::getTopInviteId,userId).count(); |
| | | user.setCount1(count1); |
| | | user.setCount2(count2); |
| | | user.setCount3(count3); |
| | | user.setCount4(count4); |
| | | user.setCount5(count5); |
| | | user.setCount6(count6); |
| | | user.setCount7(count7); |
| | | // user.setCount1(count1); |
| | | // user.setCount2(count2); |
| | | // user.setCount3(count3); |
| | | // user.setCount4(count4); |
| | | // user.setCount5(count5); |
| | | // user.setCount6(count6); |
| | | // user.setCount7(count7); |
| | | |
| | | List<UserSignRecord> list = userSignRecordService.lambdaQuery().eq(UserSignRecord::getSignDay, LocalDate.now()) |
| | | .eq(UserSignRecord::getAppUserId,userId).list(); |
| | |
| | | } |
| | | return R.ok(user); |
| | | } |
| | | private Long count1 = 0L; |
| | | private Long count2 = 0L; |
| | | private Long count3 = 0L; |
| | | private Long count4 = 0L; |
| | | private Long count5 = 0L; |
| | | private Long count6 = 0L; |
| | | private Long count7 = 0L; |
| | | public void getUserAncestorList(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)){ |
| | | count1 = count1 + children.stream().filter(e->e.getVipId() == 1).count(); |
| | | count2 = count2 + children.stream().filter(e->e.getVipId() == 2).count(); |
| | | count3 = count3 + children.stream().filter(e->e.getVipId() == 3).count(); |
| | | count4 = count4 + children.stream().filter(e->e.getVipId() == 4).count(); |
| | | count5 = count5 + children.stream().filter(e->e.getVipId() == 5).count(); |
| | | count6 = count6 + children.stream().filter(e->e.getVipId() == 6).count(); |
| | | count7 = count7 + children.stream().filter(e->e.getVipId() == 7).count(); |
| | | 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()); |
| | | user.setCount3((user.getCount3() == null ? 0L : user.getCount3()) + children.stream().filter(e->e.getVipId() == 3).count()); |
| | | user.setCount4((user.getCount4() == null ? 0L : user.getCount4()) + children.stream().filter(e->e.getVipId() == 4).count()); |
| | | user.setCount5((user.getCount5() == null ? 0L : user.getCount5()) + children.stream().filter(e->e.getVipId() == 5).count()); |
| | | 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(userIdList, children); |
| | | getUserAncestorList(user,userIdList, children,list); |
| | | } |
| | | } |
| | | |
| | |
| | | DangerInfoDto dangerInfoDto = new DangerInfoDto(); |
| | | BeanUtils.copyProperties(data, dangerInfoDto); |
| | | List<UserPoint> list1 = userPointService.lambdaQuery().eq(UserPoint::getType, 1).ge(UserPoint::getCreateTime, now.minusDays(data.getKeepBuyDay())).list(); |
| | | List<UserPoint> list2 = userPointService.lambdaQuery().eq(UserPoint::getType, 2).ge(UserPoint::getCreateTime, now.minusDays(data.getKeepBuyDay())).list(); |
| | | List<UserPoint> list3 = userPointService.lambdaQuery().eq(UserPoint::getType, 5).ge(UserPoint::getCreateTime, now.minusDays(data.getKeepBuyDay())).list(); |
| | | List<UserPoint> list2 = userPointService.lambdaQuery().eq(UserPoint::getType, 9).ge(UserPoint::getCreateTime, now.minusDays(data.getKeepBuyDay())).list(); |
| | | List<UserPoint> list3 = userPointService.lambdaQuery().eq(UserPoint::getType, 8).ge(UserPoint::getCreateTime, now.minusDays(data.getKeepBuyDay())).list(); |
| | | Integer userKeepBuyPoint = 0; |
| | | for (UserPoint userPoint : list1) { |
| | | userKeepBuyPoint = userPoint.getVariablePoint() + userKeepBuyPoint; |
| | |
| | | List<AppUser> list = appUserService.lambdaQuery().eq(AppUser::getInviteUserId, id).list(); |
| | | byId.setBottomUsers(list); |
| | | //消费总金额 |
| | | R<List<Order>> orderR = remoteOrderGoodsClient.byShopId(sysUser.getObjectId()); |
| | | R<List<Order>> orderR = remoteOrderGoodsClient.byShopIdAndUserId(id,sysUser.getObjectId()); |
| | | List<Order> orderList = orderR.getData(); |
| | | if (!CollectionUtils.isEmpty(orderList)){ |
| | | BigDecimal paymentAmount = orderList.stream().map(Order::getPaymentAmount).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | |
| | | @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(); |
| | | Integer shopId = sysUser.getObjectId(); |
| | | R<List<Order>> listR = remoteOrderGoodsClient.byUserId(id,shopId); |
| | | return R.ok(listR.getData()); |
| | | |
| | | } |
| | |
| | | |
| | | |
| | | /** |
| | | * 检查会员降级 |
| | | * @param appUserId |
| | | */ |
| | | @PostMapping("/app-user/vipDemotion") |
| | | public void vipDemotion(@RequestParam("appUserId") Long appUserId){ |
| | | appUserService.vipDemotion(appUserId); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 用户降级检测 |
| | | */ |
| | | @PostMapping("/demotionDetection") |