就餐模式获取修改

This commit is contained in:
2024-09-29 13:57:11 +08:00
parent 688f73b4b3
commit caccb33016
2 changed files with 24 additions and 16 deletions

View File

@@ -178,20 +178,20 @@ public class CartService {
}
String tableCartKey = RedisCst.getTableCartKey(shopId, tableId, userId);
TbCashierCart seatCartInfo = null;
// if (redisUtil.exists(tableCartKey)) {
// array = JSON.parseArray(redisUtil.getMessage(tableCartKey));
// for (int i = 0; i < array.size(); i++) {
// JSONObject object = array.getJSONObject(i);
// TbCashierCart cashierCart = JSONUtil.parseJSONStr2T(object.toJSONString(), TbCashierCart.class);
// if (cashierCart.getNumber() > 0) {
// amount = amount.add(new BigDecimal(cashierCart.getTotalNumber()).multiply(cashierCart.getSalePrice().add(cashierCart.getPackFee())));
// }
//
// if ("-999".equals(cashierCart.getProductId())) {
// seatCartInfo = cashierCart;
// }
// }
// } else {
if (redisUtil.exists(tableCartKey)) {
array = JSON.parseArray(redisUtil.getMessage(tableCartKey));
for (int i = 0; i < array.size(); i++) {
JSONObject object = array.getJSONObject(i);
TbCashierCart cashierCart = JSONUtil.parseJSONStr2T(object.toJSONString(), TbCashierCart.class);
if (cashierCart.getNumber() > 0) {
amount = amount.add(new BigDecimal(cashierCart.getTotalNumber()).multiply(cashierCart.getSalePrice().add(cashierCart.getPackFee())));
}
if ("-999".equals(cashierCart.getProductId())) {
seatCartInfo = cashierCart;
}
}
} else {
// 查询购物车所有信息
LambdaQueryWrapper<TbCashierCart> queryWrapper = new LambdaQueryWrapper<TbCashierCart>()
.eq(TbCashierCart::getShopId, shopId)
@@ -217,7 +217,7 @@ public class CartService {
}
redisUtil.saveMessage(tableCartKey, array.toString(), 60 * 60 * 12L);
}
// }
}
redisUtil.saveMessage(RedisCst.getCurrentTableSeatCount(shopEatTypeInfoDTO.getShopInfo().getId(), tableId), JSONObject.toJSONString(seatCartInfo), 60 * 60 * 12L);
@@ -485,7 +485,7 @@ public class CartService {
}
}
redisUtil.saveMessage(tableCartKey, jsonArray.toJSONString());
redisUtil.saveMessage(tableCartKey, jsonArray.toJSONString(), 60 * 60 * 12L);
// 餐位费
// Object seatCost = jsonArray.stream().findFirst().filter(info -> "-999".equals(((TbCashierCart) info).getProductId())).orElse(null);
TbCashierCart seatCost = cashierCartArrayList.stream().findFirst().filter(info -> "-999".equals(info.getProductId())).orElse(null);