From 00c70fe8a833450fa8bc2bea7357e4e23d84f2f3 Mon Sep 17 00:00:00 2001
From: liujie <1793218484@qq.com>
Date: 星期日, 04 一月 2026 14:34:09 +0800
Subject: [PATCH] 修改bug

---
 ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml                               |    2 
 ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysUser.java                   |    2 
 ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TBigGiftPackageOrderServiceImpl.java |   16 ++++----
 ruoyi-system/src/main/resources/mapper/system/TBigGiftPackageOrderMapper.xml                  |   69 ++++++++++++++++++----------------
 4 files changed, 46 insertions(+), 43 deletions(-)

diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysUser.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysUser.java
index 077b3ed..d8b2156 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysUser.java
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysUser.java
@@ -22,7 +22,7 @@
  */
 @Data
 @ApiModel(value = "用户新增编辑DTO")
-public class SysUser extends BaseEntity
+public class    SysUser extends BaseEntity
 {
     private static final long serialVersionUID = 1L;
 
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TBigGiftPackageOrderServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TBigGiftPackageOrderServiceImpl.java
index 55702f5..5f5e46b 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TBigGiftPackageOrderServiceImpl.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TBigGiftPackageOrderServiceImpl.java
@@ -243,14 +243,14 @@
         List<UserProfitPageListVo> profitPageListVos = this.baseMapper.profitUserPageList(page,query, sTime, eTime);
 
 
-        if(!profitPageListVos.isEmpty()){
-            List<Integer> orderIds = profitPageListVos.stream().map(UserProfitPageListVo::getId).collect(Collectors.toList());
-            List<TCommissionTransactionFlow> tCommissionTransactionFlows = commissionTransactionFlowMapper.selectList(new LambdaQueryWrapper<TCommissionTransactionFlow>().in(TCommissionTransactionFlow::getOrderId, orderIds));
-            for (UserProfitPageListVo profitPageListVo : profitPageListVos) {
-                List<TCommissionTransactionFlow> flows = tCommissionTransactionFlows.stream().filter(e -> e.getOrderId().equals(profitPageListVo.getId()) && e.getAppUserId().equals(query.getUserId())).collect(Collectors.toList());
-                profitPageListVo.setSelfProfit(flows.stream().map(TCommissionTransactionFlow::getCommissionAmount).reduce(BigDecimal.ZERO,BigDecimal::add));
-            }
-        }
+//        if(!profitPageListVos.isEmpty()){
+//            List<Integer> orderIds = profitPageListVos.stream().map(UserProfitPageListVo::getId).collect(Collectors.toList());
+//            List<TCommissionTransactionFlow> tCommissionTransactionFlows = commissionTransactionFlowMapper.selectList(new LambdaQueryWrapper<TCommissionTransactionFlow>().in(TCommissionTransactionFlow::getOrderId, orderIds));
+//            for (UserProfitPageListVo profitPageListVo : profitPageListVos) {
+//                List<TCommissionTransactionFlow> flows = tCommissionTransactionFlows.stream().filter(e -> e.getOrderId().equals(profitPageListVo.getId()) && e.getAppUserId().equals(query.getUserId())).collect(Collectors.toList());
+//                profitPageListVo.setSelfProfit(flows.stream().map(TCommissionTransactionFlow::getCommissionAmount).reduce(BigDecimal.ZERO,BigDecimal::add));
+//            }
+//        }
 
         return profitPageListVos;
     }
diff --git a/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml
index 972f7d3..46cd804 100644
--- a/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml
+++ b/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml
@@ -300,7 +300,7 @@
     </select>
     <select id="getUserByCompanyId" resultType="com.ruoyi.common.core.domain.entity.SysUser"
             parameterType="java.lang.Integer">
-		select * from sys_user where company_id = #{id} and del_flag = 0
+		select * from sys_user where company_id = #{id} and del_flag = 0 and role_type =2
 	</select>
 	<select id="getCompanyUserList" resultType="com.ruoyi.common.core.domain.entity.SysUser">
 		select * from sys_user where company_id = #{companyId} and del_flag = 0
diff --git a/ruoyi-system/src/main/resources/mapper/system/TBigGiftPackageOrderMapper.xml b/ruoyi-system/src/main/resources/mapper/system/TBigGiftPackageOrderMapper.xml
index aa63124..ef69f9f 100644
--- a/ruoyi-system/src/main/resources/mapper/system/TBigGiftPackageOrderMapper.xml
+++ b/ruoyi-system/src/main/resources/mapper/system/TBigGiftPackageOrderMapper.xml
@@ -132,42 +132,45 @@
         order by t1.create_time desc
     </select>
     <select id="profitUserPageList" resultType="com.ruoyi.system.vo.UserProfitPageListVo">
-select  * from (
-        select t1.id,t1.code,t1.create_time,t2.name userName,t2.phone,t1.order_price,t1.create_time as createTime
-        from t_big_gift_package_order t1 left join t_app_user t2 on t1.app_user_id = t2.id
-        where t1.del_flag = 0 and t2.referrer_user_id  = #{query.userId} and t2.referrer_status =2 AND t1.status != 6
-        <if test="query.phone != null and query.phone != ''">
-            AND t2.phone = #{query.phone}
-        </if>
-        <if test="query.code != null and query.code != ''">
-            AND t1.code = #{query.code}
-        </if>
-        <if test="query.userName != null and query.userName != ''">
-            AND t2.name like concat('%',#{query.userName},'%')
-        </if>
-        <if test="sTime !=null ">
-            AND t1.create_time BETWEEN #{sTime} AND #{eTime}
-        </if>
+        select t3.*,sum(t4.commission_amount) as selfProfit from (
+            select t1.id,t1.code,t1.create_time,t2.name userName,t2.phone,t1.order_price,t1.create_time as createTime
+            from t_big_gift_package_order t1 left join t_app_user t2 on t1.app_user_id = t2.id
+            where t1.del_flag = 0 and t2.referrer_user_id = #{query.userId} and t2.referrer_status =2 AND t1.status != 6
+            <if test="query.phone != null and query.phone != ''">
+                AND t2.phone = #{query.phone}
+            </if>
+            <if test="query.code != null and query.code != ''">
+                AND t1.code = #{query.code}
+            </if>
+            <if test="query.userName != null and query.userName != ''">
+                AND t2.name like concat('%',#{query.userName},'%')
+            </if>
+            <if test="sTime !=null ">
+                AND t1.create_time BETWEEN #{sTime} AND #{eTime}
+            </if>
 
-        union all
+            union all
 
-        select t1.id,t1.code,t1.create_time,t2.name userName,t2.phone,t1.order_price,t1.create_time as createTime
-        from t_big_gift_package_order t1 left join t_app_user t2 on t1.app_user_id = t2.id
-        where t1.del_flag = 0 and t1.app_user_id  = #{query.userId}  AND t1.status != 6
-        <if test="query.phone != null and query.phone != ''">
-            AND t2.phone = #{query.phone}
-        </if>
-        <if test="query.code != null and query.code != ''">
-            AND t1.code = #{query.code}
-        </if>
-        <if test="query.userName != null and query.userName != ''">
-            AND t2.name like concat('%',#{query.userName},'%')
-        </if>
-        <if test="sTime !=null ">
-            AND t1.create_time BETWEEN #{sTime} AND #{eTime}
-        </if>
-        ) t3
+            select t1.id,t1.code,t1.create_time,t2.name userName,t2.phone,t1.order_price,t1.create_time as createTime
+            from t_big_gift_package_order t1 left join t_app_user t2 on t1.app_user_id = t2.id
+            where t1.del_flag = 0 and t1.app_user_id = #{query.userId} AND t1.status != 6
+            <if test="query.phone != null and query.phone != ''">
+                AND t2.phone = #{query.phone}
+            </if>
+            <if test="query.code != null and query.code != ''">
+                AND t1.code = #{query.code}
+            </if>
+            <if test="query.userName != null and query.userName != ''">
+                AND t2.name like concat('%',#{query.userName},'%')
+            </if>
+            <if test="sTime !=null ">
+                AND t1.create_time BETWEEN #{sTime} AND #{eTime}
+            </if>
+        ) t3 left join t_commission_transaction_flow t4 on t3.id =t4.order_id
+        where t4.app_user_id =#{query.userId}  and t4.commission_amount>0
+        GROUP BY t3.id
         order by t3.createTime desc
+
     </select>
     <select id="profitUserPageListExport" resultType="com.ruoyi.system.vo.UserProfitPageListVo">
         select  * from (

--
Gitblit v1.7.1