From 428519bd1056dd90cd4589dbf85b380e403ff254 Mon Sep 17 00:00:00 2001 From: hjl <1657978663@qq.com> Date: 星期五, 05 七月 2024 18:13:08 +0800 Subject: [PATCH] feat: 代码初始化、腾讯云短信SDK --- ruoyi-service/ruoyi-admin/src/main/java/com/ruoyi/admin/service/impl/UserServiceImpl.java | 36 +++++++++++++++++++----------------- 1 files changed, 19 insertions(+), 17 deletions(-) diff --git a/ruoyi-service/ruoyi-admin/src/main/java/com/ruoyi/admin/service/impl/UserServiceImpl.java b/ruoyi-service/ruoyi-admin/src/main/java/com/ruoyi/admin/service/impl/UserServiceImpl.java index acc4023..20bda70 100644 --- a/ruoyi-service/ruoyi-admin/src/main/java/com/ruoyi/admin/service/impl/UserServiceImpl.java +++ b/ruoyi-service/ruoyi-admin/src/main/java/com/ruoyi/admin/service/impl/UserServiceImpl.java @@ -1,5 +1,6 @@ package com.ruoyi.admin.service.impl; +import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.ruoyi.admin.entity.User; import com.ruoyi.admin.mapper.UserMapper; @@ -38,17 +39,14 @@ private WithdrawService withdrawService; @Override - public List<UserTrendsVO> userTrends(List<String> cityIds) { - if (null == cityIds || cityIds.isEmpty()) { - return new ArrayList<>(); - } - List<UserTrendsVO> userTrendsList = baseMapper.userTrends(cityIds); + public List<UserTrendsVO> userTrends(List<String> city) { + List<UserTrendsVO> userTrendsList = baseMapper.userTrends(city); return null == userTrendsList || userTrendsList.isEmpty() ? new ArrayList<>() : userTrendsList; } @Override - public Object userDataCount(UserDataCountRequest userDataCountRequest) { - List<String> cityIdList = userDataCountRequest.getCityIdList(); + public UserDataCountVO userDataCount(UserDataCountRequest userDataCountRequest) { + List<String> cityList = userDataCountRequest.getCityList(); List<User> userList = lambdaQuery().eq(User::getIsDelete, 0).list(); // 用户总量 Integer userNumber = null == userList ? 0 : userList.size(); @@ -67,26 +65,30 @@ BigDecimal withdrawalTotalMoney; if (OrderConstants.QUARTER.equals(userDataCountRequest.getCountType())) { // 用户增长数 - increaseNumber = lambdaQuery().ge(User::getCreateTime, startDateStr).le(User::getCreateTime, endDateStr) - .in(User::getCityId, cityIdList).eq(User::getIsDelete, 0).count(); + LambdaQueryChainWrapper<User> wrapper = lambdaQuery().ge(User::getCreateTime, startDateStr) + .le(User::getCreateTime, endDateStr); + if (!cityList.isEmpty()) { + wrapper.in(User::getCity, cityList); + } + increaseNumber = wrapper.eq(User::getIsDelete, 0).count(); // 用户总交易额 - totalMoney = orderService.totalMoneyByQuarter(startDateStr, endDateStr, cityIdList); + totalMoney = orderService.totalMoneyByQuarter(startDateStr, endDateStr, cityList); // 用户提现总额 - withdrawalTotalMoney = withdrawService.withdrawalTotalMoney(cityIdList); + withdrawalTotalMoney = withdrawService.withdrawalTotalMoney(cityList,startDateStr,endDateStr); } else if (OrderConstants.YEAR.equals(userDataCountRequest.getCountType())) { // 用户增长数 - increaseNumber = baseMapper.increaseNumberByYear(cityIdList); + increaseNumber = baseMapper.increaseNumberByYear(cityList); // 用户总交易额 - totalMoney = orderService.totalMoneyByYear(cityIdList); + totalMoney = orderService.totalMoneyByYear(cityList); // 用户提现总额 - withdrawalTotalMoney = withdrawService.withdrawalTotalMoneyByYear(cityIdList); + withdrawalTotalMoney = withdrawService.withdrawalTotalMoneyByYear(cityList); } else if (OrderConstants.MONTH.equals(userDataCountRequest.getCountType())) { // 用户增长数 - increaseNumber = baseMapper.increaseNumberByMonth(cityIdList); + increaseNumber = baseMapper.increaseNumberByMonth(cityList); // 用户总交易额 - totalMoney = orderService.totalMoneyByMonth(cityIdList); + totalMoney = orderService.totalMoneyByMonth(cityList); // 用户提现总额 - withdrawalTotalMoney = withdrawService.withdrawalTotalMoneyByMonth(cityIdList); + withdrawalTotalMoney = withdrawService.withdrawalTotalMoneyByMonth(cityList); } else { // 数量初始化 increaseNumber = 0L; -- Gitblit v1.7.1