| | |
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import com.google.gson.Gson;
|
| | | import com.yeshi.fanli.dto.mq.order.body.OrderWeiQuanMQMsg;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoWeiQuanOrder;
|
| | | import com.yeshi.fanli.service.inter.order.OrderProcessService;
|
| | | import com.yeshi.fanli.service.inter.order.tb.TaoBaoWeiQuanOrderService;
|
| | | import org.springframework.stereotype.Component;
|
| | |
|
| | | import com.aliyun.openservices.ons.api.Action;
|
| | |
| | |
|
| | | /**
|
| | | * 订单到账消费
|
| | | * |
| | | * @author Administrator
|
| | | *
|
| | | * @author Administrator
|
| | | */
|
| | | @Component
|
| | | public class OrderMessageListener implements MessageListener {
|
| | |
|
| | | @Resource
|
| | | private HongBaoV2SettleTempService hongBaoV2SettleTempService;
|
| | | @Resource
|
| | | private OrderProcessService orderProcessService;
|
| | |
|
| | | @Resource
|
| | | private HongBaoV2Service hongBaoV2Service;
|
| | | @Resource
|
| | | private TaoBaoWeiQuanOrderService taoBaoWeiQuanOrderService;
|
| | |
|
| | | @Resource
|
| | | private HongBaoOrderService hongBaoOrderService;
|
| | | @Override
|
| | | public Action consume(Message message, ConsumeContext context) {
|
| | | LogHelper.mqInfo("consumer:OrderMessageListener", message.getMsgID(), message.getTopic(), message.getTag(),
|
| | | new String(message.getBody()));
|
| | | if (MQTopicName.TOPIC_ORDER.name().equalsIgnoreCase(message.getTopic())) {
|
| | | if (OrderTopicTagEnum.taoBaoOrderWeiQuan.name().equalsIgnoreCase(message.getTag())) {
|
| | | OrderWeiQuanMQMsg dto = new Gson().fromJson(new String(message.getBody()), OrderWeiQuanMQMsg.class);
|
| | | if (dto != null) {
|
| | | TaoBaoWeiQuanOrder taoBaoWeiQuanOrder = taoBaoWeiQuanOrderService.selectByTradeId(dto.getTradeId());
|
| | | orderProcessService.weiQuanOrder(taoBaoWeiQuanOrder);
|
| | | }
|
| | | return Action.CommitMessage;
|
| | | }
|
| | | }
|
| | |
|
| | | @Resource
|
| | | private Producer producer;
|
| | |
|
| | | private int getHongBaoType(int type) {
|
| | | switch (type) {
|
| | | case HongBaoV2.TYPE_YIJI:
|
| | | case HongBaoV2.TYPE_ERJI:
|
| | | case HongBaoV2.TYPE_SHARE_YIJI:
|
| | | case HongBaoV2.TYPE_SHARE_ERJI:
|
| | | return OrderMoneyRecievedMQMsg.TYPE_INVITE;
|
| | | case HongBaoV2.TYPE_SHARE_GOODS:
|
| | | return OrderMoneyRecievedMQMsg.TYPE_SHARE;
|
| | | case HongBaoV2.TYPE_ZIGOU:
|
| | | return OrderMoneyRecievedMQMsg.TYPE_ZIGOU;
|
| | | }
|
| | | return 0;
|
| | | }
|
| | |
|
| | | @Override
|
| | | public Action consume(Message message, ConsumeContext context) {
|
| | | LogHelper.mqInfo("consumer:OrderMessageListener", message.getMsgID(), message.getTopic(), message.getTag(),
|
| | | new String(message.getBody()));
|
| | | if (MQTopicName.TOPIC_ORDER.name().equalsIgnoreCase(message.getTopic())) {
|
| | | if (OrderTopicTagEnum.taoBaoOrderWeiQuan.name().equalsIgnoreCase(message.getTag())) {
|
| | | String key = message.getKey();
|
| | | // 订单维权
|
| | | //TODO 维权增加
|
| | | |
| | | return Action.CommitMessage;
|
| | | }
|
| | | }
|
| | |
|
| | | return Action.CommitMessage;
|
| | | }
|
| | | return Action.CommitMessage;
|
| | | }
|
| | |
|
| | | }
|