From a08536c00f3cb19681f288ae3394f4dd6bc26e0a Mon Sep 17 00:00:00 2001 From: tianfeng <769204422@qq.com> Date: Mon, 22 Dec 2025 17:45:56 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=B6=E6=97=8F=E5=8A=9F=E8=83=BD=20?= =?UTF-8?q?=E6=B6=88=E6=81=AF=E6=A8=A1=E5=9D=97=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/family/FamilyRestController.java | 63 +++++++------------ .../command/family/ApplyJoinFamilyExe.java | 16 +++-- .../family/FamilyMessageHandleExe.java | 2 +- .../app/service/family/FamilyServiceImpl.java | 8 ++- .../infra/common/family/FamilyCommon.java | 4 +- 5 files changed, 45 insertions(+), 48 deletions(-) diff --git a/rc-service/rc-service-other/other-adapter/src/main/java/com/red/circle/other/adapter/app/family/FamilyRestController.java b/rc-service/rc-service-other/other-adapter/src/main/java/com/red/circle/other/adapter/app/family/FamilyRestController.java index 6ef4f6a0..cab8cacf 100644 --- a/rc-service/rc-service-other/other-adapter/src/main/java/com/red/circle/other/adapter/app/family/FamilyRestController.java +++ b/rc-service/rc-service-other/other-adapter/src/main/java/com/red/circle/other/adapter/app/family/FamilyRestController.java @@ -84,6 +84,30 @@ public class FamilyRestController extends BaseController { return familyService.getBaseInfo(cmd); } + /** + * 申请加入家族. + */ + @PostMapping("/apply-join") + public void applyJoin(@RequestBody @Validated ApplyJoinFamilyCmd cmd) { + familyService.applyJoin(cmd); + } + + /** + * 家族消息处理. + */ + @PostMapping("/message/handle") + public void messageHandle(@RequestBody @Validated FamilyMessageHandleCmd cmd) { + familyService.messageHandle(cmd); + } + + /** + * 家族消息列表. + */ + @GetMapping("/list/message") + public List listMessage(FamilyMessageListCmd cmd) { + return familyService.listMessage(cmd); + } + /** * 家族族长信息(与家族成员信息 数据结构一致). * @@ -162,45 +186,6 @@ public class FamilyRestController extends BaseController { return familyService.listLevelConfig(cmd); } - /** - * 申请加入家族. - * - * @eo.name 申请加入家族. - * @eo.url /apply-join - * @eo.method post - * @eo.request-type json - */ - @PostMapping("/apply-join") - public void applyJoin(@RequestBody @Validated ApplyJoinFamilyCmd cmd) { - familyService.applyJoin(cmd); - } - - /** - * 家族消息处理. - * - * @eo.name 家族消息处理. - * @eo.url /message/handle - * @eo.method post - * @eo.request-type json - */ - @PostMapping("/message/handle") - public void messageHandle(@RequestBody @Validated FamilyMessageHandleCmd cmd) { - familyService.messageHandle(cmd); - } - - /** - * 家族消息列表. - * - * @eo.name 家族消息列表. - * @eo.url /list/message - * @eo.method get - * @eo.request-type formdata - */ - @GetMapping("/list/message") - public List listMessage(FamilyMessageListCmd cmd) { - return familyService.listMessage(cmd); - } - /** * 家族在线房间. * diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/family/ApplyJoinFamilyExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/family/ApplyJoinFamilyExe.java index 48cafe05..870ba43b 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/family/ApplyJoinFamilyExe.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/family/ApplyJoinFamilyExe.java @@ -1,9 +1,16 @@ package com.red.circle.other.app.command.family; 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.NoticeExtTemplateTypeCmd; +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.other.app.convertor.user.UserProfileAppConvertor; import com.red.circle.other.app.dto.cmd.family.ApplyJoinFamilyCmd; +import com.red.circle.other.app.util.OfficialNoticeUtils; +import com.red.circle.other.domain.gateway.user.UserProfileGateway; +import com.red.circle.other.domain.gateway.user.ability.UserRegionGateway; import com.red.circle.other.infra.common.family.FamilyCommon; import com.red.circle.other.infra.database.rds.entity.family.FamilyMessage; import com.red.circle.other.infra.database.rds.service.family.FamilyMemberInfoService; @@ -12,7 +19,11 @@ import com.red.circle.other.infra.enums.family.FamilyMsgTypeEnum; import com.red.circle.other.inner.asserts.DynamicErrorCode; import com.red.circle.other.inner.asserts.FamilyErrorCode; import com.red.circle.other.inner.model.dto.famliy.FamilyDetailsDTO; + +import java.util.Map; import java.util.concurrent.TimeUnit; + +import com.red.circle.other.inner.model.dto.user.UserProfileDTO; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Component; @@ -49,11 +60,6 @@ public class ApplyJoinFamilyExe { ResponseAssert .isTrue(FamilyErrorCode.FAMILY_MEMBER_MAX, levelCacheCO.getMaxMember() > familyMemberCount); - // 防止重复触发 - ResponseAssert.isTrue(DynamicErrorCode.REPEATED_SUBMIT, redisService.setIfAbsent( - "APPLY_JOIN_FAMILY_:" + cmd.getReqUserId() + ":" + cmd.getFamilyId(), 40, - TimeUnit.SECONDS)); - saveMsg(cmd); } diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/family/FamilyMessageHandleExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/family/FamilyMessageHandleExe.java index 36d2902f..9bc4f3a9 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/family/FamilyMessageHandleExe.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/family/FamilyMessageHandleExe.java @@ -96,7 +96,7 @@ public class FamilyMessageHandleExe { addFamilyMember(memberId, levelConfig.getFamilyId(), msg.getSenderUser(), cmd.getReqSysOrigin().getOrigin()); - sendHonorReward(msg.getSenderUser(), levelConfig); +// sendHonorReward(msg.getSenderUser(), levelConfig); } private Integer getMemberCount(FamilyDetailsDTO levelConfig) { diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/service/family/FamilyServiceImpl.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/service/family/FamilyServiceImpl.java index 8d170697..3a95be97 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/service/family/FamilyServiceImpl.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/service/family/FamilyServiceImpl.java @@ -54,6 +54,8 @@ import com.red.circle.other.app.dto.cmd.family.ReceiveFamilyAwardCmd; import java.math.BigDecimal; import java.util.List; import java.util.Objects; + +import com.red.circle.other.app.util.DistributedLockUtil; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; @@ -93,6 +95,7 @@ public class FamilyServiceImpl implements FamilyService { private final FamilyDismissGroupChatExe familyDismissGroupChatExe; private final FamilyMemberIdGetUserIdExe familyMemberIdGetUserIdExe; private final FamilyPurchasingGroupChatExe familyPurchasingGroupChatExe; + private final DistributedLockUtil distributedLockUtil; @Override public Long create(FamilyCreateCmd cmd) { @@ -177,7 +180,10 @@ public class FamilyServiceImpl implements FamilyService { @Override public void applyJoin(ApplyJoinFamilyCmd cmd) { - applyJoinFamilyExe.execute(cmd); + String key = "FAMILY_APPLY_JOIN" + ":" + cmd.getReqUserId() + "_" + cmd.getReqUserId(); + distributedLockUtil.executeWithLock(key, () -> { + applyJoinFamilyExe.execute(cmd); + }); } @Override diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/common/family/FamilyCommon.java b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/common/family/FamilyCommon.java index d55e3970..22aae526 100644 --- a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/common/family/FamilyCommon.java +++ b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/common/family/FamilyCommon.java @@ -403,7 +403,7 @@ public class FamilyCommon { */ private void handleFamilyLevel(FamilyLevelConfig levelConfig, FamilyDetailsDTO familyCO) { - PropsSourceRecord avatarFrame = getPropsSourceById(levelConfig.getAvatarFrameId()); + /*PropsSourceRecord avatarFrame = getPropsSourceById(levelConfig.getAvatarFrameId()); BadgePictureConfig badge = getByBadgeId(levelConfig.getSysOrigin(), levelConfig.getBadgeId()); GiftConfig gift = getEffectiveById(levelConfig); @@ -424,7 +424,7 @@ public class FamilyCommon { familyCO.setGiftId(gift.getId()); familyCO.setGiftCover(gift.getGiftPhoto()); familyCO.setGiftSvg(gift.getGiftSourceUrl()); - } + }*/ familyCO.setLevelSort(levelConfig.getSort()); familyCO.setFamilyLevelId(levelConfig.getId());