From 69ada2534f02d2c24bed5a37d3d16eebf431c6f1 Mon Sep 17 00:00:00 2001 From: tianfeng <769204422@qq.com> Date: Wed, 14 Jan 2026 15:03:56 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=A8=E6=88=B7=E5=8F=91=E9=80=81=E7=BA=A2?= =?UTF-8?q?=E5=8C=85=E6=96=B0=E5=A2=9E=E9=99=90=E5=88=B6=E8=B4=A2=E5=AF=8C?= =?UTF-8?q?=E7=AD=89=E7=BA=A710=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../circle/other/inner/asserts/OtherErrorCode.java | 4 ++++ .../command/redpacket/SendUserRedPacketCmdExe.java | 11 +++++++++++ 2 files changed, 15 insertions(+) diff --git a/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/asserts/OtherErrorCode.java b/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/asserts/OtherErrorCode.java index 1965992d..bbd3f6db 100644 --- a/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/asserts/OtherErrorCode.java +++ b/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/asserts/OtherErrorCode.java @@ -168,6 +168,10 @@ public enum OtherErrorCode implements IResponseErrorCode { NOT_RED_PACKET_RECEIVER(40302, "You are not a red envelope recipient"), + /** + * 用户财富等级不足10级 + */ + USER_WEALTH_NEED_THAN_10(40303, "User wealth level needs to be greater than 10"), ; private final int code; diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/redpacket/SendUserRedPacketCmdExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/redpacket/SendUserRedPacketCmdExe.java index 01805a8e..bea70c0a 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/redpacket/SendUserRedPacketCmdExe.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/redpacket/SendUserRedPacketCmdExe.java @@ -1,5 +1,7 @@ package com.red.circle.other.app.command.redpacket; +import com.red.circle.common.business.core.enums.SysOriginPlatformEnum; +import com.red.circle.common.business.core.level.LevelUtils; import com.red.circle.framework.core.asserts.ResponseAssert; import com.red.circle.other.app.convertor.UserRedPacketAppConvertor; import com.red.circle.other.app.dto.clientobject.UserRedPacketCO; @@ -9,6 +11,8 @@ import com.red.circle.other.domain.redpacket.RoomRedPacketType; import com.red.circle.other.domain.redpacket.UserRedPacket; import com.red.circle.other.domain.redpacket.UserRedPacketStatus; import com.red.circle.other.infra.database.cache.service.other.UserRedPacketCacheService; +import com.red.circle.other.infra.database.rds.entity.user.user.ConsumptionLevel; +import com.red.circle.other.infra.database.rds.service.user.user.ConsumptionLevelService; import com.red.circle.other.inner.asserts.OtherErrorCode; import com.red.circle.tool.core.sequence.IdWorkerUtils; import com.red.circle.tool.core.tuple.PennyAmount; @@ -21,6 +25,7 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; +import java.math.BigDecimal; import java.time.Duration; import java.time.LocalDateTime; import java.util.HashMap; @@ -37,6 +42,7 @@ public class SendUserRedPacketCmdExe { private final UserRedPacketGateway userRedPacketGateway; private final UserRedPacketCacheService userRedPacketCacheService; private final WalletGoldClient walletGoldClient; + private final ConsumptionLevelService consumptionLevelService; /** * 手续费比例:10% @@ -85,6 +91,11 @@ public class SendUserRedPacketCmdExe { if (cmd.getTotalAmount() < 100 || cmd.getTotalAmount() > 50000) { throw new RuntimeException(OtherErrorCode.RED_PACKET_AMOUNT_ERROR.getMessage()); } + + ConsumptionLevel consumptionLevel = consumptionLevelService.getByUserId(cmd.getReqUserId()); + Integer level = LevelUtils.getWealthLevel(SysOriginPlatformEnum.LIKEI, consumptionLevel.getConsumptionGolds().longValue()).getLevel(); + ResponseAssert.isTrue(OtherErrorCode.USER_WEALTH_NEED_THAN_10, level >= 10); + } /**