From a823bffa3800426d0a908b9397a8ea7586b5be21 Mon Sep 17 00:00:00 2001 From: Pu Zhibing <393733352@qq.com> Date: 星期三, 18 十二月 2024 18:00:24 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/BalanceChangeRecordServiceImpl.java | 30 +++++++++++------------------- 1 files changed, 11 insertions(+), 19 deletions(-) diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/BalanceChangeRecordServiceImpl.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/BalanceChangeRecordServiceImpl.java index 828b2a5..1a3ca07 100644 --- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/BalanceChangeRecordServiceImpl.java +++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/BalanceChangeRecordServiceImpl.java @@ -14,12 +14,15 @@ import com.ruoyi.account.service.BalanceChangeRecordService; import com.ruoyi.account.vo.CommissionStatistics; import com.ruoyi.common.core.utils.StringUtils; +import com.ruoyi.other.api.domain.ShopPoint; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; import javax.annotation.Resource; import java.math.BigDecimal; +import java.math.RoundingMode; import java.util.List; +import java.util.Map; import java.util.stream.Collectors; @Service @@ -38,25 +41,14 @@ @Override public CommissionStatistics commissionStatistics(Page<BalanceChangeRecord> page, BalanceChangeRecord balanceChangeRecord) { + List<BalanceChangeRecord> balanceChangeRecordList = this.baseMapper.selectBalanceChangeRecordList(balanceChangeRecord); + BigDecimal totalCommission = balanceChangeRecordList.stream() + .filter(item -> !(item.getChangeType().equals(2) && item.getChangeType().equals(5))) + .map(BalanceChangeRecord::getChangeAmount) + .reduce(BigDecimal.ZERO, BigDecimal::add) + .setScale(2, RoundingMode.HALF_UP); - List<AppUser> appUserList = appUserService.list(new LambdaQueryWrapper<AppUser>() - .like(StringUtils.isNotEmpty(balanceChangeRecord.getUserName()), AppUser::getName, balanceChangeRecord.getUserName()) - .like(StringUtils.isNotEmpty(balanceChangeRecord.getUserPhone()), AppUser::getPhone, balanceChangeRecord.getUserPhone())); - if (CollectionUtils.isEmpty(appUserList)){ - return new CommissionStatistics(); - } - - List<Long> appUserIds = appUserList.stream().map(AppUser::getId).collect(Collectors.toList()); - - BigDecimal totalCommission = appUserList.stream() - .map(AppUser::getTotalDistributionAmount) - .reduce(BigDecimal.ZERO, BigDecimal::add); - - - Page<BalanceChangeRecord> changeRecordPage = page(page, new LambdaQueryWrapper<BalanceChangeRecord>() - .in(BalanceChangeRecord::getAppUserId, appUserIds) - .between(balanceChangeRecord.getStartTime() != null && balanceChangeRecord.getEndTime() != null, - BalanceChangeRecord::getCreateTime, balanceChangeRecord.getStartTime(), balanceChangeRecord.getEndTime())); - return new CommissionStatistics(totalCommission, changeRecordPage); + IPage<BalanceChangeRecord> balanceChangeRecordIPage = this.baseMapper.queryCommissionStatistics(page, balanceChangeRecord); + return new CommissionStatistics(totalCommission, balanceChangeRecordIPage); } } -- Gitblit v1.7.1