每日任务功能优化

This commit is contained in:
tianfeng 2025-10-23 16:56:08 +08:00
parent d448123b7c
commit 628176078a
18 changed files with 89 additions and 73 deletions

View File

@ -75,11 +75,11 @@ public class InAppPurchaseProductServiceImpl implements InAppPurchaseProductServ
public PurchaseReceiptCO purchase(AbstractPurchaseCmd cmd) {
log.info("purchase:{}", JacksonUtils.toJson(cmd));
//完成任务 钩子 9 充值 谷歌
taskMqMessage.sendTask(TaskApprovalEvent.builder()
/*taskMqMessage.sendTask(TaskApprovalEvent.builder()
.taskId(9)
.userId(cmd.getReqUserId())
.day(LocalDateTimeUtils.nowFormat("yyyy-MM-dd"))
.build());
.build());*/
return appInAppPurchaseCmdExe.execute(cmd);
}

View File

@ -105,13 +105,7 @@ public class DynamicContentAddCmdExe {
dynamicCacheService.pushUserTodayDynamicCount(cmd.getReqUserId());
//每日任务 发送动态
taskMqMessage.sendTask(TaskApprovalEvent.builder()
.taskId(5)
.userId(cmd.getReqUserId())
.day(LocalDateTimeUtils.nowFormat("yyyy-MM-dd"))
.build());
if (CollectionUtils.isEmpty(cmd.getPictures())) {
return contentId;

View File

@ -48,12 +48,6 @@ public class FamilyUserInfoExe {
if (Objects.isNull(baseInfo)) {
return new FamilyUserInfoCO();
}
//成长任务 创建或加入家族
taskMqMessage.sendTask(TaskApprovalEvent.builder()
.taskId(6)
.userId(cmd.getUserId())
.day(LocalDateTimeUtils.nowFormat("yyyy-MM-dd"))
.build());
return getBaseInfoCO(cmd.getReqSysOrigin().getOrigin(), familyMemberInfo, baseInfo);
}

View File

@ -85,11 +85,11 @@ public class BlessingsGiftGiveCmdExe {
taskMqMessage.sendTask(TaskApprovalEvent.builder()
/*taskMqMessage.sendTask(TaskApprovalEvent.builder()
.taskId(2)
.userId(cmd.getReqUserId())
.day(LocalDateTimeUtils.nowFormat("yyyy-MM-dd"))
.build());
.build());*/
return receipt.getBalance().getDollarAmount();
}

View File

@ -3,7 +3,9 @@ package com.red.circle.other.app.command.gift;
import com.red.circle.framework.core.asserts.ResponseAssert;
import com.red.circle.framework.core.response.CommonErrorCode;
import com.red.circle.framework.core.response.ResponseErrorCode;
import com.red.circle.mq.business.model.event.task.TaskApprovalEvent;
import com.red.circle.mq.rocket.business.producer.GiftMqMessage;
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;
@ -15,6 +17,7 @@ import com.red.circle.other.inner.enums.material.GiftCurrencyType;
import com.red.circle.other.inner.enums.material.GiftTabEnum;
import com.red.circle.other.inner.model.dto.material.GiftConfigDTO;
import com.red.circle.tool.core.collection.CollectionUtils;
import com.red.circle.tool.core.date.LocalDateTimeUtils;
import com.red.circle.wallet.inner.endpoint.wallet.WalletGoldClient;
import com.red.circle.wallet.inner.model.cmd.GoldReceiptCmd;
import com.red.circle.wallet.inner.model.dto.WalletReceiptResDTO;
@ -41,6 +44,7 @@ public class LuckyGiftGiveCmdExe {
private final GiftCacheService giftCacheService;
private final UserProfileGateway userProfileGateway;
private final GameLuckyGiftCommon gameLuckyGiftCommon;
private final TaskMqMessage taskMqMessage;
public BigDecimal execute(GiveAwayGiftBatchCmd cmd) {
@ -75,6 +79,11 @@ public class LuckyGiftGiveCmdExe {
userProfileGateway.removeCache(cmd.requiredReqUserId());
taskMqMessage.sendTask(TaskApprovalEvent.builder()
.taskId(8)
.userId(cmd.getReqUserId())
.build());
return receipt.getBalance().getDollarAmount();
}

View File

@ -107,9 +107,9 @@ public class PropsPurchasingCmdExe {
sendGiveAwayNotice(cmd, commodity);
//完成任务 钩子 9 充值
//完成任务3 在商店购买任意商品
taskMqMessage.sendTask(TaskApprovalEvent.builder()
.taskId(8)
.taskId(3)
.userId(cmd.getReqUserId())
.day(LocalDateTimeUtils.nowFormat("yyyy-MM-dd"))
.build());

View File

@ -87,11 +87,10 @@ public class RoomEnterCmdExe {
public EntryRoomResponseCO execute(RoomEntryCmd cmd) {
//checkEntryUserId(cmd);
//进入房间计数
//进入房间任务
taskMqMessage.sendTask(TaskApprovalEvent.builder()
.taskId(10)
.taskId(7)
.userId(cmd.getReqUserId())
.day(LocalDateTimeUtils.nowFormat("yyyy-MM-dd"))
.build());
RoomProfileManager manager = roomProfileManagerService.getById(cmd.getRoomId());

View File

@ -2,10 +2,13 @@ package com.red.circle.other.app.command.room;
import com.red.circle.framework.core.asserts.ResponseAssert;
import com.red.circle.framework.core.response.CommonErrorCode;
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.cmd.room.RoomSubscriptionCmd;
import com.red.circle.other.infra.database.mongo.service.live.RoomProfileManagerService;
import com.red.circle.other.infra.database.rds.service.live.RoomSubscriptionCountService;
import com.red.circle.other.infra.database.rds.service.live.RoomSubscriptionService;
import com.red.circle.tool.core.date.LocalDateTimeUtils;
import com.red.circle.tool.core.text.StringUtils;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
@ -24,6 +27,7 @@ public class RoomSubscriptionCmdExe {
private final RoomSubscriptionService roomSubscriptionService;
private final RoomProfileManagerService roomProfileManagerService;
private final RoomSubscriptionCountService roomSubscriptionCountService;
private final TaskMqMessage taskMqMessage;
public Boolean execute(RoomSubscriptionCmd cmd) {
// 无法操作错误归属
@ -40,6 +44,13 @@ public class RoomSubscriptionCmdExe {
}
roomSubscriptionService.add(cmd.requiredReqUserId(), cmd.getRoomId());
roomSubscriptionCountService.saveRoomSubscriptionCount(cmd.getRoomId(), Boolean.TRUE);
//关注一个房间任务
taskMqMessage.sendTask(TaskApprovalEvent.builder()
.taskId(10)
.userId(cmd.requiredReqUserId())
.day(LocalDateTimeUtils.nowFormat("yyyy-MM-dd"))
.build());
return Boolean.TRUE;
}
}

View File

@ -35,9 +35,8 @@ public class RoomVoiceProfileByUserIdQryExe {
if (Objects.nonNull(roomProfileManagerDTO)&&Objects.nonNull(roomProfileManagerDTO.getCountryCode())) {
//放一个创建自己房间钩子
taskMqMessage.sendTask(TaskApprovalEvent.builder()
.taskId(11)
.taskId(5)
.userId(cmd.getReqUserId())
.day(LocalDateTimeUtils.nowFormat("yyyy-MM-dd"))
.build());

View File

@ -85,12 +85,10 @@ public class UserHandleFriendApplyCmdExe {
friendsApplyListService.changeStatus(cmd.requiredReqUserId(), cmd.getApplyUserId(),
getFriendApplyStatus(cmd.getAgree()));
//添加好友 每日任务
//添加好友
taskMqMessage.sendTask(TaskApprovalEvent.builder()
.taskId(3)
.taskId(6)
.userId(cmd.getApplyUserId())
.day(LocalDateTimeUtils.nowFormat("yyyy-MM-dd"))
.build());
//sendPush(cmd);

View File

@ -8,6 +8,7 @@ import com.red.circle.external.inner.model.cmd.message.notice.official.NoticeExt
import com.red.circle.external.inner.model.enums.message.OfficialNoticeTypeEnum;
import com.red.circle.framework.core.asserts.ResponseAssert;
import com.red.circle.framework.core.response.CommonErrorCode;
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.convertor.user.UserProfileAppConvertor;
import com.red.circle.other.app.util.OfficialNoticeUtils;
@ -25,6 +26,7 @@ import com.red.circle.other.infra.database.rds.service.user.user.ShieldBlackServ
import com.red.circle.other.infra.database.rds.service.user.user.UserSubscriptionService;
import com.red.circle.other.inner.asserts.user.UserRelationErrorCode;
import com.red.circle.other.inner.model.dto.user.UserProfileDTO;
import com.red.circle.tool.core.date.LocalDateTimeUtils;
import com.red.circle.tool.core.date.TimestampUtils;
import com.red.circle.tool.core.text.StringUtils;
import com.red.circle.other.inner.asserts.user.UserErrorCode;
@ -55,6 +57,7 @@ public class UserSupportRelationFollowOrCancelCmdExe {
private final OfficialNoticeClient officialNoticeClient;
private final RoomProfileManagerService roomProfileManagerService;
private final RelationshipFriendService relationshipFriendService;
private final TaskMqMessage taskMqMessage;
public Boolean execute(AppUserIdCmd cmd) {
// 不可操作自己
@ -96,6 +99,13 @@ public class UserSupportRelationFollowOrCancelCmdExe {
Long subUserId = cmd.getUserId();
boolean mutual = userSubscriptionService.checkSubscription(subUserId, userId);
// 关注一个用户任务
taskMqMessage.sendTask(TaskApprovalEvent.builder()
.taskId(9)
.userId(cmd.requiredReqUserId())
.day(LocalDateTimeUtils.nowFormat("yyyy-MM-dd"))
.build());
// 如果是相互关注 则自动加为好友
if (mutual) {
try {
@ -128,6 +138,18 @@ public class UserSupportRelationFollowOrCancelCmdExe {
roomUserBlacklistService.removeBlack(roomProfile.getId(), cmd.requiredReqUserId());
}
}
// 双方都完成好友任务
taskMqMessage.sendTask(TaskApprovalEvent.builder()
.taskId(6)
.userId(cmd.requiredReqUserId())
.build());
taskMqMessage.sendTask(TaskApprovalEvent.builder()
.taskId(6)
.userId(subUserId)
.build());
} else {
UserProfileDTO userProfile = userProfileAppConvertor.toUserProfileDTO(userProfileGateway.getByUserId(cmd.requiredReqUserId()));
officialNoticeClient.send(NoticeExtTemplateTypeCmd.builder()

View File

@ -43,12 +43,6 @@ public class UserCpPairUserProfileQryExe {
return new CpPairUserProfileCO()
.setMeUserProfile(userProfileAppConvertor.toUserProfileDTO((meUser)));
}
//task 活动 cp活动
taskMqMessage.sendTask(TaskApprovalEvent.builder()
.taskId(7)
.userId(cmd.requiredReqUserId())
.day(LocalDateTimeUtils.nowFormat("yyyy-MM-dd"))
.build());
return new CpPairUserProfileCO()
.setMeUserProfile(userProfileAppConvertor.toUserProfileDTO((meUser)))

View File

@ -211,11 +211,11 @@ public class GiftCountStrategy implements GiftStrategy {
// 送礼物不再计入财富等级
// consumptionLevelService.incrConsumptionGolds(runningWater.getUserId(), wealthActualAmount);
//累计财富等级mq
taskMqMessage.sendTask(TaskApprovalEvent.builder()
.taskId(13)
.userId(runningWater.getUserId())
.day(LocalDateTimeUtils.nowFormat("yyyy-MM-dd"))
.build());
// taskMqMessage.sendTask(TaskApprovalEvent.builder()
// .taskId(13)
// .userId(runningWater.getUserId())
// .day(LocalDateTimeUtils.nowFormat("yyyy-MM-dd"))
// .build());
// 财富等级
// consumptionLevelService.incrConsumptionGolds(runningWater.getUserId(), wealthActualAmount);
@ -235,11 +235,11 @@ public class GiftCountStrategy implements GiftStrategy {
// 记录魅力等级
consumptionLevelService.incrConsumptionDiamond(accept.getAcceptUserId(), charmGiftValue);
taskMqMessage.sendTask(TaskApprovalEvent.builder()
/*taskMqMessage.sendTask(TaskApprovalEvent.builder()
.taskId(14)
.userId(accept.getAcceptUserId())
.day(LocalDateTimeUtils.nowFormat("yyyy-MM-dd"))
.build());
.build());*/
userMqMessageService.sendBadgeEvent(accept.getAcceptUserId(), BadgeKeyEnum.CHARM.name());

View File

@ -117,7 +117,7 @@ public class TaskListener implements MessageListener {
handleTask9(eventBody);
break;
case 10:
// 处理任务-9 的逻辑 关注一个房间
// 处理任务-10 的逻辑 关注一个房间
handleTask10(eventBody);
break;
default:
@ -128,14 +128,6 @@ public class TaskListener implements MessageListener {
);
}
private void handleTask10(TaskApprovalEvent eventBody) {
}
private void handleTask8(TaskApprovalEvent eventBody) {
}
private void handleTask1(TaskApprovalEvent eventBody) {
// // 增加心跳次数 放一天
String redisKey = "mic:heartbeat:" + eventBody.getUserId();
@ -225,10 +217,9 @@ public class TaskListener implements MessageListener {
private void handleTask6(TaskApprovalEvent eventBody) {
log.warn("处理任务-6 添加10个好友: {}", eventBody);
// 更新任务状态的逻辑
if (relationshipFriendService.todayFlowSize(eventBody.getUserId()) >= 3) {
if (relationshipFriendService.selectMyFriendsCount(eventBody.getUserId()) >= 10) {
updateTaskStatus(eventBody);
}
//判断用户是否添加了3个好友
}
@ -257,13 +248,17 @@ public class TaskListener implements MessageListener {
updateTaskStatus(eventBody);
}
private void handleTask8(TaskApprovalEvent eventBody) {
}
private void handleTask9(TaskApprovalEvent eventBody) {
log.warn("处理任务-9: {}", eventBody);
// 首次充值
// updateTaskStatus(eventBody);
// checkMemberActive(eventBody.getUserId(), MemberActiveEnum.TASK_3);
// 如果是币商给用户充值
dealRechargeCommission(eventBody);
}
private void handleTask10(TaskApprovalEvent eventBody) {
}
private void dealRechargeCommission(TaskApprovalEvent eventBody) {
@ -285,7 +280,7 @@ public class TaskListener implements MessageListener {
redisService.increment(redisKey, 1);
} else {
//大于3次完成
if ("3".equals(inc)) {
if ("3".equals(inc) || Integer.parseInt(inc) >= 3) {
// 更新任务状态的逻辑 直接更新
updateTaskStatus(eventBody);
} else {
@ -296,10 +291,6 @@ public class TaskListener implements MessageListener {
private void handleTask5(TaskApprovalEvent eventBody) {
log.warn("处理任务-5 创建我的房间: {}", eventBody);
// AppExtCommand appExtCommand = new AppExtCommand();
// appExtCommand.setReqUserId(eventBody.getUserId());
// if (!Objects.isNull(roomProfileService.getRoomProfile(appExtCommand))) {
// }
updateTaskStatus(eventBody);
}

View File

@ -211,14 +211,6 @@ public class UserAccountCommon {
userInviteUser.setUserId(userId);
userInviteUser.setSysOrigin(cmd.requireReqSysOrigin());
userInviteUserService.save(userInviteUser);
//这里发一个mq
taskMqMessage.sendTask(TaskApprovalEvent.builder()
.taskId(99)
.imei(cmd.getReqImei())
.userId(userId)
.ip(cmd.getReqIp())
.day(LocalDateTimeUtils.nowFormat("yyyy-MM-dd"))
.build());
}
private void mobileRegister(CreateAccountCmd cmd, BaseInfo baseInfo) {

View File

@ -36,6 +36,11 @@ public interface RelationshipFriendService extends BaseService<RelationshipFrien
Long todayFlowSize(Long userId);
/**
* 查询我有多少个好友
*/
Long selectMyFriendsCount(Long userId);
/**
* 检测是否是好友关系.
*

View File

@ -74,7 +74,15 @@ public class RelationshipFriendServiceImpl extends
.count();
}
@Override
@Override
public Long selectMyFriendsCount(Long userId) {
return query()
.eq(RelationshipFriend::getUserId, userId)
.orderByDesc(RelationshipFriend::getId)
.count();
}
@Override
public Boolean checkFriend(Long userId, Long friendUserId) {
return Optional.ofNullable(
query()

View File

@ -138,13 +138,13 @@ public class SendFreightShipCmdExe {
userSvipClient.incrIntegral(cmd.getAcceptUserId(), cmd.getQuantity().longValue());
//完成任务 钩子 9 充值 币商
taskMqMessage.sendTask(TaskApprovalEvent.builder()
/*taskMqMessage.sendTask(TaskApprovalEvent.builder()
.taskId(9)
.userId(cmd.getAcceptUserId())
.sysOrigin(cmd.requireReqSysOrigin())
.currencyDiff((cmd.getQuantity().longValue()))
.day(LocalDateTimeUtils.nowFormat("yyyy-MM-dd"))
.build());
.build());*/
return balance;
} finally {