购物车清空修改
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");
|
// cashierCartMapper.updateStatusByTableId(jsonObject.getString("tableId"), "closed");
|
||||||
String tableCartKey = RedisCst.getTableCartKey(shopId, tableId, userId);
|
String tableCartKey = RedisCst.getTableCartKey(shopId, tableId, userId);
|
||||||
redisUtil.saveMessage(tableCartKey, new JSONArray().toJSONString());
|
redisUtil.saveMessage(tableCartKey, new JSONArray().toJSONString());
|
||||||
|
|||||||
@@ -490,7 +490,7 @@ public class ProductService {
|
|||||||
|
|
||||||
public void checkPauseSale(TbProduct tbProduct, List<TbProductSku> skus, boolean isSingle) {
|
public void checkPauseSale(TbProduct tbProduct, List<TbProductSku> skus, boolean isSingle) {
|
||||||
if (tbProduct.getIsStock() == 1) {//库存开关 1开启
|
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) {
|
if (tbProduct.getStockNumber() != null && tbProduct.getStockNumber() <= 0) {
|
||||||
tbProduct.setIsPauseSale(Byte.parseByte("1"));//售罄 1暂停
|
tbProduct.setIsPauseSale(Byte.parseByte("1"));//售罄 1暂停
|
||||||
return;
|
return;
|
||||||
@@ -499,25 +499,25 @@ public class ProductService {
|
|||||||
if (isSingle && tbProduct.getIsPauseSale() == 1) {
|
if (isSingle && tbProduct.getIsPauseSale() == 1) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
// } else {
|
||||||
if (isSingle && !skus.stream().filter(res -> res.getIsPauseSale().equals(1)).collect(Collectors.toList()).isEmpty()) {
|
// if (isSingle && !skus.stream().filter(res -> res.getIsPauseSale().equals(1)).collect(Collectors.toList()).isEmpty()) {
|
||||||
tbProduct.setIsPauseSale(Byte.parseByte("1"));//售罄 1暂停
|
// tbProduct.setIsPauseSale(Byte.parseByte("1"));//售罄 1暂停
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
if (!tbProduct.getTypeEnum().equals("sku")) {
|
// if (!tbProduct.getTypeEnum().equals("sku")) {
|
||||||
if (skus.stream().anyMatch(sku -> sku.getStockNumber() != null && sku.getStockNumber() <= 0)){
|
// if (skus.stream().anyMatch(sku -> sku.getStockNumber() != null && sku.getStockNumber() <= 0)){
|
||||||
tbProduct.setIsPauseSale(Byte.parseByte("1"));//售罄 1暂停
|
// tbProduct.setIsPauseSale(Byte.parseByte("1"));//售罄 1暂停
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
} else {
|
// } else {
|
||||||
skus.removeIf(sku -> sku.getStockNumber() != null && sku.getStockNumber() <= 0);
|
// skus.removeIf(sku -> sku.getStockNumber() != null && sku.getStockNumber() <= 0);
|
||||||
if (CollectionUtils.isEmpty(skus)) {
|
// if (CollectionUtils.isEmpty(skus)) {
|
||||||
tbProduct.setIsPauseSale(Byte.parseByte("1"));//售罄 1暂停
|
// tbProduct.setIsPauseSale(Byte.parseByte("1"));//售罄 1暂停
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
Iterator<TbProductSku> iterator = skus.iterator();
|
Iterator<TbProductSku> iterator = skus.iterator();
|
||||||
while (iterator.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
TbProductSku tbProductSku = iterator.next();
|
TbProductSku tbProductSku = iterator.next();
|
||||||
|
|||||||
Reference in New Issue
Block a user