From 1f09f6daaf73bc83cceb4ae22b862b7b365635cf Mon Sep 17 00:00:00 2001
From: Pu Zhibing <393733352@qq.com>
Date: 星期四, 03 四月 2025 19:59:17 +0800
Subject: [PATCH] 修改反馈文档bug

---
 ruoyi-service/ruoyi-account/src/main/resources/mapper/account/UserPointMapper.xml                      |    3 +
 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/ShoppingCartServiceImpl.java      |    1 
 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/ShopPointServiceImpl.java         |   12 ++++++
 ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/UserPointController.java        |    8 +---
 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/ShopPointService.java                  |    9 ++++
 ruoyi-service/ruoyi-other/src/main/resources/mapper/other/ShopPointMapper.xml                          |    3 +
 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopBalanceStatementController.java |   31 +++++++++++++++
 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopPointController.java            |   10 +---
 8 files changed, 64 insertions(+), 13 deletions(-)

diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/UserPointController.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/UserPointController.java
index 618aa6b..2986881 100644
--- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/UserPointController.java
+++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/UserPointController.java
@@ -166,12 +166,8 @@
 
     @GetMapping("/user/list")
     @ApiOperation(value = "积分管理-用户积分明细(必传用户id)", tags = "后台")
-    public R<Page<UserPoint>> userlist(UserPoint userPoint) {
-        Page<UserPoint> page = userPointService.lambdaQuery()
-                .eq(userPoint.getType()!=null,UserPoint::getType, userPoint.getType())
-                .eq(UserPoint::getAppUserId, userPoint.getAppUserId())
-                .orderByDesc(UserPoint::getCreateTime)
-                .page(Page.of(userPoint.getPageNum(), userPoint.getPageSize()));
+    public R<IPage<UserPoint>> userlist(UserPoint userPoint) {
+        IPage<UserPoint> page = userPointService.getUserPointPage(Page.of(userPoint.getPageNum(), userPoint.getPageSize()), userPoint);
         for (UserPoint record : page.getRecords()) {
             if (record.getType()==1 || record.getType()==11){
                 Order data = orderClient.getOrderById(record.getObjectId()).getData();
diff --git a/ruoyi-service/ruoyi-account/src/main/resources/mapper/account/UserPointMapper.xml b/ruoyi-service/ruoyi-account/src/main/resources/mapper/account/UserPointMapper.xml
index 4cfa480..40310ce 100644
--- a/ruoyi-service/ruoyi-account/src/main/resources/mapper/account/UserPointMapper.xml
+++ b/ruoyi-service/ruoyi-account/src/main/resources/mapper/account/UserPointMapper.xml
@@ -31,6 +31,9 @@
         LEFT JOIN t_app_user tau ON tup.app_user_id = tau.id
         <where>
             tup.type not in (8, 9, 14) and tau.status != 3 and tau.del_flag = 0
+            <if test="userPoint.appUserId != null and userPoint.appUserId != ''">
+                AND tup.app_user_id = #{userPoint.appUserId}
+            </if>
             <if test="userPoint.userName != null and userPoint.userName != ''">
                 AND tau.`name` LIKE concat('%',#{userPoint.userName},'%')
             </if>
diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/ShoppingCartServiceImpl.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/ShoppingCartServiceImpl.java
index a21ace2..a6dc9fb 100644
--- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/ShoppingCartServiceImpl.java
+++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/ShoppingCartServiceImpl.java
@@ -975,6 +975,7 @@
 				}
 			}
 		}
+		paymentMoney = paymentMoney.add(expressFee);
 		if(BigDecimal.ZERO.compareTo(paymentMoney) > 0){
 			paymentMoney = BigDecimal.ZERO;
 		}
diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopBalanceStatementController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopBalanceStatementController.java
index 83fee5f..90eb980 100644
--- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopBalanceStatementController.java
+++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopBalanceStatementController.java
@@ -125,11 +125,20 @@
         if (type == null) {
             List<ShopBalanceStatement> list = shopBalanceStatementService.lambdaQuery().eq(ShopBalanceStatement::getShopId, objectId).eq(ShopBalanceStatement::getType, 3).list();
             List<ShopBalanceStatement> list1 = shopBalanceStatementService.lambdaQuery().eq(ShopBalanceStatement::getShopId, objectId).eq(ShopBalanceStatement::getType, 1).list();
+            List<ShopBalanceStatementCopy> list3 = shopBalanceStatementCopyMapper.selectList(new LambdaQueryWrapper<ShopBalanceStatementCopy>().eq(ShopBalanceStatementCopy::getShopId, objectId).eq(ShopBalanceStatementCopy::getType, 3));
+            List<ShopBalanceStatementCopy> list4 = shopBalanceStatementCopyMapper.selectList(new LambdaQueryWrapper<ShopBalanceStatementCopy>().eq(ShopBalanceStatementCopy::getShopId, objectId).eq(ShopBalanceStatementCopy::getType, 1));
+            
             BigDecimal bigDecimal1 = new BigDecimal(0);
             for (ShopBalanceStatement shopBalanceStatement : list) {
                 bigDecimal1 = bigDecimal1.add(shopBalanceStatement.getVariableAmount());
             }
+            for (ShopBalanceStatementCopy shopBalanceStatement : list3) {
+                bigDecimal1 = bigDecimal1.add(shopBalanceStatement.getVariableAmount());
+            }
             for (ShopBalanceStatement shopBalanceStatement : list1) {
+                bigDecimal1 = bigDecimal1.add(shopBalanceStatement.getVariableAmount());
+            }
+            for (ShopBalanceStatementCopy shopBalanceStatement : list4) {
                 bigDecimal1 = bigDecimal1.add(shopBalanceStatement.getVariableAmount());
             }
             dto.setBigDecimal1(bigDecimal1);
@@ -138,17 +147,27 @@
             for (ShopBalanceStatement shopBalanceStatement : list) {
                 bigDecimal2 = bigDecimal2.add(shopBalanceStatement.getVariableAmount());
             }
+            for (ShopBalanceStatementCopy shopBalanceStatement : list3) {
+                bigDecimal2 = bigDecimal2.add(shopBalanceStatement.getVariableAmount());
+            }
             dto.setBigDecimal2(bigDecimal2);
 
             BigDecimal bigDecimal3 = new BigDecimal(0);
             for (ShopBalanceStatement shopBalanceStatement : list1) {
                 bigDecimal3 = bigDecimal3.add(shopBalanceStatement.getVariableAmount());
             }
+            for (ShopBalanceStatementCopy shopBalanceStatement : list4) {
+                bigDecimal3 = bigDecimal3.add(shopBalanceStatement.getVariableAmount());
+            }
             dto.setBigDecimal3(bigDecimal3);
 
             List<ShopBalanceStatement> list2 = shopBalanceStatementService.lambdaQuery().eq(ShopBalanceStatement::getShopId, objectId).eq(ShopBalanceStatement::getType, 2).list();
+            List<ShopBalanceStatementCopy> list5 = shopBalanceStatementCopyMapper.selectList(new LambdaQueryWrapper<ShopBalanceStatementCopy>().eq(ShopBalanceStatementCopy::getShopId, objectId).eq(ShopBalanceStatementCopy::getType, 2));
             BigDecimal bigDecimal4 = new BigDecimal(0);
             for (ShopBalanceStatement shopBalanceStatement : list2) {
+                bigDecimal4 = bigDecimal4.add(shopBalanceStatement.getVariableAmount());
+            }
+            for (ShopBalanceStatementCopy shopBalanceStatement : list5) {
                 bigDecimal4 = bigDecimal4.add(shopBalanceStatement.getVariableAmount());
             }
             dto.setBigDecimal4(bigDecimal4);
@@ -162,7 +181,11 @@
                     // 关联用户分拥
                     BigDecimal bigDecimal = new BigDecimal("0");
                     List<ShopBalanceStatement> list1 = shopBalanceStatementService.lambdaQuery().eq(ShopBalanceStatement::getShopId, objectId).eq(ShopBalanceStatement::getType, 1).list();
+                    List<ShopBalanceStatementCopy> list4 = shopBalanceStatementCopyMapper.selectList(new LambdaQueryWrapper<ShopBalanceStatementCopy>().eq(ShopBalanceStatementCopy::getShopId, objectId).eq(ShopBalanceStatementCopy::getType, 1));
                     for (ShopBalanceStatement shopBalanceStatement : list1) {
+                        bigDecimal = bigDecimal.add(shopBalanceStatement.getVariableAmount());
+                    }
+                    for (ShopBalanceStatementCopy shopBalanceStatement : list4) {
                         bigDecimal = bigDecimal.add(shopBalanceStatement.getVariableAmount());
                     }
                     dto.setBigDecimal3(bigDecimal);
@@ -172,7 +195,11 @@
                     // 下级门店分佣
                     BigDecimal bigDecimal2 = new BigDecimal(0);
                     List<ShopBalanceStatement> list2 = shopBalanceStatementService.lambdaQuery().eq(ShopBalanceStatement::getShopId, objectId).eq(ShopBalanceStatement::getType, 2).list();
+                    List<ShopBalanceStatementCopy> list5 = shopBalanceStatementCopyMapper.selectList(new LambdaQueryWrapper<ShopBalanceStatementCopy>().eq(ShopBalanceStatementCopy::getShopId, objectId).eq(ShopBalanceStatementCopy::getType, 2));
                     for (ShopBalanceStatement shopBalanceStatement : list2) {
+                        bigDecimal2 = bigDecimal2.add(shopBalanceStatement.getVariableAmount());
+                    }
+                    for (ShopBalanceStatementCopy shopBalanceStatement : list5) {
                         bigDecimal2 = bigDecimal2.add(shopBalanceStatement.getVariableAmount());
                     }
                     dto.setBigDecimal4(bigDecimal2);
@@ -181,10 +208,14 @@
                 case 3:
                     // 服务费分佣
                     List<ShopBalanceStatement> list = shopBalanceStatementService.lambdaQuery().eq(ShopBalanceStatement::getShopId, objectId).eq(ShopBalanceStatement::getType, 3).list();
+                    List<ShopBalanceStatementCopy> list6 = shopBalanceStatementCopyMapper.selectList(new LambdaQueryWrapper<ShopBalanceStatementCopy>().eq(ShopBalanceStatementCopy::getShopId, objectId).eq(ShopBalanceStatementCopy::getType, 3));
                     BigDecimal bigDecimal3 = new BigDecimal(0);
                     for (ShopBalanceStatement shopBalanceStatement : list) {
                         bigDecimal3 = bigDecimal3.add(shopBalanceStatement.getVariableAmount());
                     }
+                    for (ShopBalanceStatementCopy shopBalanceStatement : list6) {
+                        bigDecimal3 = bigDecimal3.add(shopBalanceStatement.getVariableAmount());
+                    }
                     dto.setBigDecimal2(bigDecimal3);
                     dto.setBigDecimal1(bigDecimal3);
                     break;
diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopPointController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopPointController.java
index 9530eb1..ccc562b 100644
--- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopPointController.java
+++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopPointController.java
@@ -76,13 +76,9 @@
     }
     @GetMapping("/statistics/list")
     @ApiOperation(value = "门店积分明细必传门店id", tags = {"后台"})
-    public R<Page<ShopPoint>> statisticslist(ShopPoint shopPoint,Integer pageNum,Integer pageSize) {
-        Page<ShopPoint> page = shopPointService.lambdaQuery()
-                .eq(ShopPoint::getShopId, shopPoint.getShopId())
-                .eq(shopPoint.getType()!=null && shopPoint.getType()!=0,ShopPoint::getType, shopPoint.getType())
-                .like(shopPoint.getOrderNum()!=null,ShopPoint::getOrderNum, shopPoint.getOrderNum())
-                .orderByDesc(ShopPoint::getCreateTime)
-                .page(Page.of(pageNum, pageSize));
+    public R<IPage<ShopPoint>> statisticslist(ShopPoint shopPoint,Integer pageNum,Integer pageSize) {
+        IPage<ShopPoint> page = shopPointService.getShopPointPage(Page.of(pageNum, pageSize), shopPoint);
+        page.getRecords().forEach(s->s.setVariablePoint(s.getVariablePoint() * s.getChangeDirection()));
         return R.ok(page);
     }
 
diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/ShopPointService.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/ShopPointService.java
index 521a1b9..738076c 100644
--- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/ShopPointService.java
+++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/ShopPointService.java
@@ -2,6 +2,7 @@
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.ruoyi.common.core.web.page.PageInfo;
 import com.ruoyi.other.api.domain.ShopPoint;
 import com.ruoyi.other.vo.ShopPointStatistics;
 
@@ -16,4 +17,12 @@
 public interface ShopPointService extends IService<ShopPoint> {
 
     ShopPointStatistics statistics(IPage<ShopPoint> page, ShopPoint shopPoint);
+    
+    /**
+     * 获取门店积分流水
+     * @param page
+     * @param shopPoint
+     * @return
+     */
+    IPage<ShopPoint> getShopPointPage(IPage<ShopPoint>page, ShopPoint shopPoint);
 }
diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/ShopPointServiceImpl.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/ShopPointServiceImpl.java
index 73b96ae..7d435f6 100644
--- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/ShopPointServiceImpl.java
+++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/ShopPointServiceImpl.java
@@ -201,4 +201,16 @@
             return shopPointStatistics;
         }
     }
+    
+    
+    /**
+     * 获取门店积分流水
+     * @param page
+     * @param shopPoint
+     * @return
+     */
+    @Override
+    public IPage<ShopPoint> getShopPointPage(IPage<ShopPoint> page, ShopPoint shopPoint) {
+        return this.baseMapper.queryShpointPage(page, shopPoint);
+    }
 }
diff --git a/ruoyi-service/ruoyi-other/src/main/resources/mapper/other/ShopPointMapper.xml b/ruoyi-service/ruoyi-other/src/main/resources/mapper/other/ShopPointMapper.xml
index b50577c..49c3404 100644
--- a/ruoyi-service/ruoyi-other/src/main/resources/mapper/other/ShopPointMapper.xml
+++ b/ruoyi-service/ruoyi-other/src/main/resources/mapper/other/ShopPointMapper.xml
@@ -54,6 +54,9 @@
         (select * from t_shop_point union all select * from t_shop_point_copy) tsp
         LEFT JOIN t_shop ts ON tsp.shop_id = ts.id
         <where>
+            <if test="shopPoint.shopId != null and shopPoint.shopId != ''">
+                AND tsp.shop_id = #{shopPoint.shopId}
+            </if>
             <if test="shopPoint.shopName != null and shopPoint.shopName != ''">
                 AND ts.`name` LIKE concat('%',#{shopPoint.shopName},'%')
             </if>

--
Gitblit v1.7.1