zq-erp/src/main/java/com/matrix/system/shopXcx/mqTask/SalesOrderRefundTask.java
@@ -2,6 +2,7 @@
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.matrix.component.asyncmessage.MessageHandler;
import com.matrix.core.tools.LogUtil;
import com.matrix.system.fenxiao.dao.ShopSalesmanOrderDao;
import com.matrix.system.fenxiao.entity.ShopSalesmanOrder;
@@ -16,12 +17,14 @@
import org.springframework.stereotype.Component;
import java.io.IOException;
import java.util.List;
import java.util.Map;
/**
 * 分销订单退款
 */
@Component
public class SalesOrderRefundTask implements DeliverCallback {
public class SalesOrderRefundTask implements MessageHandler {
    @Autowired
@@ -38,19 +41,35 @@
    @Override
    public void handle(String consumerTag, Delivery message) throws IOException {
    public String getName() {
        return "分销订单退款";
    }
        String orderId = new String(message.getBody(), "UTF-8");
    @Override
    public String getRouteKey() {
        return AsyncMessageRouting.SHOP_ORDER_REFUND;
    }
    @Override
    public void handle(Map<String,Object> param){
        String orderId = (String) param.get("orderId");
        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);
        }
        List<ShopSalesmanOrder> list = shopSalesmanOrderDao.selectList(queryWrapper);
        list.forEach(shopSalesmanOrder->{
            if(shopSalesmanOrder!=null){
                shopSalesmanOrder.setOrderStatus(ShopSalesmanOrder.STATUS_YTK);
                shopSalesmanOrderDao.updateById(shopSalesmanOrder);
            }else{
                LogUtil.debug("改订单为生成分销订单={}", orderId);
            }
        });
        ShopOrder order=shopOrderDao.selectById(Integer.parseInt(orderId));
        //如果是积分支付则需要返还积分