Pu Zhibing
2025-01-13 66ae2020f8ea1e1f2573b46c668874180a483f3d
Merge remote-tracking branch 'origin/master'
4个文件已修改
41 ■■■■ 已修改文件
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserController.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/BalanceChangeRecordServiceImpl.java 35 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-account/src/main/resources/mapper/account/BalanceChangeRecordMapper.xml 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-account/src/main/resources/mapper/account/UserCancellationLogMapper.xml 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserController.java
@@ -520,6 +520,10 @@
    @ApiOperation(value = "用户列表-更换绑定人", tags = {"管理后台"})
    public R<AppUser> select(Long id, Long inviteId) {
        AppUser byId = appUserService.getById(id);
        Long userId = byId.getId();
        if (userId.equals(inviteId)) {
            return R.fail("不能选择自己为绑定人。");
        }
        byId.setInviteUserId(inviteId);
        byId.setTopInviteId(getTop(inviteId));
        appUserService.updateById(byId);
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/BalanceChangeRecordServiceImpl.java
@@ -62,14 +62,32 @@
        ShopBalanceStatement shopBalanceStatement = new ShopBalanceStatement();
        shopBalanceStatement.setType(1);
        IPage<BalanceChangeRecord> balanceChangeRecordIPage = this.baseMapper.queryCommissionStatistics(page, balanceChangeRecord);
        IPage<WalletStatisticsDetail> walletStatisticsDetailIPage = balanceChangeRecordIPage.convert(changeRecord -> {
        List<BalanceChangeRecord> balanceChangeRecordList = this.baseMapper.selectBalanceChangeRecordList(balanceChangeRecord);
        List<WalletStatisticsDetail> walletStatisticsDetailList = new ArrayList<>();
        for (BalanceChangeRecord changeRecord : balanceChangeRecordList) {
            WalletStatisticsDetail walletStatisticsDetail = new WalletStatisticsDetail();
            BeanUtils.copyBeanProp(walletStatisticsDetail, changeRecord);
            return walletStatisticsDetail;
        });
            walletStatisticsDetailList.add(walletStatisticsDetail);
        }
        Map<Integer, BigDecimal> shopCommissionMap = walletStatisticsDetailIPage.getRecords().stream()
        // 按时间排序(倒序)
        walletStatisticsDetailList.sort(Comparator.comparing(WalletStatisticsDetail::getCreateTime).reversed());
        long current = page.getCurrent();
        long size = page.getSize();
        if (current < 1) {
            current = 1;
        }
        int fromIndex = (int) ((current - 1) * size);
        int toIndex = (int) Math.min(fromIndex + size, walletStatisticsDetailList.size());
        if (fromIndex >= walletStatisticsDetailList.size()) {
            throw new ServiceException("页面参数无效");
        }
        Map<Integer, BigDecimal> shopCommissionMap = walletStatisticsDetailList.stream()
                .collect(Collectors.groupingBy(
                        WalletStatisticsDetail::getChangeType,
                        Collectors.reducing(
@@ -83,9 +101,14 @@
        BigDecimal totalWithdraw = shopCommissionMap.get(2);
        BigDecimal totalShopWithdraw = shopCommissionMap.get(7);
        List<WalletStatisticsDetail> walletStatisticsDetailList2 = walletStatisticsDetailList.subList(fromIndex, toIndex);
        WalletStatistics walletStatistics = new WalletStatistics();
        walletStatistics.setPage(walletStatisticsDetailIPage);
        Page<WalletStatisticsDetail> walletStatisticsDetailPage = new Page<>();
        walletStatisticsDetailPage.setCurrent(current);
        walletStatisticsDetailPage.setSize(walletStatisticsDetailList.size());
        walletStatisticsDetailPage.setRecords(walletStatisticsDetailList2);
        walletStatistics.setPage(walletStatisticsDetailPage);
        walletStatistics.setTotalRecharge(totalRecharge);
        walletStatistics.setTotalWithdraw(totalWithdraw);
        walletStatistics.setTotalShopWithdraw(totalShopWithdraw);
ruoyi-service/ruoyi-account/src/main/resources/mapper/account/BalanceChangeRecordMapper.xml
@@ -20,6 +20,7 @@
                        and DATE(t1.create_time) between  #{agentQuery.localDate1} and #{agentQuery.localDate2}
                    </if>
                </where>
                order by t1.create_time desc
    </select>
    <sql id="balanceChangeRecordList">
ruoyi-service/ruoyi-account/src/main/resources/mapper/account/UserCancellationLogMapper.xml
@@ -33,6 +33,7 @@
                and DATE(t1.create_time) between #{agentQuery.localDate1} and #{agentQuery.localDate2}
            </if>
        </where>
        order by t1.create_time desc
    </select>
</mapper>