|
|
package com.yohoufo.order.mq.consumer;
|
|
|
|
|
|
import com.yoho.core.rabbitmq.YhConsumer;
|
|
|
import com.yohoufo.order.common.TabType;
|
|
|
import com.yohoufo.order.event.NotPaidNoticeEvent;
|
|
|
import com.yohoufo.order.mq.TopicConstants;
|
|
|
import com.yohoufo.order.service.proxy.InBoxFacade;
|
|
|
import com.yohoufo.order.utils.LoggerUtils;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
import java.util.Objects;
|
|
|
|
|
|
/**
|
|
|
* Created by chenchao on 2018/10/15.
|
|
|
*/
|
|
|
@Component
|
|
|
public class NotPaidNoticeDelayMsgConsumer implements YhConsumer {
|
|
|
|
|
|
private Logger logger = LoggerUtils.getMqConsumerLogger();
|
|
|
|
|
|
@Autowired
|
|
|
private InBoxFacade inBoxFacade;
|
|
|
|
|
|
|
|
|
@Override
|
|
|
public void handleMessage(Object o) throws Exception {
|
|
|
final String topic = TopicConstants.ORDER_NOT_PAID_NOTICE;
|
|
|
logger.info("in topic {}, msg {}", topic, o);
|
|
|
if (o == null){
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
NotPaidNoticeEvent event = (NotPaidNoticeEvent)o;
|
|
|
TabType actorType;
|
|
|
if (Objects.nonNull(actorType=event.getActorType())){
|
|
|
switch (actorType){
|
|
|
case SELL:
|
|
|
inBoxFacade.sellerOrderNotPaid(event.getUid(), event.getPrdName());
|
|
|
break;
|
|
|
|
|
|
case BUY:
|
|
|
inBoxFacade.buyerOrderNotPayed(event.getUid(), event.getOrderCode());
|
|
|
break;
|
|
|
}
|
|
|
}else{
|
|
|
logger.warn("actorType is null in topic {}, msg {}", topic, event);
|
|
|
}
|
|
|
}
|
|
|
} |
...
|
...
|
|