From 49e96cc15baf35d710fe3a049fb97aff6a1af132 Mon Sep 17 00:00:00 2001
From: Pu Zhibing <393733352@qq.com>
Date: 星期二, 25 二月 2025 19:35:33 +0800
Subject: [PATCH] 修改分佣逻辑

---
 ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/WalletController.java |   40 +++++-----------------------------------
 1 files changed, 5 insertions(+), 35 deletions(-)

diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/WalletController.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/WalletController.java
index b5aa88c..a463f14 100644
--- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/WalletController.java
+++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/WalletController.java
@@ -14,9 +14,11 @@
 import com.ruoyi.account.util.payment.PaymentUtil;
 import com.ruoyi.account.util.payment.model.UniPayCallbackResult;
 import com.ruoyi.account.util.payment.model.UniPayResult;
+import com.ruoyi.account.vo.UserPointDetailVO;
 import com.ruoyi.account.vo.WalletVO;
 import com.ruoyi.common.core.domain.R;
 import com.ruoyi.common.core.web.controller.BaseController;
+import com.ruoyi.common.core.web.page.PageInfo;
 import com.ruoyi.common.security.service.TokenService;
 import com.ruoyi.common.security.utils.SecurityUtils;
 import com.ruoyi.order.feignClient.RemoteOrderGoodsClient;
@@ -109,41 +111,9 @@
             // 将最后一天转换为 LocalDateTime,并设置为当天的最后一秒 (23:59:59.999)
             endTime = lastDayOfMonth.atTime(LocalTime.MAX);
         }
-
-        Page<BalanceChangeRecordCopy> page = balanceChangeRecordCopyService.page(Page.of(pageCurr, pageSize), new LambdaQueryWrapper<BalanceChangeRecordCopy>()
-                .eq(changeType != null, BalanceChangeRecordCopy::getChangeType, changeType)
-                .between(startTime != null, BalanceChangeRecordCopy::getCreateTime, startTime, endTime)
-                .eq(BalanceChangeRecordCopy::getAppUserId, userId).orderByDesc(BalanceChangeRecordCopy::getCreateTime));
-
-        List<BalanceChangeRecordCopy> list = page.getRecords();
-
-        List<Long> orderIds = list.stream().map(BalanceChangeRecordCopy::getOrderId).collect(Collectors.toList());
-        if (CollectionUtil.isNotEmpty(orderIds)){
-            R<List<Order>> r = remoteOrderGoodsClient.getOrderListByIds(orderIds);
-            if (!R.isSuccess(r)){
-                return R.fail(r.getMsg());
-            }
-            List<Order> orderList = r.getData();
-            list.forEach(bc -> {
-                orderList.stream().filter(o -> o.getId().equals(bc.getOrderId())).findFirst().ifPresent(o -> {
-                    Long appUserId = o.getAppUserId();
-                    AppUser appUser = appUserService.getById(appUserId);
-                    if(null != appUser){
-                        bc.setUserName(appUser.getName());
-                        bc.setAmount(o.getPaymentAmount());
-                    }
-                });
-
-                BigDecimal beforeAmount = bc.getBeforeAmount();
-                BigDecimal afterAmount = bc.getAfterAmount();
-                if (beforeAmount.compareTo(afterAmount) > 0){
-                    bc.setFlag(2);
-                }else {
-                    bc.setFlag(1);
-                }
-            });
-        }
-        return R.ok(page);
+        Page<BalanceChangeRecordCopy> pageInfo = new Page<>(pageCurr, pageSize);
+        IPage<BalanceChangeRecordCopy> change = balanceChangeRecordService.change(pageInfo, changeType, startTime, endTime, userId);
+        return R.ok(change);
     }
 
     /**

--
Gitblit v1.7.1