每日任务逻辑优化
This commit is contained in:
parent
21258dee1b
commit
c077c563eb
@ -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();
|
||||
}
|
||||
|
||||
|
||||
@ -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();
|
||||
}
|
||||
|
||||
@ -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) {
|
||||
|
||||
@ -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(),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user