luodangjia
2025-02-07 8ffeb751b3a694e8d1cb6a21bec855f6c49b31b6
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/BalanceChangeRecordServiceImpl.java
@@ -42,6 +42,7 @@
    @Override
    public CommissionStatistics commissionStatistics(Page<BalanceChangeRecord> page, BalanceChangeRecord balanceChangeRecord) {
        balanceChangeRecord.setChangeType(4);
        List<BalanceChangeRecord> balanceChangeRecordList = this.baseMapper.selectBalanceChangeRecordList(balanceChangeRecord);
        BigDecimal totalCommission = balanceChangeRecordList.stream()
@@ -75,18 +76,15 @@
        ShopBalanceStatement shopBalanceStatement = new ShopBalanceStatement();
        shopBalanceStatement.setType(1);
        List<BalanceChangeRecord> balanceChangeRecordList = this.baseMapper.selectBalanceChangeRecordList(balanceChangeRecord);
        List<BalanceChangeRecord> balanceChangeRecordList = this.baseMapper.selectBalanceChangeRecordList1(balanceChangeRecord);
        List<WalletStatisticsDetail> walletStatisticsDetailList = new ArrayList<>();
        for (BalanceChangeRecord changeRecord : balanceChangeRecordList) {
            WalletStatisticsDetail walletStatisticsDetail = new WalletStatisticsDetail();
            BeanUtils.copyBeanProp(walletStatisticsDetail, changeRecord);
            walletStatisticsDetailList.add(walletStatisticsDetail);
        }
        // 按时间排序(倒序)
        walletStatisticsDetailList.sort(Comparator.comparing(WalletStatisticsDetail::getCreateTime).reversed());
        long current = page.getCurrent();
        long size = page.getSize();
        if (current < 1) {
@@ -102,7 +100,6 @@
            walletStatistics.setPage(walletStatisticsDetailPage);
            return walletStatistics;
        }
        Map<Integer, BigDecimal> shopCommissionMap = walletStatisticsDetailList.stream()
@@ -121,20 +118,20 @@
        List<WalletStatisticsDetail> walletStatisticsDetailList2 = walletStatisticsDetailList.subList(fromIndex, toIndex);
        for (WalletStatisticsDetail changeRecord : walletStatisticsDetailList2) {
            if (changeRecord.getChangeType().equals(1)||changeRecord.getChangeType().equals(3)||changeRecord.getChangeType().equals(4)||changeRecord.getChangeType().equals(6)){
                changeRecord.setChangeAmountString("+¥"+changeRecord.getChangeAmount());
            } else{
            changeRecord.setChangeAmountString("-¥"+changeRecord.getChangeAmount());
            if (changeRecord.getChangeType().equals(1) || changeRecord.getChangeType().equals(3) || changeRecord.getChangeType().equals(4) || changeRecord.getChangeType().equals(6)) {
                changeRecord.setChangeAmountString("+¥" + changeRecord.getChangeAmount());
            } else {
                changeRecord.setChangeAmountString("-¥" + changeRecord.getChangeAmount());
            }
            walletStatisticsDetailPage.setCurrent(current);
            walletStatisticsDetailPage.setSize(size);
            walletStatisticsDetailPage.setTotal(walletStatisticsDetailList.size());
            walletStatisticsDetailPage.setRecords(walletStatisticsDetailList2);
            walletStatistics.setPage(walletStatisticsDetailPage);
            walletStatistics.setTotalRecharge(totalRecharge);
            walletStatistics.setTotalWithdraw(totalWithdraw);
            walletStatistics.setTotalShopWithdraw(totalShopWithdraw);
        }
        walletStatisticsDetailPage.setCurrent(current);
        walletStatisticsDetailPage.setSize(size);
        walletStatisticsDetailPage.setTotal(walletStatisticsDetailList.size());
        walletStatisticsDetailPage.setRecords(walletStatisticsDetailList2);
        walletStatistics.setPage(walletStatisticsDetailPage);
        walletStatistics.setTotalRecharge(totalRecharge);
        walletStatistics.setTotalWithdraw(totalWithdraw);
        walletStatistics.setTotalShopWithdraw(totalShopWithdraw);
        return walletStatistics;
    }
}