tb_product
删除 库存警戒线 库存开关 库存数量 新增 是否自动售罄 标识 tb_shop_prod_category 新增 refund_mode 退菜是否退库存 tb_shop_config 新增 refund_mode 退菜退库存模式 删除 扣除库存模式
This commit is contained in:
@@ -11,7 +11,6 @@ import com.czg.log.annotation.OperationLog;
|
||||
import com.czg.product.dto.ProdConsBindDTO;
|
||||
import com.czg.product.dto.ProdSkuDTO;
|
||||
import com.czg.product.dto.ProductDTO;
|
||||
import com.czg.product.entity.ProductStockFlow;
|
||||
import com.czg.product.param.*;
|
||||
import com.czg.product.service.ProdConsRelationService;
|
||||
import com.czg.product.service.ProductService;
|
||||
@@ -72,12 +71,6 @@ public class ProductController {
|
||||
public CzgResult<Map<String, Object>> getProductPage(ProductDTO param) {
|
||||
Page<ProductDTO> data = productService.getProductPage(param);
|
||||
Map<String, Object> map = JSONObject.parseObject(JSONObject.toJSONString(data), Map.class);
|
||||
if (data.getRecords() != null && !data.getRecords().isEmpty()) {
|
||||
ProductDTO first = data.getRecords().getFirst();
|
||||
map.put("warnLine", first.getWarnLine());
|
||||
} else {
|
||||
map.put("warnLine", 0);
|
||||
}
|
||||
return CzgResult.success(map);
|
||||
}
|
||||
|
||||
@@ -99,7 +92,6 @@ public class ProductController {
|
||||
Long shopId = StpKit.USER.getShopId();
|
||||
param.setShopId(shopId);
|
||||
List<ProductDTO> productList = productService.getProductCacheList(param);
|
||||
productService.refreshProductStock(param, productList);
|
||||
productList.forEach(prod -> prod.setIsSaleTime(uProductService.calcIsSaleTime(prod.getDays(), prod.getStartTime(), prod.getEndTime())));
|
||||
return CzgResult.success(productList);
|
||||
}
|
||||
@@ -150,10 +142,6 @@ public class ProductController {
|
||||
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();
|
||||
dto.setShopId(shopId);
|
||||
productService.updateProduct(dto);
|
||||
@@ -162,18 +150,6 @@ public class ProductController {
|
||||
return CzgResult.success();
|
||||
}
|
||||
|
||||
@PostMapping("modifyStock")
|
||||
@OperationLog("商品-修改库存")
|
||||
//@SaStaffCheckPermission("yun_xu_xiu_gai_shang_pin")
|
||||
public CzgResult<Void> updateProductStock(@RequestBody ProductModifyStockParam param) {
|
||||
ValidatorUtil.validateEntity(param, DefaultGroup.class);
|
||||
Long shopId = StpKit.USER.getShopId();
|
||||
param.setShopId(shopId);
|
||||
productService.updateProductStock(param);
|
||||
ThreadUtil.execAsync(() -> rabbitPublisher.sendProductInfoChangeMsg(Convert.toStr(shopId)));
|
||||
return CzgResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 商品-删除
|
||||
*
|
||||
@@ -236,7 +212,7 @@ public class ProductController {
|
||||
}
|
||||
|
||||
/**
|
||||
* 商品-退款退至库存
|
||||
* 商品-退款退至库存 开关
|
||||
*/
|
||||
@PostMapping("refundToStock")
|
||||
@OperationLog("商品-退款退至库存")
|
||||
@@ -247,29 +223,13 @@ public class ProductController {
|
||||
return CzgResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 商品-库存预警设置
|
||||
*/
|
||||
@PostMapping("stockWarning")
|
||||
@OperationLog("商品-库存预警设置")
|
||||
//@SaAdminCheckPermission("product:stockWarning")
|
||||
public CzgResult<Void> stockWarning(@RequestParam Integer warnLine) {
|
||||
AssertUtil.isNull(warnLine, "{}不能为空", "warnLine");
|
||||
if (warnLine < 0) {
|
||||
throw new CzgException("预警值不能小于0");
|
||||
}
|
||||
productService.stockWarning(warnLine);
|
||||
return CzgResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 商品-报损
|
||||
*/
|
||||
@PostMapping("reportDamage")
|
||||
@OperationLog("商品-报损")
|
||||
//@SaStaffCheckPermission("yun_xu_ti_jiao_bao_sun")
|
||||
//@SaAdminCheckPermission("product:reportDamage")
|
||||
public CzgResult<Void> reportDamage(@RequestBody ProductReportDamageParam param) {
|
||||
//TODO 报损功能
|
||||
ValidatorUtil.validateEntity(param, DefaultGroup.class);
|
||||
productService.reportDamage(param);
|
||||
return CzgResult.success();
|
||||
@@ -288,17 +248,6 @@ public class ProductController {
|
||||
return CzgResult.success(data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 商品-库存变动记录
|
||||
*/
|
||||
@GetMapping("stockFlow")
|
||||
@OperationLog("商品-库存变动记录")
|
||||
//@SaAdminCheckPermission("consStockFlow:flow")
|
||||
public CzgResult<Page<ProductStockFlow>> stockFlow(ProductStockFlowParam param) {
|
||||
Page<ProductStockFlow> data = productService.findProductStockFlowPage(param);
|
||||
return CzgResult.success(data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 商品-报损
|
||||
*/
|
||||
|
||||
@@ -19,7 +19,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
@@ -44,7 +43,6 @@ public class UProductController {
|
||||
list.forEach(prod -> {
|
||||
prod.setIsSaleTime(uProductService.calcIsSaleTime(prod.getDays(), prod.getStartTime(), prod.getEndTime()));
|
||||
});
|
||||
uProductService.refreshProductStock(shopId, list);
|
||||
return CzgResult.success(list);
|
||||
}
|
||||
|
||||
@@ -55,9 +53,7 @@ public class UProductController {
|
||||
public CzgResult<List<ShopGroupProductVo>> queryGroupProductList() {
|
||||
Long shopId = StpKit.USER.getShopId(0L);
|
||||
List<ShopGroupProductVo> list = uProductService.queryGroupProductList(shopId);
|
||||
Map<Long, Integer> productStock = uProductService.findShopProductStock(shopId);
|
||||
list.forEach(item -> {
|
||||
uProductService.refreshProductStock(productStock, item.getProductList());
|
||||
item.getProductList().forEach(prod -> {
|
||||
prod.setIsSaleTime(uProductService.calcIsSaleTime(prod.getDays(), prod.getStartTime(), prod.getEndTime()));
|
||||
prod.setIsSaleTime(uProductService.calcIsSaleTime(prod.getIsSaleTime(), item.getUseTime(), item.getSaleStartTime(), item.getSaleEndTime()));
|
||||
|
||||
Reference in New Issue
Block a user