添加购物车修改
This commit is contained in:
@@ -263,7 +263,6 @@ public class CartService {
|
||||
.eq(TbCashierCart::getSkuId, "-999")
|
||||
.eq(TbCashierCart::getStatus, "create")
|
||||
.gt(TbCashierCart::getCreatedAt, DateUtil.offsetDay(DateUtil.date(), -1).getTime())
|
||||
.and(r -> r.eq(TbCashierCart::getUserId, userId).or().isNull(TbCashierCart::getUserId))
|
||||
.eq(TbCashierCart::getUseType, shopEatTypeInfoDTO.getUseType())
|
||||
.eq(TbCashierCart::getTableId, tableId);
|
||||
TbCashierCart cart = mpCashierCartMapper.selectOne(query);
|
||||
@@ -271,27 +270,6 @@ public class CartService {
|
||||
return;
|
||||
}
|
||||
|
||||
String tableCartKey = RedisCst.getTableCartKey(shopEatTypeInfoDTO.getShopInfo().getId().toString(), tableId, userId);
|
||||
String message = redisUtil.getMessage(tableCartKey);
|
||||
|
||||
boolean hasSeatInfo = false;
|
||||
JSONArray array = null;
|
||||
if (StrUtil.isNotBlank(message)) {
|
||||
array = JSON.parseArray(message);
|
||||
long count = array.stream().filter(item -> {
|
||||
TbCashierCart cashierCart = JSONUtil.parseJSONStr2T(((JSONObject) item).toJSONString(), TbCashierCart.class);
|
||||
return "-999".equals(cashierCart.getProductId());
|
||||
}).count();
|
||||
hasSeatInfo = count > 0;
|
||||
}
|
||||
|
||||
if (hasSeatInfo) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (array == null) {
|
||||
array = new JSONArray();
|
||||
}
|
||||
|
||||
String oldSeatInfo = redisUtil.getMessage(RedisCst.getCurrentTableSeatCount(shopEatTypeInfoDTO.getShopInfo().getId(), tableId));
|
||||
TbCashierCart tbCashierCart = null;
|
||||
@@ -323,8 +301,6 @@ public class CartService {
|
||||
tbCashierCart.setId(null);
|
||||
|
||||
mpCashierCartMapper.insert(tbCashierCart);
|
||||
array.add(tbCashierCart);
|
||||
redisUtil.saveMessage(tableCartKey, array.toString());
|
||||
redisUtil.saveMessage(RedisCst.getCurrentTableSeatCount(shopEatTypeInfoDTO.getShopInfo().getId(), tableId), JSONObject.toJSONString(tbCashierCart), 60 * 60 * 12L);
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user