package com.matrix.system.shopXcx.mqTask; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.matrix.core.tools.LogUtil; import com.matrix.system.fenxiao.dao.ShopSalesmanOrderDao; import com.matrix.system.fenxiao.entity.ShopSalesmanOrder; import com.rabbitmq.client.DeliverCallback; import com.rabbitmq.client.Delivery; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import java.io.IOException; /** * 分销订单退款 */ @Component public class SalesOrderRefundTask implements DeliverCallback { @Autowired private ShopSalesmanOrderDao shopSalesmanOrderDao; @Override public void handle(String consumerTag, Delivery message) throws IOException { String orderId = new String(message.getBody(), "UTF-8"); LogUtil.debug("收到分销订单退款任务orderId={}", orderId); QueryWrapper queryWrapper=new QueryWrapper(); queryWrapper.eq("order_id",orderId); ShopSalesmanOrder shopSalesmanOrder = shopSalesmanOrderDao.selectOne(queryWrapper); if(shopSalesmanOrder!=null){ shopSalesmanOrder.setOrderStatus(ShopSalesmanOrder.STATUS_YTK); shopSalesmanOrderDao.updateById(shopSalesmanOrder); }else{ LogUtil.debug("改订单为生成分销订单={}", orderId); } } }