Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -1,9 +1,13 @@
|
||||
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.log.annotation.OperationLog;
|
||||
import com.czg.product.dto.ProdGroupDTO;
|
||||
import com.czg.product.service.ProdGroupService;
|
||||
import com.czg.resp.CzgResult;
|
||||
import com.czg.sa.StpKit;
|
||||
import com.czg.utils.AssertUtil;
|
||||
import com.czg.validator.group.DefaultGroup;
|
||||
import com.czg.validator.group.InsertGroup;
|
||||
@@ -17,16 +21,17 @@ import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 商品分组
|
||||
*
|
||||
* @author Tankaikai tankaikai@aliyun.com
|
||||
* @since 1.0 2025-02-17
|
||||
*/
|
||||
* 商品分组
|
||||
*
|
||||
* @author Tankaikai tankaikai@aliyun.com
|
||||
* @since 1.0 2025-02-17
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/admin/prod/group")
|
||||
public class ProdGroupController {
|
||||
private final ProdGroupService prodGroupService;
|
||||
private final RabbitPublisher rabbitPublisher;
|
||||
|
||||
/**
|
||||
* 分页
|
||||
@@ -34,7 +39,7 @@ public class ProdGroupController {
|
||||
@GetMapping("page")
|
||||
@OperationLog("商品分组-分页")
|
||||
//@SaAdminCheckPermission("prodGroup:page")
|
||||
public CzgResult<Page<ProdGroupDTO>> getProdGroupPage(ProdGroupDTO param){
|
||||
public CzgResult<Page<ProdGroupDTO>> getProdGroupPage(ProdGroupDTO param) {
|
||||
Page<ProdGroupDTO> data = prodGroupService.getProdGroupPage(param);
|
||||
return CzgResult.success(data);
|
||||
}
|
||||
@@ -45,7 +50,7 @@ public class ProdGroupController {
|
||||
@GetMapping("list")
|
||||
@OperationLog("商品分组-列表")
|
||||
//@SaAdminCheckPermission("prodGroup:list")
|
||||
public CzgResult<List<ProdGroupDTO>> getProdGroupList(ProdGroupDTO param){
|
||||
public CzgResult<List<ProdGroupDTO>> getProdGroupList(ProdGroupDTO param) {
|
||||
List<ProdGroupDTO> data = prodGroupService.getProdGroupList(param);
|
||||
return CzgResult.success(data);
|
||||
}
|
||||
@@ -58,7 +63,7 @@ public class ProdGroupController {
|
||||
@GetMapping("{id}")
|
||||
@OperationLog("商品分组-详情")
|
||||
//@SaAdminCheckPermission("prodGroup:info")
|
||||
public CzgResult<ProdGroupDTO> getProdGroupById(@PathVariable("id") Long id){
|
||||
public CzgResult<ProdGroupDTO> getProdGroupById(@PathVariable("id") Long id) {
|
||||
AssertUtil.isNull(id, "{}不能为空", "id");
|
||||
ProdGroupDTO data = prodGroupService.getProdGroupById(id);
|
||||
return CzgResult.success(data);
|
||||
@@ -70,8 +75,13 @@ public class ProdGroupController {
|
||||
@PostMapping
|
||||
@OperationLog("商品分组-新增")
|
||||
//@SaAdminCheckPermission("prodGroup:add")
|
||||
public CzgResult<Void> addProdGroup(@RequestBody @Validated({InsertGroup.class, DefaultGroup.class}) ProdGroupDTO dto){
|
||||
public CzgResult<Void> addProdGroup(@RequestBody @Validated({InsertGroup.class, DefaultGroup.class}) ProdGroupDTO dto) {
|
||||
Long shopId = StpKit.USER.getShopId(0L);
|
||||
dto.setShopId(shopId);
|
||||
prodGroupService.addProdGroup(dto);
|
||||
ThreadUtil.execAsync(() -> {
|
||||
rabbitPublisher.sendProductInfoChangeMsg(Convert.toStr(shopId));
|
||||
});
|
||||
return CzgResult.success();
|
||||
}
|
||||
|
||||
@@ -81,8 +91,13 @@ public class ProdGroupController {
|
||||
@PutMapping
|
||||
@OperationLog("商品分组-修改")
|
||||
//@SaAdminCheckPermission("prodGroup:update")
|
||||
public CzgResult<Void> updateProdGroup(@RequestBody @Validated({UpdateGroup.class, DefaultGroup.class}) ProdGroupDTO dto){
|
||||
public CzgResult<Void> updateProdGroup(@RequestBody @Validated({UpdateGroup.class, DefaultGroup.class}) ProdGroupDTO dto) {
|
||||
Long shopId = StpKit.USER.getShopId(0L);
|
||||
dto.setShopId(shopId);
|
||||
prodGroupService.updateProdGroup(dto);
|
||||
ThreadUtil.execAsync(() -> {
|
||||
rabbitPublisher.sendProductInfoChangeMsg(Convert.toStr(shopId));
|
||||
});
|
||||
return CzgResult.success();
|
||||
}
|
||||
|
||||
@@ -92,10 +107,14 @@ public class ProdGroupController {
|
||||
@DeleteMapping("{id}")
|
||||
@OperationLog("商品分组-删除")
|
||||
//@SaAdminCheckPermission("prodGroup:delete")
|
||||
public CzgResult<Void> deleteProdGroup(@PathVariable("id") Long id){
|
||||
public CzgResult<Void> deleteProdGroup(@PathVariable("id") Long id) {
|
||||
//效验数据
|
||||
AssertUtil.isNull(id, "{}不能为空", "id");
|
||||
prodGroupService.deleteProdGroup(id);
|
||||
Long shopId = StpKit.USER.getShopId(0L);
|
||||
prodGroupService.deleteProdGroup(shopId, id);
|
||||
ThreadUtil.execAsync(() -> {
|
||||
rabbitPublisher.sendProductInfoChangeMsg(Convert.toStr(shopId));
|
||||
});
|
||||
return CzgResult.success();
|
||||
}
|
||||
|
||||
@@ -108,7 +127,11 @@ public class ProdGroupController {
|
||||
public CzgResult<Void> disableProdGroup(@PathVariable("id") Long id) {
|
||||
//效验数据
|
||||
AssertUtil.isNull(id, "{}不能为空", "id");
|
||||
prodGroupService.disableProdGroup(id);
|
||||
Long shopId = StpKit.USER.getShopId(0L);
|
||||
prodGroupService.disableProdGroup(shopId, id);
|
||||
ThreadUtil.execAsync(() -> {
|
||||
rabbitPublisher.sendProductInfoChangeMsg(Convert.toStr(shopId));
|
||||
});
|
||||
return CzgResult.success();
|
||||
}
|
||||
|
||||
@@ -121,7 +144,11 @@ public class ProdGroupController {
|
||||
public CzgResult<Void> enableProdGroup(@PathVariable("id") Long id) {
|
||||
//效验数据
|
||||
AssertUtil.isNull(id, "{}不能为空", "id");
|
||||
prodGroupService.enableProdGroup(id);
|
||||
Long shopId = StpKit.USER.getShopId(0L);
|
||||
prodGroupService.enableProdGroup(shopId, id);
|
||||
ThreadUtil.execAsync(() -> {
|
||||
rabbitPublisher.sendProductInfoChangeMsg(Convert.toStr(shopId));
|
||||
});
|
||||
return CzgResult.success();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user