|
@@ -17,6 +17,7 @@ import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
+import javax.validation.constraints.NotNull;
|
|
|
import java.time.LocalDateTime;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
@@ -34,14 +35,16 @@ public class FsIntegralCartServiceImpl extends ServiceImpl<FsIntegralCartMapper,
|
|
|
|
|
|
/**
|
|
|
* 添加或修改购物车
|
|
|
- * @param userId 用户ID
|
|
|
- * @param goodsId 积分商品ID
|
|
|
- * @param cartNum 数量
|
|
|
+ *
|
|
|
+ * @param userId 用户ID
|
|
|
+ * @param goodsId 积分商品ID
|
|
|
+ * @param cartNum 数量
|
|
|
+ * @param isCart 是否购物车
|
|
|
*/
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
@Override
|
|
|
- public void addOrUpdateCart(Long userId, Long goodsId, Integer cartNum) {
|
|
|
- log.debug("addOrUpdateCart userId: {}, goodsId: {}, cartNum: {}", userId, goodsId, cartNum);
|
|
|
+ public void addOrUpdateCart(Long userId, Long goodsId, Integer cartNum, Integer isCart) {
|
|
|
+ log.debug("addOrUpdateCart userId: {}, goodsId: {}, cartNum: {}, isCart: {}", userId, goodsId, cartNum, isCart);
|
|
|
FsUser fsUser = userMapper.selectFsUserByUserId(userId);
|
|
|
if (Objects.isNull(fsUser)) {
|
|
|
log.warn("addOrUpdateCart user not find userId: {}", userId);
|
|
@@ -67,6 +70,7 @@ public class FsIntegralCartServiceImpl extends ServiceImpl<FsIntegralCartMapper,
|
|
|
cart.setCash(fsIntegralGoods.getCash());
|
|
|
cart.setCreateTime(LocalDateTime.now());
|
|
|
cart.setUpdateTime(LocalDateTime.now());
|
|
|
+ cart.setAddToExist(isCart == 0);
|
|
|
baseMapper.insertOrUpdate(cart);
|
|
|
}
|
|
|
|