1. 商品信息变动刷新库存

2. 商品信息变动发生Mq消息
This commit is contained in:
Tankaikai
2025-03-03 10:31:05 +08:00
parent 152e2261e8
commit ec32fc48f5
10 changed files with 60 additions and 3 deletions

View File

@@ -1,5 +1,7 @@
package com.czg.controller.admin;
import cn.hutool.core.convert.Convert;
import com.czg.config.RabbitPublisher;
import com.czg.exception.CzgException;
import com.czg.log.annotation.OperationLog;
import com.czg.product.dto.ProdConsBindDTO;
@@ -37,6 +39,7 @@ import java.util.List;
public class ProductController {
private final ProductService productService;
private final ProdConsRelationService prodConsRelationService;
private final RabbitPublisher rabbitPublisher;
@GetMapping("page")
@OperationLog("商品-分页")
@@ -74,6 +77,7 @@ public class ProductController {
Long shopId = StpKit.USER.getShopId(0L);
dto.setShopId(shopId);
productService.addProduct(dto);
rabbitPublisher.sendProductInfoChangeMsg(Convert.toStr(shopId));
return CzgResult.success();
}
@@ -84,6 +88,7 @@ public class ProductController {
Long shopId = StpKit.USER.getShopId(0L);
dto.setShopId(shopId);
productService.updateProduct(dto);
rabbitPublisher.sendProductInfoChangeMsg(Convert.toStr(shopId));
return CzgResult.success();
}
@@ -95,6 +100,7 @@ public class ProductController {
AssertUtil.isNull(id, "{}不能为空", "id");
Long shopId = StpKit.USER.getShopId(0L);
productService.deleteProduct(shopId, id);
rabbitPublisher.sendProductInfoChangeMsg(Convert.toStr(shopId));
return CzgResult.success();
}
@@ -108,6 +114,7 @@ public class ProductController {
Long shopId = StpKit.USER.getShopId(0L);
param.setShopId(shopId);
productService.onOffProduct(param);
rabbitPublisher.sendProductInfoChangeMsg(Convert.toStr(shopId));
return CzgResult.success();
}
@@ -121,6 +128,7 @@ public class ProductController {
Long shopId = StpKit.USER.getShopId(0L);
param.setShopId(shopId);
productService.markProductIsSoldOut(param);
rabbitPublisher.sendProductInfoChangeMsg(Convert.toStr(shopId));
return CzgResult.success();
}