浏览代码

fix 指定杭州ip无法看到对应商品

zoujiajian 2 年之前
父节点
当前提交
11a001500b
共有 1 个文件被更改,包括 14 次插入0 次删除
  1. 14 0
      netflix-web/src/main/java/com/cyksj/web/controller/goods/GoodsDonController.java

+ 14 - 0
netflix-web/src/main/java/com/cyksj/web/controller/goods/GoodsDonController.java

@@ -535,6 +535,10 @@ public class GoodsDonController {
 			yhsId = yhShopFrontService.getYhsIdByCustomId(customId);
 			key = RedisService.key.YH_HOME_PAGHE_CACHE_SHOP.getEnvName() + yhsId + ":homeManage";
 		}
+		List<Long> filter_goodsIds = getFilterGoodsIds();
+		if (CollUtil.isNotEmpty(filter_goodsIds)) {
+			key += ":hz-ip";
+		}
 		Long fUid = StpUserUtil.getUserIdAfterLogin();
 		Object o = redisService.get(key);
 		if (o == null) {
@@ -550,6 +554,9 @@ public class GoodsDonController {
 								.field(HomeManagementFrontView::getType, type.name());
 						if (type == HomeManagementConfig.Type.ex || type == HomeManagementConfig.Type.vg) {
 							builder.put("condition", conditionSql);
+							if (CollUtil.isNotEmpty(filter_goodsIds)) {
+								builder.field(HomeManagementFrontView::getGoodsId, filter_goodsIds).op(Operator.NotIn);
+							}
 						}
 						List<HomeManagementFrontView> homeManagementFrontViews = beanSearcher.searchAll(HomeManagementFrontView.class, builder.build());
 						map.putIfAbsent(type.name(), homeManagementFrontViews);
@@ -936,6 +943,10 @@ public class GoodsDonController {
 		if (cgy != null) {
 			categoryGoodsKey += ":" + cgy;
 		}
+		List<Long> filter_goodsIds = getFilterGoodsIds();
+		if (CollUtil.isNotEmpty(filter_goodsIds)) {
+			categoryGoodsKey += ":hz-ip";
+		}
 		Object o = redisService.get(categoryGoodsKey);
 		if (o == null) {
 			MapBuilder mapBuilder = MapUtils.flatBuilder(request.getParameterMap());
@@ -943,6 +954,9 @@ public class GoodsDonController {
 				String condition = String.format(" and gcr.category = %s", cgy);
 				mapBuilder.put("condition", condition);
 			}
+			if (CollUtil.isNotEmpty(filter_goodsIds)) {
+				mapBuilder.field(GoodsFrontListCategoryView::getId, filter_goodsIds).op(Operator.NotIn);
+			}
 			List<GoodsFrontListCategoryView> goodsFrontListViews = beanSearcher.searchAll(GoodsFrontListCategoryView.class, mapBuilder.build());
 			redisService.setNx(categoryGoodsKey, goodsFrontListViews, RedisService.key.YH_HOME_PAGHE_CACHE.getTimeout() + 10 * 60);
 			o = redisService.get(categoryGoodsKey);