diff --git a/rc-common-business/common-business-dto/src/main/java/com/red/circle/common/business/enums/SendPropsOrigin.java b/rc-common-business/common-business-dto/src/main/java/com/red/circle/common/business/enums/SendPropsOrigin.java index 3c339ead..d5dc70f3 100644 --- a/rc-common-business/common-business-dto/src/main/java/com/red/circle/common/business/enums/SendPropsOrigin.java +++ b/rc-common-business/common-business-dto/src/main/java/com/red/circle/common/business/enums/SendPropsOrigin.java @@ -274,6 +274,8 @@ public enum SendPropsOrigin { */ COUPON_EXCHANGE("Coupon Exchange"), + LUCK_DOLLAR_REWARD("Luck Dollar Rewards"), + ; private final String desc; diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/activity/ActivityRewardConfigQryExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/activity/ActivityRewardConfigQryExe.java index d8f2c50f..3ea4c247 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/activity/ActivityRewardConfigQryExe.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/activity/ActivityRewardConfigQryExe.java @@ -51,8 +51,9 @@ public class ActivityRewardConfigQryExe { Map claimMap = getUserClaimMap(cmd.getReqUserId(), ruleIds); BigDecimal userTotalAmount = userActivityRechargeService.getUserTotalAmount( - cmd.getActivityId(), - cmd.getReqUserId() + cmd.getReqUserId(), + cmd.getActivityId() + ); if (Objects.isNull(userTotalAmount)) { userTotalAmount = BigDecimal.ZERO; diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/activity/ClaimActivityRewardExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/activity/ClaimActivityRewardExe.java index 2656338d..f41b6838 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/activity/ClaimActivityRewardExe.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/activity/ClaimActivityRewardExe.java @@ -3,6 +3,7 @@ package com.red.circle.other.app.command.activity; import cn.hutool.core.util.StrUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.red.circle.common.business.core.enums.SysOriginPlatformEnum; +import com.red.circle.common.business.enums.SendPropsOrigin; import com.red.circle.framework.core.asserts.ResponseAssert; import com.red.circle.framework.core.response.CommonErrorCode; import com.red.circle.other.app.dto.clientobject.activity.ClaimRewardResultCO; @@ -16,9 +17,13 @@ import com.red.circle.other.infra.database.rds.service.activity.UserActivityRech import com.red.circle.other.infra.database.rds.service.user.device.LatestMobileDeviceService; import com.red.circle.other.inner.asserts.OtherErrorCode; import com.red.circle.other.inner.endpoint.activity.LotteryTicketClient; +import com.red.circle.other.inner.endpoint.activity.PropsActivityClient; import com.red.circle.other.inner.enums.activity.PropsActivityTypeEnum; +import com.red.circle.other.inner.model.cmd.activity.SendActivityRewardCmd; +import com.red.circle.other.inner.model.dto.activity.props.ActivityPropsGroup; import com.red.circle.other.inner.model.dto.activity.props.ActivityPropsRule; import com.red.circle.other.inner.asserts.DynamicErrorCode; +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.json.JacksonUtils; import lombok.RequiredArgsConstructor; @@ -46,6 +51,7 @@ public class ClaimActivityRewardExe { private final LotteryTicketClient lotteryTicketClient; private final LatestMobileDeviceService latestMobileDeviceService; private final LotteryDeviceRecordService lotteryDeviceRecordService; + private final PropsActivityClient propsActivityClient; @Transactional(rollbackFor = Exception.class) public ClaimRewardResultCO execute(ClaimActivityRewardCmd cmd) { @@ -75,8 +81,8 @@ public class ClaimActivityRewardExe { ResponseAssert.notNull(DynamicErrorCode.NO_RELATED_INFORMATION_FOUND, requiredAmount); BigDecimal userTotalAmount = userActivityRechargeService.getUserTotalAmount( - cmd.getActivityId(), - cmd.getReqUserId() + cmd.getReqUserId(), + cmd.getActivityId() ); ResponseAssert.isFalse(OtherErrorCode.USER_RECHARGE_INVALID, Objects.isNull(userTotalAmount) || userTotalAmount.compareTo(requiredAmount) < 0); @@ -111,6 +117,23 @@ public class ClaimActivityRewardExe { userActivityRewardClaimDAO.insert(claim); + ActivityPropsGroup group = activitySourceGroupGateway.getActivityPropsGroup( + sysOrigin.name(), + ruleConfigs.get(0).getResourceGroupId() + ); + + List activityRewardProps = group.getActivityRewardProps(); + ResponseAssert.isFalse(DynamicErrorCode.NO_RELATED_INFORMATION_FOUND, activityRewardProps.isEmpty()); + ActivityRewardProps rewardProps = activityRewardProps.get(0); + + propsActivityClient.sendActivityReward(new SendActivityRewardCmd() + .setTrackId(cmd.getActivityId()) + .setOrigin(SendPropsOrigin.LUCK_DOLLAR_REWARD) + .setSysOrigin(SysOriginPlatformEnum.valueOf(cmd.getReqSysOrigin().getOrigin())) + .setSourceGroupId(rewardProps.getGroupId()) + .setAcceptUserId(cmd.getReqUserId()) + ); + return new ClaimRewardResultCO() .setSuccess(true) .setLotteryTicketIds(ticketIds);