|
|
|
@ -6,6 +6,7 @@ import com.qniao.dam.domain.aggregate.gmpi.entity.GuildMemberProfitItem; |
|
|
|
import com.qniao.dam.domain.aggregate.revenuereward.entity.RevenueReward; |
|
|
|
import com.qniao.dam.domian.aggregate.revenuereward.event.RevenueRewardRecordCreatedEvent; |
|
|
|
import com.qniao.dam.domian.aggregate.walletaccount.constant.IdentityTypeEnum; |
|
|
|
import com.qniao.dam.domian.aggregate.walletaccount.constant.TradeTypeEnum; |
|
|
|
import com.qniao.dam.infrastructure.persistent.dao.domain.RevenueRewardDao; |
|
|
|
import com.qniao.dam.query.livematchmaker.LiveMatchmakerQueryService; |
|
|
|
import com.qniao.dau.domain.aggregate.livematchmaker.entity.LiveMatchmaker; |
|
|
|
@ -31,14 +32,19 @@ public class GuildMemberProfitItemEventHandler extends BaseApplicationService { |
|
|
|
@Subscribe |
|
|
|
private void handle(RevenueRewardRecordCreatedEvent event) { |
|
|
|
try { |
|
|
|
RevenueReward revenueReward = revenueRewardDao.selectById(event.getRevenueRewardId()); |
|
|
|
if (IdentityTypeEnum.INDIVIDUAL.equals(revenueReward.getIdentityType())) { |
|
|
|
LiveMatchmaker liveMatchmaker = liveMatchmakerQueryService.queryByUserId(revenueReward.getUserId()); |
|
|
|
if (Objects.nonNull(liveMatchmaker) && Objects.nonNull(liveMatchmaker.getGuildId())) { |
|
|
|
GuildMemberProfitItem item = GuildMemberProfitItem.build(liveMatchmaker.getGuildId(), liveMatchmaker.getUserId(), |
|
|
|
liveMatchmaker.getType(), event.getTradeType(), event.getRevenue(), event.getId()); |
|
|
|
BaseDomainEvent guildMemberProfitItemEvent = guildMemberProfitItemAggregate.create(item); |
|
|
|
this.sendEvent(guildMemberProfitItemEvent); |
|
|
|
if (TradeTypeEnum.CHAT_REWARD.equals(event.getTradeType()) || |
|
|
|
TradeTypeEnum.IM_GIFT_REWARD.equals(event.getTradeType()) || |
|
|
|
TradeTypeEnum.LINK_MIC_REWARD.equals(event.getTradeType()) || |
|
|
|
TradeTypeEnum.CHANNEL_GIFT_REWARD.equals(event.getTradeType())) { |
|
|
|
RevenueReward revenueReward = revenueRewardDao.selectById(event.getRevenueRewardId()); |
|
|
|
if (IdentityTypeEnum.INDIVIDUAL.equals(revenueReward.getIdentityType())) { |
|
|
|
LiveMatchmaker liveMatchmaker = liveMatchmakerQueryService.queryByUserId(revenueReward.getUserId()); |
|
|
|
if (Objects.nonNull(liveMatchmaker) && Objects.nonNull(liveMatchmaker.getGuildId())) { |
|
|
|
GuildMemberProfitItem item = GuildMemberProfitItem.build(liveMatchmaker.getGuildId(), liveMatchmaker.getUserId(), |
|
|
|
liveMatchmaker.getType(), event.getTradeType(), event.getRevenue(), event.getId()); |
|
|
|
BaseDomainEvent guildMemberProfitItemEvent = guildMemberProfitItemAggregate.create(item); |
|
|
|
this.sendEvent(guildMemberProfitItemEvent); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} catch (Exception e) { |
|
|
|
|