diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/convertor/game/GameRankingConvertor.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/convertor/game/GameRankingConvertor.java index 7dc4fccf..72a019f5 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/convertor/game/GameRankingConvertor.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/convertor/game/GameRankingConvertor.java @@ -30,6 +30,7 @@ public class GameRankingConvertor { co.setSysOrigin(record.getSysOrigin()); co.setTotalPrizeAmount(record.getTotalPrizeAmount()); co.setPeriodType(record.getPeriodType()); + co.setGameCreateTime(record.getGameCreateTime()); return co; } } diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/service/game/common/GameEventService.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/service/game/common/GameEventService.java index 854289cb..78f9616b 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/service/game/common/GameEventService.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/service/game/common/GameEventService.java @@ -169,6 +169,7 @@ public class GameEventService { .amount(gold) .periodType(GameRankingPeriodType.WEEK.getCode()) .periodKey(ZonedDateTimeAsiaRiyadhUtils.nowWeekMondayToInt().toString()) + .gameCreateTime(gameConfig.getCreateTime()) .build() ); } diff --git a/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/clientobject/game/GameRankingCO.java b/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/clientobject/game/GameRankingCO.java index e198e61e..61f2c88a 100644 --- a/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/clientobject/game/GameRankingCO.java +++ b/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/clientobject/game/GameRankingCO.java @@ -2,6 +2,10 @@ package com.red.circle.other.app.dto.clientobject.game; import lombok.Data; +import java.sql.Timestamp; +import java.time.Duration; +import java.time.Instant; + /** * 游戏排行榜返回对象. * @@ -51,4 +55,16 @@ public class GameRankingCO { * 周期类型 */ private String periodType; + + /** + * 游戏创建时间 + */ + private Timestamp gameCreateTime; + + public boolean isLatest() { + if (gameCreateTime == null) { + return false; + } + return Duration.between(gameCreateTime.toInstant(), Instant.now()).toDays() < 7; + } } diff --git a/rc-service/rc-service-other/other-domain/src/main/java/com/red/circle/other/domain/game/GameRankingIncrementCmd.java b/rc-service/rc-service-other/other-domain/src/main/java/com/red/circle/other/domain/game/GameRankingIncrementCmd.java index 8b195c71..e233f5d0 100644 --- a/rc-service/rc-service-other/other-domain/src/main/java/com/red/circle/other/domain/game/GameRankingIncrementCmd.java +++ b/rc-service/rc-service-other/other-domain/src/main/java/com/red/circle/other/domain/game/GameRankingIncrementCmd.java @@ -57,6 +57,11 @@ public class GameRankingIncrementCmd { */ private String periodKey; + /** + * 游戏创建时间 + */ + private java.sql.Timestamp gameCreateTime; + /** * 中奖金额(单位:分) */ diff --git a/rc-service/rc-service-other/other-domain/src/main/java/com/red/circle/other/domain/game/GameRankingRecord.java b/rc-service/rc-service-other/other-domain/src/main/java/com/red/circle/other/domain/game/GameRankingRecord.java index e1a9c289..e838baeb 100644 --- a/rc-service/rc-service-other/other-domain/src/main/java/com/red/circle/other/domain/game/GameRankingRecord.java +++ b/rc-service/rc-service-other/other-domain/src/main/java/com/red/circle/other/domain/game/GameRankingRecord.java @@ -2,6 +2,9 @@ package com.red.circle.other.domain.game; import lombok.Data; +import java.sql.Timestamp; +import java.time.LocalDateTime; + /** * 游戏排行榜领域对象. * @@ -56,4 +59,9 @@ public class GameRankingRecord { * 总中奖金额(单位:分) */ private Long totalPrizeAmount; + + /** + * 游戏创建时间 + */ + private Timestamp gameCreateTime; } diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/mongo/entity/game/rank/GameRanking.java b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/mongo/entity/game/rank/GameRanking.java index 73e91427..9949b55b 100644 --- a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/mongo/entity/game/rank/GameRanking.java +++ b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/mongo/entity/game/rank/GameRanking.java @@ -6,6 +6,7 @@ import org.springframework.data.mongodb.core.index.CompoundIndex; import org.springframework.data.mongodb.core.index.CompoundIndexes; import org.springframework.data.mongodb.core.mapping.Document; +import java.sql.Timestamp; import java.time.LocalDateTime; /** @@ -76,6 +77,11 @@ public class GameRanking { */ private Long totalPrizeAmount; + /** + * 游戏创建时间 + */ + private Timestamp gameCreateTime; + /** * 创建时间 */ diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/gateway/game/GameRankingGatewayImpl.java b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/gateway/game/GameRankingGatewayImpl.java index 11f438f4..86b1b0b0 100644 --- a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/gateway/game/GameRankingGatewayImpl.java +++ b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/gateway/game/GameRankingGatewayImpl.java @@ -86,6 +86,7 @@ public class GameRankingGatewayImpl implements GameRankingGateway { update.setOnInsert("gameId", cmd.getGameId()); update.setOnInsert("periodType", cmd.getPeriodType()); update.setOnInsert("periodKey", cmd.getPeriodKey()); + update.setOnInsert("gameCreateTime", cmd.getGameCreateTime()); update.setOnInsert("gameCover", cmd.getGameCover()); update.setOnInsert("gameUrl", cmd.getGameUrl()); update.setOnInsert("gameName", cmd.getGameName()); @@ -107,6 +108,7 @@ public class GameRankingGatewayImpl implements GameRankingGateway { record.setPeriodType(entity.getPeriodType()); record.setPeriodKey(entity.getPeriodKey()); record.setTotalPrizeAmount(entity.getTotalPrizeAmount()); + record.setGameCreateTime(entity.getGameCreateTime()); return record; } }