初始化购物车接口校验是否需要餐位费,不需要删除旧数据
This commit is contained in:
@@ -184,25 +184,25 @@ public class CartService {
|
|||||||
boolean ignoreTableFee = shopInfo.getIsTableFee() != null && shopInfo.getIsTableFee() == 1;
|
boolean ignoreTableFee = shopInfo.getIsTableFee() != null && shopInfo.getIsTableFee() == 1;
|
||||||
|
|
||||||
TbCashierCart seatCartInfo = null;
|
TbCashierCart seatCartInfo = null;
|
||||||
if (redisUtil.exists(tableCartKey)) {
|
// if (redisUtil.exists(tableCartKey)) {
|
||||||
JSONArray jsonArray = JSON.parseArray(redisUtil.getMessage(tableCartKey));
|
// JSONArray jsonArray = JSON.parseArray(redisUtil.getMessage(tableCartKey));
|
||||||
for (int i = 0; i < jsonArray.size(); i++) {
|
// for (int i = 0; i < jsonArray.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 ((!TableConstant.CART_SEAT_ID.equals(cashierCart.getProductId()) || !ignoreTableFee) && cashierCart.getNumber() > 0) {
|
// if ((!TableConstant.CART_SEAT_ID.equals(cashierCart.getProductId()) || !ignoreTableFee) && 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 (TableConstant.CART_SEAT_ID.equals(cashierCart.getProductId())) {
|
// if (TableConstant.CART_SEAT_ID.equals(cashierCart.getProductId())) {
|
||||||
seatCartInfo = cashierCart;
|
// seatCartInfo = cashierCart;
|
||||||
if (!ignoreTableFee) {
|
// if (!ignoreTableFee) {
|
||||||
array.add(cashierCart);
|
// array.add(cashierCart);
|
||||||
}
|
// }
|
||||||
}else {
|
// }else {
|
||||||
array.add(cashierCart);
|
// array.add(cashierCart);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
} else {
|
// } else {
|
||||||
|
|
||||||
// 查询购物车所有信息
|
// 查询购物车所有信息
|
||||||
LambdaQueryWrapper<TbCashierCart> queryWrapper = new LambdaQueryWrapper<TbCashierCart>()
|
LambdaQueryWrapper<TbCashierCart> queryWrapper = new LambdaQueryWrapper<TbCashierCart>()
|
||||||
@@ -235,7 +235,7 @@ public class CartService {
|
|||||||
}
|
}
|
||||||
redisUtil.saveMessage(tableCartKey, array.toString(), 60 * 60 * 12L);
|
redisUtil.saveMessage(tableCartKey, array.toString(), 60 * 60 * 12L);
|
||||||
}
|
}
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (ignoreTableFee && seatCartInfo != null) {
|
if (ignoreTableFee && seatCartInfo != null) {
|
||||||
mpCashierCartMapper.deleteById(seatCartInfo.getId());
|
mpCashierCartMapper.deleteById(seatCartInfo.getId());
|
||||||
|
|||||||
Reference in New Issue
Block a user