后台-推广后台-修复数据问题

This commit is contained in:
khalil
2023-07-03 19:54:52 +08:00
parent 6b80358916
commit 92f90a3bd9
3 changed files with 77 additions and 54 deletions

View File

@@ -10,9 +10,9 @@
*/
package com.xuanyin.flowteam.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.xuanyin.flowteam.dto.FlowTeamSettlementDetail;
import com.xuanyin.flowteam.model.FlowTeamSettlementInfo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import java.util.Date;
@@ -55,8 +55,7 @@ public interface FlowTeamSettlementInfoMapper extends BaseMapper<FlowTeamSettlem
* @return
*/
List<FlowTeamSettlementInfo> listFlowTeamSettlementInfoV2(@Param("teamIds") List<String> teamIds, @Param("month") String month,
@Param("queryLimitTime") Date queryLimitTime
);
@Param("queryLimitTime") Date queryLimitTime);
/**
* 获取小组某月结算详情 (根据小组-组员-用户固化关系查询)
*

View File

@@ -97,10 +97,10 @@
sum(a.totalChargeAmount) totalChargeAmount, sum(a.totalChargeUserNum) totalChargeUserNum, sum(a.totalChargeNum) totalChargeNum
from (
-- 小组N月新增用户概况
select date_format(fm.create_time, '%Y-%m') month, count(distinct fm.uid) newUserNum, 0 newUserChargeAmount,
select date_format(u.create_time, '%Y-%m') month, count(distinct fm.uid) newUserNum, 0 newUserChargeAmount,
0 totalChargeAmount, 0 totalChargeUserNum, 0 totalChargeNum
from flow_team_member_invite_user fm
where 1=1
from flow_team_member_invite_user fm, users u
where fm.uid = u.uid
<if test="teamIds != null and teamIds.size > 0">
and fm.team_id in
<foreach collection="teamIds" item="teamId" open="(" close=")" separator=",">
@@ -113,10 +113,13 @@
select date_format(r.create_time, '%Y-%m') month, 0 newUserNum
, ifnull(sum(r.amount / 100), 0) newUserChargeAmount , 0 totalChargeAmount, 0 totalChargeUserNum, 0 totalChargeNum
from
flow_team_member_invite_user fi, charge_record r
where fi.uid = r.uid and r.charge_status = 2
and r.charge_prod_id != 'exchange'
flow_team_member_invite_user fi, users u, charge_record r
where fi.uid = r.uid
and u.uid = r.uid
and r.charge_status = 2
and r.charge_prod_id != 'exchange'
and r.buss_type in (0,4)
and date_format(r.create_time, '%Y-%m') = date_format(u.create_time, '%Y-%m')
<if test="teamIds != null and teamIds.size > 0">
and fi.team_id in
<foreach collection="teamIds" item="teamId" open="(" close=")" separator=",">
@@ -129,8 +132,7 @@
select date_format(r.create_time, '%Y-%m') month, 0 newUserNum ,
0 newUserChargeAmount, ifnull(sum(r.amount/100), 0) totalChargeAmount,
count(distinct r.uid) totalChargeUserNum, count(r.charge_record_id) totalChargeNum
from
flow_team_member_invite_user fi , charge_record r
from flow_team_member_invite_user fi , charge_record r
where fi.uid = r.uid and r.charge_status = 2 and r.charge_prod_id != 'exchange'
and r.buss_type in (0,4)
<if test="queryLimitTime != null">
@@ -143,10 +145,10 @@
</foreach>
</if>
group by month, fi.team_id) a
group by a.month
<if test="month != null and month != ''">
having month = #{month}
</if>
group by a.month
<if test="month != null and month != ''">
having month = #{month}
</if>
order by a.month
;
</select>
@@ -180,17 +182,15 @@
fm.member_name inviteUserNick,
sum(r.amount /100) amount
from
charge_record r, flow_team_member fm, flow_team_member_invite_user fu
left join users u on fu.uid = u.uid
where fu.uid = r.uid and r.charge_status = 2 and r.charge_prod_id != 'exchange'
and fm.member_id = fu.member_id
charge_record r, flow_team_member fm, flow_team_member_invite_user fu, users u
where fm.member_id = fu.member_id and fu.uid = u.uid and u.uid = r.uid
<if test="teamIds != null and teamIds.size > 0">
and fu.team_id in
<foreach collection="teamIds" item="teamId" open="(" close=")" separator=",">
#{teamId}
</foreach>
</if>
and r.buss_type in (0,4)
and r.charge_status = 2 and r.charge_prod_id != 'exchange' and r.buss_type in (0,4)
and date_format(r.create_time, '%Y-%m') = #{month}
<if test="queryLimitTime != null and queryLimitTime != ''">
and u.create_time >= #{queryLimitTime}