就餐模式获取修改

This commit is contained in:
2024-09-29 13:45:53 +08:00
parent 0dbc76c207
commit 688f73b4b3

View File

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