Forráskód Böngészése

fix 官网平台数据

zoujiajian 2 éve
szülő
commit
28de46f8f9

+ 20 - 15
netflix-web/src/main/java/com/cyksj/web/controller/goods/GoodsDonController.java

@@ -339,7 +339,8 @@ public class GoodsDonController {
 			return yhShopGoodsDetail;
 		}
 		String goodsDetailKey = RedisService.key.YH_HOME_PAGHE_CACHE.getEnvName() + "goods_detail:" + id;
-		List<Long> filter_goodsIds = getFilterGoodsIds();
+		//List<Long> filter_goodsIds = getFilterGoodsIds();
+		List<Long> filter_goodsIds = null;
 		//存在过滤平台 商品详情不返回
 		if (CollUtil.isNotEmpty(filter_goodsIds) && filter_goodsIds.contains(id)) {
 			return GatewayResponse.SUCCESS.newBuilder().toResult();
@@ -540,7 +541,8 @@ public class GoodsDonController {
 			yhsId = yhShopFrontService.getYhsIdByCustomId(customId);
 			key = RedisService.key.YH_HOME_PAGHE_CACHE_SHOP.getEnvName() + yhsId + ":homeManage";
 		}
-		List<Long> filter_goodsIds = getFilterGoodsIds();
+		//List<Long> filter_goodsIds = getFilterGoodsIds();
+		List<Long> filter_goodsIds = null;
 		if (CollUtil.isNotEmpty(filter_goodsIds)) {
 			key += ":hz-ip";
 		}
@@ -948,12 +950,14 @@ public class GoodsDonController {
 		if (cgy != null) {
 			categoryGoodsKey += ":" + cgy;
 		}
-		List<Long> filter_goodsIds = getFilterGoodsIds();
+		//List<Long> filter_goodsIds = getFilterGoodsIds();
+		List<Long> filter_goodsIds = null;
 		if (CollUtil.isNotEmpty(filter_goodsIds)) {
 			categoryGoodsKey += ":hz-ip";
 		}
 		Object o = redisService.get(categoryGoodsKey);
 		if (o == null) {
+			DateTime now = DateTime.now();
 			MapBuilder mapBuilder = MapUtils.flatBuilder(request.getParameterMap());
 			if (cgy != null) {
 				String condition = String.format(" and gcr.category = %s", cgy);
@@ -963,11 +967,16 @@ public class GoodsDonController {
 				mapBuilder.field(GoodsFrontListCategoryView::getId, filter_goodsIds).op(Operator.NotIn);
 			}
 			List<GoodsFrontListCategoryView> goodsFrontListViews = beanSearcher.searchAll(GoodsFrontListCategoryView.class, mapBuilder.build());
+			goodsFrontListViews.forEach(data -> {
+				Integer sold = orderDonMapper.selectCount(Wrappers.lambdaQuery(OrderDon.class)
+						.eq(OrderDon::getGoodsId, data.getId()).notIn(OrderDon::getStatus, Constant.noOrderStatus));
+				data.setSold(sold + data.getSold());
+				data.setNotifyMsg(getPayMsgTime(data.getId(), now, 1, null));
+			});
 			redisService.setNx(categoryGoodsKey, goodsFrontListViews, RedisService.key.YH_HOME_PAGHE_CACHE.getTimeout() + 10 * 60);
 			o = redisService.get(categoryGoodsKey);
 		}
 		List<GoodsFrontListCategoryView> goodsFrontListViews = Jsons.parseList(o, GoodsFrontListCategoryView.class);
-		DateTime now = DateTime.now();
 		AtomicLong dsUserId = new AtomicLong();
 		AtomicBoolean existsChannel = new AtomicBoolean(true);
 		if (StrUtil.isNotBlank(dsCode)) {
@@ -991,10 +1000,6 @@ public class GoodsDonController {
 				data.setMonths(minPriceUserOwnsSku.getMonths());
 				data.setDays(minPriceUserOwnsSku.getDays());
 			}
-			Integer sold = orderDonMapper.selectCount(Wrappers.lambdaQuery(OrderDon.class)
-					.eq(OrderDon::getGoodsId, data.getId()).notIn(OrderDon::getStatus, Constant.noOrderStatus));
-			data.setSold(sold + data.getSold());
-			data.setNotifyMsg(getPayMsgTime(data.getId(), now, 1, null));
 			//设置特定价格
 			setGcSpecificPrice(data, fUid, dsUserId.get());
 			return true;
@@ -1010,6 +1015,7 @@ public class GoodsDonController {
 		}
 		Object value = redisService.get(categoryGoodsKey);
 		if (value == null) {
+			DateTime now = DateTime.now();
 			MapBuilder builder = MapUtils.flatBuilder(request.getParameterMap());
 			builder.put("yhsId", String.format(" and yhs_id = %s", yhsId));
 			String condition = StrUtil.EMPTY;
@@ -1018,17 +1024,16 @@ public class GoodsDonController {
 			}
 			builder.put("condition", condition);
 			List<YhShopGoodsFrontCategoryView> list = beanSearcher.searchAll(YhShopGoodsFrontCategoryView.class, builder.build());
+			list.forEach(data->{
+				Integer sold = orderDonMapper.selectCount(Wrappers.lambdaQuery(OrderDon.class)
+						.eq(OrderDon::getGoodsId, data.getId()).notIn(OrderDon::getStatus, Constant.noOrderStatus));
+				data.setSold(sold + data.getSold());
+				data.setNotifyMsg(getPayMsgTime(data.getId(), now, 1, yhsId));
+			});
 			redisService.setNx(categoryGoodsKey, list, RedisService.key.YH_HOME_PAGHE_CACHE.getTimeout() + 5 * 60);
 			value = redisService.get(categoryGoodsKey);
 		}
 		List<YhShopGoodsFrontCategoryView> list = Jsons.parseList(value, YhShopGoodsFrontCategoryView.class);
-		DateTime now = DateTime.now();
-		list.forEach(data -> {
-			Integer sold = orderDonMapper.selectCount(Wrappers.lambdaQuery(OrderDon.class)
-					.eq(OrderDon::getGoodsId, data.getId()).notIn(OrderDon::getStatus, Constant.noOrderStatus));
-			data.setSold(sold + data.getSold());
-			data.setNotifyMsg(getPayMsgTime(data.getId(), now, 1, yhsId));
-		});
 		return GatewayResponse.SUCCESS.newBuilder().toResult(list);
 	}