From 1a52d8b4826752bf60d6aa8fd0b2463959930aee Mon Sep 17 00:00:00 2001 From: tianfeng <769204422@qq.com> Date: Thu, 23 Oct 2025 14:59:47 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8A=BD=E5=A5=96=E6=8E=A5=E5=8F=A3=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E9=94=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../activity/LotteryActivityRestServiceImpl.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/service/activity/LotteryActivityRestServiceImpl.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/service/activity/LotteryActivityRestServiceImpl.java index e3d48c8e..cda2f8a3 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/service/activity/LotteryActivityRestServiceImpl.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/service/activity/LotteryActivityRestServiceImpl.java @@ -18,6 +18,8 @@ import com.red.circle.other.app.dto.clientobject.activity.*; import com.red.circle.other.app.dto.cmd.activity.*; import java.util.List; + +import com.red.circle.other.app.util.DistributedLockUtil; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; @@ -43,6 +45,8 @@ public class LotteryActivityRestServiceImpl implements LotteryActivityRestServic private final LotteryWithdrawApplyExe lotteryWithdrawApplyExe; private final LotteryWithdrawQryExe lotteryWithdrawQryExe; private final LotteryWithdrawAmountQryExe lotteryWithdrawAmountQryExe; + private final DistributedLockUtil distributedLockUtil; + private static final String LOCK_KEY_PREFIX = "activity:lottery:draw:lock"; @Override public List listValidActivities(AppExtCommand cmd) { @@ -56,12 +60,16 @@ public class LotteryActivityRestServiceImpl implements LotteryActivityRestServic @Override public LotteryDrawResultCO draw(LotteryDrawCmd cmd) { - return lotteryDrawExe.execute(cmd); + return distributedLockUtil.executeWithLock( + DistributedLockUtil.buildLockKey(LOCK_KEY_PREFIX, cmd.requiredReqUserId()), + () -> lotteryDrawExe.execute(cmd)); } @Override public LotteryMultiDrawResultCO multiDraw(LotteryMultiDrawCmd cmd) { - return lotteryMultiDrawExe.execute(cmd); + return distributedLockUtil.executeWithLock( + DistributedLockUtil.buildLockKey(LOCK_KEY_PREFIX, cmd.requiredReqUserId()), + () -> lotteryMultiDrawExe.execute(cmd)); } @Override