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 e3cac6da..cefc4fef 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 @@ -1,16 +1,16 @@ package com.red.circle.other.app.command.family; -import com.red.circle.external.inner.endpoint.message.ImMessageClient; 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.other.app.dto.cmd.family.FamilyMessageHandleCmd; +import com.red.circle.other.domain.gateway.SystemI18nConfigGateway; import com.red.circle.other.domain.gateway.user.UserProfileGateway; +import com.red.circle.other.domain.gateway.user.ability.UserRegionGateway; import com.red.circle.other.domain.model.user.UserProfile; -import com.red.circle.other.domain.propcoupon.PropCoupon; -import com.red.circle.other.domain.propcoupon.PropCouponType; +import com.red.circle.other.domain.system.i18n.I18nTypeEnum; import com.red.circle.other.infra.common.family.FamilyCommon; import com.red.circle.other.infra.common.family.FamilyNewsRecorder; import com.red.circle.other.infra.database.rds.entity.family.FamilyMemberInfo; @@ -23,6 +23,7 @@ import com.red.circle.other.infra.enums.family.FamilyRoleEnum; import com.red.circle.other.inner.asserts.FamilyErrorCode; import com.red.circle.other.inner.enums.FamilyMessageStatusEnum; import com.red.circle.other.inner.model.dto.famliy.FamilyDetailsDTO; +import com.red.circle.other.inner.model.dto.user.reigon.UserRegionDTO; import com.red.circle.tool.core.sequence.IdWorkerUtils; import com.red.circle.tool.core.text.StringUtils; import java.util.Objects; @@ -49,6 +50,8 @@ public class FamilyMessageHandleExe { private final OfficialNoticeClient officialNoticeClient; private final FamilyMessageService familyMessageService; private final FamilyMemberInfoService familyMemberInfoService; + private final SystemI18nConfigGateway systemI18nConfigGateway; + private final UserRegionGateway userRegionGateway; @Transactional(rollbackFor = Exception.class) public void execute(FamilyMessageHandleCmd cmd) { @@ -106,19 +109,25 @@ public class FamilyMessageHandleExe { * 发送通过和拒绝通知 */ private void sendNotification(Long userId, boolean agree) { - String content = "Your family application has been approved"; - if (!agree) { - content = "Your family application has been rejected"; + try { + UserRegionDTO userRegion = userRegionGateway.getUserRegion(userId); + String i18nKey = agree ? "family_apply_approved" : "family_apply_rejected"; + String content = systemI18nConfigGateway.getByTypeCountryKey( + I18nTypeEnum.FAMILY_APPLY.getCode(), + userRegion.getRegionCode(), + i18nKey + ).getI18nValue(); + + officialNoticeClient.send( + NoticeExtTemplateCustomizeCmd.builder() + .toAccount(userId) + .noticeType(OfficialNoticeTypeEnum.FAMILY_APPLY_APPROVAL) + .content(content) + .build() + ); + } catch (Exception ignored) { + } - - officialNoticeClient.send( - NoticeExtTemplateCustomizeCmd.builder() - .toAccount(userId) - .noticeType(OfficialNoticeTypeEnum.FAMILY_APPLY_APPROVAL) - .content(content) - .build() - ); - } private void userJoinFamily(FamilyMessageHandleCmd cmd, FamilyMessage msg, diff --git a/rc-service/rc-service-other/other-domain/src/main/java/com/red/circle/other/domain/system/i18n/I18nTypeEnum.java b/rc-service/rc-service-other/other-domain/src/main/java/com/red/circle/other/domain/system/i18n/I18nTypeEnum.java index eac86342..7aeb0206 100644 --- a/rc-service/rc-service-other/other-domain/src/main/java/com/red/circle/other/domain/system/i18n/I18nTypeEnum.java +++ b/rc-service/rc-service-other/other-domain/src/main/java/com/red/circle/other/domain/system/i18n/I18nTypeEnum.java @@ -21,7 +21,14 @@ public enum I18nTypeEnum { /** * 道具券相关 */ - PROP_COUPON("PROP_COUPON", "道具券"); + PROP_COUPON("PROP_COUPON", "道具券"), + + /** + * 家族申请 + */ + FAMILY_APPLY("FAMILY_APPLY", "家族申请"), + + ; /** * 类型代码