Authored by mali

收藏数目

@@ -446,6 +446,14 @@ public class CacheService { @@ -446,6 +446,14 @@ public class CacheService {
446 return aBoolean; 446 return aBoolean;
447 } 447 }
448 448
  449 +
  450 + public void delUserSkuFavorate(Integer userId, Integer storageId){
  451 + if (null != storageId) {
  452 + yhRedisTemplate.delete(getSkuFavoriteFlagRedisKeyBuilder(userId, storageId));
  453 + }
  454 + yhRedisTemplate.delete(getSkuFavoriteRedisKeyBuilder(userId));
  455 + }
  456 +
449 private String getSkuFacoriteValue(Integer storageId, BigDecimal price) { 457 private String getSkuFacoriteValue(Integer storageId, BigDecimal price) {
450 StringBuilder sb = new StringBuilder(); 458 StringBuilder sb = new StringBuilder();
451 sb.append(storageId).append(":").append(price); 459 sb.append(storageId).append(":").append(price);
@@ -6,6 +6,7 @@ import com.yoho.tools.common.beans.ApiResponse; @@ -6,6 +6,7 @@ import com.yoho.tools.common.beans.ApiResponse;
6 import com.yohobuy.ufo.model.user.req.FavoriteSkuRequestVO; 6 import com.yohobuy.ufo.model.user.req.FavoriteSkuRequestVO;
7 import com.yohobuy.ufo.model.user.resp.FavoriteSkuResp; 7 import com.yohobuy.ufo.model.user.resp.FavoriteSkuResp;
8 import com.yohoufo.common.annotation.IgnoreSession; 8 import com.yohoufo.common.annotation.IgnoreSession;
  9 +import com.yohoufo.common.annotation.IgnoreSignature;
9 import com.yohoufo.common.caller.UfoServiceCaller; 10 import com.yohoufo.common.caller.UfoServiceCaller;
10 import com.yohoufo.user.requestVO.FavoriteRequestVO; 11 import com.yohoufo.user.requestVO.FavoriteRequestVO;
11 import com.yohoufo.user.service.IFavoriteService; 12 import com.yohoufo.user.service.IFavoriteService;
@@ -148,6 +149,22 @@ public class FavoriteSkuController { @@ -148,6 +149,22 @@ public class FavoriteSkuController {
148 } 149 }
149 150
150 151
  152 + /**
  153 + * 用户收藏商品数量num
  154 + * @param vo
  155 + * @return
  156 + * @throws ServiceException
  157 + * http://java-yohoufo-fore.test3.ingress.dev.yohocorp.com/ufo-gateway/?debug=XYZ&method=ufo.user.skuFavoriteNum&uid=500031120
  158 + */
  159 + @IgnoreSession
  160 + @IgnoreSignature
  161 + @RequestMapping(params = "method=ufo.user.clearSkuFavoriteCache")
  162 + public ApiResponse clearSkuFavoriteCache(FavoriteSkuRequestVO vo) throws ServiceException {
  163 + logger.info("Begin call ufo.user.clearSkuFavoriteCache . with param is {}", vo);
  164 + favoriteSkuService.clearSkuFavoriteCache(vo.getUid(), vo.getStorageId());
  165 + return new ApiResponse.ApiResponseBuilder().data("success").build();
  166 + }
  167 +
151 private void validateRequest(FavoriteSkuRequestVO vo, boolean checkStorage, boolean checkProduct) { 168 private void validateRequest(FavoriteSkuRequestVO vo, boolean checkStorage, boolean checkProduct) {
152 if (null == vo) { 169 if (null == vo) {
153 logger.warn("validateRequest params is null"); 170 logger.warn("validateRequest params is null");
@@ -242,4 +242,8 @@ public class FavoriteSkuService { @@ -242,4 +242,8 @@ public class FavoriteSkuService {
242 }); 242 });
243 return respList; 243 return respList;
244 } 244 }
  245 +
  246 + public void clearSkuFavoriteCache(Integer uid, Integer storageId) {
  247 + cacheService.delUserSkuFavorate(uid, storageId);
  248 + }
245 } 249 }