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