fix: 支持套餐商品点餐

This commit is contained in:
张松
2024-12-04 13:51:07 +08:00
parent ae699246d0
commit aee40bef30

View File

@@ -285,13 +285,27 @@ public class CartService {
/**
* 重置购物车套餐商品信息
*/
private void resetGroupProductCart(List<Integer> productIds,TbCashierCart cashierCart) {
private void resetGroupProductCart(List<Integer> productIds, TbCashierCart cashierCart) {
if (StrUtil.isBlank(cashierCart.getProductId())) {
return;
}
TbProduct product = productMapper.selectById(Integer.valueOf(cashierCart.getProductId()));
resetCartInfo(productIds, product, cashierCart);
}
/**
* 重置购物车套餐商品信息
*/
private void resetGroupProductCart(List<Integer> productIds, TbProduct product, TbCashierCart cashierCart) {
if (StrUtil.isBlank(cashierCart.getProductId())) {
return;
}
resetCartInfo(productIds, product, cashierCart);
}
private void resetCartInfo(List<Integer> productIds, TbProduct product, TbCashierCart cashierCart) {
boolean isChoseGroup = TableConstant.Product.Type.PACKAGE.equalsVals(product.getType()) && product.getGroupType() == 1;
boolean isFixGroup = TableConstant.Product.Type.PACKAGE.equalsVals(product.getType()) && product.getGroupType() == 0;
if (isChoseGroup && productIds != null && !productIds.isEmpty()) {
@@ -702,7 +716,7 @@ public class CartService {
cashierCart.setIsVip((byte) 0);
cashierCart.resetTotalAmount();
cashierCart.setPlatformType(PlatformTypeEnum.MINI_APP.getValue());
resetGroupProductCart(groupProductIds, cashierCart);
resetGroupProductCart(groupProductIds, product, cashierCart);
mpCashierCartMapper.insert(cashierCart);
//修改耗材数据