|
|
|
@ -4,6 +4,7 @@ import com.google.common.eventbus.Subscribe; |
|
|
|
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.marriagebount.constant.MarriageBountyOrderStatusEnum; |
|
|
|
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; |
|
|
|
@ -45,14 +46,17 @@ public class PaymentOrderRefundEventHandler extends BaseApplicationService { |
|
|
|
if (Objects.nonNull(marriageBountyOrder)) { |
|
|
|
List<Long> tradeOrderIdList = marriageBountyOrder.getOrderRelList().stream().map(MarriageBountyOrderRel::getOrderId).collect(Collectors.toList()); |
|
|
|
if (paymentOrderRefundQueryService.checkRefunded(tradeOrderIdList)) { |
|
|
|
MarriageBountyOrderStatusEnum status = marriageBountyOrder.getStatus(); |
|
|
|
MarriageBountyOrder refundMarriageBountyOrder = new MarriageBountyOrder(); |
|
|
|
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_CANCELLED, null, cancelledMQ); |
|
|
|
//主动发起退款 |
|
|
|
if (MarriageBountyOrderStatusEnum.MATCHMAKING.equals(status)) { |
|
|
|
MarriageBountyOrderCancelledMQ cancelledMQ = TypeConvertUtils.convert(marriageBountyOrder, MarriageBountyOrderCancelledMQ.class); |
|
|
|
cancelledMQ.setMarriageBountyOrderId(event.getId()); |
|
|
|
// 发送mq事件 |
|
|
|
amqpTemplate.convertAndSend(MqExchange.MARRIAGE_BOUNTY_ORDER_CANCELLED, null, cancelledMQ); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|