From c077c563ebdb64fe572c8adb0749f00cd3121264 Mon Sep 17 00:00:00 2001 From: tianfeng <769204422@qq.com> Date: Tue, 16 Dec 2025 12:31:09 +0800 Subject: [PATCH] =?UTF-8?q?=E6=AF=8F=E6=97=A5=E4=BB=BB=E5=8A=A1=E9=80=BB?= =?UTF-8?q?=E8=BE=91=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../command/gift/GiftGiveAwayBatchCmdExe.java | 16 +++++++++---- .../app/command/gift/LuckyGiftGiveCmdExe.java | 16 +++++++++---- .../team/TeamMemberHeartbeatCmdExe.java | 18 +++++++++----- .../service/game/GameBaishunServiceImpl.java | 24 ++++++++++++------- 4 files changed, 49 insertions(+), 25 deletions(-) diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/gift/GiftGiveAwayBatchCmdExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/gift/GiftGiveAwayBatchCmdExe.java index 02e81e1c..bfcd52b9 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/gift/GiftGiveAwayBatchCmdExe.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/gift/GiftGiveAwayBatchCmdExe.java @@ -10,6 +10,7 @@ import com.red.circle.mq.rocket.business.producer.GiftMqMessage; import com.red.circle.mq.rocket.business.producer.TaskMqMessage; import com.red.circle.other.app.convertor.material.GiftAppConvertor; import com.red.circle.other.app.dto.cmd.gift.GiveAwayGiftBatchCmd; +import com.red.circle.other.app.service.task.TaskService; import com.red.circle.other.domain.gateway.user.UserProfileGateway; import com.red.circle.other.infra.database.cache.service.other.GiftCacheService; import com.red.circle.other.inner.asserts.GiftErrorCode; @@ -50,6 +51,7 @@ public class GiftGiveAwayBatchCmdExe { private final TaskMqMessage taskMqMessage; private final UserProfileGateway userProfileGateway; private final WalletDiamondClient walletDiamondClient; + private final TaskService taskService; public BigDecimal execute(GiveAwayGiftBatchCmd cmd) { @@ -79,12 +81,16 @@ public class GiftGiveAwayBatchCmdExe { giftMqMessage.sendGift(receipt.getConsumeId().toString(), giftAppConvertor.toGiveAwayGiftBatchEvent(cmd, giftConfig, receipt.getConsumeId())); userProfileGateway.removeCache(cmd.requiredReqUserId()); - taskMqMessage.sendTask(TaskApprovalEvent.builder() - .taskId(2) - .userId(cmd.getReqUserId()) - .day(LocalDateTimeUtils.nowFormat("yyyy-MM-dd")) - .build()); + // 检查是否未完成任务 + Boolean taskStatus = taskService.checkTaskStatus(cmd.getReqUserId(), 2L, LocalDateTimeUtils.nowFormat("yyyy-MM-dd")); + if (taskStatus) { + taskMqMessage.sendTask(TaskApprovalEvent.builder() + .taskId(2) + .userId(cmd.getReqUserId()) + .day(LocalDateTimeUtils.nowFormat("yyyy-MM-dd")) + .build()); + } return receipt.getBalance(); } diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/gift/LuckyGiftGiveCmdExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/gift/LuckyGiftGiveCmdExe.java index 1bff6e3b..552d17c0 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/gift/LuckyGiftGiveCmdExe.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/gift/LuckyGiftGiveCmdExe.java @@ -9,6 +9,7 @@ import com.red.circle.mq.rocket.business.producer.TaskMqMessage; import com.red.circle.other.app.common.gift.GameLuckyGiftCommon; import com.red.circle.other.app.convertor.material.GiftAppConvertor; import com.red.circle.other.app.dto.cmd.gift.GiveAwayGiftBatchCmd; +import com.red.circle.other.app.service.task.TaskService; import com.red.circle.other.domain.gateway.user.UserProfileGateway; import com.red.circle.other.infra.database.cache.service.other.GiftCacheService; import com.red.circle.other.inner.asserts.GiftErrorCode; @@ -45,6 +46,7 @@ public class LuckyGiftGiveCmdExe { private final UserProfileGateway userProfileGateway; private final GameLuckyGiftCommon gameLuckyGiftCommon; private final TaskMqMessage taskMqMessage; + private final TaskService taskService; public BigDecimal execute(GiveAwayGiftBatchCmd cmd) { @@ -79,11 +81,15 @@ public class LuckyGiftGiveCmdExe { userProfileGateway.removeCache(cmd.requiredReqUserId()); - taskMqMessage.sendTask(TaskApprovalEvent.builder() - .taskId(8) - .quantity(cmd.getQuantity()) - .userId(cmd.getReqUserId()) - .build()); + // 检查是否未完成任务 + Boolean taskStatus = taskService.checkTaskStatus(cmd.getReqUserId(), 8L, null); + if (taskStatus) { + taskMqMessage.sendTask(TaskApprovalEvent.builder() + .taskId(8) + .quantity(cmd.getQuantity()) + .userId(cmd.getReqUserId()) + .build()); + } return receipt.getBalance().getDollarAmount(); } diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/team/TeamMemberHeartbeatCmdExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/team/TeamMemberHeartbeatCmdExe.java index 54aeb88d..99a59d01 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/team/TeamMemberHeartbeatCmdExe.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/team/TeamMemberHeartbeatCmdExe.java @@ -6,6 +6,7 @@ import com.red.circle.framework.core.asserts.ResponseAssert; import com.red.circle.mq.business.model.event.task.TaskApprovalEvent; import com.red.circle.mq.rocket.business.producer.TaskMqMessage; import com.red.circle.other.app.dto.clientobject.team.TeamMemberWorkDailyTargetCO; +import com.red.circle.other.app.service.task.TaskService; import com.red.circle.other.infra.common.team.TeamTargetCommon; import com.red.circle.other.infra.database.mongo.entity.live.RoomProfile; import com.red.circle.other.infra.database.mongo.entity.team.team.TeamMemberTarget; @@ -46,14 +47,19 @@ public class TeamMemberHeartbeatCmdExe { private final TeamMemberTargetService teamMemberTargetService; private final TaskMqMessage taskMqMessage; private final AdministratorService administratorService; + private final TaskService taskService; public void execute(AppRoomIdCmd cmd) { - //心跳mic 每日任务 - taskMqMessage.sendTask(TaskApprovalEvent.builder() - .taskId(1) - .userId(cmd.requiredReqUserId()) - .day(LocalDateTimeUtils.nowFormat("yyyy-MM-dd")) - .build()); + + Boolean taskStatus = taskService.checkTaskStatus(cmd.requiredReqUserId(), 1L, LocalDateTimeUtils.nowFormat("yyyy-MM-dd")); + if (taskStatus) { + //心跳mic 每日任务 + taskMqMessage.sendTask(TaskApprovalEvent.builder() + .taskId(1) + .userId(cmd.requiredReqUserId()) + .day(LocalDateTimeUtils.nowFormat("yyyy-MM-dd")) + .build()); + } boolean admin = administratorService.existsAdmin(cmd.requiredReqUserId()); if (admin) { diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/service/game/GameBaishunServiceImpl.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/service/game/GameBaishunServiceImpl.java index 11d8517d..461e875c 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/service/game/GameBaishunServiceImpl.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/service/game/GameBaishunServiceImpl.java @@ -27,6 +27,7 @@ import com.red.circle.other.app.convertor.user.UserProfileAppConvertor; import com.red.circle.other.app.dto.cmd.activity.RankingDataUpdateCmd; import com.red.circle.other.app.enums.violation.GameOriginEnum; import com.red.circle.other.app.service.activity.RankingActivityService; +import com.red.circle.other.app.service.task.TaskService; import com.red.circle.other.app.util.OfficialNoticeUtils; import com.red.circle.other.domain.game.GameRankingIncrementCmd; import com.red.circle.other.domain.gateway.game.GameRankingGateway; @@ -81,6 +82,7 @@ public class GameBaishunServiceImpl implements GameBaishunService { private final RankingActivityService rankingActivityService; private final GameRankingGateway gameRankingGateway; private final GameListCacheService gameListCacheService; + private final TaskService taskService; @Value("${red-circle.game-rank.gameid}") private String gameId; @@ -179,15 +181,19 @@ public class GameBaishunServiceImpl implements GameBaishunService { //游玩一句游戏结束 每日任务 baishun Long userId = DataTypeUtils.toLong(request.getUserId()); - taskMqMessage.sendTask(TaskApprovalEvent.builder() - .taskId(4) - .userId(userId) - .day(LocalDateTimeUtils.nowFormat("yyyy-MM-dd")) - .currencyDiff(request.getCurrencyDiff()) - .sysOrigin(sysOrigin) - .gameName(GoldOrigin.BAISHUN_GAME.name()) - .gameId(Long.parseLong(request.getGameId())) - .build()); + // 检查是否未完成任务 + Boolean taskStatus = taskService.checkTaskStatus(userId, 4L, LocalDateTimeUtils.nowFormat("yyyy-MM-dd")); + if (taskStatus) { + taskMqMessage.sendTask(TaskApprovalEvent.builder() + .taskId(4) + .userId(userId) + .day(LocalDateTimeUtils.nowFormat("yyyy-MM-dd")) + .currencyDiff(request.getCurrencyDiff()) + .sysOrigin(sysOrigin) + .gameName(GoldOrigin.BAISHUN_GAME.name()) + .gameId(Long.parseLong(request.getGameId())) + .build()); + } GameListConfig gameListConfig = gameListCacheService.getByGameIdWithCache( request.getGameId(),