| | |
| | | * 首页统计 |
| | | */ |
| | | @GetMapping("/getStatistics") |
| | | public AjaxResult getUserTeamAndPosition() { |
| | | public AjaxResult getUserTeamAndPosition(@RequestParam(value = "invitationCode",required = false) String invitationCode) { |
| | | HomePageStatisticsOut statisticsOut = new HomePageStatisticsOut(); |
| | | |
| | | //邀请人账号 |
| | | String account = null; |
| | | if(StringUtils.isNotEmpty(invitationCode)){ |
| | | UserAccount userAccount = userAccountService.getOne(new LambdaQueryWrapper<UserAccount>() |
| | | .eq(UserAccount::getInvitationCode, invitationCode) |
| | | ); |
| | | if(ObjectUtil.isNotEmpty(userAccount)){ |
| | | account = userAccount.getAccount(); |
| | | } |
| | | } |
| | | |
| | | |
| | | // 今日注册 |
| | | LambdaQueryWrapper<UserAccount> todayWrapper = new LambdaQueryWrapper<>(); |
| | | todayWrapper.apply("DATE(create_time) = CURDATE()"); |
| | | todayWrapper.eq(StringUtils.isNotEmpty(account),UserAccount::getInvitationAccount,account); |
| | | statisticsOut.setTodayRegister(userAccountService.count(todayWrapper)); |
| | | |
| | | // 总注册 |
| | | statisticsOut.setTotalRegister(userAccountService.count()); |
| | | statisticsOut.setTotalRegister(userAccountService.count(new LambdaQueryWrapper<UserAccount>().eq(StringUtils.isNotEmpty(account),UserAccount::getInvitationAccount,account))); |
| | | |
| | | |
| | | List<UserAccount> userAccounts = userAccountService.list(new LambdaQueryWrapper<UserAccount>() |
| | | .eq(StringUtils.isNotEmpty(account), UserAccount::getInvitationAccount, account) |
| | | ); |
| | | |
| | | List<String> accounts = userAccounts.stream().map(UserAccount::getAccount).collect(Collectors.toList()); |
| | | |
| | | // 今日激活 |
| | | LambdaQueryWrapper<UserPolicy> userPolicyTodayWrapper = new LambdaQueryWrapper<>(); |
| | | userPolicyTodayWrapper.eq(UserPolicy::getApprovalStatus, 1) |
| | | userPolicyTodayWrapper |
| | | .eq(UserPolicy::getApprovalStatus, 1) |
| | | .in(!CollectionUtils.isEmpty(accounts),UserPolicy::getAccount,accounts) |
| | | .apply("DATE(created_at) = CURDATE()"); |
| | | statisticsOut.setTodayActivate(userPolicyService.count(userPolicyTodayWrapper)); |
| | | |
| | | // 总激活 |
| | | LambdaQueryWrapper<UserPolicy> userPolicyTotalWrapper = new LambdaQueryWrapper<>(); |
| | | userPolicyTotalWrapper.eq(UserPolicy::getApprovalStatus, 1); |
| | | userPolicyTotalWrapper |
| | | .in(!CollectionUtils.isEmpty(accounts),UserPolicy::getAccount,accounts) |
| | | .eq(UserPolicy::getApprovalStatus, 1); |
| | | statisticsOut.setTotalActivate(userPolicyService.count(userPolicyTotalWrapper)); |
| | | |
| | | return AjaxResult.success(statisticsOut); |