分销更名 全民股东
新增全民股东群聊配置
This commit is contained in:
@@ -2,6 +2,7 @@ package com.czg.controller.admin;
|
||||
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.thread.ThreadUtil;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.czg.account.entity.ShopInfo;
|
||||
import com.czg.account.service.ShopInfoService;
|
||||
import com.czg.config.RabbitPublisher;
|
||||
@@ -30,6 +31,7 @@ import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
@@ -66,9 +68,16 @@ public class ProductController {
|
||||
@GetMapping("page")
|
||||
@OperationLog("商品-分页")
|
||||
//@SaAdminCheckPermission("product:page")
|
||||
public CzgResult<Page<ProductDTO>> getProductPage(ProductDTO param) {
|
||||
public CzgResult<Map<String, Object>> getProductPage(ProductDTO param) {
|
||||
Page<ProductDTO> data = productService.getProductPage(param);
|
||||
return CzgResult.success(data);
|
||||
Map<String, Object> map = JSONObject.parseObject(JSONObject.toJSONString(data), Map.class);
|
||||
if(data.getRecords() != null){
|
||||
ProductDTO first = data.getRecords().getFirst();
|
||||
map.put("warnLine", first.getWarnLine());
|
||||
}else {
|
||||
map.put("warnLine", 0);
|
||||
}
|
||||
return CzgResult.success(map);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -111,7 +120,7 @@ public class ProductController {
|
||||
for (ProdSkuDTO prodSkuDTO : dto.getSkuList()) {
|
||||
ValidatorUtil.validateEntity(prodSkuDTO, DefaultGroup.class);
|
||||
}
|
||||
Long shopId = StpKit.USER.getShopId(0L);
|
||||
Long shopId = StpKit.USER.getShopId();
|
||||
dto.setShopId(shopId);
|
||||
productService.addProduct(dto);
|
||||
asyncProductToShop(dto.getId());
|
||||
@@ -140,7 +149,7 @@ public class ProductController {
|
||||
if (dto.getStockNumber() != null) {
|
||||
StpKit.USER.checkStaffPermission("yun_xu_xiu_gai_shang_pin_ku_cun");
|
||||
}
|
||||
Long shopId = StpKit.USER.getShopId(0L);
|
||||
Long shopId = StpKit.USER.getShopId();
|
||||
dto.setShopId(shopId);
|
||||
productService.updateProduct(dto);
|
||||
asyncProductToShop(dto.getId());
|
||||
@@ -155,7 +164,7 @@ public class ProductController {
|
||||
//@SaStaffCheckPermission("yun_xu_xiu_gai_shang_pin")
|
||||
public CzgResult<Void> updateProductStock(@RequestBody ProductModifyStockParam param) {
|
||||
ValidatorUtil.validateEntity(param, DefaultGroup.class);
|
||||
Long shopId = StpKit.USER.getShopId(0L);
|
||||
Long shopId = StpKit.USER.getShopId();
|
||||
param.setShopId(shopId);
|
||||
productService.updateProductStock(param);
|
||||
ThreadUtil.execAsync(() -> {
|
||||
@@ -176,7 +185,7 @@ public class ProductController {
|
||||
public CzgResult<Void> deleteProduct(@PathVariable("id") Long id) {
|
||||
//效验数据
|
||||
AssertUtil.isNull(id, "{}不能为空", "id");
|
||||
Long shopId = StpKit.USER.getShopId(0L);
|
||||
Long shopId = StpKit.USER.getShopId();
|
||||
productService.deleteProduct(shopId, id);
|
||||
asyncProductToShop(id);
|
||||
ThreadUtil.execAsync(() -> {
|
||||
@@ -193,7 +202,7 @@ public class ProductController {
|
||||
//@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);
|
||||
Long shopId = StpKit.USER.getShopId();
|
||||
param.setShopId(shopId);
|
||||
productService.onOffProduct(param);
|
||||
ThreadUtil.execAsync(() -> {
|
||||
@@ -210,7 +219,7 @@ public class ProductController {
|
||||
//@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);
|
||||
Long shopId = StpKit.USER.getShopId();
|
||||
param.setShopId(shopId);
|
||||
productService.markProductIsSoldOut(param);
|
||||
ThreadUtil.execAsync(() -> {
|
||||
|
||||
Reference in New Issue
Block a user