员工权限完善

This commit is contained in:
张松
2025-03-11 09:48:47 +08:00
parent 27635d7b0d
commit b6229f24e4
6 changed files with 54 additions and 2 deletions

View File

@@ -2,6 +2,7 @@ package com.czg.controller.admin;
import cn.hutool.core.convert.Convert;
import cn.hutool.core.thread.ThreadUtil;
import com.czg.annotation.SaStaffCheckPermission;
import com.czg.config.RabbitPublisher;
import com.czg.exception.CzgException;
import com.czg.log.annotation.OperationLog;
@@ -87,8 +88,20 @@ public class ProductController {
@PutMapping
@OperationLog("商品-修改")
@SaStaffCheckPermission("yun_xu_xiu_gai_shang_pin")
//@SaAdminCheckPermission("product:update")
public CzgResult<Void> updateProduct(@RequestBody @Validated({UpdateGroup.class, DefaultGroup.class}) ProductDTO dto) {
if (dto.getCategoryId() != null) {
StpKit.USER.checkStaffPermission("yun_xu_xiu_gai_fen_lei");
}
if (dto.getGroupCategoryId() != null) {
StpKit.USER.checkStaffPermission("yun_xu_xiu_gai_fen_zu");
}
if (dto.getStockNumber() != null) {
StpKit.USER.checkStaffPermission("yun_xu_xiu_gai_shang_pin_ku_cun");
}
Long shopId = StpKit.USER.getShopId(0L);
dto.setShopId(shopId);
productService.updateProduct(dto);
@@ -100,6 +113,7 @@ public class ProductController {
@DeleteMapping("{id}")
@OperationLog("商品-删除")
@SaStaffCheckPermission("yun_xu_xiu_gai_shang_pin")
//@SaAdminCheckPermission("product:delete")
public CzgResult<Void> deleteProduct(@PathVariable("id") Long id) {
//效验数据
@@ -117,6 +131,7 @@ public class ProductController {
*/
@PostMapping("onOff")
@OperationLog("商品-上下架")
@SaStaffCheckPermission("yun_xu_shang_xia_jia_shang_pin")
//@SaAdminCheckPermission("product:on-off")
public CzgResult<Void> onOffProduct(@RequestBody @Validated({DefaultGroup.class}) ProductIsSaleParam param) {
Long shopId = StpKit.USER.getShopId(0L);
@@ -133,6 +148,7 @@ public class ProductController {
*/
@PostMapping("markIsSoldOut")
@OperationLog("商品-标记售罄")
@SaStaffCheckPermission("yun_xu_shou_qing_shang_pin")
//@SaAdminCheckPermission("product:markIsSoldOut")
public CzgResult<Void> markIsSoldOutProduct(@RequestBody @Validated({DefaultGroup.class}) ProductIsSoldOutParam param) {
Long shopId = StpKit.USER.getShopId(0L);
@@ -193,4 +209,4 @@ public class ProductController {
return CzgResult.success();
}
}
}