就餐模式获取修改

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);
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)
@@ -215,9 +215,9 @@ public class CartService {
if (cashierCart.getIsVip().equals((byte) 1)) continue;
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);