新增累计收到转赠统计
This commit is contained in:
@@ -58,9 +58,9 @@ public class FlowTeamSettlementInfoController extends BaseController {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@GetMapping("/listTeamSettlementData")
|
@GetMapping("/listTeamSettlementData")
|
||||||
public Pagination listTeamSettlementData(String teamId) {
|
public Pagination<FlowTeamSettlementInfo> listTeamSettlementData(String teamId) {
|
||||||
List<FlowTeamSettlementInfo> infos = flowTeamSettlementBizService.listTeamSettlementData(teamId);
|
List<FlowTeamSettlementInfo> infos = flowTeamSettlementBizService.listTeamSettlementData(teamId);
|
||||||
return new Pagination(infos.size(), infos);
|
return new Pagination<FlowTeamSettlementInfo>(infos.size(), infos);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -67,27 +67,12 @@ public class FlowTeamSettlementBizService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private FlowTeamBaseService flowTeamBaseService;
|
private FlowTeamBaseService flowTeamBaseService;
|
||||||
|
|
||||||
|
|
||||||
@Transactional(rollbackFor = Exception.class, transactionManager = "mybatisplusTransactionManager")
|
|
||||||
public List<FlowTeamSettlementInfo> listTeamSettlementData(String teamIds) {
|
public List<FlowTeamSettlementInfo> listTeamSettlementData(String teamIds) {
|
||||||
if (StringUtils.isBlank(teamIds)) {
|
if (StringUtils.isBlank(teamIds)) {
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
List<String> teamIdList = Arrays.asList(teamIds.split(","));
|
List<String> teamIdList = Arrays.asList(teamIds.split(","));
|
||||||
|
List<FlowTeamSettlementInfo> flowTeamSettlementInfos = flowTeamSettlementInfoMapper.listFlowTeamSettlementInfoV2(teamIdList, null, null);
|
||||||
// // 获取往月的固化数据
|
|
||||||
// List<FlowTeamSettlementInfo> oldMonthSettlementInfos = flowTeamSettlementInfoService.listByTeamId(teamId);
|
|
||||||
// if (CollectionUtils.isEmpty(oldMonthSettlementInfos)) {
|
|
||||||
// oldMonthSettlementInfos = initFlowTeamMonthSettlementData(teamId);
|
|
||||||
// }
|
|
||||||
// // 实时查询本月的结算数据
|
|
||||||
// Date now = new Date();
|
|
||||||
// String month = DateTimeUtil.convertDate(now, DateTimeUtil.DEFAULT_DATE_PATTERN_YEAR_MONTH);
|
|
||||||
// List<FlowTeamSettlementInfo> currMonthSettlementInfo = flowTeamSettlementInfoMapper.listFlowTeamSettlementInfo(teamId, false, month);
|
|
||||||
|
|
||||||
List<FlowTeamSettlementInfo> flowTeamSettlementInfos =
|
|
||||||
flowTeamSettlementInfoMapper.listFlowTeamSettlementInfoV2(teamIdList, null, null);
|
|
||||||
|
|
||||||
// 数据组合返回
|
// 数据组合返回
|
||||||
return buildResList(flowTeamSettlementInfos);
|
return buildResList(flowTeamSettlementInfos);
|
||||||
}
|
}
|
||||||
|
@@ -29,20 +29,35 @@ public class FlowTeamSettlementInfo {
|
|||||||
|
|
||||||
@TableField(value = "month")
|
@TableField(value = "month")
|
||||||
private String month;
|
private String month;
|
||||||
|
|
||||||
@TableField(value = "team_id")
|
@TableField(value = "team_id")
|
||||||
private String teamId;
|
private String teamId;
|
||||||
|
|
||||||
@TableField(value = "new_user_num")
|
@TableField(value = "new_user_num")
|
||||||
private Integer newUserNum;
|
private Integer newUserNum;
|
||||||
|
|
||||||
@TableField(value = "new_user_charge_amount")
|
@TableField(value = "new_user_charge_amount")
|
||||||
private Double newUserChargeAmount;
|
private Double newUserChargeAmount;
|
||||||
|
|
||||||
@TableField(value = "total_charge_amount")
|
@TableField(value = "total_charge_amount")
|
||||||
private Double totalChargeAmount;
|
private Double totalChargeAmount;
|
||||||
|
|
||||||
@TableField(value = "total_charge_user_num")
|
@TableField(value = "total_charge_user_num")
|
||||||
private Integer totalChargeUserNum;
|
private Integer totalChargeUserNum;
|
||||||
|
|
||||||
@TableField(value = "total_charge_num")
|
@TableField(value = "total_charge_num")
|
||||||
private Integer totalChargeNum;
|
private Integer totalChargeNum;
|
||||||
|
|
||||||
|
@TableField(value = "total_give_num")
|
||||||
|
private Integer totalGiveNum;
|
||||||
|
|
||||||
|
@TableField(value = "total_give_amount")
|
||||||
|
private Double totalGiveAmount;
|
||||||
|
|
||||||
@TableField(value = "create_time")
|
@TableField(value = "create_time")
|
||||||
private Date createTime;
|
private Date createTime;
|
||||||
|
|
||||||
@TableField(value = "update_time")
|
@TableField(value = "update_time")
|
||||||
private Date updateTime;
|
private Date updateTime;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -93,64 +93,113 @@
|
|||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="listFlowTeamSettlementInfoV2" resultType="com.xuanyin.flowteam.model.FlowTeamSettlementInfo">
|
<select id="listFlowTeamSettlementInfoV2" resultType="com.xuanyin.flowteam.model.FlowTeamSettlementInfo">
|
||||||
select month, sum(a.newUserNum) newUserNum, sum(a.newUserChargeAmount) newUserChargeAmount,
|
select
|
||||||
sum(a.totalChargeAmount) totalChargeAmount, sum(a.totalChargeUserNum) totalChargeUserNum, sum(a.totalChargeNum) totalChargeNum
|
a.`month`,
|
||||||
|
sum(a.newUserNum) as newUserNum,
|
||||||
|
sum(a.newUserChargeAmount) as newUserChargeAmount,
|
||||||
|
sum(a.totalChargeAmount) as totalChargeAmount,
|
||||||
|
sum(a.totalChargeUserNum) as totalChargeUserNum,
|
||||||
|
sum(a.totalChargeNum) as totalChargeNum,
|
||||||
|
sum(a.totalGiveNum) as totalGiveNum,
|
||||||
|
sum(a.totalGiveAmount) as totalGiveAmount
|
||||||
from (
|
from (
|
||||||
-- 小组N月新增用户概况
|
select
|
||||||
select date_format(u.create_time, '%Y-%m') month, count(distinct fm.uid) newUserNum, 0 newUserChargeAmount,
|
date_format(u.create_time, '%Y-%m') as `month`,
|
||||||
0 totalChargeAmount, 0 totalChargeUserNum, 0 totalChargeNum
|
count(distinct fm.uid) as newUserNum,
|
||||||
from flow_team_member_invite_user fm, users u
|
0 as newUserChargeAmount,
|
||||||
where fm.uid = u.uid
|
0 as totalChargeAmount,
|
||||||
<if test="teamIds != null and teamIds.size > 0">
|
0 as totalChargeUserNum,
|
||||||
and fm.team_id in
|
0 as totalChargeNum,
|
||||||
<foreach collection="teamIds" item="teamId" open="(" close=")" separator=",">
|
0 as totalGiveNum,
|
||||||
#{teamId}
|
0 as totalGiveAmount
|
||||||
</foreach>
|
from flow_team_member_invite_user as fm, users as u
|
||||||
</if>
|
where fm.uid = u.uid
|
||||||
group by month
|
<if test="teamIds != null and teamIds.size > 0">
|
||||||
union
|
and fm.team_id in
|
||||||
-- 小组N月新增用户充值概况
|
<foreach collection="teamIds" item="teamId" open="(" close=")" separator=",">
|
||||||
select date_format(r.create_time, '%Y-%m') month, 0 newUserNum
|
#{teamId}
|
||||||
, ifnull(sum(r.amount / 100), 0) newUserChargeAmount , 0 totalChargeAmount, 0 totalChargeUserNum, 0 totalChargeNum
|
</foreach>
|
||||||
from
|
</if>
|
||||||
flow_team_member_invite_user fi, users u, charge_record r
|
group by `month`
|
||||||
where fi.uid = r.uid
|
union
|
||||||
and u.uid = r.uid
|
select
|
||||||
and r.charge_status = 2
|
date_format(r.create_time, '%Y-%m') as `month`,
|
||||||
and r.charge_prod_id != 'exchange'
|
0 as newUserNum,
|
||||||
and r.buss_type in (0,4)
|
ifnull(sum(r.amount / 100), 0) as newUserChargeAmount,
|
||||||
and date_format(r.create_time, '%Y-%m') = date_format(u.create_time, '%Y-%m')
|
0 as totalChargeAmount,
|
||||||
<if test="teamIds != null and teamIds.size > 0">
|
0 as totalChargeUserNum,
|
||||||
and fi.team_id in
|
0 as totalChargeNum,
|
||||||
<foreach collection="teamIds" item="teamId" open="(" close=")" separator=",">
|
0 as totalGiveNum,
|
||||||
#{teamId}
|
0 as totalGiveAmount
|
||||||
</foreach>
|
from
|
||||||
</if>
|
flow_team_member_invite_user as fi, users as u, charge_record as r
|
||||||
group by month
|
where fi.uid = r.uid
|
||||||
union
|
and u.uid = r.uid
|
||||||
-- 小组过去1年邀请的用户在N月的充值概况
|
and r.charge_status = 2
|
||||||
select date_format(r.create_time, '%Y-%m') month, 0 newUserNum ,
|
and r.charge_prod_id != 'exchange'
|
||||||
0 newUserChargeAmount, ifnull(sum(r.amount/100), 0) totalChargeAmount,
|
and r.buss_type in (0,4)
|
||||||
count(distinct r.uid) totalChargeUserNum, count(r.charge_record_id) totalChargeNum
|
and date_format(r.create_time, '%Y-%m') = date_format(u.create_time, '%Y-%m')
|
||||||
from flow_team_member_invite_user fi , charge_record r
|
<if test="teamIds != null and teamIds.size > 0">
|
||||||
where fi.uid = r.uid and r.charge_status in (2,6) and r.charge_prod_id != 'exchange'
|
and fi.team_id in
|
||||||
and r.buss_type in (0,4)
|
<foreach collection="teamIds" item="teamId" open="(" close=")" separator=",">
|
||||||
<if test="queryLimitTime != null">
|
#{teamId}
|
||||||
and r.create_time >= #{queryLimitTime}
|
</foreach>
|
||||||
</if>
|
</if>
|
||||||
<if test="teamIds != null and teamIds.size > 0">
|
group by `month`
|
||||||
and fi.team_id in
|
union
|
||||||
<foreach collection="teamIds" item="teamId" open="(" close=")" separator=",">
|
select
|
||||||
#{teamId}
|
date_format(r.create_time, '%Y-%m') as `month`,
|
||||||
</foreach>
|
0 as newUserNum,
|
||||||
</if>
|
0 as newUserChargeAmount,
|
||||||
group by month, fi.team_id) a
|
ifnull(sum(r.amount / 100), 0) as totalChargeAmount,
|
||||||
group by a.month
|
count(distinct r.uid) as totalChargeUserNum,
|
||||||
<if test="month != null and month != ''">
|
count(r.charge_record_id) as totalChargeNum,
|
||||||
having month = #{month}
|
0 as totalGiveNum,
|
||||||
</if>
|
0 as totalGiveAmount
|
||||||
order by a.month
|
from flow_team_member_invite_user as fi, charge_record as r
|
||||||
;
|
where fi.uid = r.uid
|
||||||
|
and r.charge_status in (2,6)
|
||||||
|
and r.charge_prod_id != 'exchange'
|
||||||
|
and r.buss_type in (0,4)
|
||||||
|
<if test="queryLimitTime != null">
|
||||||
|
and r.create_time >= #{queryLimitTime}
|
||||||
|
</if>
|
||||||
|
<if test="teamIds != null and teamIds.size > 0">
|
||||||
|
and fi.team_id in
|
||||||
|
<foreach collection="teamIds" item="teamId" open="(" close=")" separator=",">
|
||||||
|
#{teamId}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
group by `month`, fi.team_id
|
||||||
|
union
|
||||||
|
select
|
||||||
|
date_format(dgh.create_time, '%Y-%m') as `month`,
|
||||||
|
0 as newUserNum,
|
||||||
|
0 as newUserChargeAmount,
|
||||||
|
0 as totalChargeAmount,
|
||||||
|
0 as totalChargeUserNum,
|
||||||
|
0 as totalChargeNum,
|
||||||
|
count(1) as totalGiveNum,
|
||||||
|
ifnull(sum(dgh.diamond_num / 1000), 0) as totalGiveAmount
|
||||||
|
from flow_team_member_invite_user as fi
|
||||||
|
left join diamond_give_history as dgh on dgh.to_uid = fi.uid
|
||||||
|
where 1 = 1
|
||||||
|
<if test="queryLimitTime != null">
|
||||||
|
and dgh.create_time >= #{queryLimitTime}
|
||||||
|
</if>
|
||||||
|
<if test="teamIds != null and teamIds.size > 0">
|
||||||
|
and fi.team_id in
|
||||||
|
<foreach collection="teamIds" item="teamId" open="(" close=")" separator=",">
|
||||||
|
#{teamId}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
group by `month`, fi.team_id
|
||||||
|
) as a
|
||||||
|
group by a.`month`
|
||||||
|
<if test="month != null and month != ''">
|
||||||
|
having a.`month = #{month}
|
||||||
|
</if>
|
||||||
|
order by a.`month`
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="listFlowTeamSettleDetailV2" resultType="com.xuanyin.flowteam.dto.FlowTeamSettlementDetail">
|
<select id="listFlowTeamSettleDetailV2" resultType="com.xuanyin.flowteam.dto.FlowTeamSettlementDetail">
|
||||||
|
Reference in New Issue
Block a user