Browse Source

悬赏招亲

release
张彭杰 1 year ago
parent
commit
edfefb6bc5
1 changed files with 23 additions and 1 deletions
  1. 24
      dating-agency-mall-server/src/main/java/com/qniao/dam/application/handler/marriagebounty/MarriageBountyOrderEventHandle.java

24
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);
}

Loading…
Cancel
Save