|
|
|
@ -3,12 +3,16 @@ package com.qniao.dam.application.handler.paymentorderrefund; |
|
|
|
import com.qniao.dam.domain.aggregate.marriagebounty.MarriageBountyOrderAggregate; |
|
|
|
import com.qniao.dam.domain.aggregate.marriagebounty.entity.MarriageBountyOrder; |
|
|
|
import com.qniao.dam.domain.aggregate.marriagebounty.valueobj.MarriageBountyOrderRel; |
|
|
|
import com.qniao.dam.domian.aggregate.marriagebounty.event.MarriageBountyOrderCancelledMQ; |
|
|
|
import com.qniao.dam.domian.aggregate.paymentorderrefund.constant.PaymentOrderRefundStatusEnum; |
|
|
|
import com.qniao.dam.domian.aggregate.paymentorderrefund.event.PaymentOrderRefundRefundedEvent; |
|
|
|
import com.qniao.dam.infrastructure.constant.MqExchange; |
|
|
|
import com.qniao.dam.query.marriagebounty.MarriageBountyOrderQueryService; |
|
|
|
import com.qniao.dam.query.paymentorderrefund.PaymentOrderRefundQueryService; |
|
|
|
import com.qniao.domain.BaseApplicationService; |
|
|
|
import com.qniao.framework.utils.TypeConvertUtils; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.springframework.amqp.core.AmqpTemplate; |
|
|
|
import org.springframework.stereotype.Component; |
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
|
@ -26,6 +30,8 @@ public class PaymentOrderRefundEventHandler extends BaseApplicationService { |
|
|
|
private PaymentOrderRefundQueryService paymentOrderRefundQueryService; |
|
|
|
@Resource |
|
|
|
private MarriageBountyOrderAggregate marriageBountyOrderAggregate; |
|
|
|
@Resource |
|
|
|
private AmqpTemplate amqpTemplate; |
|
|
|
|
|
|
|
/** |
|
|
|
* 付款单已退款事件 |
|
|
|
@ -41,6 +47,10 @@ public class PaymentOrderRefundEventHandler extends BaseApplicationService { |
|
|
|
refundMarriageBountyOrder.setId(marriageBountyOrder.getId()); |
|
|
|
marriageBountyOrderAggregate.refund(refundMarriageBountyOrder); |
|
|
|
//todo 主动发起退款 |
|
|
|
MarriageBountyOrderCancelledMQ cancelledMQ = TypeConvertUtils.convert(marriageBountyOrder, MarriageBountyOrderCancelledMQ.class); |
|
|
|
cancelledMQ.setMarriageBountyOrderId(event.getId()); |
|
|
|
// 发送mq事件 |
|
|
|
amqpTemplate.convertAndSend(MqExchange.MARRIAGE_BOUNTY_ORDER_CREATED, null, cancelledMQ); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|