diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/material/PropsPurchasingCmdExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/material/PropsPurchasingCmdExe.java index e6ec5bda..41f2011f 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/material/PropsPurchasingCmdExe.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/material/PropsPurchasingCmdExe.java @@ -11,7 +11,9 @@ import com.red.circle.framework.core.response.CommonErrorCode; import com.red.circle.framework.core.response.ResponseErrorCode; import com.red.circle.mq.business.model.event.task.TaskApprovalEvent; import com.red.circle.mq.rocket.business.producer.TaskMqMessage; +import com.red.circle.other.app.convertor.user.UserProfileAppConvertor; import com.red.circle.other.app.dto.cmd.material.PropsPurchasingCmd; +import com.red.circle.other.app.util.OfficialNoticeUtils; import com.red.circle.other.domain.gateway.props.PropsStoreGateway; import com.red.circle.other.domain.gateway.user.UserProfileGateway; import com.red.circle.other.domain.model.user.UserProfile; @@ -27,6 +29,7 @@ import com.red.circle.other.inner.model.dto.material.props.NobleVipAbility; import com.red.circle.other.inner.model.dto.material.props.ProductProps; import com.red.circle.other.inner.model.dto.material.props.PropsNobleVipAbilityDTO; import com.red.circle.other.inner.model.dto.material.props.PropsStoreCommodity; +import com.red.circle.other.inner.model.dto.user.UserProfileDTO; import com.red.circle.tool.core.collection.MapBuilder; import com.red.circle.tool.core.date.LocalDateTimeUtils; import com.red.circle.tool.core.date.TimestampUtils; @@ -65,6 +68,7 @@ public class PropsPurchasingCmdExe { private final PropsVipActualEquityService propsVipActualEquityService; private final TaskMqMessage taskMqMessage; private final PropsNobleVipClient propsNobleVipClient; + private final UserProfileAppConvertor userProfileAppConvertor; public BigDecimal execute(PropsPurchasingCmd cmd) { if (cmd.getDays() <= 0) { @@ -179,22 +183,13 @@ public class PropsPurchasingCmdExe { private void sendGiveAwayNotice(PropsPurchasingCmd cmd, PropsStoreCommodity commodity) { - if (cmd.isPurchasing()) { - return; - } - - UserProfile userProfile = userProfileGateway.getByUserId(cmd.requiredReqUserId()); + UserProfileDTO userProfileDTO = userProfileAppConvertor.toUserProfileDTO(userProfileGateway.getByUserId(cmd.requiredReqUserId())); String sourceUrl = commodity.getPropsResources().getSourceUrl(); officialNoticeClient.send(NoticeExtTemplateTypeCmd.builder() .toAccount(cmd.getAcceptUserId()) .noticeType(OfficialNoticeTypeEnum.GIVE_AWAY_PROPS) - .templateParam(MapBuilder.builder() - .put("userProfile", String.format("%s(%s)", userProfile.getUserNickname(), userProfile.getAccount())) - .put("userAvatar", userProfile.getUserAvatar()) - .put("countryCode", userProfile.getCountryCode()) - .put("countryName", userProfile.getCountryName()) - .build()) + .templateParam(OfficialNoticeUtils.buildUserProfile(userProfileDTO)) .expand(sourceUrl) .build()); }