5 changed files with 74 additions and 3 deletions
@ -0,0 +1,41 @@
|
||||
package com.logpm.distribution.receiver; |
||||
|
||||
import cn.hutool.json.JSONUtil; |
||||
import com.logpm.distribution.entity.DistributionStockArticleEntity; |
||||
import com.logpm.distribution.service.IDistributionStockArticleService; |
||||
import com.rabbitmq.client.Channel; |
||||
import lombok.AllArgsConstructor; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.springblade.common.constant.RabbitConstant; |
||||
import org.springblade.common.constant.factorydata.FactoryDataConstants; |
||||
import org.springblade.core.tool.utils.StringUtil; |
||||
import org.springframework.amqp.core.ExchangeTypes; |
||||
import org.springframework.amqp.rabbit.annotation.Exchange; |
||||
import org.springframework.amqp.rabbit.annotation.Queue; |
||||
import org.springframework.amqp.rabbit.annotation.QueueBinding; |
||||
import org.springframework.amqp.rabbit.annotation.RabbitListener; |
||||
import org.springframework.stereotype.Component; |
||||
|
||||
@Slf4j |
||||
@Component |
||||
@AllArgsConstructor |
||||
public class OrderInfoUpdateHandler { |
||||
|
||||
private final IDistributionStockArticleService distributionStockArticleService; |
||||
|
||||
@RabbitListener(bindings = @QueueBinding( |
||||
value = @Queue(name = RabbitConstant.ORDER_INFO_UPDATE_QUEUE, durable = "true"), |
||||
exchange = @Exchange(name = RabbitConstant.ORDER_INFO_UPDATE_EXCHANGE, |
||||
type = ExchangeTypes.DIRECT, |
||||
delayed = FactoryDataConstants.Mq.DELAYED) |
||||
)) |
||||
public void updateOrderInfo(String msg, Channel channel) { |
||||
if(StringUtil.isNotBlank(msg)){ |
||||
DistributionStockArticleEntity bean = JSONUtil.toBean(msg, DistributionStockArticleEntity.class); |
||||
|
||||
distributionStockArticleService.updateOrderInfoByDistributionStockArticleEntity(bean); |
||||
|
||||
} |
||||
} |
||||
|
||||
} |
Loading…
Reference in new issue