935090232@qq.com
2021-03-18 5d43370b99a03391c9271d04d3f351f0fd734dae
zq-erp/src/main/java/com/matrix/system/shopXcx/mqTask/SalesOrderRefundTask.java
New file
@@ -0,0 +1,43 @@
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);
        }
    }
}