商品模块代码提交

This commit is contained in:
Tankaikai
2025-03-05 16:49:00 +08:00
parent a8a3a311bf
commit 283774ce3a

View File

@@ -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();
}