修改河南项目的管理后台ui和删除之前不需要的游戏

This commit is contained in:
2026-09-22 17:14:18 +08:00
parent 1e256b94e8
commit 687a1f0f98
36 changed files with 327 additions and 309 deletions
@@ -113,7 +113,7 @@ public class PromoAdminManageController extends BaseController {
BigDecimal anchorRecharge = BigDecimal.ZERO;
BigDecimal anchorTurnover = BigDecimal.ZERO;
BigDecimal anchorSpecialTurnover = BigDecimal.ZERO; // 特殊游戏(玫瑰女郎)流水
BigDecimal anchorSpecialTurnover = BigDecimal.ZERO; // 特殊游戏(麻将胡了)流水
BigDecimal anchorClassicTurnover = BigDecimal.ZERO; // 经典游戏流水
BigDecimal anchorEarnings = BigDecimal.ZERO;
BigDecimal businessEarningsForAnchor = BigDecimal.ZERO; // 招商从该主播获得的收益
@@ -130,7 +130,7 @@ public class PromoAdminManageController extends BaseController {
TtAccountRecordType.INPUT.getCode());
// 总流水(游戏消费)
anchorTurnover = sumGameConsume(subUserIds);
// 特殊游戏(玫瑰女郎)消费
// 特殊游戏(麻将胡了)消费
anchorSpecialTurnover = sumNewGameConsume(subUserIds);
// 经典游戏消费
anchorClassicTurnover = sumClassicGameConsume(subUserIds);
@@ -256,7 +256,7 @@ public class PromoAdminManageController extends BaseController {
TtAccountRecordType.INPUT.getCode());
// 总流水(游戏消费)
totalTurnover = sumGameConsume(subUserIds);
// 新游戏消费
// 新游戏(麻将胡了)消费
newGameConsume = sumNewGameConsume(subUserIds);
// 经典游戏消费
classicGameConsume = sumClassicGameConsume(subUserIds);
@@ -382,7 +382,7 @@ public class PromoAdminManageController extends BaseController {
}
/**
* 汇总新游戏消费(奥林匹斯)
* 汇总新游戏消费(麻将胡了)
*/
private BigDecimal sumNewGameConsume(List<Integer> userIds) {
return sumConsumeByFilter(userIds, TtAccountRecordSource::isNewGameConsumeForCommission);
@@ -404,16 +404,16 @@ public class PromoTurnoverController extends BaseController {
BigDecimal battleConsume = BigDecimal.ZERO;
BigDecimal luckUpgradeConsume = BigDecimal.ZERO;
BigDecimal crazyWheelConsume = BigDecimal.ZERO;
BigDecimal olympusConsume = BigDecimal.ZERO;
BigDecimal mahjongConsume = BigDecimal.ZERO;
if (!gameUserIds.isEmpty()) {
classicBoxConsume = coalesce(promoTurnoverMapper.getGameConsumeByUserIds(gameUserIds, Collections.singletonList(2), startTime, endTime));
battleConsume = coalesce(promoTurnoverMapper.getGameConsumeByUserIds(gameUserIds, Collections.singletonList(4), startTime, endTime));
luckUpgradeConsume = coalesce(promoTurnoverMapper.getGameConsumeByUserIds(gameUserIds, Collections.singletonList(40), startTime, endTime));
crazyWheelConsume = coalesce(promoTurnoverMapper.getGameConsumeByUserIds(gameUserIds, Collections.singletonList(38), startTime, endTime));
olympusConsume = coalesce(promoTurnoverMapper.getGameConsumeByUserIds(gameUserIds, Collections.singletonList(60), startTime, endTime));
mahjongConsume = coalesce(promoTurnoverMapper.getGameConsumeByUserIds(gameUserIds, Collections.singletonList(68), startTime, endTime));
}
BigDecimal classicGameConsume = classicBoxConsume.add(battleConsume).add(luckUpgradeConsume).add(crazyWheelConsume);
BigDecimal specialGameConsume = olympusConsume;
BigDecimal specialGameConsume = mahjongConsume;
// 主播行流水列:均为该主播名下所有普通用户的流水汇总
BigDecimal anchorTotalFlow = classicGameConsume.add(specialGameConsume);
BigDecimal anchorClassicFlow = classicGameConsume;
@@ -432,7 +432,7 @@ public class PromoTurnoverController extends BaseController {
item.put("battleConsume", battleConsume);
item.put("luckUpgradeConsume", luckUpgradeConsume);
item.put("crazyWheelConsume", crazyWheelConsume);
item.put("olympusConsume", olympusConsume);
item.put("mahjongConsume", mahjongConsume);
item.put("totalCommission", totalCommission);
// 主播下属普通用户明细(供前端展开展示,不计算佣金)
@@ -456,13 +456,13 @@ public class PromoTurnoverController extends BaseController {
BigDecimal uBattle = coalesce(promoTurnoverMapper.getGameConsumeBySources(u.getUserId(), Collections.singletonList(4), startTime, endTime));
BigDecimal uLuck = coalesce(promoTurnoverMapper.getGameConsumeBySources(u.getUserId(), Collections.singletonList(40), startTime, endTime));
BigDecimal uWheel = coalesce(promoTurnoverMapper.getGameConsumeBySources(u.getUserId(), Collections.singletonList(38), startTime, endTime));
BigDecimal uOlympus = coalesce(promoTurnoverMapper.getGameConsumeBySources(u.getUserId(), Collections.singletonList(60), startTime, endTime));
BigDecimal uMahjong = coalesce(promoTurnoverMapper.getGameConsumeBySources(u.getUserId(), Collections.singletonList(68), startTime, endTime));
child.put("totalRecharge", uRecharge);
child.put("classicBoxConsume", uCB);
child.put("battleConsume", uBattle);
child.put("luckUpgradeConsume", uLuck);
child.put("crazyWheelConsume", uWheel);
child.put("olympusConsume", uOlympus);
child.put("mahjongConsume", uMahjong);
child.put("totalCommission", BigDecimal.ZERO); // 普通用户行不独立计算
children.add(child);
}
@@ -493,10 +493,10 @@ public class PromoTurnoverController extends BaseController {
BigDecimal battleConsume = coalesce(promoTurnoverMapper.getGameConsumeBySources(u.getUserId(), Collections.singletonList(4), startTime, endTime));
BigDecimal luckUpgradeConsume = coalesce(promoTurnoverMapper.getGameConsumeBySources(u.getUserId(), Collections.singletonList(40), startTime, endTime));
BigDecimal crazyWheelConsume = coalesce(promoTurnoverMapper.getGameConsumeBySources(u.getUserId(), Collections.singletonList(38), startTime, endTime));
BigDecimal olympusConsume = coalesce(promoTurnoverMapper.getGameConsumeBySources(u.getUserId(), Collections.singletonList(60), startTime, endTime));
BigDecimal mahjongConsume = coalesce(promoTurnoverMapper.getGameConsumeBySources(u.getUserId(), Collections.singletonList(68), startTime, endTime));
BigDecimal classicGameConsume = classicBoxConsume.add(battleConsume).add(luckUpgradeConsume).add(crazyWheelConsume);
BigDecimal specialGameConsume = olympusConsume;
BigDecimal specialGameConsume = mahjongConsume;
// 主播佣金:分项各自 calcRate 后相加,舍入口径与 admin 端 calcRate 完全一致
BigDecimal totalCommission = calcRate(totalRecharge, commissionRate)
@@ -508,7 +508,7 @@ public class PromoTurnoverController extends BaseController {
item.put("battleConsume", battleConsume);
item.put("luckUpgradeConsume", luckUpgradeConsume);
item.put("crazyWheelConsume", crazyWheelConsume);
item.put("olympusConsume", olympusConsume);
item.put("mahjongConsume", mahjongConsume);
item.put("totalCommission", totalCommission);
result.add(item);
}
@@ -715,6 +715,7 @@ public class PromoTurnoverController extends BaseController {
/**
* 招商游戏消费返点比例:按游戏来源取新游戏/经典玩法费率(口径与周结 CommissionSettlementTask 一致)。
* 新游戏 = 麻将胡了(source 68),走 newGameCommissionRate。
*/
private BigDecimal businessGameRate(TtUser businessUser, int src) {
return TtAccountRecordSource.isNewGameConsumeForCommission(src)
@@ -777,10 +778,10 @@ public class PromoTurnoverController extends BaseController {
BigDecimal battleConsume = coalesce(promoTurnoverMapper.getGameConsumeBySources(u.getUserId(), Collections.singletonList(4), startTime, endTime));
BigDecimal luckUpgradeConsume = coalesce(promoTurnoverMapper.getGameConsumeBySources(u.getUserId(), Collections.singletonList(40), startTime, endTime));
BigDecimal crazyWheelConsume = coalesce(promoTurnoverMapper.getGameConsumeBySources(u.getUserId(), Collections.singletonList(38), startTime, endTime));
BigDecimal olympusConsume = coalesce(promoTurnoverMapper.getGameConsumeBySources(u.getUserId(), Collections.singletonList(60), startTime, endTime));
BigDecimal mahjongConsume = coalesce(promoTurnoverMapper.getGameConsumeBySources(u.getUserId(), Collections.singletonList(68), startTime, endTime));
classicGameConsume = classicGameConsume.add(classicBoxConsume).add(battleConsume).add(luckUpgradeConsume).add(crazyWheelConsume);
specialGameConsume = specialGameConsume.add(olympusConsume);
specialGameConsume = specialGameConsume.add(mahjongConsume);
}
return calcRate(totalRecharge, anchor.getCommissionRate())
@@ -173,7 +173,7 @@ public interface PromoTurnoverMapper {
/**
* 按 business_id 快照统计指定招商上周流水(不受后续改绑/解绑影响)。
* 返回 Map:recharge, newGameConsume, classicGameConsume。
* 返回 Map:recharge, classicGameConsume。
* 游戏消费按 anchor_id IS NOT NULL 排除主播自玩,与旧口径「仅普通用户」一致。
*/
Map<String, Object> getWeeklyCommissionDataWithSnapshot(@Param("businessUserId") Integer businessUserId,
@@ -183,8 +183,8 @@ public interface PromoTurnoverMapper {
/**
* 按天统计本周佣金计算所需数据(按当前关系树 user_id IN 统计,增加 GROUP BY DATE(create_time))。
* - rechargeUserIds:全部下级(含主播自身),统计充值
* - gameUserIds:仅普通用户(排除主播自玩),统计新/经典游戏消费
* 返回每天一行 Map:date, recharge, newGameConsume, classicGameConsume
* - gameUserIds:仅普通用户(排除主播自玩),统计游戏消费
* 返回每天一行 Map:date, recharge, classicGameConsume
* 注意:本方法是“本周待结算”展示口径,与周结落账用的 business_id 快照口径不同。
*/
List<Map<String, Object>> getWeeklyDailyCommissionData(@Param("rechargeUserIds") List<Integer> rechargeUserIds,
@@ -280,19 +280,6 @@ public interface PromoTurnoverMapper {
@Param("startTime") Date startTime,
@Param("endTime") Date endTime);
/**
* 统计指定用户群在指定日期内的特殊游戏(玫瑰女郎)消费总额
*/
@Select({"<script>",
"SELECT COALESCE(SUM(ABS(total)), 0) FROM tt_user_blend_ercash",
"WHERE type = 0 AND source IN (60)",
"AND user_id IN <foreach item='id' collection='userIds' open='(' separator=',' close=')'>#{id}</foreach>",
"AND create_time >= #{startTime} AND create_time &lt; #{endTime}",
"</script>"})
BigDecimal getSubNewGameConsumeByDate(@Param("userIds") List<Integer> userIds,
@Param("startTime") Date startTime,
@Param("endTime") Date endTime);
/**
* 统计指定用户群在指定日期内的经典玩法游戏消费总额(经典开箱、对战、幸运升级、疯狂转盘)
*/
@@ -358,12 +345,6 @@ public interface PromoTurnoverMapper {
@Select("SELECT COALESCE(SUM(ABS(amount)), 0) FROM tt_user_blend_ercash WHERE user_id = #{userId} AND type = 0 AND source IN (2, 4, 40, 38)")
BigDecimal getNormalGameConsumeByUserId(@Param("userId") Integer userId);
/**
* 用户终身特殊游戏消费(玫瑰女郎)
*/
@Select("SELECT COALESCE(SUM(ABS(amount)), 0) FROM tt_user_blend_ercash WHERE user_id = #{userId} AND type = 0 AND source IN (60)")
BigDecimal getSpecialGameConsumeByUserId(@Param("userId") Integer userId);
/**
* 按 source 列表统计用户游戏消费(startTime/endTime 为空时为终身累计)
*/
@@ -113,7 +113,7 @@ public class PromoTurnoverServiceImpl implements PromoTurnoverService {
BigDecimal yesterdayCommission = BigDecimal.ZERO;
if (CollectionUtils.isNotEmpty(allSubUserIds)) {
// === 佣金数据:一次查询替代原来6次(充值×2 + 新游戏×2 + 经典×2)===
// === 佣金数据:一次查询替代原来多次查询(充值×2 + 新游戏×2 + 经典×2)===
Map<String, Object> commData = promoTurnoverMapper.getBatchedCommissionData(
allSubUserIds, gameUserIds, todayStart, todayEnd, yesterdayStart, yesterdayEnd);
BigDecimal todaySubRecharge = toBd(commData, "todayRecharge");
@@ -273,19 +273,19 @@ public class PromoTurnoverServiceImpl implements PromoTurnoverService {
List<Map<String, Object>> periods = new ArrayList<>();
periods.add(buildPeriod("今日", data,
rechargeRate, newGameRate, classicGameRate,
"todayClassicBox", "todayLuckyUpgrade", "todayBattle", "todayCrazyWheel", "todayOlympus",
"todayClassicBox", "todayLuckyUpgrade", "todayBattle", "todayCrazyWheel", "todayMahjong",
"todayRecharge", todayNewSub));
periods.add(buildPeriod("昨日", data,
rechargeRate, newGameRate, classicGameRate,
"yesterdayClassicBox", "yesterdayLuckyUpgrade", "yesterdayBattle", "yesterdayCrazyWheel", "yesterdayOlympus",
"yesterdayClassicBox", "yesterdayLuckyUpgrade", "yesterdayBattle", "yesterdayCrazyWheel", "yesterdayMahjong",
"yesterdayRecharge", yesterdayNewSub));
periods.add(buildPeriod("本周", data,
rechargeRate, newGameRate, classicGameRate,
"weekClassicBox", "weekLuckyUpgrade", "weekBattle", "weekCrazyWheel", "weekOlympus",
"weekClassicBox", "weekLuckyUpgrade", "weekBattle", "weekCrazyWheel", "weekMahjong",
"weekRecharge", weekNewSub));
periods.add(buildPeriod("总", data,
rechargeRate, newGameRate, classicGameRate,
"totalClassicBox", "totalLuckyUpgrade", "totalBattle", "totalCrazyWheel", "totalOlympus",
"totalClassicBox", "totalLuckyUpgrade", "totalBattle", "totalCrazyWheel", "totalMahjong",
"totalRecharge", totalNewSub));
result.put("periods", periods);
@@ -460,7 +460,6 @@ public class PromoTurnoverServiceImpl implements PromoTurnoverService {
return TtAccountRecordSource.isSpecialGameConsume(v.getSource());
}).map(v -> v.getAmount().abs()).reduce(BigDecimal.ZERO, BigDecimal::add);
userInfo.setTotalNormGameCost(totalNormalGameConsume);
userInfo.setTotalSpecialGameCost(totalSpecialGameConsume);
userInfo.setTotalRecharge(totalRecharge);
@@ -817,10 +816,10 @@ public class PromoTurnoverServiceImpl implements PromoTurnoverService {
private Map<String, Object> createZeroGameCommissionData() {
Map<String, Object> map = new HashMap<>();
String[] keys = {
"todayClassicBox", "todayLuckyUpgrade", "todayBattle", "todayCrazyWheel", "todayOlympus",
"yesterdayClassicBox", "yesterdayLuckyUpgrade", "yesterdayBattle", "yesterdayCrazyWheel", "yesterdayOlympus",
"weekClassicBox", "weekLuckyUpgrade", "weekBattle", "weekCrazyWheel", "weekOlympus",
"totalClassicBox", "totalLuckyUpgrade", "totalBattle", "totalCrazyWheel", "totalOlympus",
"todayClassicBox", "todayLuckyUpgrade", "todayBattle", "todayCrazyWheel", "todayMahjong",
"yesterdayClassicBox", "yesterdayLuckyUpgrade", "yesterdayBattle", "yesterdayCrazyWheel", "yesterdayMahjong",
"weekClassicBox", "weekLuckyUpgrade", "weekBattle", "weekCrazyWheel", "weekMahjong",
"totalClassicBox", "totalLuckyUpgrade", "totalBattle", "totalCrazyWheel", "totalMahjong",
"todayRecharge", "yesterdayRecharge", "weekRecharge", "totalRecharge"
};
for (String key : keys) {
@@ -835,17 +834,17 @@ public class PromoTurnoverServiceImpl implements PromoTurnoverService {
private Map<String, Object> buildPeriod(String periodName, Map<String, Object> data,
BigDecimal rechargeRate, BigDecimal newGameRate, BigDecimal classicGameRate,
String classicBoxKey, String luckyUpgradeKey, String battleKey,
String crazyWheelKey, String olympusKey, String rechargeKey, int newSub) {
String crazyWheelKey, String mahjongKey, String rechargeKey, int newSub) {
BigDecimal classicBox = toBd(data, classicBoxKey);
BigDecimal luckyUpgrade = toBd(data, luckyUpgradeKey);
BigDecimal battle = toBd(data, battleKey);
BigDecimal crazyWheel = toBd(data, crazyWheelKey);
BigDecimal olympus = toBd(data, olympusKey);
BigDecimal mahjong = toBd(data, mahjongKey);
BigDecimal recharge = toBd(data, rechargeKey);
BigDecimal totalConsume = classicBox.add(luckyUpgrade).add(battle).add(crazyWheel).add(olympus);
BigDecimal totalConsume = classicBox.add(luckyUpgrade).add(battle).add(crazyWheel).add(mahjong);
BigDecimal classicConsume = classicBox.add(luckyUpgrade).add(battle).add(crazyWheel);
BigDecimal totalRebate = calcCommission(recharge, rechargeRate)
.add(calcCommission(olympus, newGameRate))
.add(calcCommission(mahjong, newGameRate))
.add(calcCommission(classicConsume, classicGameRate));
Map<String, Object> period = new LinkedHashMap<>();
@@ -854,7 +853,7 @@ public class PromoTurnoverServiceImpl implements PromoTurnoverService {
period.put("luckyUpgrade", luckyUpgrade);
period.put("battle", battle);
period.put("crazyWheel", crazyWheel);
period.put("olympus", olympus);
period.put("mahjong", mahjong);
period.put("totalConsume", totalConsume);
period.put("recharge", recharge);
period.put("newSub", newSub);
@@ -102,14 +102,14 @@
</foreach>
AND create_time >= #{yesterdayStart} AND create_time &lt; #{yesterdayEnd}
THEN amount ELSE 0 END), 0) AS yesterdayRecharge,
COALESCE(SUM(CASE WHEN source IN (60) AND type = 0
COALESCE(SUM(CASE WHEN source IN (68) AND type = 0
AND user_id IN
<foreach item="id" collection="gameUserIds" open="(" separator="," close=")">
#{id}
</foreach>
AND create_time >= #{todayStart} AND create_time &lt; #{todayEnd}
THEN ABS(total) ELSE 0 END), 0) AS todayNewGame,
COALESCE(SUM(CASE WHEN source IN (60) AND type = 0
COALESCE(SUM(CASE WHEN source IN (68) AND type = 0
AND user_id IN
<foreach item="id" collection="gameUserIds" open="(" separator="," close=")">
#{id}
@@ -137,7 +137,7 @@
#{id}
</foreach>)
OR
(source IN (60, 2, 4, 40, 38) AND type = 0 AND user_id IN
(source IN (68, 2, 4, 40, 38) AND type = 0 AND user_id IN
<foreach item="id" collection="gameUserIds" open="(" separator="," close=")">
#{id}
</foreach>)
@@ -164,22 +164,22 @@
COALESCE(SUM(CASE WHEN source = 40 AND type = 0 AND create_time >= #{todayStart} AND create_time &lt; #{todayEnd} THEN ABS(total) ELSE 0 END), 0) AS todayLuckyUpgrade,
COALESCE(SUM(CASE WHEN source = 4 AND type = 0 AND create_time >= #{todayStart} AND create_time &lt; #{todayEnd} THEN ABS(total) ELSE 0 END), 0) AS todayBattle,
COALESCE(SUM(CASE WHEN source = 38 AND type = 0 AND create_time >= #{todayStart} AND create_time &lt; #{todayEnd} THEN ABS(total) ELSE 0 END), 0) AS todayCrazyWheel,
COALESCE(SUM(CASE WHEN source = 60 AND type = 0 AND create_time >= #{todayStart} AND create_time &lt; #{todayEnd} THEN ABS(total) ELSE 0 END), 0) AS todayOlympus,
COALESCE(SUM(CASE WHEN source = 68 AND type = 0 AND create_time >= #{todayStart} AND create_time &lt; #{todayEnd} THEN ABS(total) ELSE 0 END), 0) AS todayMahjong,
COALESCE(SUM(CASE WHEN source = 2 AND type = 0 AND create_time >= #{yesterdayStart} AND create_time &lt; #{yesterdayEnd} THEN ABS(total) ELSE 0 END), 0) AS yesterdayClassicBox,
COALESCE(SUM(CASE WHEN source = 40 AND type = 0 AND create_time >= #{yesterdayStart} AND create_time &lt; #{yesterdayEnd} THEN ABS(total) ELSE 0 END), 0) AS yesterdayLuckyUpgrade,
COALESCE(SUM(CASE WHEN source = 4 AND type = 0 AND create_time >= #{yesterdayStart} AND create_time &lt; #{yesterdayEnd} THEN ABS(total) ELSE 0 END), 0) AS yesterdayBattle,
COALESCE(SUM(CASE WHEN source = 38 AND type = 0 AND create_time >= #{yesterdayStart} AND create_time &lt; #{yesterdayEnd} THEN ABS(total) ELSE 0 END), 0) AS yesterdayCrazyWheel,
COALESCE(SUM(CASE WHEN source = 60 AND type = 0 AND create_time >= #{yesterdayStart} AND create_time &lt; #{yesterdayEnd} THEN ABS(total) ELSE 0 END), 0) AS yesterdayOlympus,
COALESCE(SUM(CASE WHEN source = 68 AND type = 0 AND create_time >= #{yesterdayStart} AND create_time &lt; #{yesterdayEnd} THEN ABS(total) ELSE 0 END), 0) AS yesterdayMahjong,
COALESCE(SUM(CASE WHEN source = 2 AND type = 0 AND create_time >= #{weekStart} AND create_time &lt; #{weekEnd} THEN ABS(total) ELSE 0 END), 0) AS weekClassicBox,
COALESCE(SUM(CASE WHEN source = 40 AND type = 0 AND create_time >= #{weekStart} AND create_time &lt; #{weekEnd} THEN ABS(total) ELSE 0 END), 0) AS weekLuckyUpgrade,
COALESCE(SUM(CASE WHEN source = 4 AND type = 0 AND create_time >= #{weekStart} AND create_time &lt; #{weekEnd} THEN ABS(total) ELSE 0 END), 0) AS weekBattle,
COALESCE(SUM(CASE WHEN source = 38 AND type = 0 AND create_time >= #{weekStart} AND create_time &lt; #{weekEnd} THEN ABS(total) ELSE 0 END), 0) AS weekCrazyWheel,
COALESCE(SUM(CASE WHEN source = 60 AND type = 0 AND create_time >= #{weekStart} AND create_time &lt; #{weekEnd} THEN ABS(total) ELSE 0 END), 0) AS weekOlympus,
COALESCE(SUM(CASE WHEN source = 68 AND type = 0 AND create_time >= #{weekStart} AND create_time &lt; #{weekEnd} THEN ABS(total) ELSE 0 END), 0) AS weekMahjong,
COALESCE(SUM(CASE WHEN source = 2 AND type = 0 THEN ABS(total) ELSE 0 END), 0) AS totalClassicBox,
COALESCE(SUM(CASE WHEN source = 40 AND type = 0 THEN ABS(total) ELSE 0 END), 0) AS totalLuckyUpgrade,
COALESCE(SUM(CASE WHEN source = 4 AND type = 0 THEN ABS(total) ELSE 0 END), 0) AS totalBattle,
COALESCE(SUM(CASE WHEN source = 38 AND type = 0 THEN ABS(total) ELSE 0 END), 0) AS totalCrazyWheel,
COALESCE(SUM(CASE WHEN source = 60 AND type = 0 THEN ABS(total) ELSE 0 END), 0) AS totalOlympus,
COALESCE(SUM(CASE WHEN source = 68 AND type = 0 THEN ABS(total) ELSE 0 END), 0) AS totalMahjong,
COALESCE(SUM(CASE WHEN source = 1 AND type = 1 AND create_time >= #{todayStart} AND create_time &lt; #{todayEnd} THEN amount ELSE 0 END), 0) AS todayRecharge,
COALESCE(SUM(CASE WHEN source = 1 AND type = 1 AND create_time >= #{yesterdayStart} AND create_time &lt; #{yesterdayEnd} THEN amount ELSE 0 END), 0) AS yesterdayRecharge,
COALESCE(SUM(CASE WHEN source = 1 AND type = 1 AND create_time >= #{weekStart} AND create_time &lt; #{weekEnd} THEN amount ELSE 0 END), 0) AS weekRecharge,
@@ -188,7 +188,7 @@
SELECT user_id, source, type, amount, total, create_time
FROM tt_user_blend_ercash
WHERE (
(source IN (2, 4, 38, 40, 60) AND type = 0 AND user_id IN
(source IN (68, 2, 4, 38, 40) AND type = 0 AND user_id IN
<foreach item="id" collection="gameUserIds" open="(" separator="," close=")">#{id}</foreach>)
OR
(source = 1 AND type = 1 AND user_id IN
@@ -198,7 +198,7 @@
SELECT user_id, source, type, amount, total, create_time
FROM tt_user_blend_ercash_archive
WHERE (
(source IN (2, 4, 38, 40, 60) AND type = 0 AND user_id IN
(source IN (68, 2, 4, 38, 40) AND type = 0 AND user_id IN
<foreach item="id" collection="gameUserIds" open="(" separator="," close=")">#{id}</foreach>)
OR
(source = 1 AND type = 1 AND user_id IN
@@ -436,7 +436,7 @@
COALESCE(SUM(CASE WHEN source = 1 AND type = 1
AND business_id = #{businessUserId}
THEN amount ELSE 0 END), 0) AS recharge,
COALESCE(SUM(CASE WHEN source IN (60) AND type = 0
COALESCE(SUM(CASE WHEN source IN (68) AND type = 0
AND business_id = #{businessUserId} AND anchor_id IS NOT NULL
THEN ABS(total) ELSE 0 END), 0) AS newGameConsume,
COALESCE(SUM(CASE WHEN source IN (2, 4, 40, 38) AND type = 0
@@ -452,7 +452,7 @@
(source = 1 AND type = 1 AND business_id = #{businessUserId})
OR
-- 只统计属于该招商的下级产生的游戏消费记录
(source IN (60, 2, 4, 40, 38) AND type = 0 AND business_id = #{businessUserId})
(source IN (68, 2, 4, 40, 38) AND type = 0 AND business_id = #{businessUserId})
)
UNION ALL
SELECT create_time, user_id, source, type, amount, total, business_id, anchor_id
@@ -464,7 +464,7 @@
(source = 1 AND type = 1 AND business_id = #{businessUserId})
OR
-- 只统计属于该招商的下级产生的游戏消费记录
(source IN (60, 2, 4, 40, 38) AND type = 0 AND business_id = #{businessUserId})
(source IN (68, 2, 4, 40, 38) AND type = 0 AND business_id = #{businessUserId})
)
) t
</select>
@@ -478,7 +478,7 @@
DATE(t.create_time) AS date,
COALESCE(SUM(CASE WHEN t.source = 1 AND t.type = 1
THEN t.amount ELSE 0 END), 0) AS recharge,
COALESCE(SUM(CASE WHEN t.source IN (60) AND t.type = 0
COALESCE(SUM(CASE WHEN t.source IN (68) AND t.type = 0
THEN ABS(t.total) ELSE 0 END), 0) AS newGameConsume,
COALESCE(SUM(CASE WHEN t.source IN (2, 4, 40, 38) AND t.type = 0
THEN ABS(t.total) ELSE 0 END), 0) AS classicGameConsume
@@ -493,7 +493,7 @@
#{id}
</foreach>)
OR
(source IN (60, 2, 4, 40, 38) AND type = 0 AND user_id IN
(source IN (68, 2, 4, 40, 38) AND type = 0 AND user_id IN
<foreach item="id" collection="gameUserIds" open="(" separator="," close=")">
#{id}
</foreach>)
@@ -509,7 +509,7 @@
#{id}
</foreach>)
OR
(source IN (60, 2, 4, 40, 38) AND type = 0 AND user_id IN
(source IN (68, 2, 4, 40, 38) AND type = 0 AND user_id IN
<foreach item="id" collection="gameUserIds" open="(" separator="," close=")">
#{id}
</foreach>)
@@ -639,13 +639,13 @@
<sql id="businessGameConsumeRows">
SELECT create_time, user_id, source, total
FROM tt_user_blend_ercash
WHERE type = 0 AND source IN (2, 4, 38, 40, 60)
WHERE type = 0 AND source IN (68, 2, 4, 38, 40)
AND user_id IN
<foreach item="id" collection="gameUserIds" open="(" separator="," close=")">#{id}</foreach>
UNION ALL
SELECT create_time, user_id, source, total
FROM tt_user_blend_ercash_archive
WHERE type = 0 AND source IN (2, 4, 38, 40, 60)
WHERE type = 0 AND source IN (68, 2, 4, 38, 40)
AND user_id IN
<foreach item="id" collection="gameUserIds" open="(" separator="," close=")">#{id}</foreach>
</sql>