feat: 添加购物车简化修改
This commit is contained in:
@@ -380,7 +380,6 @@ public class OrderService {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (StringUtils.isEmpty(masterId)) {
|
||||
boolean flag = redisUtil.exists("SHOP:CODE:" + clientType + ":" + shopId);
|
||||
if (flag) {
|
||||
@@ -396,24 +395,10 @@ public class OrderService {
|
||||
}
|
||||
|
||||
|
||||
if (Objects.nonNull(cart) && cart.getGroupType() != null && cart.getGroupType() == 0) {
|
||||
//查询现有规格商品
|
||||
cart.setNumber(number);
|
||||
cart.setIsGift(isGift);
|
||||
cart.setIsPack(isPack);
|
||||
cart.setTotalNumber(number);
|
||||
cart.resetTotalAmount();
|
||||
cart.setUuid(uuid);
|
||||
cart.setIsPrint(isPrint);
|
||||
if (product != null) {
|
||||
resetGroupProductCart(groupProductIdList, product, cart);
|
||||
}
|
||||
cashierCartMapper.updateByPrimaryKeySelective(cart);
|
||||
} else {
|
||||
List<TbCashierCart> list = cashierCartMapper.selectALlByMasterId(masterId, "create");
|
||||
|
||||
TbCashierCart cashierCart = getCashierInfo(shopId, skuId, productId, tableId, masterId, shopEatTypeInfoDTO);
|
||||
// 不存在新增
|
||||
if (Objects.isNull(cashierCart) || (cart != null && cart.getGroupType() != null && cart.getGroupType() == 1)) {
|
||||
if (type.equals("add") || cashierCart == null || (cart != null && cart.getGroupType() != null && cart.getGroupType() == 1)) {
|
||||
cashierCart = new TbCashierCart();
|
||||
cashierCart.setUseType(shopEatTypeInfoDTO.getUseType());
|
||||
if (product != null) {
|
||||
@@ -471,24 +456,25 @@ public class OrderService {
|
||||
}
|
||||
list.add(cashierCart);
|
||||
mpCashierCartMapper.insert(cashierCart);
|
||||
} else {
|
||||
if (type.equals("add")) {
|
||||
cashierCart.setNumber(cashierCart.getNumber().add(number));
|
||||
}else {
|
||||
cashierCart.setNumber(number);
|
||||
}
|
||||
if (product != null) {
|
||||
resetGroupProductCart(groupProductIdList, product, cashierCart);
|
||||
}
|
||||
cashierCart.setTotalNumber(number);
|
||||
cashierCart.setIsPrint(isPrint);
|
||||
cashierCart.setIsPack(isPack);
|
||||
cashierCart.resetTotalAmount();
|
||||
cashierCart.setUuid(uuid);
|
||||
cashierCart.setIsPrint(isPrint);
|
||||
cashierCart.resetTotalAmount();
|
||||
if (product != null) {
|
||||
resetGroupProductCart(groupProductIdList, product, cart);
|
||||
}
|
||||
|
||||
mpCashierCartMapper.updateById(cashierCart);
|
||||
}
|
||||
|
||||
cart = cashierCart;
|
||||
}
|
||||
|
||||
|
||||
setRedisTableCartInfo(tableId, shopId, Collections.singletonList(cart), true);
|
||||
|
||||
return Result.success(CodeEnum.SUCCESS, masterId);
|
||||
|
||||
Reference in New Issue
Block a user