diff --git a/cash-api/product-server/src/main/java/com/czg/controller/admin/ProductController.java b/cash-api/product-server/src/main/java/com/czg/controller/admin/ProductController.java index 2182e135..01cccac3 100644 --- a/cash-api/product-server/src/main/java/com/czg/controller/admin/ProductController.java +++ b/cash-api/product-server/src/main/java/com/czg/controller/admin/ProductController.java @@ -1,6 +1,7 @@ package com.czg.controller.admin; import cn.hutool.core.convert.Convert; +import cn.hutool.core.thread.ThreadUtil; import com.czg.config.RabbitPublisher; import com.czg.exception.CzgException; import com.czg.log.annotation.OperationLog; @@ -77,7 +78,9 @@ public class ProductController { Long shopId = StpKit.USER.getShopId(0L); dto.setShopId(shopId); productService.addProduct(dto); - rabbitPublisher.sendProductInfoChangeMsg(Convert.toStr(shopId)); + ThreadUtil.execAsync(() -> { + rabbitPublisher.sendProductInfoChangeMsg(Convert.toStr(shopId)); + }); return CzgResult.success(); } @@ -88,7 +91,9 @@ public class ProductController { Long shopId = StpKit.USER.getShopId(0L); dto.setShopId(shopId); productService.updateProduct(dto); - rabbitPublisher.sendProductInfoChangeMsg(Convert.toStr(shopId)); + ThreadUtil.execAsync(() -> { + rabbitPublisher.sendProductInfoChangeMsg(Convert.toStr(shopId)); + }); return CzgResult.success(); } @@ -100,7 +105,9 @@ public class ProductController { AssertUtil.isNull(id, "{}不能为空", "id"); Long shopId = StpKit.USER.getShopId(0L); productService.deleteProduct(shopId, id); - rabbitPublisher.sendProductInfoChangeMsg(Convert.toStr(shopId)); + ThreadUtil.execAsync(() -> { + rabbitPublisher.sendProductInfoChangeMsg(Convert.toStr(shopId)); + }); return CzgResult.success(); } @@ -114,7 +121,9 @@ public class ProductController { Long shopId = StpKit.USER.getShopId(0L); param.setShopId(shopId); productService.onOffProduct(param); - rabbitPublisher.sendProductInfoChangeMsg(Convert.toStr(shopId)); + ThreadUtil.execAsync(() -> { + rabbitPublisher.sendProductInfoChangeMsg(Convert.toStr(shopId)); + }); return CzgResult.success(); } @@ -128,7 +137,9 @@ public class ProductController { Long shopId = StpKit.USER.getShopId(0L); param.setShopId(shopId); productService.markProductIsSoldOut(param); - rabbitPublisher.sendProductInfoChangeMsg(Convert.toStr(shopId)); + ThreadUtil.execAsync(() -> { + rabbitPublisher.sendProductInfoChangeMsg(Convert.toStr(shopId)); + }); return CzgResult.success(); }