| | |
| | | import com.ruoyi.account.vo.WalletStatisticsDetail; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.exception.ServiceException; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.common.core.utils.bean.BeanUtils; |
| | | import com.ruoyi.other.api.domain.ShopBalanceStatement; |
| | | import com.ruoyi.other.api.feignClient.ShopClient; |
| | |
| | | @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) |
| | |
| | | .setScale(2, RoundingMode.HALF_UP); |
| | | |
| | | IPage<BalanceChangeRecord> balanceChangeRecordIPage = this.baseMapper.queryCommissionStatistics(page, balanceChangeRecord); |
| | | // 过滤商城购物 |
| | | List<BalanceChangeRecord> collect = balanceChangeRecordIPage.getRecords().stream().filter(e -> e.getChangeType() != 5).collect(Collectors.toList()); |
| | | balanceChangeRecordIPage.setRecords(collect); |
| | | return new CommissionStatistics(totalCommission, balanceChangeRecordIPage); |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | List<BalanceChangeRecord> balanceChangeRecordList = this.baseMapper.selectBalanceChangeRecordList(balanceChangeRecord); |
| | | |
| | | List<WalletStatisticsDetail> walletStatisticsDetailList = new ArrayList<>(); |
| | | for (BalanceChangeRecord changeRecord : balanceChangeRecordList) { |
| | | WalletStatisticsDetail walletStatisticsDetail = new WalletStatisticsDetail(); |
| | |
| | | walletStatisticsDetailList.add(walletStatisticsDetail); |
| | | } |
| | | |
| | | walletStatisticsDetailList.addAll(r.getData().stream().map(this::createWalletStatisticsDetail).collect(Collectors.toList())); |
| | | List<WalletStatisticsDetail> collect = r.getData().stream().map(this::createWalletStatisticsDetail).collect(Collectors.toList()); |
| | | // 根据门店名称、用户姓名、联系电话进行模糊过滤 |
| | | collect = collect.stream() |
| | | .filter(e -> { |
| | | if (StringUtils.isNotEmpty(balanceChangeRecord.getShopName())) { |
| | | return e.getShopName().contains(balanceChangeRecord.getShopName()); |
| | | } else if (StringUtils.isNotEmpty(balanceChangeRecord.getUserName())) { |
| | | return e.getUserName().contains(balanceChangeRecord.getUserName()); |
| | | } else if (StringUtils.isNotEmpty(balanceChangeRecord.getUserPhone())) { |
| | | return e.getUserPhone().contains(balanceChangeRecord.getUserPhone()); |
| | | } |
| | | // 根据时间进行范围过滤 |
| | | if (balanceChangeRecord.getStartTime() != null && balanceChangeRecord.getEndTime() != null) { |
| | | return e.getCreateTime().isAfter(balanceChangeRecord.getStartTime()) && e.getCreateTime().isBefore(balanceChangeRecord.getEndTime()); |
| | | } |
| | | return false; |
| | | }).collect(Collectors.toList()); |
| | | walletStatisticsDetailList.addAll(collect); |
| | | |
| | | // 按时间排序(倒序) |
| | | walletStatisticsDetailList.sort(Comparator.comparing(WalletStatisticsDetail::getCreateTime).reversed()); |