后端bug修复
This commit is contained in:
@@ -153,7 +153,8 @@ public class CartInfoServiceImpl implements CartInfoService {
|
||||
BoundHashOperations<String, String, CartInfo> hashOperations = redisTemplate.boundHashOps(cartKey);
|
||||
List<CartInfo> cartInfoList = hashOperations.values();
|
||||
for (CartInfo cartInfo : cartInfoList) {
|
||||
hashOperations.delete(cartInfo.getSkuId().toString());
|
||||
hashOperations.delete(cartInfo.getSkuId()
|
||||
.toString());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -192,7 +193,8 @@ public class CartInfoServiceImpl implements CartInfoService {
|
||||
cartInfoList = boundHashOperations.values();
|
||||
if (!CollectionUtils.isEmpty(cartInfoList)) {
|
||||
//根据商品添加时间,降序
|
||||
cartInfoList.sort((o1, o2) -> o1.getCreateTime().compareTo(o2.getCreateTime()));
|
||||
cartInfoList.sort((o1, o2) -> o1.getCreateTime()
|
||||
.compareTo(o2.getCreateTime()));
|
||||
}
|
||||
return cartInfoList;
|
||||
}
|
||||
@@ -234,7 +236,8 @@ public class CartInfoServiceImpl implements CartInfoService {
|
||||
List<CartInfo> cartInfoList = boundHashOperations.values();
|
||||
cartInfoList.forEach(cartInfo -> {
|
||||
cartInfo.setIsChecked(isChecked);
|
||||
boundHashOperations.put(cartInfo.getSkuId().toString(), cartInfo);
|
||||
boundHashOperations.put(cartInfo.getSkuId()
|
||||
.toString(), cartInfo);
|
||||
});
|
||||
this.setCartKeyExpire(cartKey);
|
||||
}
|
||||
@@ -253,7 +256,8 @@ public class CartInfoServiceImpl implements CartInfoService {
|
||||
skuIdList.forEach(skuId -> {
|
||||
CartInfo cartInfo = boundHashOperations.get(skuId.toString());
|
||||
cartInfo.setIsChecked(isChecked);
|
||||
boundHashOperations.put(cartInfo.getSkuId().toString(), cartInfo);
|
||||
boundHashOperations.put(cartInfo.getSkuId()
|
||||
.toString(), cartInfo);
|
||||
});
|
||||
this.setCartKeyExpire(cartKey);
|
||||
}
|
||||
@@ -270,9 +274,9 @@ public class CartInfoServiceImpl implements CartInfoService {
|
||||
BoundHashOperations<String, String, CartInfo> boundHashOperations = redisTemplate.boundHashOps(cartKey);
|
||||
List<CartInfo> cartInfoList = boundHashOperations.values();
|
||||
//isChecked = 1购物项选中
|
||||
return cartInfoList.stream().filter(cartInfo -> {
|
||||
return cartInfo.getIsChecked().intValue() == 1;
|
||||
}).collect(Collectors.toList());
|
||||
return cartInfoList != null ? cartInfoList.stream()
|
||||
.filter(cartInfo -> cartInfo.getIsChecked() == 1)
|
||||
.collect(Collectors.toList()) : null;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -286,7 +290,9 @@ public class CartInfoServiceImpl implements CartInfoService {
|
||||
List<CartInfo> cartInfoList = this.getCartCheckedList(userId);
|
||||
|
||||
//查询list数据处理,得到skuId集合
|
||||
List<Long> skuIdList = cartInfoList.stream().map(item -> item.getSkuId()).collect(Collectors.toList());
|
||||
List<Long> skuIdList = cartInfoList.stream()
|
||||
.map(item -> item.getSkuId())
|
||||
.collect(Collectors.toList());
|
||||
|
||||
//构建redis的key值
|
||||
// hash类型 key filed-value
|
||||
|
Reference in New Issue
Block a user