From edfefb6bc5ab774ac52722549b2a68b018d33fb7 Mon Sep 17 00:00:00 2001 From: Derran Date: Tue, 6 Aug 2024 16:24:36 +0800 Subject: [PATCH] =?UTF-8?q?=E6=82=AC=E8=B5=8F=E6=8B=9B=E4=BA=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MarriageBountyOrderEventHandle.java | 24 ++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) 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 bfbbe41..3d8c001 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 @@ -4,16 +4,22 @@ import cn.hutool.core.collection.CollUtil; import com.google.common.eventbus.Subscribe; import com.qniao.dam.api.command.reward.user.request.AcquireMatchmakerConfirmMatchRewardDto; import com.qniao.dam.api.command.reward.user.request.AcquireMatchmakerConfirmMeetingRewardDto; +import com.qniao.dam.api.query.marriagebounty.user.response.UserGetMarriageBountyOrderProductInfoVo; import com.qniao.dam.application.service.marriagebounty.MarriageBountyOrderApplicationService; import com.qniao.dam.application.service.reward.RewardApplicationService; +import com.qniao.dam.domain.aggregate.marriagebounty.MarriageBountyOrderAggregate; +import com.qniao.dam.domain.aggregate.marriagebounty.entity.MarriageBountyOrder; +import com.qniao.dam.domian.aggregate.marriagebount.constant.MarriageBountyOrderStatusEnum; +import com.qniao.dam.domian.aggregate.marriagebount.constant.MarriageBountyOrderType; import com.qniao.dam.domian.aggregate.marriagebounty.event.MarriageBountyOrderConfirmedMatchEvent; 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.infrastructure.constant.MqExchange; import com.qniao.dam.infrastructure.constant.MqQueue; +import com.qniao.dam.infrastructure.persistent.dao.domain.MarriageBountyOrderDao; +import com.qniao.dam.query.marriagebounty.MarriageBountyOrderQueryService; import com.qniao.das.domian.aggregate.marriageseekingreward.event.MatchSuccessfullyEvent; -import com.qniao.das.domian.aggregate.marriageseekingreward.event.RewardSelectedGuestEvent; import com.qniao.domain.BaseApplicationService; import com.qniao.framework.utils.TypeConvertUtils; import lombok.extern.slf4j.Slf4j; @@ -38,6 +44,12 @@ public class MarriageBountyOrderEventHandle extends BaseApplicationService { private RewardApplicationService rewardApplicationService; @Resource private MarriageBountyOrderApplicationService marriageBountyOrderApplicationService; + @Resource + private MarriageBountyOrderQueryService marriageBountyOrderQueryService; + @Resource + private MarriageBountyOrderDao marriageBountyOrderDao; + @Resource + private MarriageBountyOrderAggregate marriageBountyOrderAggregate; @Subscribe public void handle(MarriageBountyOrderCreatedEvent event) { @@ -63,6 +75,16 @@ public class MarriageBountyOrderEventHandle extends BaseApplicationService { rewardApplicationService.acquireMatchmakerConfirmMeetingReward(confirmMeetingRewardDto); } } + //判断悬赏是否结束 + UserGetMarriageBountyOrderProductInfoVo productInfoVo = marriageBountyOrderQueryService.getMarriageBountyOrderProductInfo(event.getId()); + if (Objects.nonNull(productInfoVo)) { + if (MarriageBountyOrderType.MEETING.equals(productInfoVo.getType()) && productInfoVo.getUsableMeetingQuantity() == 0) { + //见面类型见面完毕后自动结束 + MarriageBountyOrder marriageBountyOrder = marriageBountyOrderDao.selectById(event.getId()); + marriageBountyOrder.setStatus(MarriageBountyOrderStatusEnum.MATCH_SUCCESS); + marriageBountyOrderAggregate.update(marriageBountyOrder); + } + } } catch (Exception e) { log.error("悬赏招亲订单确认见面事件处理异常", e); }