diff --git a/dating-agency-mall-server/src/main/java/com/qniao/dam/application/handler/marriagebounty/MarriageBountyOrderEventHandle.java b/dating-agency-mall-server/src/main/java/com/qniao/dam/application/handler/marriagebounty/MarriageBountyOrderEventHandle.java index 23da7f2..266a946 100644 --- a/dating-agency-mall-server/src/main/java/com/qniao/dam/application/handler/marriagebounty/MarriageBountyOrderEventHandle.java +++ b/dating-agency-mall-server/src/main/java/com/qniao/dam/application/handler/marriagebounty/MarriageBountyOrderEventHandle.java @@ -15,11 +15,18 @@ import com.qniao.dam.domian.aggregate.marriagebounty.event.MarriageBountyOrderCo import com.qniao.dam.domian.aggregate.marriagebounty.event.MarriageBountyOrderConfirmedMeetingEvent; import com.qniao.dam.domian.aggregate.marriagebounty.event.MarriageBountyOrderCreatedEvent; import com.qniao.dam.domian.aggregate.marriagebounty.event.MarriageBountyOrderCreatedMQ; +import com.qniao.dam.domian.aggregate.pointaccount.event.PointRewardCreatedMQ; +import com.qniao.dam.domian.aggregate.prc.constant.PointRewardConfigTypeEnum; +import com.qniao.dam.domian.aggregate.walletaccount.constant.IdentityTypeEnum; import com.qniao.dam.infrastructure.constant.MqExchange; import com.qniao.dam.infrastructure.constant.MqQueue; import com.qniao.dam.infrastructure.persistent.dao.domain.MarriageBountyOrderDao; +import com.qniao.dam.infrastructure.persistent.dao.domain.MarriageInformationDao; +import com.qniao.dam.infrastructure.persistent.dao.domain.MatchmakerDao; import com.qniao.dam.query.marriagebounty.MarriageBountyOrderQueryService; +import com.qniao.das.domian.aggregate.marriageinformation.MarriageInformation; import com.qniao.das.domian.aggregate.marriageseekingreward.event.MatchSuccessfullyEvent; +import com.qniao.dau.domain.aggregate.matchmaker.entity.Matchmaker; import com.qniao.domain.BaseApplicationService; import com.qniao.framework.utils.TypeConvertUtils; import lombok.extern.slf4j.Slf4j; @@ -51,6 +58,10 @@ public class MarriageBountyOrderEventHandle extends BaseApplicationService { private MarriageBountyOrderDao marriageBountyOrderDao; @Resource private MarriageBountyOrderAggregate marriageBountyOrderAggregate; + @Resource + private MatchmakerDao matchmakerDao; + @Resource + private MarriageInformationDao marriageInformationDao; @Subscribe public void handle(MarriageBountyOrderCreatedEvent event) { @@ -64,6 +75,27 @@ public class MarriageBountyOrderEventHandle extends BaseApplicationService { } } + @Subscribe + public void handle2(MarriageBountyOrderCreatedEvent event) { + try { + MarriageInformation marriageInformation = marriageInformationDao.selectById(event.getMiId()); + MarriageBountyOrder marriageBountyOrder = marriageBountyOrderDao.selectById(event.getId()); + PointRewardCreatedMQ mq = new PointRewardCreatedMQ(); + Matchmaker matchmaker = matchmakerDao.selectById(event.getMatchmakerId()); + mq.setOwnId(matchmaker.getUserId()); + mq.setIdentityType(IdentityTypeEnum.INDIVIDUAL); + mq.setPointType(PointRewardConfigTypeEnum.INVITE_BOUNTY); + mq.setContent("邀请发榜:" + marriageInformation.getNickName()); + mq.setIsIncome(true); + mq.setAssociateId(event.getId()); + mq.setAmount(marriageBountyOrder.getPaidAmount()); + // 发送mq事件 + amqpTemplate.convertAndSend(MqExchange.POINT_REWARD_CREATED, null, mq); + } catch (Exception e) { + log.error("悬赏招亲订单已创建事件处理异常", e); + } + } + @Subscribe public void handle(MarriageBountyOrderConfirmedMeetingEvent event) { try {