From ff9b790de53d37bb2520bedada11ad1357221faf Mon Sep 17 00:00:00 2001 From: hy001 Date: Fri, 24 Apr 2026 17:10:36 +0800 Subject: [PATCH] z MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 增加灵仙游戏,修复房间排序,数据大屏增加 --- nacos_config/rc-service-other/application.yml | 8 + .../model/event/user/LoginLoggerEvent.java | 5 + .../cmd/user/account/CreateAccountCmd.java | 5 + .../datav/CountryDashboardServiceImpl.java | 206 ++++++++++++++++++ .../datav/CountryDashboardMetricCO.java | 32 +++ .../rds/dao/datav/CountryDashboardDAO.java | 15 ++ .../dto/datav/CountryDashboardMetricDTO.java | 4 + .../CountryDashboardRetentionUserDTO.java | 24 ++ .../dao/datav/CountryDashboardDAO.xml | 110 +++++++--- .../room/query/RoomVoiceDiscoverQryExe.java | 31 ++- .../sys/query/GameListConfigQryExe.java | 7 +- .../common/invite/InviteCampaignGoClient.java | 92 ++++++++ .../user/UserProfileAppConvertor.java | 1 + .../listener/user/LoginLoggerListener.java | 31 +++ .../query/RoomVoiceDiscoverQryExeTest.java | 15 +- .../infra/config/InviteCampaignGoConfig.java | 21 ++ .../user/UserProfileInfraConvertor.java | 1 + .../live/impl/ActiveVoiceRoomServiceImpl.java | 28 +-- .../impl/RoomProfileManagerServiceImpl.java | 3 +- .../service/sys/GameListConfigService.java | 5 + .../sys/impl/GameListConfigServiceImpl.java | 82 ++++++- .../impl/ActiveVoiceRoomServiceImplTest.java | 26 ++- .../RoomProfileManagerServiceImplTest.java | 5 +- 23 files changed, 689 insertions(+), 68 deletions(-) create mode 100644 rc-service/rc-service-console/console-infrastructure/src/main/java/com/red/circle/console/infra/database/rds/dto/datav/CountryDashboardRetentionUserDTO.java create mode 100644 rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/common/invite/InviteCampaignGoClient.java create mode 100644 rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/config/InviteCampaignGoConfig.java diff --git a/nacos_config/rc-service-other/application.yml b/nacos_config/rc-service-other/application.yml index eb5644da..d7f31a00 100644 --- a/nacos_config/rc-service-other/application.yml +++ b/nacos_config/rc-service-other/application.yml @@ -107,6 +107,14 @@ lucky: app_id: ${LIKEI_GAME_BAISHUN_APP_ID} app_channel: ${LIKEI_GAME_BAISHUN_APP_CHANNEL} +invite: + campaign: + go: + enabled: ${INVITE_CAMPAIGN_GO_ENABLED:true} + base-url: ${INVITE_CAMPAIGN_GO_URL:} + internal-token: ${GAME_INTERNAL_CALLBACK_SECRET:} + timeout-millis: ${INVITE_CAMPAIGN_GO_TIMEOUT_MILLIS:10000} + activity: ranking: reward: diff --git a/rc-common-business/common-business-mq/business-mq-model/src/main/java/com/red/circle/mq/business/model/event/user/LoginLoggerEvent.java b/rc-common-business/common-business-mq/business-mq-model/src/main/java/com/red/circle/mq/business/model/event/user/LoginLoggerEvent.java index d84614c9..7616843e 100644 --- a/rc-common-business/common-business-mq/business-mq-model/src/main/java/com/red/circle/mq/business/model/event/user/LoginLoggerEvent.java +++ b/rc-common-business/common-business-mq/business-mq-model/src/main/java/com/red/circle/mq/business/model/event/user/LoginLoggerEvent.java @@ -29,6 +29,11 @@ public class LoginLoggerEvent implements Serializable { @JsonSerialize(using = ToStringSerializer.class) private String invitePeople; + /** + * 邀请活动邀请码(注册时才有). + */ + private String invitationCode; + /** * 0.注册登录,1.登陆. */ diff --git a/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/cmd/user/account/CreateAccountCmd.java b/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/cmd/user/account/CreateAccountCmd.java index 37b553cd..146d1ef2 100644 --- a/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/cmd/user/account/CreateAccountCmd.java +++ b/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/cmd/user/account/CreateAccountCmd.java @@ -25,6 +25,11 @@ public class CreateAccountCmd extends AppExtCommand { */ private String invitePeople; + /** + * 邀请活动邀请码. + */ + private String invitationCode; + /** * 注册类型:MOBILE、FACEBOOK、GOOGLE、APPLE、Snapchat. */ diff --git a/rc-service/rc-service-console/console-application/src/main/java/com/red/circle/console/app/service/app/datav/CountryDashboardServiceImpl.java b/rc-service/rc-service-console/console-application/src/main/java/com/red/circle/console/app/service/app/datav/CountryDashboardServiceImpl.java index 343b0576..c68bc451 100644 --- a/rc-service/rc-service-console/console-application/src/main/java/com/red/circle/console/app/service/app/datav/CountryDashboardServiceImpl.java +++ b/rc-service/rc-service-console/console-application/src/main/java/com/red/circle/console/app/service/app/datav/CountryDashboardServiceImpl.java @@ -5,6 +5,7 @@ import com.red.circle.console.app.dto.clientobject.datav.CountryDashboardMetricC import com.red.circle.console.app.dto.cmd.datav.CountryDashboardQryCmd; import com.red.circle.console.infra.database.rds.dao.datav.CountryDashboardDAO; import com.red.circle.console.infra.database.rds.dto.datav.CountryDashboardMetricDTO; +import com.red.circle.console.infra.database.rds.dto.datav.CountryDashboardRetentionUserDTO; import com.red.circle.console.infra.database.rds.dto.datav.CountryDashboardUserCountryDTO; import java.math.BigDecimal; import java.math.RoundingMode; @@ -19,11 +20,13 @@ import java.util.ArrayList; import java.util.Collection; import java.util.Comparator; import java.util.HashMap; +import java.util.HashSet; import java.util.LinkedHashMap; import java.util.List; import java.util.Locale; import java.util.Map; import java.util.Objects; +import java.util.Set; import java.util.function.BiConsumer; import lombok.RequiredArgsConstructor; import org.bson.Document; @@ -32,6 +35,7 @@ import org.springframework.data.mongodb.core.MongoTemplate; import org.springframework.data.mongodb.core.aggregation.Aggregation; import org.springframework.data.mongodb.core.aggregation.AggregationOperation; import org.springframework.data.mongodb.core.query.Criteria; +import org.springframework.data.mongodb.core.query.Query; import org.springframework.stereotype.Service; /** @@ -42,6 +46,7 @@ import org.springframework.stereotype.Service; public class CountryDashboardServiceImpl implements CountryDashboardService { private static final String COLLECTION_GIFT_GIVE_RUNNING_WATER = "gift_give_running_water"; + private static final String COLLECTION_USER_DAILY_ACTIVE_LOG = "user_daily_active_log"; private static final String PERIOD_ALL = "ALL"; private static final DateTimeFormatter DATE_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd"); private static final DateTimeFormatter MONTH_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM"); @@ -79,11 +84,16 @@ public class CountryDashboardServiceImpl implements CountryDashboardService { mergeSql(rows, countryDashboardDAO.listLuckyBoxGame( condition.periodType, condition.startTime, condition.endTime, condition.countryKeyword, condition.sysOrigin)); + mergeSql(rows, countryDashboardDAO.listGameUser( + condition.periodType, condition.startTime, condition.endTime, + condition.countryKeyword, condition.sysOrigin)); mergeMongo(rows, condition, listGiftConsume(condition), (row, amount) -> row.setGiftConsume(add(row.getGiftConsume(), amount))); mergeMongo(rows, condition, listLuckyGiftAnchorShare(condition), (row, amount) -> row.setLuckyGiftAnchorShare(add(row.getLuckyGiftAnchorShare(), amount))); + mergeDailyActive(rows, condition, listDailyActive(condition)); + mergeRetention(rows, condition); List records = rows.values().stream() .peek(this::calculateFormulaFields) @@ -118,8 +128,10 @@ public class CountryDashboardServiceImpl implements CountryDashboardService { row.setDealerRecharge(add(row.getDealerRecharge(), metric.getDealerRecharge())); row.setSalaryExchange(add(row.getSalaryExchange(), metric.getSalaryExchange())); row.setLuckyGiftTotalFlow(add(row.getLuckyGiftTotalFlow(), metric.getLuckyGiftTotalFlow())); + row.setLuckyGiftUser(row.getLuckyGiftUser() + safeLong(metric.getLuckyGiftUser())); row.setLuckyGiftPayout(add(row.getLuckyGiftPayout(), metric.getLuckyGiftPayout())); row.setGameTotalFlow(add(row.getGameTotalFlow(), metric.getGameTotalFlow())); + row.setGameUser(row.getGameUser() + safeLong(metric.getGameUser())); row.setGamePayout(add(row.getGamePayout(), metric.getGamePayout())); } } @@ -145,6 +157,66 @@ public class CountryDashboardServiceImpl implements CountryDashboardService { } } + private void mergeDailyActive(Map rows, QueryCondition condition, + List metrics) { + if (metrics == null || metrics.isEmpty()) { + return; + } + + Map countryMap = mapUserCountries( + metrics.stream().map(MongoUserDayMetric::userId).filter(Objects::nonNull).distinct().toList()); + Set counted = new HashSet<>(); + + for (MongoUserDayMetric metric : metrics) { + CountryDashboardUserCountryDTO country = countryMap.get(metric.userId()); + if (country == null || !matchesCountry(country, condition.countryKeyword)) { + continue; + } + PeriodBucket bucket = condition.toPeriodBucket(metric.day()); + String dedupeKey = country.getCountryCode() + "|" + bucket.key() + "|" + metric.userId(); + if (!counted.add(dedupeKey)) { + continue; + } + CountryDashboardMetricCO row = getRow(rows, country.getCountryCode(), country.getCountryName(), + bucket.key(), bucket.name()); + row.setDailyActiveUser(row.getDailyActiveUser() + 1); + } + } + + private void mergeRetention(Map rows, QueryCondition condition) { + List cohorts = countryDashboardDAO.listNewUserCohorts( + condition.periodType, condition.startTime, condition.endTime, + condition.countryKeyword, condition.sysOrigin); + if (cohorts == null || cohorts.isEmpty()) { + return; + } + + LocalDate today = LocalDate.now(); + Set userIds = new HashSet<>(); + Set activeDates = new HashSet<>(); + for (CountryDashboardRetentionUserDTO cohort : cohorts) { + if (cohort.getUserId() == null || !hasText(cohort.getRegisterDate())) { + continue; + } + userIds.add(cohort.getUserId()); + collectRetentionActiveDate(activeDates, cohort.getRegisterDate(), 1, today); + collectRetentionActiveDate(activeDates, cohort.getRegisterDate(), 7, today); + collectRetentionActiveDate(activeDates, cohort.getRegisterDate(), 30, today); + } + + Set activeUserDates = listActiveUserDateSet(userIds, activeDates, condition.sysOrigin); + for (CountryDashboardRetentionUserDTO cohort : cohorts) { + if (cohort.getUserId() == null || !hasText(cohort.getRegisterDate())) { + continue; + } + CountryDashboardMetricCO row = getRow(rows, cohort.getCountryCode(), cohort.getCountryName(), + cohort.getPeriodKey(), cohort.getPeriodName()); + mergeRetentionDay(row, cohort.getUserId(), cohort.getRegisterDate(), 1, today, activeUserDates); + mergeRetentionDay(row, cohort.getUserId(), cohort.getRegisterDate(), 7, today, activeUserDates); + mergeRetentionDay(row, cohort.getUserId(), cohort.getRegisterDate(), 30, today, activeUserDates); + } + } + private List listGiftConsume(QueryCondition condition) { List criteria = baseGiftCriteria(condition); criteria.add(Criteria.where("luckyGift").ne(Boolean.TRUE)); @@ -163,6 +235,23 @@ public class CountryDashboardServiceImpl implements CountryDashboardService { return aggregateGiftAmount(criteria, "$acceptUsers.targetAmount", true); } + private List listDailyActive(QueryCondition condition) { + List criteria = baseActiveCriteria(condition); + List operations = new ArrayList<>(); + if (!criteria.isEmpty()) { + operations.add(Aggregation.match(new Criteria().andOperator(criteria.toArray(new Criteria[0])))); + } + operations.add(Aggregation.group("userId", "activeDate")); + + return mongoTemplate.aggregate(Aggregation.newAggregation(operations), + COLLECTION_USER_DAILY_ACTIVE_LOG, Document.class) + .getMappedResults() + .stream() + .map(this::toMongoUserDayMetric) + .filter(Objects::nonNull) + .toList(); + } + private List baseGiftCriteria(QueryCondition condition) { List criteria = new ArrayList<>(); criteria.add(Criteria.where("refunded").ne(Boolean.TRUE)); @@ -179,6 +268,27 @@ public class CountryDashboardServiceImpl implements CountryDashboardService { return criteria; } + private List baseActiveCriteria(QueryCondition condition) { + List criteria = new ArrayList<>(); + Criteria activeDate = Criteria.where("activeDate"); + boolean hasActiveDateCriteria = false; + if (hasText(condition.startDate)) { + activeDate = activeDate.gte(condition.startDate); + hasActiveDateCriteria = true; + } + if (hasText(condition.endDate)) { + activeDate = activeDate.lte(condition.endDate); + hasActiveDateCriteria = true; + } + if (hasActiveDateCriteria) { + criteria.add(activeDate); + } + if (hasText(condition.sysOrigin)) { + criteria.add(Criteria.where("sysOrigin").is(condition.sysOrigin)); + } + return criteria; + } + private List aggregateGiftAmount(List criteria, String amountPath, boolean unwindAcceptUsers) { List operations = new ArrayList<>(); @@ -220,6 +330,79 @@ public class CountryDashboardServiceImpl implements CountryDashboardService { return new MongoMetric(userId, day, amount); } + private MongoUserDayMetric toMongoUserDayMetric(Document document) { + Object id = document.get("_id"); + if (!(id instanceof Document idDoc)) { + return null; + } + Long userId = toLong(idDoc.get("userId")); + String day = Objects.toString(idDoc.get("activeDate"), null); + if (userId == null || !hasText(day)) { + return null; + } + return new MongoUserDayMetric(userId, day); + } + + private void collectRetentionActiveDate(Set activeDates, String registerDate, + int retentionDays, LocalDate today) { + LocalDate targetDate = LocalDate.parse(registerDate, DATE_FORMATTER).plusDays(retentionDays); + if (!targetDate.isAfter(today)) { + activeDates.add(DATE_FORMATTER.format(targetDate)); + } + } + + private void mergeRetentionDay(CountryDashboardMetricCO row, Long userId, String registerDate, + int retentionDays, LocalDate today, Set activeUserDates) { + LocalDate targetDate = LocalDate.parse(registerDate, DATE_FORMATTER).plusDays(retentionDays); + if (targetDate.isAfter(today)) { + return; + } + String activeKey = userId + "|" + DATE_FORMATTER.format(targetDate); + boolean retained = activeUserDates.contains(activeKey); + if (retentionDays == 1) { + row.setD1RetentionBaseUser(row.getD1RetentionBaseUser() + 1); + row.setD1RetentionUser(row.getD1RetentionUser() + (retained ? 1 : 0)); + return; + } + if (retentionDays == 7) { + row.setD7RetentionBaseUser(row.getD7RetentionBaseUser() + 1); + row.setD7RetentionUser(row.getD7RetentionUser() + (retained ? 1 : 0)); + return; + } + row.setD30RetentionBaseUser(row.getD30RetentionBaseUser() + 1); + row.setD30RetentionUser(row.getD30RetentionUser() + (retained ? 1 : 0)); + } + + private Set listActiveUserDateSet(Set userIds, Set activeDates, + String sysOrigin) { + Set result = new HashSet<>(); + if (userIds == null || userIds.isEmpty() || activeDates == null || activeDates.isEmpty()) { + return result; + } + + List ids = new ArrayList<>(userIds); + for (int start = 0; start < ids.size(); start += USER_COUNTRY_BATCH_SIZE) { + int end = Math.min(start + USER_COUNTRY_BATCH_SIZE, ids.size()); + List criteria = new ArrayList<>(); + criteria.add(Criteria.where("userId").in(ids.subList(start, end))); + criteria.add(Criteria.where("activeDate").in(activeDates)); + if (hasText(sysOrigin)) { + criteria.add(Criteria.where("sysOrigin").is(sysOrigin)); + } + Query query = Query.query(new Criteria().andOperator(criteria.toArray(new Criteria[0]))); + query.fields().include("userId").include("activeDate"); + List documents = mongoTemplate.find(query, Document.class, COLLECTION_USER_DAILY_ACTIVE_LOG); + for (Document document : documents) { + Long userId = toLong(document.get("userId")); + String activeDate = Objects.toString(document.get("activeDate"), null); + if (userId != null && hasText(activeDate)) { + result.add(userId + "|" + activeDate); + } + } + } + return result; + } + private Map mapUserCountries(Collection userIds) { Map result = new HashMap<>(); if (userIds == null || userIds.isEmpty()) { @@ -268,8 +451,15 @@ public class CountryDashboardServiceImpl implements CountryDashboardService { row.setLuckyGiftProfit(safe(row.getLuckyGiftTotalFlow()) .subtract(safe(row.getLuckyGiftPayout())) .subtract(safe(row.getLuckyGiftAnchorShare()))); + row.setLuckyGiftUserRate(percent(row.getLuckyGiftUser(), row.getDailyActiveUser())); + row.setLuckyGiftPayoutRate(percent(row.getLuckyGiftPayout(), row.getLuckyGiftTotalFlow())); row.setLuckyGiftProfitRate(percent(row.getLuckyGiftProfit(), row.getLuckyGiftTotalFlow())); row.setGameProfit(safe(row.getGameTotalFlow()).subtract(safe(row.getGamePayout()))); + row.setGamePayoutRate(percent(row.getGamePayout(), row.getGameTotalFlow())); + row.setGameProfitRate(percent(row.getGameProfit(), row.getGameTotalFlow())); + row.setD1RetentionRate(percent(row.getD1RetentionUser(), row.getD1RetentionBaseUser())); + row.setD7RetentionRate(percent(row.getD7RetentionUser(), row.getD7RetentionBaseUser())); + row.setD30RetentionRate(percent(row.getD30RetentionUser(), row.getD30RetentionBaseUser())); } private CountryDashboardMetricCO buildTotal(List records, @@ -281,16 +471,25 @@ public class CountryDashboardServiceImpl implements CountryDashboardService { .setPeriodName("合计"); for (CountryDashboardMetricCO row : records) { total.setCountryNewUser(total.getCountryNewUser() + safeLong(row.getCountryNewUser())); + total.setDailyActiveUser(total.getDailyActiveUser() + safeLong(row.getDailyActiveUser())); total.setNewUserRecharge(add(total.getNewUserRecharge(), row.getNewUserRecharge())); total.setOfficialRecharge(add(total.getOfficialRecharge(), row.getOfficialRecharge())); total.setDealerRecharge(add(total.getDealerRecharge(), row.getDealerRecharge())); total.setSalaryExchange(add(total.getSalaryExchange(), row.getSalaryExchange())); total.setGiftConsume(add(total.getGiftConsume(), row.getGiftConsume())); total.setLuckyGiftTotalFlow(add(total.getLuckyGiftTotalFlow(), row.getLuckyGiftTotalFlow())); + total.setLuckyGiftUser(total.getLuckyGiftUser() + safeLong(row.getLuckyGiftUser())); total.setLuckyGiftPayout(add(total.getLuckyGiftPayout(), row.getLuckyGiftPayout())); total.setLuckyGiftAnchorShare(add(total.getLuckyGiftAnchorShare(), row.getLuckyGiftAnchorShare())); total.setGameTotalFlow(add(total.getGameTotalFlow(), row.getGameTotalFlow())); + total.setGameUser(total.getGameUser() + safeLong(row.getGameUser())); total.setGamePayout(add(total.getGamePayout(), row.getGamePayout())); + total.setD1RetentionUser(total.getD1RetentionUser() + safeLong(row.getD1RetentionUser())); + total.setD1RetentionBaseUser(total.getD1RetentionBaseUser() + safeLong(row.getD1RetentionBaseUser())); + total.setD7RetentionUser(total.getD7RetentionUser() + safeLong(row.getD7RetentionUser())); + total.setD7RetentionBaseUser(total.getD7RetentionBaseUser() + safeLong(row.getD7RetentionBaseUser())); + total.setD30RetentionUser(total.getD30RetentionUser() + safeLong(row.getD30RetentionUser())); + total.setD30RetentionBaseUser(total.getD30RetentionBaseUser() + safeLong(row.getD30RetentionBaseUser())); } calculateFormulaFields(total); return total; @@ -314,6 +513,10 @@ public class CountryDashboardServiceImpl implements CountryDashboardService { .divide(safeDenominator, 4, RoundingMode.HALF_UP); } + private static BigDecimal percent(Long numerator, Long denominator) { + return percent(BigDecimal.valueOf(safeLong(numerator)), BigDecimal.valueOf(safeLong(denominator))); + } + private static long safeLong(Long value) { return value == null ? 0L : value; } @@ -351,6 +554,9 @@ public class CountryDashboardServiceImpl implements CountryDashboardService { private record MongoMetric(Long userId, String day, BigDecimal amount) { } + private record MongoUserDayMetric(Long userId, String day) { + } + private record PeriodBucket(String key, String name) { } diff --git a/rc-service/rc-service-console/console-client/src/main/java/com/red/circle/console/app/dto/clientobject/datav/CountryDashboardMetricCO.java b/rc-service/rc-service-console/console-client/src/main/java/com/red/circle/console/app/dto/clientobject/datav/CountryDashboardMetricCO.java index d06df8b5..c6fc02cb 100644 --- a/rc-service/rc-service-console/console-client/src/main/java/com/red/circle/console/app/dto/clientobject/datav/CountryDashboardMetricCO.java +++ b/rc-service/rc-service-console/console-client/src/main/java/com/red/circle/console/app/dto/clientobject/datav/CountryDashboardMetricCO.java @@ -26,6 +26,8 @@ public class CountryDashboardMetricCO implements Serializable { private Long countryNewUser = 0L; + private Long dailyActiveUser = 0L; + private BigDecimal newUserRecharge = BigDecimal.ZERO; private BigDecimal dealerRecharge = BigDecimal.ZERO; @@ -38,8 +40,14 @@ public class CountryDashboardMetricCO implements Serializable { private BigDecimal luckyGiftTotalFlow = BigDecimal.ZERO; + private Long luckyGiftUser = 0L; + + private BigDecimal luckyGiftUserRate = BigDecimal.ZERO; + private BigDecimal luckyGiftPayout = BigDecimal.ZERO; + private BigDecimal luckyGiftPayoutRate = BigDecimal.ZERO; + private BigDecimal luckyGiftAnchorShare = BigDecimal.ZERO; private BigDecimal luckyGiftProfit = BigDecimal.ZERO; @@ -48,10 +56,34 @@ public class CountryDashboardMetricCO implements Serializable { private BigDecimal gameTotalFlow = BigDecimal.ZERO; + private Long gameUser = 0L; + private BigDecimal gamePayout = BigDecimal.ZERO; + private BigDecimal gamePayoutRate = BigDecimal.ZERO; + private BigDecimal gameProfit = BigDecimal.ZERO; + private BigDecimal gameProfitRate = BigDecimal.ZERO; + + private Long d1RetentionUser = 0L; + + private Long d1RetentionBaseUser = 0L; + + private BigDecimal d1RetentionRate = BigDecimal.ZERO; + + private Long d7RetentionUser = 0L; + + private Long d7RetentionBaseUser = 0L; + + private BigDecimal d7RetentionRate = BigDecimal.ZERO; + + private Long d30RetentionUser = 0L; + + private Long d30RetentionBaseUser = 0L; + + private BigDecimal d30RetentionRate = BigDecimal.ZERO; + /** * 官方直充总额,服务端用于计算总充值. */ diff --git a/rc-service/rc-service-console/console-infrastructure/src/main/java/com/red/circle/console/infra/database/rds/dao/datav/CountryDashboardDAO.java b/rc-service/rc-service-console/console-infrastructure/src/main/java/com/red/circle/console/infra/database/rds/dao/datav/CountryDashboardDAO.java index 25669183..7c23b72f 100644 --- a/rc-service/rc-service-console/console-infrastructure/src/main/java/com/red/circle/console/infra/database/rds/dao/datav/CountryDashboardDAO.java +++ b/rc-service/rc-service-console/console-infrastructure/src/main/java/com/red/circle/console/infra/database/rds/dao/datav/CountryDashboardDAO.java @@ -1,6 +1,7 @@ package com.red.circle.console.infra.database.rds.dao.datav; import com.red.circle.console.infra.database.rds.dto.datav.CountryDashboardMetricDTO; +import com.red.circle.console.infra.database.rds.dto.datav.CountryDashboardRetentionUserDTO; import com.red.circle.console.infra.database.rds.dto.datav.CountryDashboardUserCountryDTO; import com.red.circle.console.infra.database.rds.entity.app.IUserBaseInfo; import com.red.circle.framework.mybatis.dao.BaseDAO; @@ -70,5 +71,19 @@ public interface CountryDashboardDAO extends BaseDAO { @Param("countryKeyword") String countryKeyword, @Param("sysOrigin") String sysOrigin); + List listGameUser( + @Param("periodType") String periodType, + @Param("startTime") LocalDateTime startTime, + @Param("endTime") LocalDateTime endTime, + @Param("countryKeyword") String countryKeyword, + @Param("sysOrigin") String sysOrigin); + + List listNewUserCohorts( + @Param("periodType") String periodType, + @Param("startTime") LocalDateTime startTime, + @Param("endTime") LocalDateTime endTime, + @Param("countryKeyword") String countryKeyword, + @Param("sysOrigin") String sysOrigin); + List listUserCountryByIds(@Param("userIds") Collection userIds); } diff --git a/rc-service/rc-service-console/console-infrastructure/src/main/java/com/red/circle/console/infra/database/rds/dto/datav/CountryDashboardMetricDTO.java b/rc-service/rc-service-console/console-infrastructure/src/main/java/com/red/circle/console/infra/database/rds/dto/datav/CountryDashboardMetricDTO.java index 2f6b1a82..ac8cd41a 100644 --- a/rc-service/rc-service-console/console-infrastructure/src/main/java/com/red/circle/console/infra/database/rds/dto/datav/CountryDashboardMetricDTO.java +++ b/rc-service/rc-service-console/console-infrastructure/src/main/java/com/red/circle/console/infra/database/rds/dto/datav/CountryDashboardMetricDTO.java @@ -31,9 +31,13 @@ public class CountryDashboardMetricDTO { private BigDecimal luckyGiftTotalFlow; + private Long luckyGiftUser; + private BigDecimal luckyGiftPayout; private BigDecimal gameTotalFlow; + private Long gameUser; + private BigDecimal gamePayout; } diff --git a/rc-service/rc-service-console/console-infrastructure/src/main/java/com/red/circle/console/infra/database/rds/dto/datav/CountryDashboardRetentionUserDTO.java b/rc-service/rc-service-console/console-infrastructure/src/main/java/com/red/circle/console/infra/database/rds/dto/datav/CountryDashboardRetentionUserDTO.java new file mode 100644 index 00000000..aee9d9cd --- /dev/null +++ b/rc-service/rc-service-console/console-infrastructure/src/main/java/com/red/circle/console/infra/database/rds/dto/datav/CountryDashboardRetentionUserDTO.java @@ -0,0 +1,24 @@ +package com.red.circle.console.infra.database.rds.dto.datav; + +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * 国家数据大屏新增用户留存队列. + */ +@Data +@Accessors(chain = true) +public class CountryDashboardRetentionUserDTO { + + private Long userId; + + private String countryCode; + + private String countryName; + + private String periodKey; + + private String periodName; + + private String registerDate; +} diff --git a/rc-service/rc-service-console/console-infrastructure/src/main/resources/dao/datav/CountryDashboardDAO.xml b/rc-service/rc-service-console/console-infrastructure/src/main/resources/dao/datav/CountryDashboardDAO.xml index 467fbe3a..4b878f14 100644 --- a/rc-service/rc-service-console/console-infrastructure/src/main/resources/dao/datav/CountryDashboardDAO.xml +++ b/rc-service/rc-service-console/console-infrastructure/src/main/resources/dao/datav/CountryDashboardDAO.xml @@ -117,6 +117,43 @@ FROM likei_wallet.wallet_gold_asset_record_12 + + ( + t.event_type IN ( + 'GAME_SLOT_MACHINE', + 'GAME_BARBECUE', + 'TURNTABLE_GAME', + 'LUDO_GAME', + 'GAME_BURST_CRYSTAL', + 'EGG', + 'FRUIT_GAME', + 'DOUBLE_LAYER_FRUIT', + 'DOUBLE_LAYER_BARBECUE', + 'GAME_FRUIT_BET', + 'GAME_FRUIT_AWARD', + 'GAME_BACK', + 'GAME_WINNING', + 'LUDO_VICTORY', + 'LUDO_REFUND', + 'GAME_LUDO_REFUND', + 'USD_GAME_WIN', + 'USD_GAME_REFUND', + 'USD_GAME_REFUND_DRAW', + 'TEEN_PATTI', + 'BET_TEEN_PATTI', + 'LOTTERY_NUMBER_BET', + 'LOTTERY_REWARD' + ) + OR t.event_type LIKE 'BAISHUN_GAME%' + OR t.event_type LIKE 'YOMI_GAME%' + OR t.event_type LIKE 'HKYS_GAME%' + OR t.event_type LIKE 'HOT_GAME%' + ) + AND t.event_type NOT IN ('LUCKY_GIFT', 'LUCKY_GIFT_GOLD_REWARD', 'LUCKY_BOX_GAME', 'NEW_LUCKY_BOX_GAME', 'GAME_RAKE') + AND t.event_type NOT LIKE 'GIVE_GIFT%' + AND t.event_type NOT LIKE 'ACCEPT_GIFT%' + + + + + +