From 4c12994010187fa2e37e1aed79c9517a4957e44a Mon Sep 17 00:00:00 2001 From: tianfeng <769204422@qq.com> Date: Wed, 29 Oct 2025 17:54:36 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9EtaskId=2011=20=E5=A1=AB?= =?UTF-8?q?=E5=86=99=E5=85=B6=E4=BB=96=E7=94=A8=E6=88=B7=E9=82=80=E8=AF=B7?= =?UTF-8?q?=E7=A0=81=E4=BB=BB=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../other/app/command/activity/BindInviteCodeExe.java | 10 ++++++++++ .../circle/other/app/listener/task/TaskListener.java | 11 +++++++++++ .../other/app/service/task/TaskServiceImpl.java | 6 ++++++ 3 files changed, 27 insertions(+) diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/activity/BindInviteCodeExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/activity/BindInviteCodeExe.java index 3eb8f5ea..ae07f51a 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/activity/BindInviteCodeExe.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/activity/BindInviteCodeExe.java @@ -2,6 +2,8 @@ package com.red.circle.other.app.command.activity; import com.red.circle.component.redis.service.RedisService; import com.red.circle.framework.dto.ResultResponse; +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.command.user.InviteCodeService; import com.red.circle.other.app.dto.cmd.SpinsTaskProgressUpdateCmd; import com.red.circle.other.app.dto.cmd.activity.BindInviteCodeCmd; @@ -12,6 +14,7 @@ import com.red.circle.other.infra.database.rds.entity.user.user.UserInviteUser; import com.red.circle.other.infra.database.rds.service.user.user.UserInviteUserService; import com.red.circle.other.infra.enums.user.InviteTypeEnum; import com.red.circle.other.inner.endpoint.user.device.RegisterDeviceClient; +import com.red.circle.tool.core.date.LocalDateTimeUtils; import com.red.circle.tool.core.date.TimestampUtils; import com.red.circle.tool.core.date.ZonedDateTimeAsiaRiyadhUtils; import com.red.circle.tool.core.sequence.IdWorkerUtils; @@ -44,6 +47,7 @@ public class BindInviteCodeExe { private final RedisService redisService; private final SpinsUserTaskProgressService spinsUserTaskProgressService; private final RegisterDeviceClient registerDeviceClient; + private final TaskMqMessage taskMqMessage; /** * 执行绑定邀请码 @@ -183,6 +187,12 @@ public class BindInviteCodeExe { .setProgressValue(inviteCount) ); } + + // 关注一个用户任务 + taskMqMessage.sendTask(TaskApprovalEvent.builder() + .taskId(11) + .userId(cmd.requiredReqUserId()) + .build()); } /** diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/listener/task/TaskListener.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/listener/task/TaskListener.java index 65bf4949..37cef53b 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/listener/task/TaskListener.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/listener/task/TaskListener.java @@ -120,6 +120,10 @@ public class TaskListener implements MessageListener { // 处理任务-10 的逻辑 关注一个房间 handleTask10(eventBody); break; + case 11: + // 处理任务-11 的逻辑 填写其他人的邀请码 + handleTask11(eventBody); + break; default: // 处理未知任务 ID 的情况 handleUnknownTask(taskId); @@ -325,6 +329,13 @@ public class TaskListener implements MessageListener { } } + private void handleTask11(TaskApprovalEvent eventBody) { + log.warn("处理任务-11: {}", eventBody); + eventBody.setTargetValue(1); + eventBody.setCompleteValue(1); + updateTaskStatus(eventBody); + } + private void dealRechargeCommission(TaskApprovalEvent eventBody) { if (StringUtils.isNotBlank(eventBody.getSysOrigin()) && eventBody.getCurrencyDiff() > 0L) { try { diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/service/task/TaskServiceImpl.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/service/task/TaskServiceImpl.java index cf13340f..1ab5fe69 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/service/task/TaskServiceImpl.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/service/task/TaskServiceImpl.java @@ -23,6 +23,7 @@ import com.red.circle.other.inner.model.dto.activity.props.ActivityRewardProps; import com.red.circle.tool.core.date.TimestampUtils; import com.red.circle.tool.core.sequence.IdWorkerUtils; import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; @@ -32,6 +33,7 @@ import java.util.stream.Collectors; /** * 任务服务实现类 */ +@Slf4j @Service @RequiredArgsConstructor public class TaskServiceImpl implements TaskService { @@ -227,6 +229,10 @@ public class TaskServiceImpl implements TaskService { List userTaskProgresses = userTaskProgressDao.selectList(updateWrapper); if (CollectionUtils.isEmpty(userTaskProgresses)) { TaskConfig taskConfig = taskConfigDao.selectById(taskId); + if (taskConfig == null) { + log.warn("任务不存在:{} 无法创建UserTaskProgress", taskId); + return; + } UserTaskProgress progress = new UserTaskProgress(); progress.setId(IdWorkerUtils.getId());