购物车清空修改
This commit is contained in:
@@ -1124,7 +1124,16 @@ public class CartService {
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
cashierCartMapper.updateStatusByOrderIdForMini(jsonObject.getString("tableId"), "closed");
|
||||
if (StrUtil.isNotBlank(tableId)) {
|
||||
cashierCartMapper.updateStatusByOrderIdForMini(jsonObject.getString("tableId"), "closed");
|
||||
}else {
|
||||
mpCashierCartMapper.update(null, new LambdaUpdateWrapper<TbCashierCart>()
|
||||
.eq(TbCashierCart::getShopId, shopId)
|
||||
.and(q -> q.isNull(TbCashierCart::getTableId).or().eq(TbCashierCart::getTableId, ""))
|
||||
.eq(TbCashierCart::getUserId, userId)
|
||||
.gt(TbCashierCart::getCreatedAt, DateUtil.offsetDay(DateUtil.date(), -1).getTime())
|
||||
.set(TbCashierCart::getStatus, "closed"));
|
||||
}
|
||||
// cashierCartMapper.updateStatusByTableId(jsonObject.getString("tableId"), "closed");
|
||||
String tableCartKey = RedisCst.getTableCartKey(shopId, tableId, userId);
|
||||
redisUtil.saveMessage(tableCartKey, new JSONArray().toJSONString());
|
||||
|
||||
@@ -490,7 +490,7 @@ public class ProductService {
|
||||
|
||||
public void checkPauseSale(TbProduct tbProduct, List<TbProductSku> skus, boolean isSingle) {
|
||||
if (tbProduct.getIsStock() == 1) {//库存开关 1开启
|
||||
if (Integer.valueOf(tbProduct.getIsDistribute()).equals(1)) {//共享库存 1开启
|
||||
// if (Integer.valueOf(tbProduct.getIsDistribute()).equals(1)) {//共享库存 1开启
|
||||
if (tbProduct.getStockNumber() != null && tbProduct.getStockNumber() <= 0) {
|
||||
tbProduct.setIsPauseSale(Byte.parseByte("1"));//售罄 1暂停
|
||||
return;
|
||||
@@ -499,25 +499,25 @@ public class ProductService {
|
||||
if (isSingle && tbProduct.getIsPauseSale() == 1) {
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
if (isSingle && !skus.stream().filter(res -> res.getIsPauseSale().equals(1)).collect(Collectors.toList()).isEmpty()) {
|
||||
tbProduct.setIsPauseSale(Byte.parseByte("1"));//售罄 1暂停
|
||||
return;
|
||||
}
|
||||
|
||||
if (!tbProduct.getTypeEnum().equals("sku")) {
|
||||
if (skus.stream().anyMatch(sku -> sku.getStockNumber() != null && sku.getStockNumber() <= 0)){
|
||||
tbProduct.setIsPauseSale(Byte.parseByte("1"));//售罄 1暂停
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
skus.removeIf(sku -> sku.getStockNumber() != null && sku.getStockNumber() <= 0);
|
||||
if (CollectionUtils.isEmpty(skus)) {
|
||||
tbProduct.setIsPauseSale(Byte.parseByte("1"));//售罄 1暂停
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
// } else {
|
||||
// if (isSingle && !skus.stream().filter(res -> res.getIsPauseSale().equals(1)).collect(Collectors.toList()).isEmpty()) {
|
||||
// tbProduct.setIsPauseSale(Byte.parseByte("1"));//售罄 1暂停
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// if (!tbProduct.getTypeEnum().equals("sku")) {
|
||||
// if (skus.stream().anyMatch(sku -> sku.getStockNumber() != null && sku.getStockNumber() <= 0)){
|
||||
// tbProduct.setIsPauseSale(Byte.parseByte("1"));//售罄 1暂停
|
||||
// return;
|
||||
// }
|
||||
// } else {
|
||||
// skus.removeIf(sku -> sku.getStockNumber() != null && sku.getStockNumber() <= 0);
|
||||
// if (CollectionUtils.isEmpty(skus)) {
|
||||
// tbProduct.setIsPauseSale(Byte.parseByte("1"));//售罄 1暂停
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
Iterator<TbProductSku> iterator = skus.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
TbProductSku tbProductSku = iterator.next();
|
||||
|
||||
Reference in New Issue
Block a user