From 3336472708bb21fed3b5a6795d0d1bbe1fc54653 Mon Sep 17 00:00:00 2001 From: tianfeng <769204422@qq.com> Date: Sat, 28 Feb 2026 17:40:28 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B4=BB=E5=8A=A8=E8=BD=AC=E8=B4=A6=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E9=87=91=E5=B8=81=E5=88=B0=E8=B4=A6=E9=80=9A=E7=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../command/activity/LotteryTransferExe.java | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/activity/LotteryTransferExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/activity/LotteryTransferExe.java index eb1c80da..9fae2218 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/activity/LotteryTransferExe.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/activity/LotteryTransferExe.java @@ -3,9 +3,13 @@ package com.red.circle.other.app.command.activity; import com.red.circle.common.business.core.enums.OpUserType; import com.red.circle.common.business.core.enums.ReceiptType; import com.red.circle.component.redis.service.RedisService; +import com.red.circle.external.inner.endpoint.message.OfficialNoticeClient; +import com.red.circle.external.inner.model.cmd.message.notice.official.NoticeExtTemplateCustomizeCmd; +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.framework.core.response.ResponseErrorCode; +import com.red.circle.framework.dto.ResultResponse; import com.red.circle.other.app.dto.clientobject.activity.LotteryWithdrawAmountCO; import com.red.circle.other.app.dto.cmd.activity.LotteryTransferCmd; import com.red.circle.other.app.service.activity.LotteryActivityRestService; @@ -14,7 +18,9 @@ import com.red.circle.other.infra.database.rds.entity.activity.LotteryWithdraw; import com.red.circle.other.infra.database.rds.service.activity.LotteryUserProgressService; import com.red.circle.other.infra.database.rds.service.activity.LotteryWithdrawService; import com.red.circle.other.inner.endpoint.user.region.UserRegionClient; +import com.red.circle.other.inner.endpoint.user.user.UserProfileClient; import com.red.circle.other.inner.model.dto.user.SysExchangeGoldTipDTO; +import com.red.circle.other.inner.model.dto.user.UserProfileDTO; import com.red.circle.tool.core.date.TimestampUtils; import com.red.circle.tool.core.num.ArithmeticUtils; import com.red.circle.tool.core.tuple.PennyAmount; @@ -57,6 +63,8 @@ public class LotteryTransferExe { private final FreightBalanceClient freightBalanceClient; private final FreightBalanceRunningWaterClient freightBalanceRunningWaterClient; private final LotteryWithdrawAmountQryExe lotteryWithdrawAmountQryExe; + private final OfficialNoticeClient officialNoticeClient; + private final UserProfileClient userProfileClient; public void execute(LotteryTransferCmd cmd) { ResponseAssert.isTrue(ResponseErrorCode.REQUEST_PARAMETER_ERROR, @@ -151,6 +159,16 @@ public class LotteryTransferExe { .setOrigin(FreightBalanceOrigin.PURCHASE.name()) .setRemark(remark) .setCreateUser(cmd.requiredReqUserId())); + + String noticeContent = getNoticeContent(cmd, goldQuantity); + officialNoticeClient.send( + NoticeExtTemplateCustomizeCmd.builder() + .toAccount(cmd.getAcceptUserId()) + .noticeType(OfficialNoticeTypeEnum.COIN_SELLER_COINS_RECEIVED) + .content(noticeContent) + .build() + ); + return; } @@ -168,6 +186,35 @@ public class LotteryTransferExe { walletGoldClient.changeBalance(build); } + private String getNoticeContent(LotteryTransferCmd cmd, BigDecimal goldQuantity) { + // 获取发送者(代理)的 account + String agencyAccount = resolveAccount(cmd.getReqUserId()); + + // 获取接收者的区域判断是否为阿拉伯语 + ResultResponse regionResponse = userRegionClient.getRegionCode(cmd.getAcceptUserId()); + boolean arRegion = regionResponse.checkSuccess() && "AR".equals(regionResponse.getBody()); + + long goldCoins = goldQuantity.longValue(); + String noticeTemplate = arRegion + ? "لقد استلمت %,d عملة. تم تحويل الأموال من المستخدم (ID: %s) إلى محفظة وكالة الشحن الخاصة بك. يرجى تأكيد الاستلام." + : "You have received %,d Coins. The funds have been transferred from user (ID: %s) to your recharge agency wallet. Please confirm receipt."; + return String.format(noticeTemplate, goldCoins, agencyAccount); + } + + /** + * 获取用户展示的 account,优先取专属号(ownSpecialId),否则取普通 account + */ + private String resolveAccount(Long userId) { + ResultResponse response = userProfileClient.getByUserId(userId); + if (!response.checkSuccess() || response.getBody() == null) { + return Objects.toString(userId); + } + UserProfileDTO profile = response.getBody(); + return profile.getOwnSpecialId() != null + ? profile.getOwnSpecialId().getAccount() + : profile.getAccount(); + } + /** * 获得1$兑换多少金币比例,基于区域+用户输入的美元.